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

Unified Diff: content/renderer/paint_aggregator.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 2 months 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
Index: content/renderer/paint_aggregator.cc
diff --git a/content/renderer/paint_aggregator.cc b/content/renderer/paint_aggregator.cc
index 5ed988eb33ed4ae7c8ce4cc882f2570781d46a6a..949e3495ea8914965cb9d937124a1873f2f2e256 100644
--- a/content/renderer/paint_aggregator.cc
+++ b/content/renderer/paint_aggregator.cc
@@ -77,8 +77,7 @@ gfx::Rect PaintAggregator::PendingUpdate::GetScrollDamage() const {
}
// In case the scroll offset exceeds the width/height of the scroll rect
- damaged_rect.Intersect(scroll_rect);
- return damaged_rect;
+ return gfx::IntersectRects(scroll_rect, damaged_rect);
}
gfx::Rect PaintAggregator::PendingUpdate::GetPaintBounds() const {
@@ -123,8 +122,7 @@ void PaintAggregator::InvalidateRect(const gfx::Rect& rect) {
return;
if (rect.Intersects(existing_rect) || rect.SharesEdgeWith(existing_rect)) {
// Re-invalidate in case the union intersects other paint rects.
- gfx::Rect combined_rect = existing_rect;
- combined_rect.Union(rect);
+ gfx::Rect combined_rect = gfx::UnionRects(existing_rect, rect);
update_.paint_rects.erase(update_.paint_rects.begin() + i);
InvalidateRect(combined_rect);
return;
@@ -141,9 +139,8 @@ void PaintAggregator::InvalidateRect(const gfx::Rect& rect) {
if (ShouldInvalidateScrollRect(rect)) {
InvalidateScrollRect();
} else if (update_.scroll_rect.Contains(rect)) {
- gfx::Rect paint_rect = rect;
- paint_rect.Subtract(update_.GetScrollDamage());
- update_.paint_rects[update_.paint_rects.size() - 1] = paint_rect;
+ update_.paint_rects[update_.paint_rects.size() - 1] =
+ gfx::SubtractRects(rect, update_.GetScrollDamage());
if (update_.paint_rects[update_.paint_rects.size() - 1].IsEmpty())
update_.paint_rects.erase(update_.paint_rects.end() - 1);
}
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_backing_store.cc ('k') | content/renderer/paint_aggregator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698