cc: Remove WebCore rect use from the compositor, except within Region.
This replaces the last cases of FloatRect with gfx::RectF. It depends on the IsExpressibleAsRect() method in https://codereview.chromium.org/11364054/ and removes the stubs as well! We add an API to the Region class that is intended to be our final Region class interface. It uses an iterator to walk the rects in the Region, which is compatible with the SkRegion API, but can also hide the IntRects exposed by the WebCore Region API. Once this is done, there is no need to use cc::IntRect, and we can remove it entirely. Covered by existing tests; no change in behaviour. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11360066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165837 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -257,10 +257,8 @@
|
||||
'sources': [
|
||||
'<@(cc_source_files)',
|
||||
'stubs/FloatPoint.h',
|
||||
'stubs/FloatRect.h',
|
||||
'stubs/FloatSize.h',
|
||||
'stubs/IntPoint.h',
|
||||
'stubs/IntRect.h',
|
||||
'stubs/IntSize.h',
|
||||
'stubs/Region.h',
|
||||
'stubs/SkiaUtils.h',
|
||||
@ -268,10 +266,8 @@
|
||||
|
||||
'stubs/config.h',
|
||||
'stubs/float_point.h',
|
||||
'stubs/float_rect.h',
|
||||
'stubs/float_size.h',
|
||||
'stubs/int_point.h',
|
||||
'stubs/int_rect.h',
|
||||
'stubs/int_size.h',
|
||||
'stubs/skia_utils.h',
|
||||
'stubs/unit_bezier.h',
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "cc/gl_renderer.h"
|
||||
|
||||
#include "FloatRect.h"
|
||||
#include "base/debug/trace_event.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/string_split.h"
|
||||
@ -552,7 +551,7 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
|
||||
LayerQuad deviceLayerEdges = LayerQuad(deviceQuad);
|
||||
|
||||
// Use anti-aliasing programs only when necessary.
|
||||
bool useAA = (!deviceQuad.IsRectilinear() || !cc::FloatRect(deviceQuad.BoundingBox()).isExpressibleAsIntRect());
|
||||
bool useAA = (!deviceQuad.IsRectilinear() || !deviceQuad.BoundingBox().IsExpressibleAsRect());
|
||||
if (useAA) {
|
||||
deviceLayerBounds.inflateAntiAliasingDistance();
|
||||
deviceLayerEdges.inflateAntiAliasingDistance();
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef LayerChromium_h
|
||||
#define LayerChromium_h
|
||||
|
||||
#include "IntPoint.h"
|
||||
#include "Region.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "cc/cc_export.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "FloatSize.h"
|
||||
#include "IntPoint.h"
|
||||
#include "Region.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
@ -1689,11 +1689,11 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// If the child layer is opaque, then it adds to the occlusion seen by the rootLayer.
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1706,11 +1706,11 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// Add a second child to the root layer and the regions should merge
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1724,13 +1724,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// Move the second child to be sure.
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1744,13 +1744,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1766,13 +1766,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
|
||||
setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1788,13 +1788,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1811,13 +1811,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
|
||||
setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
|
||||
@ -1834,13 +1834,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// Kill the layerTreeHost immediately.
|
||||
m_layerTreeHost->setRootLayer(0);
|
||||
@ -1897,13 +1897,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree,
|
||||
// and should not contribute to the rootLayer
|
||||
@ -1924,13 +1924,13 @@ public:
|
||||
m_layerTreeHost->commitComplete();
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(child2->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(grandChild->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(child->occludedScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(rootLayer->occludedScreenSpace()).size());
|
||||
|
||||
// Kill the layerTreeHost immediately.
|
||||
m_layerTreeHost->setRootLayer(0);
|
||||
@ -1989,7 +1989,7 @@ public:
|
||||
gfx::Rect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
|
||||
|
||||
EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(layers[i]->occludedScreenSpace()).size());
|
||||
}
|
||||
|
||||
// Kill the layerTreeHost immediately.
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "FloatRect.h"
|
||||
#include "cc/layer.h"
|
||||
#include "cc/layer_impl.h"
|
||||
#include "cc/math_util.h"
|
||||
@ -136,10 +135,9 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
|
||||
|
||||
Region transformedRegion;
|
||||
|
||||
Vector<WebCore::IntRect> rects = region.rects();
|
||||
for (size_t i = 0; i < rects.size(); ++i) {
|
||||
for (Region::Iterator rects(region); rects.has_rect(); rects.next()) {
|
||||
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
|
||||
gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(rects[i])));
|
||||
gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, gfx::RectF(rects.rect())));
|
||||
if (!surface->clipRect().IsEmpty())
|
||||
transformedRect.Intersect(surface->clipRect());
|
||||
transformedRegion.Union(transformedRect);
|
||||
@ -153,11 +151,11 @@ static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec
|
||||
return;
|
||||
|
||||
Region affectedOcclusion = intersect(occlusion, affectedArea);
|
||||
Vector<WebCore::IntRect> affectedOcclusionRects = affectedOcclusion.rects();
|
||||
Region::Iterator affectedOcclusionRects(affectedOcclusion);
|
||||
|
||||
occlusion.Subtract(affectedArea);
|
||||
for (size_t j = 0; j < affectedOcclusionRects.size(); ++j) {
|
||||
WebCore::IntRect& occlusionRect = affectedOcclusionRects[j];
|
||||
for (; affectedOcclusionRects.has_rect(); affectedOcclusionRects.next()) {
|
||||
gfx::Rect occlusionRect = affectedOcclusionRects.rect();
|
||||
|
||||
// Shrink the rect by expanding the non-opaque pixels outside the rect.
|
||||
|
||||
@ -175,11 +173,10 @@ static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec
|
||||
// the occlusionRect into it, shrinking its right edge.
|
||||
int shrinkLeft = occlusionRect.x() == affectedArea.x() ? 0 : expandedPixel.right();
|
||||
int shrinkTop = occlusionRect.y() == affectedArea.y() ? 0 : expandedPixel.bottom();
|
||||
int shrinkRight = occlusionRect.maxX() == affectedArea.right() ? 0 : -expandedPixel.x();
|
||||
int shrinkBottom = occlusionRect.maxY() == affectedArea.bottom() ? 0 : -expandedPixel.y();
|
||||
int shrinkRight = occlusionRect.right() == affectedArea.right() ? 0 : -expandedPixel.x();
|
||||
int shrinkBottom = occlusionRect.bottom() == affectedArea.bottom() ? 0 : -expandedPixel.y();
|
||||
|
||||
occlusionRect.move(shrinkLeft, shrinkTop);
|
||||
occlusionRect.contract(shrinkLeft + shrinkRight, shrinkTop + shrinkBottom);
|
||||
occlusionRect.Inset(shrinkLeft, shrinkTop, shrinkRight, shrinkBottom);
|
||||
|
||||
occlusion.Union(occlusionRect);
|
||||
}
|
||||
@ -263,10 +260,9 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye
|
||||
if (clipped || !visibleTransformedQuad.IsRectilinear())
|
||||
return;
|
||||
|
||||
Vector<WebCore::IntRect> contentRects = opaqueContents.rects();
|
||||
for (size_t i = 0; i < contentRects.size(); ++i) {
|
||||
for (Region::Iterator opaqueContentRects(opaqueContents); opaqueContentRects.has_rect(); opaqueContentRects.next()) {
|
||||
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
|
||||
gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(contentRects[i])));
|
||||
gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, gfx::RectF(opaqueContentRects.rect())));
|
||||
transformedRect.Intersect(clipRectInTarget);
|
||||
if (transformedRect.width() >= minimumTrackingSize.width() || transformedRect.height() >= minimumTrackingSize.height()) {
|
||||
if (occludingScreenSpaceRects)
|
||||
|
@ -472,9 +472,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
|
||||
@ -524,9 +524,9 @@ protected:
|
||||
this->enterLayer(layer1, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// This checks cases where the quads don't match their "containing"
|
||||
// layers, e.g. in terms of transforms or clip rect. This is typical for
|
||||
@ -568,9 +568,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
|
||||
@ -620,9 +620,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)));
|
||||
@ -689,17 +689,17 @@ protected:
|
||||
this->enterContributingSurface(child, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->leaveContributingSurface(child, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)));
|
||||
@ -771,9 +771,9 @@ protected:
|
||||
this->enterLayer(layer2, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(0, 0, 25, 25)));
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(10, 25, 25, 25)));
|
||||
@ -811,32 +811,32 @@ protected:
|
||||
this->visitLayer(child2, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitLayer(layer, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->enterContributingSurface(child, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// Occlusion in |child2| should get merged with the |child| surface we are leaving now.
|
||||
this->leaveContributingSurface(child, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
|
||||
EXPECT_RECT_EQ(gfx::Rect(90, 30, 10, 10), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 70, 70)));
|
||||
@ -926,9 +926,9 @@ protected:
|
||||
this->enterContributingSurface(child, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild));
|
||||
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).IsEmpty());
|
||||
@ -953,9 +953,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1)));
|
||||
EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(75, 55, 1, 1)));
|
||||
@ -991,9 +991,9 @@ protected:
|
||||
this->enterContributingSurface(child, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(9, 430, 60, 70)));
|
||||
@ -1011,9 +1011,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)));
|
||||
@ -1080,9 +1080,9 @@ protected:
|
||||
this->enterContributingSurface(child2, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)));
|
||||
@ -1106,9 +1106,9 @@ protected:
|
||||
this->enterContributingSurface(child1, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 70)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-11, 430, 80, 70)));
|
||||
@ -1123,9 +1123,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 20, 80, 80)));
|
||||
|
||||
@ -1196,9 +1196,9 @@ protected:
|
||||
this->enterLayer(child2, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)));
|
||||
@ -1217,9 +1217,9 @@ protected:
|
||||
this->enterContributingSurface(child1, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(420, -20, 80, 90)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(419, -20, 80, 90)));
|
||||
@ -1236,9 +1236,9 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(10, 20, 90, 80)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(9, 20, 90, 80)));
|
||||
@ -1325,16 +1325,16 @@ protected:
|
||||
this->enterContributingSurface(opaqueLayer, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// And it gets translated to the parent surface.
|
||||
this->leaveContributingSurface(opaqueLayer, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// The blur layer needs to throw away any occlusion from outside its subtree.
|
||||
this->enterLayer(blurLayer, occlusion);
|
||||
@ -1351,9 +1351,9 @@ protected:
|
||||
this->leaveContributingSurface(blurLayer, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1376,16 +1376,16 @@ protected:
|
||||
this->visitLayer(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitContributingSurface(surface, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
// The surface and replica should both be occluding the parent.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1409,16 +1409,16 @@ protected:
|
||||
this->visitLayer(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitContributingSurface(surface, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
// The surface and replica should both be occluding the parent.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1442,16 +1442,16 @@ protected:
|
||||
this->visitLayer(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitContributingSurface(surface, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
// The replica should not be occluding the parent, since it has a mask applied to it.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1859,7 +1859,7 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().IsEmpty());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1884,7 +1884,7 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
|
||||
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
|
||||
@ -1900,7 +1900,7 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
|
||||
@ -1916,7 +1916,7 @@ protected:
|
||||
this->enterLayer(parent, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
|
||||
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
|
||||
@ -2076,8 +2076,8 @@ protected:
|
||||
// The |layer| is entirely behind the camera and should not occlude.
|
||||
this->visitLayer(layer, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2110,9 +2110,9 @@ protected:
|
||||
this->visitLayer(layer, occlusion);
|
||||
this->enterLayer(parent, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2259,7 +2259,7 @@ protected:
|
||||
this->enterContributingSurface(surface2, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
|
||||
this->leaveContributingSurface(surface2, occlusion);
|
||||
this->enterLayer(surfaceChild2, occlusion);
|
||||
@ -2273,9 +2273,9 @@ protected:
|
||||
this->enterLayer(surfaceChild, occlusion);
|
||||
EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 100, 300)));
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
|
||||
|
||||
// The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it
|
||||
@ -2287,17 +2287,17 @@ protected:
|
||||
this->enterLayer(surface, occlusion);
|
||||
// The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
|
||||
|
||||
this->leaveLayer(surface, occlusion);
|
||||
// The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
|
||||
|
||||
this->enterContributingSurface(surface, occlusion);
|
||||
@ -2342,9 +2342,9 @@ protected:
|
||||
this->visitContributingSurface(surface2, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// Clear any stored occlusion.
|
||||
occlusion.setOcclusionInScreenSpace(Region());
|
||||
@ -2354,9 +2354,9 @@ protected:
|
||||
this->visitContributingSurface(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2380,9 +2380,9 @@ protected:
|
||||
this->visitContributingSurface(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2407,16 +2407,16 @@ protected:
|
||||
this->visitLayer(topmost, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitLayer(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->enterContributingSurface(surface, occlusion);
|
||||
|
||||
@ -2446,16 +2446,16 @@ protected:
|
||||
this->visitLayer(topmost, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitLayer(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->enterContributingSurface(surface, occlusion);
|
||||
|
||||
@ -2488,16 +2488,16 @@ protected:
|
||||
this->visitLayer(overSurface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitLayer(surface, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->enterContributingSurface(surface, occlusion);
|
||||
|
||||
@ -2529,18 +2529,18 @@ protected:
|
||||
this->visitLayer(topmost, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitLayer(surfaceChild, occlusion);
|
||||
|
||||
// surfaceChild increases the occlusion in the screen by a narrow sliver.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
// In its own surface, surfaceChild is at 0,0 as is its occlusion.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
|
||||
// mask to bounds, so it doesn't have a clipRect of its own. Thus the parent of |surfaceChild| exercises different code paths
|
||||
@ -2555,9 +2555,9 @@ protected:
|
||||
// When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also.
|
||||
this->enterLayer(surface, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
this->leaveLayer(surface, occlusion);
|
||||
|
||||
this->enterContributingSurface(surface, occlusion);
|
||||
@ -2630,17 +2630,17 @@ protected:
|
||||
this->visitLayer(topmost, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface.
|
||||
this->visitLayer(surfaceChild, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
|
||||
// mask to bounds, so it doesn't have a clipRect of its own. Thus the parent of |surfaceChild| exercises different code paths
|
||||
@ -2704,9 +2704,9 @@ protected:
|
||||
this->visitLayer(occludingLayer1, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// Everything outside the surface/replica is occluded but the surface/replica itself is not.
|
||||
this->enterLayer(filteredSurface, occlusion);
|
||||
@ -2723,9 +2723,9 @@ protected:
|
||||
|
||||
// The filtered layer/replica does not occlude.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels
|
||||
// it needs should be removed some the occluded area so that when we get to the parent they are drawn.
|
||||
@ -2733,9 +2733,9 @@ protected:
|
||||
|
||||
this->enterLayer(parent, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
gfx::Rect outsetRect;
|
||||
gfx::Rect testRect;
|
||||
@ -2816,24 +2816,24 @@ protected:
|
||||
|
||||
this->visitLayer(occludingLayerAbove, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
this->visitLayer(filteredSurface2, occlusion);
|
||||
this->visitContributingSurface(filteredSurface2, occlusion);
|
||||
this->visitLayer(filteredSurface1, occlusion);
|
||||
this->visitContributingSurface(filteredSurface1, occlusion);
|
||||
|
||||
ASSERT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
ASSERT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
ASSERT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// Test expectations in the target.
|
||||
gfx::Rect expectedOcclusion = gfx::Rect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outsetTop + outsetBottom) * 2);
|
||||
EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]);
|
||||
EXPECT_RECT_EQ(expectedOcclusion, Region::Iterator(occlusion.occlusionInTargetSurface()).rect());
|
||||
|
||||
// Test expectations in the screen are the same as in the target, as the render surface is 1:1 with the screen.
|
||||
EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]);
|
||||
EXPECT_RECT_EQ(expectedOcclusion, Region::Iterator(occlusion.occlusionInScreenSpace()).rect());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2882,9 +2882,9 @@ protected:
|
||||
this->visitLayer(occludingLayer1, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// Everything outside the surface/replica is occluded but the surface/replica itself is not.
|
||||
this->enterLayer(filteredSurface, occlusion);
|
||||
@ -2901,9 +2901,9 @@ protected:
|
||||
|
||||
// The filtered layer/replica does not occlude.
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels
|
||||
// it needs should be removed some the occluded area so that when we get to the parent they are drawn.
|
||||
@ -2911,7 +2911,7 @@ protected:
|
||||
|
||||
this->enterContributingSurface(clippingSurface, occlusion);
|
||||
EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(5u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
|
||||
gfx::Rect outsetRect;
|
||||
gfx::Rect clippedOutsetRect;
|
||||
@ -3003,9 +3003,9 @@ protected:
|
||||
|
||||
gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionBehindSurface, occlusionBehindReplica);
|
||||
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -3052,9 +3052,9 @@ protected:
|
||||
|
||||
gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionAboveSurface, occlusionAboveReplica);
|
||||
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(2u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -3118,15 +3118,17 @@ protected:
|
||||
expectedOcclusion.Union(occlusionBesideSurface);
|
||||
expectedOcclusion.Union(occlusionBesideReplica);
|
||||
|
||||
ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInTargetSurface().rects().size());
|
||||
ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInScreenSpace().rects().size());
|
||||
ASSERT_EQ(Region::Iterator(expectedOcclusion).size(), Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
ASSERT_EQ(Region::Iterator(expectedOcclusion).size(), Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
|
||||
for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) {
|
||||
cc::IntRect expectedRect = expectedOcclusion.rects()[i];
|
||||
cc::IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i];
|
||||
cc::IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i];
|
||||
EXPECT_EQ(expectedRect, screenRect);
|
||||
EXPECT_EQ(expectedRect, targetRect);
|
||||
Region::Iterator expectedRects(expectedOcclusion);
|
||||
Region::Iterator screenSpaceRects(occlusion.occlusionInScreenSpace());
|
||||
Region::Iterator targetSurfaceRects(occlusion.occlusionInTargetSurface());
|
||||
for (; expectedRects.has_rect(); expectedRects.next(), screenSpaceRects.next(), targetSurfaceRects.next()) {
|
||||
ASSERT_TRUE(screenSpaceRects.has_rect());
|
||||
ASSERT_TRUE(targetSurfaceRects.has_rect());
|
||||
EXPECT_EQ(expectedRects.rect(), screenSpaceRects.rect());
|
||||
EXPECT_EQ(expectedRects.rect(), targetSurfaceRects.rect());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -3155,17 +3157,17 @@ protected:
|
||||
this->visitLayer(small, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(0u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
|
||||
// The large layer is tracked as it is large enough.
|
||||
this->visitLayer(large, occlusion);
|
||||
|
||||
EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInScreenSpace()).size());
|
||||
EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
|
||||
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(occlusion.occlusionInTargetSurface()).size());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -98,10 +98,9 @@ void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
|
||||
SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque));
|
||||
DCHECK(rootLayer->screenSpaceTransform().isInvertible());
|
||||
WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse();
|
||||
Vector<WebCore::IntRect> fillRects = fillRegion.rects();
|
||||
for (size_t i = 0; i < fillRects.size(); ++i) {
|
||||
for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects.next()) {
|
||||
// The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient.
|
||||
gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i]));
|
||||
gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fillRects.rect());
|
||||
// Skip the quad culler and just append the quads directly to avoid occlusion checks.
|
||||
m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>());
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
// Copyright 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Temporary forwarding header
|
||||
#include "cc/stubs/float_rect.h"
|
@ -1,6 +0,0 @@
|
||||
// Copyright 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Temporary forwarding header
|
||||
#include "cc/stubs/int_rect.h"
|
@ -5,12 +5,12 @@
|
||||
#ifndef CC_STUBS_REGION_H_
|
||||
#define CC_STUBS_REGION_H_
|
||||
|
||||
#include "IntRect.h"
|
||||
#if INSIDE_WEBKIT_BUILD
|
||||
#include "Source/WebCore/platform/graphics/Region.h"
|
||||
#else
|
||||
#include "third_party/WebKit/Source/WebCore/platform/graphics/Region.h"
|
||||
#endif
|
||||
#include "base/logging.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
namespace cc {
|
||||
@ -19,16 +19,6 @@ class Region : public WebCore::Region {
|
||||
public:
|
||||
Region() { }
|
||||
|
||||
Region(const IntRect& rect)
|
||||
: WebCore::Region(rect)
|
||||
{
|
||||
}
|
||||
|
||||
Region(const WebCore::IntRect& rect)
|
||||
: WebCore::Region(rect)
|
||||
{
|
||||
}
|
||||
|
||||
Region(const WebCore::Region& region)
|
||||
: WebCore::Region(region)
|
||||
{
|
||||
@ -41,31 +31,67 @@ public:
|
||||
|
||||
bool IsEmpty() const { return isEmpty(); }
|
||||
|
||||
bool Contains(const gfx::Point& point) const { return contains(cc::IntPoint(point)); }
|
||||
bool Contains(const gfx::Rect& rect) const { return contains(cc::IntRect(rect)); }
|
||||
void Subtract(const gfx::Rect& rect) { subtract(cc::IntRect(rect)); }
|
||||
bool Contains(const gfx::Point& point) const { return contains(WebCore::IntPoint(point.x(), point.y())); }
|
||||
bool Contains(const gfx::Rect& rect) const { return contains(WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())); }
|
||||
void Subtract(const gfx::Rect& rect) { subtract(WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())); }
|
||||
void Subtract(const Region& region) { subtract(region); }
|
||||
void Union(const gfx::Rect& rect) { unite(cc::IntRect(rect)); }
|
||||
void Union(const gfx::Rect& rect) { unite(WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())); }
|
||||
void Union(const Region& region) { unite(region); }
|
||||
void Intersect(const gfx::Rect& rect) { intersect(cc::IntRect(rect)); }
|
||||
void Intersect(const gfx::Rect& rect) { intersect(WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())); }
|
||||
void Intersect(const Region& region) { intersect(region); }
|
||||
|
||||
gfx::Rect bounds() const { return cc::IntRect(WebCore::Region::bounds()); }
|
||||
gfx::Rect bounds() const
|
||||
{
|
||||
WebCore::IntRect bounds = WebCore::Region::bounds();
|
||||
return gfx::Rect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
|
||||
}
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
Iterator(const Region& region);
|
||||
~Iterator();
|
||||
|
||||
gfx::Rect rect() const {
|
||||
DCHECK(has_rect());
|
||||
if (!has_rect())
|
||||
return gfx::Rect();
|
||||
return gfx::Rect(m_rects[m_pos].x(), m_rects[m_pos].y(), m_rects[m_pos].width(), m_rects[m_pos].height());
|
||||
}
|
||||
|
||||
void next() { ++m_pos; }
|
||||
bool has_rect() const { return m_pos < m_rects.size(); }
|
||||
|
||||
// It is expensive to construct the iterator just to get this size. Only
|
||||
// do this for testing.
|
||||
size_t size() const { return m_rects.size(); }
|
||||
private:
|
||||
size_t m_pos;
|
||||
Vector<WebCore::IntRect> m_rects;
|
||||
};
|
||||
|
||||
private:
|
||||
bool isEmpty() const { return WebCore::Region::isEmpty(); }
|
||||
bool contains(const IntPoint& point) const { return WebCore::Region::contains(point); }
|
||||
bool contains(const IntRect& rect) const { return WebCore::Region::contains(rect); }
|
||||
void subtract(const IntRect& rect) { return WebCore::Region::subtract(rect); }
|
||||
bool contains(const WebCore::IntPoint& point) const { return WebCore::Region::contains(point); }
|
||||
bool contains(const WebCore::IntRect& rect) const { return WebCore::Region::contains(rect); }
|
||||
void subtract(const WebCore::IntRect& rect) { return WebCore::Region::subtract(rect); }
|
||||
void subtract(const Region& region) { return WebCore::Region::subtract(region); }
|
||||
void unite(const IntRect& rect) { return WebCore::Region::unite(rect); }
|
||||
void unite(const WebCore::IntRect& rect) { return WebCore::Region::unite(rect); }
|
||||
void unite(const Region& region) { return WebCore::Region::unite(region); }
|
||||
void intersect(const IntRect& rect) { return WebCore::Region::intersect(rect); }
|
||||
void intersect(const WebCore::IntRect& rect) { return WebCore::Region::intersect(rect); }
|
||||
void intersect(const Region& region) { return WebCore::Region::intersect(region); }
|
||||
Vector<WebCore::IntRect> rects() const { return WebCore::Region::rects(); }
|
||||
};
|
||||
|
||||
inline Region subtract(const Region& region, const gfx::Rect& rect) { return WebCore::intersect(region, cc::IntRect(rect)); }
|
||||
inline Region intersect(const Region& region, const gfx::Rect& rect) { return WebCore::intersect(region, cc::IntRect(rect)); }
|
||||
inline Region subtract(const Region& region, const gfx::Rect& rect) { return WebCore::intersect(region, WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())); }
|
||||
inline Region intersect(const Region& region, const gfx::Rect& rect) { return WebCore::intersect(region, WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())); }
|
||||
|
||||
inline Region::Iterator::Iterator(const Region& region)
|
||||
: m_pos(0)
|
||||
, m_rects(region.rects())
|
||||
{
|
||||
}
|
||||
|
||||
inline Region::Iterator::~Iterator() { }
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,73 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CC_STUBS_FLOATRECT_H_
|
||||
#define CC_STUBS_FLOATRECT_H_
|
||||
|
||||
#include "FloatPoint.h"
|
||||
#include "FloatSize.h"
|
||||
#include "IntRect.h"
|
||||
#if INSIDE_WEBKIT_BUILD
|
||||
#include "Source/WebCore/platform/graphics/FloatRect.h"
|
||||
#else
|
||||
#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatRect.h"
|
||||
#endif
|
||||
#include "ui/gfx/rect_f.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
namespace cc {
|
||||
|
||||
class FloatRect : public WebCore::FloatRect {
|
||||
public:
|
||||
FloatRect() { }
|
||||
|
||||
FloatRect(const FloatPoint& location, const FloatSize& size)
|
||||
: WebCore::FloatRect(location, size)
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect(const IntPoint& location, const IntSize& size)
|
||||
: WebCore::FloatRect(location, size)
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect(float x, float y, float width, float height)
|
||||
: WebCore::FloatRect(x, y, width, height)
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect(const IntRect& rect)
|
||||
: WebCore::FloatRect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect(const WebCore::IntRect& rect)
|
||||
: WebCore::FloatRect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
FloatRect(const WebCore::FloatRect& rect)
|
||||
:WebCore::FloatRect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
explicit FloatRect(gfx::RectF rect)
|
||||
: WebCore::FloatRect(rect.x(), rect.y(), rect.width(), rect.height())
|
||||
{
|
||||
}
|
||||
|
||||
operator gfx::RectF() const { return gfx::RectF(x(), y(), width(), height()); }
|
||||
|
||||
private:
|
||||
#if defined(OS_MACOSX)
|
||||
operator CGRect() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,61 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CC_STUBS_INTRECT_H_
|
||||
#define CC_STUBS_INTRECT_H_
|
||||
|
||||
#include "IntPoint.h"
|
||||
#include "IntSize.h"
|
||||
#if INSIDE_WEBKIT_BUILD
|
||||
#include "Source/WebCore/platform/graphics/IntRect.h"
|
||||
#else
|
||||
#include "third_party/WebKit/Source/WebCore/platform/graphics/IntRect.h"
|
||||
#endif
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
namespace cc {
|
||||
|
||||
class IntRect : public WebCore::IntRect {
|
||||
public:
|
||||
IntRect() { }
|
||||
|
||||
IntRect(const IntPoint& location, const IntSize& size)
|
||||
: WebCore::IntRect(location, size)
|
||||
{
|
||||
}
|
||||
|
||||
IntRect(int x, int y, int width, int height)
|
||||
: WebCore::IntRect(x, y, width, height)
|
||||
{
|
||||
}
|
||||
|
||||
IntRect(WebCore::IntRect rect)
|
||||
: WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
explicit IntRect(gfx::Rect rect)
|
||||
: WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())
|
||||
{
|
||||
}
|
||||
|
||||
operator gfx::Rect() const { return gfx::Rect(x(), y(), width(), height()); }
|
||||
|
||||
IntPoint location() const { return WebCore::IntRect::location(); }
|
||||
IntSize size() const { return WebCore::IntRect::size(); }
|
||||
|
||||
private:
|
||||
#if defined(OS_MACOSX)
|
||||
operator CGRect() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "cc/test/layer_test_common.h"
|
||||
|
||||
#include "FloatRect.h"
|
||||
#include "Region.h"
|
||||
#include "cc/draw_quad.h"
|
||||
#include "cc/math_util.h"
|
||||
@ -25,12 +24,11 @@ const char* quadString = " Quad: ";
|
||||
bool canRectFBeSafelyRoundedToRect(const gfx::RectF& r)
|
||||
{
|
||||
// Ensure that range of float values is not beyond integer range.
|
||||
if (!cc::FloatRect(r).isExpressibleAsIntRect())
|
||||
if (!r.IsExpressibleAsRect())
|
||||
return false;
|
||||
|
||||
// Ensure that the values are actually integers.
|
||||
if (gfx::ToFlooredPoint(r.origin()) == r.origin()
|
||||
&& gfx::ToFlooredSize(r.size()) == r.size())
|
||||
if (gfx::ToFlooredPoint(r.origin()) == r.origin() && gfx::ToFlooredSize(r.size()) == r.size())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -151,9 +151,8 @@ void TiledLayer::updateBounds()
|
||||
Region oldRegion = gfx::Rect(gfx::Point(), oldBounds);
|
||||
Region newRegion = gfx::Rect(gfx::Point(), newBounds);
|
||||
newRegion.Subtract(oldRegion);
|
||||
Vector<WebCore::IntRect> rects = newRegion.rects();
|
||||
for (size_t i = 0; i < rects.size(); ++i)
|
||||
invalidateContentRect(cc::IntRect(rects[i]));
|
||||
for (Region::Iterator newRects(newRegion); newRects.has_rect(); newRects.next())
|
||||
invalidateContentRect(newRects.rect());
|
||||
}
|
||||
|
||||
void TiledLayer::setTileSize(const gfx::Size& size)
|
||||
|
@ -1271,7 +1271,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(opaqueContents).size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
|
||||
@ -1284,7 +1284,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(opaqueContents).size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
|
||||
@ -1299,7 +1299,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(opaqueContents).size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1);
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
|
||||
@ -1314,7 +1314,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
||||
updateTextures();
|
||||
opaqueContents = layer->visibleContentOpaqueRegion();
|
||||
EXPECT_RECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
|
||||
EXPECT_EQ(1u, opaqueContents.rects().size());
|
||||
EXPECT_EQ(1u, Region::Iterator(opaqueContents).size());
|
||||
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
|
||||
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include "SkMatrix44.h"
|
||||
#include "cc/content_layer.h"
|
||||
#include "cc/stubs/float_rect.h"
|
||||
#include "cc/stubs/int_rect.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClient.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "config.h"
|
||||
#include "web_layer_impl.h"
|
||||
|
||||
#include "Region.h"
|
||||
#include "SkMatrix44.h"
|
||||
#ifdef LOG
|
||||
#undef LOG
|
||||
@ -395,21 +396,18 @@ bool WebLayerImpl::shouldScrollOnMainThread() const
|
||||
|
||||
void WebLayerImpl::setNonFastScrollableRegion(const WebVector<WebRect>& rects)
|
||||
{
|
||||
WebCore::Region region;
|
||||
for (size_t i = 0; i < rects.size(); ++i) {
|
||||
WebCore::IntRect rect = convert(rects[i]);
|
||||
region.unite(rect);
|
||||
}
|
||||
cc::Region region;
|
||||
for (size_t i = 0; i < rects.size(); ++i)
|
||||
region.Union(rects[i]);
|
||||
m_layer->setNonFastScrollableRegion(region);
|
||||
|
||||
}
|
||||
|
||||
WebVector<WebRect> WebLayerImpl::nonFastScrollableRegion() const
|
||||
{
|
||||
Vector<WebCore::IntRect> regionRects = m_layer->nonFastScrollableRegion().rects();
|
||||
cc::Region::Iterator regionRects(m_layer->nonFastScrollableRegion());
|
||||
WebVector<WebRect> result(regionRects.size());
|
||||
for (size_t i = 0; i < regionRects.size(); ++i)
|
||||
result[i] = convert(regionRects[i]);
|
||||
for (size_t i = 0; regionRects.has_rect(); regionRects.next(), ++i)
|
||||
result[i] = regionRects.rect();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -8,21 +8,11 @@
|
||||
|
||||
namespace WebKit {
|
||||
|
||||
WebCore::FloatRect convert(const WebFloatRect& rect)
|
||||
{
|
||||
return WebCore::FloatRect(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
WebCore::FloatPoint convert(const WebFloatPoint& point)
|
||||
{
|
||||
return WebCore::FloatPoint(point.x, point.y);
|
||||
}
|
||||
|
||||
WebCore::IntRect convert(const WebRect& rect)
|
||||
{
|
||||
return WebCore::IntRect(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
WebCore::IntPoint convert(const WebPoint& point)
|
||||
{
|
||||
return WebCore::IntPoint(point.x, point.y);
|
||||
@ -33,11 +23,6 @@ WebCore::IntSize convert(const WebSize& size)
|
||||
return WebCore::IntSize(size.width, size.height);
|
||||
}
|
||||
|
||||
WebRect convert(const WebCore::IntRect& rect)
|
||||
{
|
||||
return WebRect(rect.x(), rect.y(), rect.width(), rect.height());
|
||||
}
|
||||
|
||||
WebSize convert(const WebCore::IntSize& size)
|
||||
{
|
||||
return WebSize(size.width(), size.height());
|
||||
|
@ -6,11 +6,8 @@
|
||||
#define WEBKIT_COMPOSITOR_BINDINGS_WEBCORE_CONVERT_H_
|
||||
|
||||
#include "FloatPoint.h"
|
||||
#include "FloatRect.h"
|
||||
#include "IntPoint.h"
|
||||
#include "IntRect.h"
|
||||
#include "IntSize.h"
|
||||
#include <public/WebFloatRect.h>
|
||||
#include <public/WebFloatPoint.h>
|
||||
#include <public/WebRect.h>
|
||||
#include <public/WebPoint.h>
|
||||
@ -18,12 +15,9 @@
|
||||
|
||||
namespace WebKit {
|
||||
|
||||
WebCore::FloatRect convert(const WebFloatRect& rect);
|
||||
WebCore::FloatPoint convert(const WebFloatPoint& point);
|
||||
WebCore::IntRect convert(const WebRect& rect);
|
||||
WebCore::IntPoint convert(const WebPoint& point);
|
||||
WebCore::IntSize convert(const WebSize& size);
|
||||
WebRect convert(const WebCore::IntRect& rect);
|
||||
WebSize convert(const WebCore::IntSize& size);
|
||||
WebFloatPoint convert(const WebCore::FloatPoint& point);
|
||||
|
||||
|
Reference in New Issue
Block a user