OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |