summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/delegated_renderer_layer_impl.cc1
-rw-r--r--cc/delegated_renderer_layer_impl_unittest.cc7
-rw-r--r--cc/draw_quad.h1
-rw-r--r--cc/draw_quad_unittest.cc11
-rw-r--r--cc/gl_renderer_pixeltest.cc2
-rw-r--r--cc/layer_impl.cc1
-rw-r--r--cc/layer_tree_host_impl.cc3
-rw-r--r--cc/layer_tree_host_impl_unittest.cc2
-rw-r--r--cc/occlusion_tracker.cc32
-rw-r--r--cc/occlusion_tracker.h7
-rw-r--r--cc/occlusion_tracker_unittest.cc282
-rw-r--r--cc/quad_culler.cc2
-rw-r--r--cc/render_pass_unittest.cc2
-rw-r--r--cc/render_surface_impl.cc24
-rw-r--r--cc/shared_quad_state.cc2
-rw-r--r--cc/shared_quad_state.h2
-rw-r--r--cc/software_renderer_unittest.cc4
-rw-r--r--cc/test/render_pass_test_common.cc1
-rw-r--r--cc/test/render_pass_test_utils.cc5
-rw-r--r--cc/tiled_layer.cc2
-rw-r--r--cc/tiled_layer_unittest.cc12
-rw-r--r--content/common/cc_messages.h1
-rw-r--r--content/common/cc_messages_unittest.cc4
23 files changed, 128 insertions, 282 deletions
diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc
index c9c2a4e..1559bd3 100644
--- a/cc/delegated_renderer_layer_impl.cc
+++ b/cc/delegated_renderer_layer_impl.cc
@@ -159,7 +159,6 @@ void DelegatedRendererLayerImpl::appendRenderPassQuads(QuadSink& quadSink, Appen
static_cast<double>(displaySize.height()) / frameSize.height());
copiedSharedQuadState->content_to_target_transform = drawTransform() * delegatedFrameToLayerSpaceTransform * copiedSharedQuadState->content_to_target_transform;
- copiedSharedQuadState->clipped_rect_in_target = MathUtil::mapClippedRect(drawTransform() * delegatedFrameToLayerSpaceTransform, copiedSharedQuadState->clipped_rect_in_target);
copiedSharedQuadState->clip_rect = MathUtil::mapClippedRect(drawTransform() * delegatedFrameToLayerSpaceTransform, copiedSharedQuadState->clip_rect);
copiedSharedQuadState->opacity *= drawOpacity();
}
diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc
index 1cc254d..7779fca 100644
--- a/cc/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/delegated_renderer_layer_impl_unittest.cc
@@ -422,7 +422,7 @@ public:
MockQuadCuller quadSink(pass->quad_list, pass->shared_quad_state_list);
AppendQuadsData data(pass->id);
SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::Create());
- sharedState->SetAll(childPassTransform, childPassRect, childPassRect, childPassRect, false, 1);
+ sharedState->SetAll(childPassTransform, childPassRect, childPassRect, false, 1);
scoped_ptr<SolidColorDrawQuad> colorQuad;
colorQuad = SolidColorDrawQuad::Create();
@@ -443,7 +443,7 @@ public:
MockQuadCuller quadSink(pass->quad_list, pass->shared_quad_state_list);
AppendQuadsData data(pass->id);
SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::Create());
- sharedState->SetAll(passTransform, passRect, passRect, passRect, false, 1);
+ sharedState->SetAll(passTransform, passRect, passRect, false, 1);
scoped_ptr<SolidColorDrawQuad> colorQuad;
scoped_ptr<RenderPassDrawQuad> renderPassQuad = RenderPassDrawQuad::Create();
@@ -531,7 +531,6 @@ TEST_F(DelegatedRendererLayerImplTestSharedData, SharedData)
// 36 - (width / 2) = 36 - 30 / 2 = 21
// The size is 100 scaled to fit inside the layer's bounds at 30x30 from a frame at 50x50.
// 100 * 30 / 50 = 60.
- EXPECT_RECT_EQ(gfx::Rect(21, 21, 60, 60), rootSharedState->clipped_rect_in_target);
EXPECT_RECT_EQ(gfx::Rect(21, 21, 60, 60), rootSharedState->clip_rect);
gfx::Transform expected;
// This is the transform from the layer's space to its target.
@@ -547,7 +546,6 @@ TEST_F(DelegatedRendererLayerImplTestSharedData, SharedData)
EXPECT_TRANSFORMATION_MATRIX_EQ(expected, rootSharedState->content_to_target_transform);
// The contributing render pass should not be transformed from its input.
- EXPECT_RECT_EQ(gfx::Rect(20, 20, 7, 7), contribSharedState->clipped_rect_in_target);
EXPECT_RECT_EQ(gfx::Rect(20, 20, 7, 7), contribSharedState->clip_rect);
expected.MakeIdentity();
expected.Scale(0.8, 0.8);
@@ -576,7 +574,6 @@ TEST_F(DelegatedRendererLayerImplTestSharedData, DisplaySize)
const SharedQuadState* rootSharedState = rootQuadList[0]->shared_quad_state;
// The results are similar to the SharedData test, but are scaled up by displaySize/bounds, which is 40/30.
- EXPECT_RECT_EQ(gfx::Rect(21, 21, 80, 80), rootSharedState->clipped_rect_in_target);
EXPECT_RECT_EQ(gfx::Rect(21, 21, 80, 80), rootSharedState->clip_rect);
gfx::Transform expected;
// This is the transform from the layer's space to its target.
diff --git a/cc/draw_quad.h b/cc/draw_quad.h
index bc88690..dc87a5d 100644
--- a/cc/draw_quad.h
+++ b/cc/draw_quad.h
@@ -38,7 +38,6 @@ class CC_EXPORT DrawQuad {
// TODO(danakj): Chromify or remove these SharedQuadState helpers.
const gfx::Transform& quadTransform() const { return shared_quad_state->content_to_target_transform; }
gfx::Rect visibleContentRect() const { return shared_quad_state->visible_content_rect; }
- gfx::Rect clippedRectInTarget() const { return shared_quad_state->clipped_rect_in_target; }
gfx::Rect clipRect() const { return shared_quad_state->clip_rect; }
bool isClipped() const { return shared_quad_state->is_clipped; }
float opacity() const { return shared_quad_state->opacity; }
diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc
index bd02ccf..e1bf9e1 100644
--- a/cc/draw_quad_unittest.cc
+++ b/cc/draw_quad_unittest.cc
@@ -27,18 +27,16 @@ TEST(DrawQuadTest, copySharedQuadState)
{
gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
gfx::Rect visibleContentRect(10, 12, 14, 16);
- gfx::Rect clippedRectInTarget(19, 21, 23, 25);
- gfx::Rect clipRect = clippedRectInTarget;
+ gfx::Rect clipRect(19, 21, 23, 25);
bool isClipped = true;
float opacity = 0.25;
scoped_ptr<SharedQuadState> state(SharedQuadState::Create());
- state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRect, isClipped, opacity);
+ state->SetAll(quadTransform, visibleContentRect, clipRect, isClipped, opacity);
scoped_ptr<SharedQuadState> copy(state->Copy());
EXPECT_EQ(quadTransform, copy->content_to_target_transform);
EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect);
- EXPECT_RECT_EQ(clippedRectInTarget, copy->clipped_rect_in_target);
EXPECT_EQ(opacity, copy->opacity);
EXPECT_RECT_EQ(clipRect, copy->clip_rect);
EXPECT_EQ(isClipped, copy->is_clipped);
@@ -48,13 +46,12 @@ scoped_ptr<SharedQuadState> createSharedQuadState()
{
gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
gfx::Rect visibleContentRect(10, 12, 14, 16);
- gfx::Rect clippedRectInTarget(19, 21, 23, 25);
- gfx::Rect clipRect = clippedRectInTarget;
+ gfx::Rect clipRect(19, 21, 23, 25);
bool isClipped = false;
float opacity = 1;
scoped_ptr<SharedQuadState> state(SharedQuadState::Create());
- state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRect, isClipped, opacity);
+ state->SetAll(quadTransform, visibleContentRect, clipRect, isClipped, opacity);
return state.Pass();
}
diff --git a/cc/gl_renderer_pixeltest.cc b/cc/gl_renderer_pixeltest.cc
index 1c63777..3507d77 100644
--- a/cc/gl_renderer_pixeltest.cc
+++ b/cc/gl_renderer_pixeltest.cc
@@ -93,14 +93,12 @@ scoped_ptr<RenderPass> CreateTestRenderPass(RenderPass::Id id, gfx::Rect rect) {
scoped_ptr<SharedQuadState> CreateTestSharedQuadState(
gfx::Transform content_to_target_transform, gfx::Rect rect) {
const gfx::Rect visible_content_rect = rect;
- const gfx::Rect clipped_rect_in_target = rect;
const gfx::Rect clip_rect = rect;
const bool is_clipped = false;
const float opacity = 1.0f;
scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create();
shared_state->SetAll(content_to_target_transform,
visible_content_rect,
- clipped_rect_in_target,
clip_rect,
is_clipped,
opacity);
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index cf50899..c3aa793 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -121,7 +121,6 @@ scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const
scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
state->SetAll(m_drawProperties.target_space_transform,
m_drawProperties.visible_content_rect,
- m_drawProperties.drawable_content_rect,
m_drawProperties.clip_rect,
m_drawProperties.is_clipped,
m_drawProperties.opacity);
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 82e518f..ce03f35 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -418,7 +418,6 @@ static void appendQuadsToFillScreen(RenderPass* targetRenderPass, LayerImpl* roo
sharedQuadState->SetAll(rootLayer->drawTransform(),
rootTargetRect,
rootTargetRect,
- rootTargetRect,
false,
opacity);
@@ -489,7 +488,7 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
} else if (it.representsItself() && !it->visibleContentRect().IsEmpty()) {
bool hasOcclusionFromOutsideTargetSurface;
bool implDrawTransformIsUnknown = false;
- if (occlusionTracker.occluded(it->renderTarget(), it->visibleContentRect(), it->drawTransform(), implDrawTransformIsUnknown, it->drawableContentRect(), &hasOcclusionFromOutsideTargetSurface))
+ if (occlusionTracker.occluded(it->renderTarget(), it->visibleContentRect(), it->drawTransform(), implDrawTransformIsUnknown, it->isClipped(), it->clipRect(), &hasOcclusionFromOutsideTargetSurface))
appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface;
else {
DCHECK_EQ(activeTree(), it->layerTreeImpl());
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 7dadfde..6f9f638 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -3720,7 +3720,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
// One shared state for all quads - we don't need the correct details
testData.sharedQuadState = SharedQuadState::Create();
- testData.sharedQuadState->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), gfx::Rect(), false, 1.0);
+ testData.sharedQuadState->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), false, 1.0);
const char* currentChar = testScript;
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index 7740fda..cfd9acb 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -47,6 +47,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveLayer(const LayerI
if (layerIterator.representsItself)
markOccludedBehindLayer(layerIterator.currentLayer);
+ // TODO(danakj): This should be done when entering the contributing surface, but in a way that the surface's own occlusion won't occlude itself.
else if (layerIterator.representsContributingRenderSurface)
leaveToRenderTarget(renderTarget);
}
@@ -279,15 +280,15 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
if (layerIsInUnsorted3dRenderingContext(layer))
return;
+ if (!layerTransformsToTargetKnown(layer))
+ return;
+
Region opaqueContents = layer->visibleContentOpaqueRegion();
if (opaqueContents.IsEmpty())
return;
DCHECK(layer->visibleContentRect().Contains(opaqueContents.bounds()));
- if (!layerTransformsToTargetKnown(layer))
- return;
-
bool clipped;
gfx::QuadF visibleTransformedQuad = MathUtil::mapQuad(layer->drawTransform(), gfx::QuadF(opaqueContents.bounds()), clipped);
// FIXME: Find a rect interior to each transformed quad.
@@ -295,7 +296,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
return;
gfx::Rect clipRectInTarget = gfx::IntersectRects(
- layerClipRectInTarget(layer),
+ layer->renderTarget()->renderSurface()->contentRect(),
screenSpaceClipRectInTargetSurface(layer->renderTarget()->renderSurface(), m_screenSpaceClipRect));
for (Region::Iterator opaqueContentRects(opaqueContents); opaqueContentRects.has_rect(); opaqueContentRects.next()) {
@@ -335,7 +336,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
}
template<typename LayerType, typename RenderSurfaceType>
-bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
+bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* renderTarget, gfx::Rect contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, bool isClipped, gfx::Rect clipRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
{
if (hasOcclusionFromOutsideTargetSurface)
*hasOcclusionFromOutsideTargetSurface = false;
@@ -363,13 +364,14 @@ bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp
// Take the ToEnclosingRect at each step, as we want to contain any unoccluded partial pixels in the resulting Rect.
Region unoccludedRegionInTargetSurface = gfx::ToEnclosingRect(MathUtil::mapClippedRect(drawTransform, gfx::RectF(contentRect)));
// Layers can't clip across surfaces, so count this as internal occlusion.
- // TODO(danakj): This would change if we clipped to the visibleContentRect().
- unoccludedRegionInTargetSurface.Intersect(clippedRectInTarget);
+ if (isClipped)
+ unoccludedRegionInTargetSurface.Intersect(clipRectInTarget);
unoccludedRegionInTargetSurface.Subtract(m_stack.back().occlusionFromInsideTarget);
gfx::RectF unoccludedRectInTargetSurfaceWithoutOutsideOcclusion = unoccludedRegionInTargetSurface.bounds();
unoccludedRegionInTargetSurface.Subtract(m_stack.back().occlusionFromOutsideTarget);
// Treat other clipping as occlusion from outside the surface.
+ // TODO(danakj): Clip to visibleContentRect?
unoccludedRegionInTargetSurface.Intersect(renderTarget->renderSurface()->contentRect());
unoccludedRegionInTargetSurface.Intersect(screenSpaceClipRectInTargetSurface(renderTarget->renderSurface(), m_screenSpaceClipRect));
@@ -384,7 +386,7 @@ bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp
}
template<typename LayerType, typename RenderSurfaceType>
-gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* renderTarget, const gfx::Rect& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
+gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* renderTarget, gfx::Rect contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, bool isClipped, gfx::Rect clipRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
{
if (hasOcclusionFromOutsideTargetSurface)
*hasOcclusionFromOutsideTargetSurface = false;
@@ -412,13 +414,14 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR
// Take the ToEnclosingRect at each step, as we want to contain any unoccluded partial pixels in the resulting Rect.
Region unoccludedRegionInTargetSurface = gfx::ToEnclosingRect(MathUtil::mapClippedRect(drawTransform, gfx::RectF(contentRect)));
// Layers can't clip across surfaces, so count this as internal occlusion.
- // TODO(danakj): This would change if we clipped to the visibleContentRect().
- unoccludedRegionInTargetSurface.Intersect(clippedRectInTarget);
+ if (isClipped)
+ unoccludedRegionInTargetSurface.Intersect(clipRectInTarget);
unoccludedRegionInTargetSurface.Subtract(m_stack.back().occlusionFromInsideTarget);
gfx::RectF unoccludedRectInTargetSurfaceWithoutOutsideOcclusion = unoccludedRegionInTargetSurface.bounds();
unoccludedRegionInTargetSurface.Subtract(m_stack.back().occlusionFromOutsideTarget);
// Treat other clipping as occlusion from outside the surface.
+ // TODO(danakj): Clip to visibleContentRect?
unoccludedRegionInTargetSurface.Intersect(renderTarget->renderSurface()->contentRect());
unoccludedRegionInTargetSurface.Intersect(screenSpaceClipRectInTargetSurface(renderTarget->renderSurface(), m_screenSpaceClipRect));
@@ -471,7 +474,6 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu
// Take the ToEnclosingRect at each step, as we want to contain any unoccluded partial pixels in the resulting Rect.
Region unoccludedRegionInTargetSurface = gfx::ToEnclosingRect(MathUtil::mapClippedRect(drawTransform, gfx::RectF(contentRect)));
// Layers can't clip across surfaces, so count this as internal occlusion.
- // TODO(danakj): This would change if we clipped to the visibleContentRect().
if (surface->isClipped())
unoccludedRegionInTargetSurface.Intersect(surface->clipRect());
if (hasOcclusion) {
@@ -500,14 +502,6 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu
return unoccludedRect;
}
-template<typename LayerType, typename RenderSurfaceType>
-gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(const LayerType* layer) const
-{
- // TODO(danakj): Can we remove this use of drawableContentRect and just use the clipRect() and target surface contentRect?
- // TODO(danakj): Or can we use visibleContentRect() which is much tighter?
- return layer->drawableContentRect();
-}
-
// Instantiate (and export) templates here for the linker.
template class OcclusionTrackerBase<Layer, RenderSurface>;
template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>;
diff --git a/cc/occlusion_tracker.h b/cc/occlusion_tracker.h
index 260dddb..1d549e7 100644
--- a/cc/occlusion_tracker.h
+++ b/cc/occlusion_tracker.h
@@ -35,9 +35,9 @@ public:
void leaveLayer(const LayerIteratorPosition<LayerType>&);
// Returns true if the given rect in content space for a layer is fully occluded in either screen space or the layer's target surface. |renderTarget| is the contributing layer's render target, and |drawTransform|, |transformsToTargetKnown| and |clippedRectInTarget| are relative to that.
- bool occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+ bool occluded(const LayerType* renderTarget, gfx::Rect contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, bool isClipped, gfx::Rect clipRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
// Gives an unoccluded sub-rect of |contentRect| in the content space of a layer. Used when considering occlusion for a layer that paints/draws something. |renderTarget| is the contributing layer's render target, and |drawTransform|, |transformsToTargetKnown| and |clippedRectInTarget| are relative to that.
- gfx::Rect unoccludedContentRect(const LayerType* renderTarget, const gfx::Rect& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+ gfx::Rect unoccludedContentRect(const LayerType* renderTarget, gfx::Rect contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, bool isClipped, gfx::Rect clipRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
// Gives an unoccluded sub-rect of |contentRect| in the content space of the renderTarget owned by the layer.
// Used when considering occlusion for a contributing surface that is rendering into another target.
@@ -76,9 +76,6 @@ protected:
// We merge the occlusion at the top of the stack with the new current subtree. This new target is pushed onto the stack if not already there.
std::vector<StackObject> m_stack;
- // Allow tests to override this.
- virtual gfx::Rect layerClipRectInTarget(const LayerType*) const;
-
private:
// Called when visiting a layer representing itself. If the target was not already current, then this indicates we have entered a new surface subtree.
void enterRenderTarget(const LayerType* newTarget);
diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc
index de7124e..494c05e 100644
--- a/cc/occlusion_tracker_unittest.cc
+++ b/cc/occlusion_tracker_unittest.cc
@@ -89,30 +89,18 @@ class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType,
public:
TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFrame = false)
: TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, recordMetricsForFrame)
- , m_overrideLayerClipRect(false)
{
}
- void setLayerClipRect(const gfx::Rect& rect) { m_overrideLayerClipRect = true; m_layerClipRect = rect;}
- void useDefaultLayerClipRect() { m_overrideLayerClipRect = false; }
- // Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface.
bool occludedLayer(const LayerType* layer, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const
{
- return this->occluded(layer->renderTarget(), contentRect, layer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layerClipRectInTarget(layer), hasOcclusionFromOutsideTargetSurface);
+ return this->occluded(layer->renderTarget(), contentRect, layer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layer->isClipped(), layer->clipRect(), hasOcclusionFromOutsideTargetSurface);
}
// Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Simple wrapper around unoccludedContentRect.
gfx::Rect unoccludedLayerContentRect(const LayerType* layer, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const
{
- return this->unoccludedContentRect(layer->renderTarget(), contentRect, layer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layerClipRectInTarget(layer), hasOcclusionFromOutsideTargetSurface);
+ return this->unoccludedContentRect(layer->renderTarget(), contentRect, layer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layer->isClipped(), layer->clipRect(), hasOcclusionFromOutsideTargetSurface);
}
-
-
-protected:
- virtual gfx::Rect layerClipRectInTarget(const LayerType* layer) const { return m_overrideLayerClipRect ? m_layerClipRect : OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(layer); }
-
-private:
- bool m_overrideLayerClipRect;
- gfx::Rect m_layerClipRect;
};
struct OcclusionTrackerTestMainThreadTypes {
@@ -485,7 +473,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
@@ -496,26 +483,18 @@ protected:
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
-
- occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 70, 70)).IsEmpty());
EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 30, 70, 70)));
EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 29, 70, 70)));
EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(31, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 29, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(100, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(31, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 31, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(29, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 31, 70, 70)));
}
};
@@ -551,11 +530,11 @@ protected:
quadTransform.Translate(30, 30);
gfx::Rect clipRectInTarget(0, 0, 100, 100);
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, false, clipRectInTarget).IsEmpty());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, clipRectInTarget));
- EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, clipRectInTarget));
- EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, clipRectInTarget));
- EXPECT_RECT_EQ(gfx::Rect(40, 40, 5, 5), occlusion.unoccludedContentRect(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, gfx::Rect(0, 0, 75, 75)));
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, false, true, clipRectInTarget).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, true, clipRectInTarget));
+ EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, true, clipRectInTarget));
+ EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, true, clipRectInTarget));
+ EXPECT_RECT_EQ(gfx::Rect(40, 40, 5, 5), occlusion.unoccludedContentRect(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, true, gfx::Rect(0, 0, 75, 75)));
}
};
@@ -579,7 +558,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
@@ -590,26 +568,18 @@ protected:
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
-
- occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 70, 70)).IsEmpty());
EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 30, 70, 70)));
EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 29, 70, 70)));
EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(31, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 29, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(100, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(31, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 31, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 70, 70)));
- EXPECT_RECT_EQ(gfx::Rect(29, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(31, 29, 69, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(29, 31, 1, 69), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 31, 70, 70)));
}
};
@@ -631,7 +601,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
@@ -642,28 +611,9 @@ protected:
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)));
EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)));
-
- occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)));
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)));
EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 50, 50, 50)).IsEmpty());
- EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 50, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 49, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 49, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(51, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 49, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(100, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 50, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(51, 51, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 51, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(50, 100, 50, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 51, 50, 50)));
- EXPECT_RECT_EQ(gfx::Rect(49, 51, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 51, 50, 50)));
- occlusion.useDefaultLayerClipRect();
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 50, 50, 50)).IsEmpty());
EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 50, 50, 50)));
EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 49, 50, 50)));
@@ -673,7 +623,6 @@ protected:
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 51, 50, 50)).IsEmpty());
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 51, 50, 50)).IsEmpty());
EXPECT_RECT_EQ(gfx::Rect(49, 51, 1, 49), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 51, 50, 50)));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
}
};
@@ -806,7 +755,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000));
this->visitLayer(child2, occlusion);
@@ -857,8 +805,8 @@ protected:
EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 11), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 70, 70)));
// This rect extends past left/right ends of |child2|.
EXPECT_RECT_EQ(gfx::Rect(20, 39, 80, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(20, 39, 80, 60)));
- EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 40, 70, 60)));
- EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 41, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 40, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 41, 70, 60)));
/* Justification for the above occlusion from |layer|:
100
@@ -911,7 +859,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
@@ -955,7 +902,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer2, occlusion);
this->visitLayer(layer1, occlusion);
@@ -992,8 +938,8 @@ protected:
EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 40, 70, 60)).IsEmpty());
EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 40, 70, 60)));
EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 39, 70, 60)));
- EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 40, 70, 60)));
- EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 41, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 40, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 41, 70, 60)));
/* Justification for the above occlusion from |layer1| and |layer2|:
@@ -1139,7 +1085,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000));
this->visitLayer(layer2, occlusion);
this->enterLayer(child2, occlusion);
@@ -1231,7 +1176,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// Opacity layer won't contribute to occlusion.
this->visitLayer(opacityLayer, occlusion);
@@ -1290,7 +1234,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
@@ -1319,7 +1262,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
@@ -1348,7 +1290,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
@@ -1371,11 +1312,12 @@ protected:
void runMyTest()
{
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ typename Types::ContentLayerType* clip = this->createDrawingLayer(parent, this->identityMatrix, gfx::PointF(200, 100), gfx::Size(100, 100), false);
+ clip->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(clip, this->identityMatrix, gfx::PointF(-200, -100), gfx::Size(200, 200), false);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100));
this->enterLayer(layer, occlusion);
@@ -1385,24 +1327,16 @@ protected:
EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
- occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
- occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100));
-
this->leaveLayer(layer, occlusion);
- this->enterLayer(parent, occlusion);
+ this->enterLayer(clip, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(-100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, -100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(clip, gfx::Rect(0, 0, 100, 100)));
- EXPECT_RECT_EQ(gfx::Rect(200, 100, 100, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedLayerContentRect(clip, gfx::Rect(-100, -100, 300, 300)));
}
};
@@ -1455,11 +1389,12 @@ protected:
void runMyTest()
{
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ typename Types::ContentLayerType* clip = this->createDrawingLayer(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(100, 100), false);
+ clip->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(clip, this->identityMatrix, gfx::PointF(-100, -100), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100));
this->enterLayer(layer, occlusion);
@@ -1470,19 +1405,22 @@ protected:
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
- this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+ EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusionFromInsideTarget().ToString());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)).IsEmpty());
+ this->enterLayer(clip, occlusion);
+
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(clip, gfx::Rect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(clip, gfx::Rect(0, 0, 300, 300)).IsEmpty());
}
};
@@ -1499,7 +1437,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
@@ -1535,11 +1472,12 @@ protected:
void runMyTest()
{
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ typename Types::ContentLayerType* clip = this->createDrawingLayer(parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(200, 200), false);
+ clip->setMasksToBounds(true);
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(clip, this->identityMatrix, gfx::PointF(-50, -50), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200));
this->enterLayer(layer, occlusion);
@@ -1548,25 +1486,16 @@ protected:
EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 50)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 50, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 50)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 50, 100)));
+
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
- this->enterLayer(parent, occlusion);
-
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+ this->enterLayer(clip, occlusion);
- EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
- EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 100)));
- EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 100, 300, 100)));
- EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200, 100, 100, 100)));
- EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_EQ(gfx::Rect(50, 50, 150, 150).ToString(), occlusion.occlusionFromInsideTarget().ToString());
}
};
@@ -1583,7 +1512,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
@@ -1617,50 +1545,6 @@ protected:
ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild);
template<class Types>
-class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest<Types> {
-protected:
- OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
- void runMyTest()
- {
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true);
- this->calcDrawEtc(parent);
-
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100));
-
- this->enterLayer(layer, occlusion);
-
- EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
-
- this->leaveLayer(layer, occlusion);
- this->visitContributingSurface(layer, occlusion);
- this->enterLayer(parent, occlusion);
-
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)).IsEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 100)).IsEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 100, 300, 100)).IsEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200, 100, 100, 100)).IsEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100, 200, 100, 100)).IsEmpty());
- }
-};
-
-ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing);
-
-template<class Types>
class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<Types> {
protected:
OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
@@ -1671,7 +1555,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
@@ -2015,6 +1898,14 @@ protected:
OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
+ // parent
+ // +--layer
+ // +--surface
+ // | +--surfaceChild
+ // | +--surfaceChild2
+ // +--parent2
+ // +--topmost
+
typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300));
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true);
typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true);
@@ -2036,22 +1927,34 @@ protected:
this->visitLayer(topmost, occlusion);
this->enterLayer(parent2, occlusion);
// This occlusion will affect all surfaces.
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent2, gfx::Rect(0, 0, 300, 300)));
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), occlusion.unoccludedLayerContentRect(parent2, gfx::Rect(0, 0, 300, 300)).ToString());
this->leaveLayer(parent2, occlusion);
this->visitLayer(surfaceChild2, occlusion);
this->enterLayer(surfaceChild, occlusion);
- EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 300, 300)));
+ EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromOutsideTarget().ToString());
+ EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 200, 300)));
this->leaveLayer(surfaceChild, occlusion);
this->enterLayer(surface, occlusion);
+ EXPECT_EQ(gfx::Rect(0, 0, 200, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromOutsideTarget().ToString());
EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surface, occlusion);
this->enterContributingSurface(surface, occlusion);
// Occlusion within the surface is lost when leaving the animating surface.
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300)));
this->leaveContributingSurface(surface, occlusion);
+ // Occlusion from outside the animating surface still exists.
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
+
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
@@ -2089,22 +1992,34 @@ protected:
this->visitLayer(topmost, occlusion);
this->enterLayer(parent2, occlusion);
// This occlusion will affect all surfaces.
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(parent2, occlusion);
this->visitLayer(surfaceChild2, occlusion);
this->enterLayer(surfaceChild, occlusion);
- EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 300, 300)));
+ EXPECT_EQ(gfx::Rect(0, 0, 100, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromOutsideTarget().ToString());
+ EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 200, 300)));
this->leaveLayer(surfaceChild, occlusion);
this->enterLayer(surface, occlusion);
+ EXPECT_EQ(gfx::Rect(0, 0, 200, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromOutsideTarget().ToString());
EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surface, occlusion);
this->enterContributingSurface(surface, occlusion);
// Occlusion within the surface is lost when leaving the animating surface.
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300)));
this->leaveContributingSurface(surface, occlusion);
+ // Occlusion from outside the animating surface still exists.
+ EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusionFromInsideTarget().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
+
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
@@ -2279,7 +2194,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes the replica, but not the surface itself.
this->visitLayer(topmost, occlusion);
@@ -2314,7 +2228,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes the surface, but not the entire surface's replica.
this->visitLayer(topmost, occlusion);
@@ -2351,7 +2264,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// These occlude the surface and replica differently, so we can test each one.
this->visitLayer(overReplica, occlusion);
@@ -2484,7 +2396,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes everything partially so we know occlusion is happening at all.
this->visitLayer(topmost, occlusion);
@@ -2549,7 +2460,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will
// need to see some of the pixels (up to radius far) underneath the occludingLayers.
@@ -2673,7 +2583,6 @@ protected:
this->calcDrawEtc(root);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(occludingLayerAbove, occlusion);
EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionFromOutsideTarget().ToString());
@@ -2727,7 +2636,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will
// need to see some of the pixels (up to radius far) underneath the occludingLayers.
@@ -2856,7 +2764,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// The surface has a background blur, so it blurs non-opaque pixels below it.
this->visitLayer(filteredSurface, occlusion);
@@ -2905,7 +2812,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(aboveReplicaLayer, occlusion);
this->visitLayer(aboveSurfaceLayer, occlusion);
@@ -2971,7 +2877,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(besideReplicaLayer, occlusion);
this->visitLayer(besideSurfaceLayer, occlusion);
@@ -3026,7 +2931,6 @@ protected:
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
occlusion.setMinimumTrackingSize(trackingSize);
// The small layer is not tracked because it is too small.
diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc
index 416d481..e8d80ba 100644
--- a/cc/quad_culler.cc
+++ b/cc/quad_culler.cc
@@ -73,7 +73,7 @@ bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu
if (m_forSurface)
culledRect = m_occlusionTracker.unoccludedContributingSurfaceContentRect(m_layer, false, drawQuad->rect, &hasOcclusionFromOutsideTargetSurface);
else
- culledRect = m_occlusionTracker.unoccludedContentRect(m_layer->renderTarget(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, drawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface);
+ culledRect = m_occlusionTracker.unoccludedContentRect(m_layer->renderTarget(), drawQuad->rect, drawQuad->quadTransform(), implDrawTransformIsUnknown, drawQuad->isClipped(), drawQuad->clipRect(), &hasOcclusionFromOutsideTargetSurface);
appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface;
diff --git a/cc/render_pass_unittest.cc b/cc/render_pass_unittest.cc
index 244e47b..fdf314c 100644
--- a/cc/render_pass_unittest.cc
+++ b/cc/render_pass_unittest.cc
@@ -49,7 +49,7 @@ TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads)
// Stick a quad in the pass, this should not get copied.
scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create();
- sharedState->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), gfx::Rect(), false, 1);
+ sharedState->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), false, 1);
pass->AppendSharedQuadState(sharedState.Pass());
scoped_ptr<CheckerboardDrawQuad> checkerboardQuad = CheckerboardDrawQuad::Create();
diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc
index 84758da0..05d19a4 100644
--- a/cc/render_surface_impl.cc
+++ b/cc/render_surface_impl.cc
@@ -150,27 +150,6 @@ void RenderSurfaceImpl::clearLayerLists()
m_contributingDelegatedRenderPassLayerList.clear();
}
-static inline gfx::Rect computeClippedRectInTarget(const LayerImpl* owningLayer)
-{
- DCHECK(owningLayer->parent());
-
- const LayerImpl* renderTarget = owningLayer->parent()->renderTarget();
- const RenderSurfaceImpl* self = owningLayer->renderSurface();
-
- gfx::Rect clippedRectInTarget = self->clipRect();
- if (owningLayer->backgroundFilters().hasFilterThatMovesPixels()) {
- // If the layer has background filters that move pixels, we cannot scissor as tightly.
- // FIXME: this should be able to be a tighter scissor, perhaps expanded by the filter outsets?
- clippedRectInTarget = renderTarget->renderSurface()->contentRect();
- } else if (clippedRectInTarget.IsEmpty()) {
- // For surfaces, empty clipRect means that the surface does not clip anything.
- clippedRectInTarget = renderTarget->renderSurface()->contentRect();
- clippedRectInTarget.Intersect(gfx::ToEnclosingRect(self->drawableContentRect()));
- } else
- clippedRectInTarget.Intersect(gfx::ToEnclosingRect(self->drawableContentRect()));
- return clippedRectInTarget;
-}
-
RenderPass::Id RenderSurfaceImpl::renderPassId()
{
int layerId = m_owningLayer->id();
@@ -193,10 +172,9 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
{
DCHECK(!forReplica || m_owningLayer->hasReplica());
- gfx::Rect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
const gfx::Transform& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadState::Create());
- sharedQuadState->SetAll(drawTransform, m_contentRect, clippedRectInTarget, m_clipRect, m_isClipped, m_drawOpacity);
+ sharedQuadState->SetAll(drawTransform, m_contentRect, m_clipRect, m_isClipped, m_drawOpacity);
if (m_owningLayer->showDebugBorders()) {
SkColor color = forReplica ? DebugColors::SurfaceReplicaBorderColor() : DebugColors::SurfaceBorderColor();
diff --git a/cc/shared_quad_state.cc b/cc/shared_quad_state.cc
index 001f594..0e9c328 100644
--- a/cc/shared_quad_state.cc
+++ b/cc/shared_quad_state.cc
@@ -21,13 +21,11 @@ scoped_ptr<SharedQuadState> SharedQuadState::Copy() const {
void SharedQuadState::SetAll(
const gfx::Transform& content_to_target_transform,
const gfx::Rect& visible_content_rect,
- const gfx::Rect& clipped_rect_in_target,
const gfx::Rect& clip_rect,
bool is_clipped,
float opacity) {
this->content_to_target_transform = content_to_target_transform;
this->visible_content_rect = visible_content_rect;
- this->clipped_rect_in_target = clipped_rect_in_target;
this->clip_rect = clip_rect;
this->is_clipped = is_clipped;
this->opacity = opacity;
diff --git a/cc/shared_quad_state.h b/cc/shared_quad_state.h
index 055f12e..974d5f1 100644
--- a/cc/shared_quad_state.h
+++ b/cc/shared_quad_state.h
@@ -21,7 +21,6 @@ class CC_EXPORT SharedQuadState {
void SetAll(const gfx::Transform& content_to_target_transform,
const gfx::Rect& visible_content_rect,
- const gfx::Rect& clipped_rect_in_target,
const gfx::Rect& clip_rect,
bool is_clipped,
float opacity);
@@ -30,7 +29,6 @@ class CC_EXPORT SharedQuadState {
gfx::Transform content_to_target_transform;
// This rect lives in the content space for the quad's originating layer.
gfx::Rect visible_content_rect;
- gfx::Rect clipped_rect_in_target;
gfx::Rect clip_rect;
bool is_clipped;
float opacity;
diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc
index eb3838e..5608ee9 100644
--- a/cc/software_renderer_unittest.cc
+++ b/cc/software_renderer_unittest.cc
@@ -78,7 +78,7 @@ TEST_F(SoftwareRendererTest, solidColorQuad)
initializeRenderer();
scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::Create();
- sharedQuadState->SetAll(gfx::Transform(), outerRect, outerRect, outerRect, false, 1.0);
+ sharedQuadState->SetAll(gfx::Transform(), outerRect, outerRect, false, 1.0);
RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::Create();
rootRenderPass->SetNew(rootRenderPassId, outerRect, gfx::Rect(), gfx::Transform());
@@ -137,7 +137,7 @@ TEST_F(SoftwareRendererTest, tileQuad)
gfx::Rect rect = gfx::Rect(gfx::Point(), deviceViewportSize());
scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::Create();
- sharedQuadState->SetAll(gfx::Transform(), outerRect, outerRect, outerRect, false, 1.0);
+ sharedQuadState->SetAll(gfx::Transform(), outerRect, outerRect, false, 1.0);
RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::Create();
rootRenderPass->SetNew(rootRenderPassId, gfx::Rect(gfx::Point(), deviceViewportSize()), gfx::Rect(), gfx::Transform());
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index eca8684..a5b7d33 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -76,7 +76,6 @@ void TestRenderPass::AppendOneOfEveryQuadType(
shared_state->SetAll(gfx::Transform(),
rect,
rect,
- rect,
false,
1);
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc
index 4e5d6ad..b9f1217 100644
--- a/cc/test/render_pass_test_utils.cc
+++ b/cc/test/render_pass_test_utils.cc
@@ -33,7 +33,7 @@ SolidColorDrawQuad* addQuad(TestRenderPass* pass,
AppendQuadsData data(pass->id);
SharedQuadState* sharedState =
quadSink.useSharedQuadState(SharedQuadState::Create());
- sharedState->SetAll(gfx::Transform(), rect, rect, rect, false, 1);
+ sharedState->SetAll(gfx::Transform(), rect, rect, false, 1);
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
quad->SetNew(sharedState, rect, color);
SolidColorDrawQuad* quadPtr = quad.get();
@@ -48,8 +48,7 @@ void addRenderPassQuad(TestRenderPass* toPass,
gfx::Rect outputRect = contributingPass->output_rect;
SharedQuadState* sharedState =
quadSink.useSharedQuadState(SharedQuadState::Create());
- sharedState->SetAll(gfx::Transform(), outputRect, outputRect, outputRect,
- false, 1);
+ sharedState->SetAll(gfx::Transform(), outputRect, outputRect, false, 1);
scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
quad->SetNew(sharedState, outputRect, contributingPass->id, false, 0,
outputRect, gfx::RectF(), WebKit::WebFilterOperations(),
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index d814ada..2d7d827 100644
--- a/cc/tiled_layer.cc
+++ b/cc/tiled_layer.cc
@@ -352,7 +352,7 @@ void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
continue;
DCHECK(!tile->occluded); // Did resetUpdateState get skipped? Are we doing more than one occlusion pass?
gfx::Rect visibleTileRect = gfx::IntersectRects(m_tiler->tileBounds(i, j), visibleContentRect());
- if (occlusion && occlusion->occluded(renderTarget(), visibleTileRect, drawTransform(), drawTransformIsAnimating(), drawableContentRect())) {
+ if (occlusion && occlusion->occluded(renderTarget(), visibleTileRect, drawTransform(), drawTransformIsAnimating(), isClipped(), clipRect())) {
tile->occluded = true;
occludedTileCount++;
} else {
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index b06551e..16740a1 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -29,7 +29,6 @@ class TestOcclusionTracker : public OcclusionTracker {
public:
TestOcclusionTracker()
: OcclusionTracker(gfx::Rect(0, 0, 1000, 1000), true)
- , m_layerClipRectInTarget(gfx::Rect(0, 0, 1000, 1000))
{
m_stack.push_back(StackObject());
}
@@ -39,13 +38,10 @@ public:
m_stack.back().target = renderTarget;
}
- void setOcclusion(const Region& occlusion) { m_stack.back().occlusionFromInsideTarget = occlusion; }
-
-protected:
- virtual gfx::Rect layerClipRectInTarget(const Layer* layer) const OVERRIDE { return m_layerClipRectInTarget; }
-
-private:
- gfx::Rect m_layerClipRectInTarget;
+ void setOcclusion(const Region& occlusion)
+ {
+ m_stack.back().occlusionFromInsideTarget = occlusion;
+ }
};
class TiledLayerTest : public testing::Test {
diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h
index d0d1da6..0367604 100644
--- a/content/common/cc_messages.h
+++ b/content/common/cc_messages.h
@@ -204,7 +204,6 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState)
IPC_STRUCT_TRAITS_MEMBER(content_to_target_transform)
IPC_STRUCT_TRAITS_MEMBER(visible_content_rect)
- IPC_STRUCT_TRAITS_MEMBER(clipped_rect_in_target)
IPC_STRUCT_TRAITS_MEMBER(clip_rect)
IPC_STRUCT_TRAITS_MEMBER(is_clipped)
IPC_STRUCT_TRAITS_MEMBER(opacity)
diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc
index efa840d..f452a6b 100644
--- a/content/common/cc_messages_unittest.cc
+++ b/content/common/cc_messages_unittest.cc
@@ -48,7 +48,6 @@ class CCMessagesTest : public testing::Test {
void Compare(const SharedQuadState* a, const SharedQuadState* b) {
EXPECT_EQ(a->content_to_target_transform, b->content_to_target_transform);
EXPECT_EQ(a->visible_content_rect, b->visible_content_rect);
- EXPECT_EQ(a->clipped_rect_in_target, b->clipped_rect_in_target);
EXPECT_EQ(a->clip_rect, b->clip_rect);
EXPECT_EQ(a->is_clipped, b->is_clipped);
EXPECT_EQ(a->opacity, b->opacity);
@@ -239,7 +238,6 @@ TEST_F(CCMessagesTest, AllQuads) {
shared_state1_in->SetAll(arbitrary_matrix,
arbitrary_rect1,
arbitrary_rect2,
- arbitrary_rect3,
arbitrary_bool1,
arbitrary_float1);
scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy();
@@ -302,7 +300,6 @@ TEST_F(CCMessagesTest, AllQuads) {
shared_state2_in->SetAll(arbitrary_matrix,
arbitrary_rect2,
arbitrary_rect3,
- arbitrary_rect1,
arbitrary_bool1,
arbitrary_float2);
scoped_ptr<SharedQuadState> shared_state2_cmp = shared_state2_in->Copy();
@@ -311,7 +308,6 @@ TEST_F(CCMessagesTest, AllQuads) {
shared_state3_in->SetAll(arbitrary_matrix,
arbitrary_rect3,
arbitrary_rect1,
- arbitrary_rect2,
arbitrary_bool1,
arbitrary_float3);
scoped_ptr<SharedQuadState> shared_state3_cmp = shared_state3_in->Copy();