diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 02:02:18 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 02:02:18 +0000 |
commit | d79757e3da43f56698b0f3d1aeae71bf80896bd8 (patch) | |
tree | 25c29dbd49ff72e7632e421ec4fd0a29b994b896 /cc/occlusion_tracker.cc | |
parent | 58622c25c65388dd60b7bdce80f313d054f4f133 (diff) | |
download | chromium_src-d79757e3da43f56698b0f3d1aeae71bf80896bd8.zip chromium_src-d79757e3da43f56698b0f3d1aeae71bf80896bd8.tar.gz chromium_src-d79757e3da43f56698b0f3d1aeae71bf80896bd8.tar.bz2 |
cc: Add some early outs to avoid expensive operations
mapHomgenousPoint is not cheap. We can do faster in projectClippedRect similar
to mapClippedRect.
rectSubtractRegion constructs a Region to do subtraction from. If the
subtraction's rvalue is empty, then there is nothing to do and we can
avoid creating a Region structure at all.
I measured time spent in calculateRenderPasses with a draw-heavy unit test.
Baseline: 0.001148 seconds
With these changes: 0.001116 seconds
So, about 3% reduction in time spent in calculateRenderPasses.
R=enne
BUG=159718
Review URL: https://chromiumcodereview.appspot.com/11312154
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/occlusion_tracker.cc')
-rw-r--r-- | cc/occlusion_tracker.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc index 9c536d2..c5f7276 100644 --- a/cc/occlusion_tracker.cc +++ b/cc/occlusion_tracker.cc @@ -349,6 +349,9 @@ bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp // the resulting unoccluded region is not rectangular, we return a rect containing it. static inline gfx::Rect rectSubtractRegion(const gfx::Rect& rect, const Region& region) { + if (region.IsEmpty()) + return rect; + Region rectRegion(rect); rectRegion.Subtract(region); return rectRegion.bounds(); |