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

Side by Side Diff: cc/occlusion_tracker.cc

Issue 11368149: cc: Define Region::Contains() to be A contains B if all points in B are also in A. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/region.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "cc/occlusion_tracker.h" 7 #include "cc/occlusion_tracker.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 gfx::Rect clipRectInScreen = gfx::IntersectRects(m_rootTargetRect, gfx:: ToEnclosedRect(clipQuadInScreen.BoundingBox())); 307 gfx::Rect clipRectInScreen = gfx::IntersectRects(m_rootTargetRect, gfx:: ToEnclosedRect(clipQuadInScreen.BoundingBox()));
308 addOcclusionBehindLayer<LayerType>(m_stack.back().occlusionInScreen, lay er, layer->screenSpaceTransform(), opaqueContents, clipRectInScreen, m_minimumTr ackingSize, m_occludingScreenSpaceRects); 308 addOcclusionBehindLayer<LayerType>(m_stack.back().occlusionInScreen, lay er, layer->screenSpaceTransform(), opaqueContents, clipRectInScreen, m_minimumTr ackingSize, m_occludingScreenSpaceRects);
309 } 309 }
310 } 310 }
311 311
312 static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const W ebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget , const Region& occlusion) 312 static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const W ebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget , const Region& occlusion)
313 { 313 {
314 gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect)); 314 gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
315 // Take the gfx::ToEnclosingRect, as we want to include partial pixels in th e test. 315 // Take the gfx::ToEnclosingRect, as we want to include partial pixels in th e test.
316 gfx::Rect targetRect = gfx::IntersectRects(gfx::ToEnclosingRect(transformedR ect), clipRectInTarget); 316 gfx::Rect targetRect = gfx::IntersectRects(gfx::ToEnclosingRect(transformedR ect), clipRectInTarget);
317 return targetRect.IsEmpty() || occlusion.Contains(targetRect); 317 return occlusion.Contains(targetRect);
318 } 318 }
319 319
320 template<typename LayerType, typename RenderSurfaceType> 320 template<typename LayerType, typename RenderSurfaceType>
321 bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp e* renderTarget, const gfx::Rect& contentRect, const WebKit::WebTransformationMa trix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRe ctInTarget, bool* hasOcclusionFromOutsideTargetSurface) const 321 bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp e* renderTarget, const gfx::Rect& contentRect, const WebKit::WebTransformationMa trix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRe ctInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
322 { 322 {
323 if (hasOcclusionFromOutsideTargetSurface) 323 if (hasOcclusionFromOutsideTargetSurface)
324 *hasOcclusionFromOutsideTargetSurface = false; 324 *hasOcclusionFromOutsideTargetSurface = false;
325 325
326 DCHECK(!m_stack.empty()); 326 DCHECK(!m_stack.empty());
327 if (m_stack.empty()) 327 if (m_stack.empty())
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // FIXME: we could remove this helper function, but unit tests currently ove rride this 458 // FIXME: we could remove this helper function, but unit tests currently ove rride this
459 // function, and they need to be verified/adjusted before this can be removed. 459 // function, and they need to be verified/adjusted before this can be removed.
460 return layer->drawableContentRect(); 460 return layer->drawableContentRect();
461 } 461 }
462 462
463 // Instantiate (and export) templates here for the linker. 463 // Instantiate (and export) templates here for the linker.
464 template class OcclusionTrackerBase<Layer, RenderSurface>; 464 template class OcclusionTrackerBase<Layer, RenderSurface>;
465 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; 465 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>;
466 466
467 } // namespace cc 467 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/region.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698