Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: cc/occlusion_tracker.cc

Issue 11871008: cc: Stop using drawableContentRect for occlusion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/occlusion_tracker.h ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/occlusion_tracker.cc
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index 7740fdabe5d13b570ece81ac70109b3bbbc55c35..cfd9acbe0c92aa13a0548dcd3f89cfbc70676301 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>;
« no previous file with comments | « cc/occlusion_tracker.h ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698