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

Side by Side Diff: cc/occlusion_tracker.cc

Issue 11312154: cc: Add some early outs to avoid expensive operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extra casts 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 | « cc/math_util.cc ('k') | no next file » | 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 return true; 342 return true;
343 } 343 }
344 344
345 return false; 345 return false;
346 } 346 }
347 347
348 // Determines what portion of rect, if any, is unoccluded (not occluded by regio n). If 348 // Determines what portion of rect, if any, is unoccluded (not occluded by regio n). If
349 // the resulting unoccluded region is not rectangular, we return a rect containi ng it. 349 // the resulting unoccluded region is not rectangular, we return a rect containi ng it.
350 static inline gfx::Rect rectSubtractRegion(const gfx::Rect& rect, const Region& region) 350 static inline gfx::Rect rectSubtractRegion(const gfx::Rect& rect, const Region& region)
351 { 351 {
352 if (region.IsEmpty())
353 return rect;
354
352 Region rectRegion(rect); 355 Region rectRegion(rect);
353 rectRegion.Subtract(region); 356 rectRegion.Subtract(region);
354 return rectRegion.bounds(); 357 return rectRegion.bounds();
355 } 358 }
356 359
357 static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRec t, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRe ctInTarget, const Region& occlusion) 360 static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRec t, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRe ctInTarget, const Region& occlusion)
358 { 361 {
359 if (!contentSpaceTransform.isInvertible()) 362 if (!contentSpaceTransform.isInvertible())
360 return contentRect; 363 return contentRect;
361 364
(...skipping 96 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 461 // 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. 462 // function, and they need to be verified/adjusted before this can be removed.
460 return layer->drawableContentRect(); 463 return layer->drawableContentRect();
461 } 464 }
462 465
463 // Instantiate (and export) templates here for the linker. 466 // Instantiate (and export) templates here for the linker.
464 template class OcclusionTrackerBase<Layer, RenderSurface>; 467 template class OcclusionTrackerBase<Layer, RenderSurface>;
465 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; 468 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>;
466 469
467 } // namespace cc 470 } // namespace cc
OLDNEW
« no previous file with comments | « cc/math_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698