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

Unified Diff: cc/occlusion_tracker.cc

Issue 11360066: cc: Remove WebCore rect use from the compositor, except within Region. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Signs 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_unittest.cc ('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 15233624f493d8543a35efc4839bc23233ecce94..c7f76cccae5e93d138c650d6895874f46e9a234e 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -8,7 +8,6 @@
#include <algorithm>
-#include "FloatRect.h"
#include "cc/layer.h"
#include "cc/layer_impl.h"
#include "cc/math_util.h"
@@ -131,10 +130,9 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
Region transformedRegion;
- Vector<WebCore::IntRect> rects = region.rects();
- for (size_t i = 0; i < rects.size(); ++i) {
+ for (Region::Iterator rects(region); rects.has_rect(); rects.next()) {
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
- gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(rects[i])));
+ gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, gfx::RectF(rects.rect())));
if (!surface->clipRect().IsEmpty())
transformedRect.Intersect(surface->clipRect());
transformedRegion.Union(transformedRect);
@@ -148,11 +146,11 @@ static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec
return;
Region affectedOcclusion = intersect(occlusion, affectedArea);
- Vector<WebCore::IntRect> affectedOcclusionRects = affectedOcclusion.rects();
+ Region::Iterator affectedOcclusionRects(affectedOcclusion);
occlusion.Subtract(affectedArea);
- for (size_t j = 0; j < affectedOcclusionRects.size(); ++j) {
- WebCore::IntRect& occlusionRect = affectedOcclusionRects[j];
+ for (; affectedOcclusionRects.has_rect(); affectedOcclusionRects.next()) {
+ gfx::Rect occlusionRect = affectedOcclusionRects.rect();
// Shrink the rect by expanding the non-opaque pixels outside the rect.
@@ -170,11 +168,10 @@ static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec
// the occlusionRect into it, shrinking its right edge.
int shrinkLeft = occlusionRect.x() == affectedArea.x() ? 0 : expandedPixel.right();
int shrinkTop = occlusionRect.y() == affectedArea.y() ? 0 : expandedPixel.bottom();
- int shrinkRight = occlusionRect.maxX() == affectedArea.right() ? 0 : -expandedPixel.x();
- int shrinkBottom = occlusionRect.maxY() == affectedArea.bottom() ? 0 : -expandedPixel.y();
+ int shrinkRight = occlusionRect.right() == affectedArea.right() ? 0 : -expandedPixel.x();
+ int shrinkBottom = occlusionRect.bottom() == affectedArea.bottom() ? 0 : -expandedPixel.y();
- occlusionRect.move(shrinkLeft, shrinkTop);
- occlusionRect.contract(shrinkLeft + shrinkRight, shrinkTop + shrinkBottom);
+ occlusionRect.Inset(shrinkLeft, shrinkTop, shrinkRight, shrinkBottom);
occlusion.Union(occlusionRect);
}
@@ -258,10 +255,9 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye
if (clipped || !visibleTransformedQuad.IsRectilinear())
return;
- Vector<WebCore::IntRect> contentRects = opaqueContents.rects();
- for (size_t i = 0; i < contentRects.size(); ++i) {
+ for (Region::Iterator opaqueContentRects(opaqueContents); opaqueContentRects.has_rect(); opaqueContentRects.next()) {
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
- gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(contentRects[i])));
+ gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, gfx::RectF(opaqueContentRects.rect())));
transformedRect.Intersect(clipRectInTarget);
if (transformedRect.width() >= minimumTrackingSize.width() || transformedRect.height() >= minimumTrackingSize.height()) {
if (occludingScreenSpaceRects)
« no previous file with comments | « cc/layer_tree_host_unittest.cc ('k') | cc/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698