summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/accelerated_surface_container_mac.cc2
-rw-r--r--content/browser/renderer_host/backing_store_aura.cc19
-rw-r--r--content/browser/renderer_host/backing_store_mac.mm10
-rw-r--r--content/browser/renderer_host/backing_store_win.cc3
-rw-r--r--content/browser/renderer_host/gtk_window_utils.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc13
-rw-r--r--content/browser/renderer_host/render_widget_host_view_gtk.cc13
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.mm10
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc6
-rw-r--r--content/common/gpu/image_transport_surface.cc3
-rw-r--r--content/plugin/webplugin_proxy.cc5
-rw-r--r--content/renderer/browser_plugin/browser_plugin_backing_store.cc14
-rw-r--r--content/renderer/disambiguation_popup_helper.cc4
-rw-r--r--content/renderer/paint_aggregator.cc24
-rw-r--r--content/renderer/paint_aggregator_unittest.cc12
-rw-r--r--content/renderer/render_widget.cc22
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc16
17 files changed, 110 insertions, 68 deletions
diff --git a/content/browser/renderer_host/accelerated_surface_container_mac.cc b/content/browser/renderer_host/accelerated_surface_container_mac.cc
index 40115e7..5009b53 100644
--- a/content/browser/renderer_host/accelerated_surface_container_mac.cc
+++ b/content/browser/renderer_host/accelerated_surface_container_mac.cc
@@ -228,7 +228,7 @@ void AcceleratedSurfaceContainerMac::set_was_painted_to(
uint64 surface_handle,
const gfx::Rect& update_rect) {
set_was_painted_to_common(surface_handle);
- update_rect_ = update_rect_.Union(update_rect);
+ update_rect_.Union(update_rect);
}
void AcceleratedSurfaceContainerMac::EnqueueTextureForDeletion() {
diff --git a/content/browser/renderer_host/backing_store_aura.cc b/content/browser/renderer_host/backing_store_aura.cc
index 4a7adaf..5d1149a 100644
--- a/content/browser/renderer_host/backing_store_aura.cc
+++ b/content/browser/renderer_host/backing_store_aura.cc
@@ -91,8 +91,9 @@ void BackingStoreAura::PaintToBackingStore(
if (bitmap_rect.IsEmpty())
return;
- gfx::Rect pixel_bitmap_rect =
- gfx::ToEnclosedRect(bitmap_rect.Scale(scale_factor));
+ gfx::RectF scaled_bitmap_rect = bitmap_rect;
+ scaled_bitmap_rect.Scale(scale_factor);
+ gfx::Rect pixel_bitmap_rect = gfx::ToEnclosedRect(scaled_bitmap_rect);
const int width = pixel_bitmap_rect.width();
const int height = pixel_bitmap_rect.height();
@@ -112,16 +113,19 @@ void BackingStoreAura::PaintToBackingStore(
sk_bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
sk_bitmap.setPixels(dib->memory());
for (size_t i = 0; i < copy_rects.size(); i++) {
- const gfx::Rect pixel_copy_rect =
- gfx::ToEnclosingRect(copy_rects[i].Scale(scale_factor));
+ gfx::RectF scaled_copy_rect = copy_rects[i];
+ scaled_copy_rect.Scale(scale_factor);
+ const gfx::Rect pixel_copy_rect = gfx::ToEnclosingRect(scaled_copy_rect);
int x = pixel_copy_rect.x() - pixel_bitmap_rect.x();
int y = pixel_copy_rect.y() - pixel_bitmap_rect.y();
SkIRect srcrect = SkIRect::MakeXYWH(x, y,
pixel_copy_rect.width(),
pixel_copy_rect.height());
+ gfx::RectF scaled_copy_dst_rect = copy_rects[i];
+ scaled_copy_dst_rect.Scale(device_scale_factor_);
const gfx::Rect pixel_copy_dst_rect =
- gfx::ToEnclosingRect(copy_rects[i].Scale(device_scale_factor_));
+ gfx::ToEnclosingRect(scaled_copy_dst_rect);
SkRect dstrect = SkRect::MakeXYWH(
SkIntToScalar(pixel_copy_dst_rect.x()),
SkIntToScalar(pixel_copy_dst_rect.y()),
@@ -134,8 +138,9 @@ void BackingStoreAura::PaintToBackingStore(
void BackingStoreAura::ScrollBackingStore(int dx, int dy,
const gfx::Rect& clip_rect,
const gfx::Size& view_size) {
- gfx::Rect pixel_rect =
- gfx::ToEnclosingRect(clip_rect.Scale(device_scale_factor_));
+ gfx::RectF scaled_clip_rect = clip_rect;
+ scaled_clip_rect.Scale(device_scale_factor_);
+ gfx::Rect pixel_rect = gfx::ToEnclosingRect(scaled_clip_rect);
int pixel_dx = dx * device_scale_factor_;
int pixel_dy = dy * device_scale_factor_;
diff --git a/content/browser/renderer_host/backing_store_mac.mm b/content/browser/renderer_host/backing_store_mac.mm
index 0cb5a3b..d8513e4 100644
--- a/content/browser/renderer_host/backing_store_mac.mm
+++ b/content/browser/renderer_host/backing_store_mac.mm
@@ -101,8 +101,9 @@ void BackingStoreMac::PaintToBackingStore(
gfx::Size pixel_size = gfx::ToFlooredSize(
size().Scale(device_scale_factor_));
- gfx::Rect pixel_bitmap_rect =
- ToFlooredRect(bitmap_rect.Scale(scale_factor));
+ gfx::RectF scaled_bitmap_rect = bitmap_rect;
+ scaled_bitmap_rect.Scale(scale_factor);
+ gfx::Rect pixel_bitmap_rect = ToFlooredRect(scaled_bitmap_rect);
size_t bitmap_byte_count =
pixel_bitmap_rect.width() * pixel_bitmap_rect.height() * 4;
@@ -121,8 +122,9 @@ void BackingStoreMac::PaintToBackingStore(
for (size_t i = 0; i < copy_rects.size(); i++) {
const gfx::Rect& copy_rect = copy_rects[i];
- gfx::Rect pixel_copy_rect =
- ToFlooredRect(copy_rect.Scale(scale_factor));
+ gfx::RectF scaled_copy_rect = copy_rect;
+ scaled_copy_rect.Scale(scale_factor);
+ gfx::Rect pixel_copy_rect = ToFlooredRect(scaled_copy_rect);
// Only the subpixels given by copy_rect have pixels to copy.
base::mac::ScopedCFTypeRef<CGImageRef> image(
diff --git a/content/browser/renderer_host/backing_store_win.cc b/content/browser/renderer_host/backing_store_win.cc
index 2c8d435..a16bd80 100644
--- a/content/browser/renderer_host/backing_store_win.cc
+++ b/content/browser/renderer_host/backing_store_win.cc
@@ -143,7 +143,8 @@ void BackingStoreWin::PaintToBackingStore(
gfx::Rect view_rect(size());
for (size_t i = 0; i < copy_rects.size(); i++) {
- gfx::Rect paint_rect = view_rect.Intersect(copy_rects[i]);
+ gfx::Rect paint_rect = view_rect;
+ paint_rect.Intersect(copy_rects[i]);
CallStretchDIBits(hdc_,
paint_rect.x(),
paint_rect.y(),
diff --git a/content/browser/renderer_host/gtk_window_utils.cc b/content/browser/renderer_host/gtk_window_utils.cc
index de62f45..c47972a 100644
--- a/content/browser/renderer_host/gtk_window_utils.cc
+++ b/content/browser/renderer_host/gtk_window_utils.cc
@@ -63,7 +63,7 @@ void GetScreenInfoFromNativeWindow(
gfx::Rect available_rect = results->rect;
gfx::Rect work_area = GetWorkArea(GDK_WINDOW_XID(gdk_window));
if (!work_area.IsEmpty())
- available_rect = available_rect.Intersect(work_area);
+ available_rect.Intersect(work_area);
results->availableRect = available_rect;
}
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 4d497cf..6896797 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -437,7 +437,7 @@ void RenderWidgetHostViewAura::MovePluginWindows(
gfx::Rect clip = moves[i].clip_rect;
clip.Offset(moves[i].window_rect.origin());
clip.Offset(scroll_offset);
- clip = clip.Intersect(view_port);
+ clip.Intersect(view_port);
clip.Offset(-moves[i].window_rect.x(), -moves[i].window_rect.y());
clip.Offset(-scroll_offset.x(), -scroll_offset.y());
moves[i].clip_rect = clip;
@@ -558,7 +558,8 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore(
SchedulePaintIfNotInClip(scroll_rect, clip_rect);
for (size_t i = 0; i < copy_rects.size(); ++i) {
- gfx::Rect rect = copy_rects[i].Subtract(scroll_rect);
+ gfx::Rect rect = copy_rects[i];
+ rect.Subtract(scroll_rect);
if (rect.IsEmpty())
continue;
@@ -871,7 +872,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer(
// Damage may not have been DIP aligned, so inflate damage to compensate
// for any round-off error.
rect_to_paint.Inset(-1, -1);
- rect_to_paint = rect_to_paint.Intersect(window_->bounds());
+ rect_to_paint.Intersect(window_->bounds());
window_->SchedulePaintInRect(rect_to_paint);
@@ -1168,7 +1169,8 @@ gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(const gfx::Rect& rect) {
}
gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() {
- const gfx::Rect rect = selection_start_rect_.Union(selection_end_rect_);
+ gfx::Rect rect = selection_start_rect_;
+ rect.Union(selection_end_rect_);
return ConvertRectToScreen(rect);
}
@@ -1796,7 +1798,8 @@ void RenderWidgetHostViewAura::SchedulePaintIfNotInClip(
const gfx::Rect& rect,
const gfx::Rect& clip) {
if (!clip.IsEmpty()) {
- gfx::Rect to_paint = rect.Subtract(clip);
+ gfx::Rect to_paint = rect;
+ to_paint.Subtract(clip);
if (!to_paint.IsEmpty())
window_->SchedulePaintInRect(to_paint);
} else {
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc
index c68dfb1..dbe534d4 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -858,19 +858,20 @@ void RenderWidgetHostViewGtk::DidUpdateBackingStore(
// be done using XCopyArea? Perhaps similar to
// BackingStore::ScrollBackingStore?
if (about_to_validate_and_paint_)
- invalid_rect_ = invalid_rect_.Union(scroll_rect);
+ invalid_rect_.Union(scroll_rect);
else
Paint(scroll_rect);
for (size_t i = 0; i < copy_rects.size(); ++i) {
// Avoid double painting. NOTE: This is only relevant given the call to
// Paint(scroll_rect) above.
- gfx::Rect rect = copy_rects[i].Subtract(scroll_rect);
+ gfx::Rect rect = copy_rects[i];
+ rect.Subtract(scroll_rect);
if (rect.IsEmpty())
continue;
if (about_to_validate_and_paint_)
- invalid_rect_ = invalid_rect_.Union(rect);
+ invalid_rect_.Union(rect);
else
Paint(rect);
}
@@ -968,7 +969,9 @@ void RenderWidgetHostViewGtk::SelectionBoundsChanged(
WebKit::WebTextDirection start_direction,
const gfx::Rect& end_rect,
WebKit::WebTextDirection end_direction) {
- im_context_->UpdateCaretBounds(start_rect.Union(end_rect));
+ gfx::Rect combined_rect = start_rect;
+ combined_rect.Union(end_rect);
+ im_context_->UpdateCaretBounds(combined_rect);
}
GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() {
@@ -1175,7 +1178,7 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) {
about_to_validate_and_paint_ = false;
gfx::Rect paint_rect = gfx::Rect(0, 0, kMaxWindowWidth, kMaxWindowHeight);
- paint_rect = paint_rect.Intersect(invalid_rect_);
+ paint_rect.Intersect(invalid_rect_);
if (backing_store) {
// Only render the widget if it is attached to a window; there's a short
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index a8d05a8..69bb0cf 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -852,8 +852,9 @@ void RenderWidgetHostViewMac::CopyFromCompositingSurface(
gfx::Rect src_gl_subrect = src_subrect;
src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom());
- gfx::Rect src_pixel_gl_subrect =
- gfx::ToEnclosingRect(src_gl_subrect.Scale(scale));
+ gfx::RectF scaled_src_gl_subrect = src_gl_subrect;
+ scaled_src_gl_subrect.Scale(scale);
+ gfx::Rect src_pixel_gl_subrect = gfx::ToEnclosingRect(scaled_src_gl_subrect);
compositing_iosurface_->CopyTo(
src_pixel_gl_subrect,
dst_pixel_size,
@@ -1118,7 +1119,7 @@ gfx::Rect RenderWidgetHostViewMac::GetFirstRectForCompositionRange(
*actual_range = ui::Range(range.start(), end_idx);
gfx::Rect rect = composition_bounds_[range.start()];
for (size_t i = range.start() + 1; i < end_idx; ++i) {
- rect = rect.Union(composition_bounds_[i]);
+ rect.Union(composition_bounds_[i]);
}
return rect;
}
@@ -2269,7 +2270,8 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
// smaller and the renderer hasn't yet repainted.
int yOffset = NSHeight([self bounds]) - backingStore->size().height();
- gfx::Rect paintRect = bitmapRect.Intersect(damagedRect);
+ gfx::Rect paintRect = bitmapRect;
+ paintRect.Intersect(damagedRect);
if (!paintRect.IsEmpty()) {
// if we have a CGLayer, draw that into the window
if (backingStore->cg_layer()) {
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index 508619a..03e7d6e 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -771,7 +771,8 @@ void RenderWidgetHostViewWin::SelectionBoundsChanged(
text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD);
// Only update caret position if the input method is enabled.
if (is_enabled) {
- caret_rect_ = start_rect.Union(end_rect);
+ caret_rect_ = start_rect;
+ caret_rect_.Union(end_rect);
ime_input_.UpdateCaretRect(m_hWnd, caret_rect_);
}
}
@@ -1357,7 +1358,8 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) {
}
for (DWORD i = 0; i < region_data->rdh.nCount; ++i) {
- gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i]));
+ gfx::Rect paint_rect = bitmap_rect;
+ paint_rect.Intersect(gfx::Rect(region_rects[i]));
if (!paint_rect.IsEmpty()) {
BitBlt(paint_dc.m_hDC,
paint_rect.x(),
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index 8c1241d..dce01a2 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -32,7 +32,8 @@ void ImageTransportSurface::GetRegionsToCopy(
const gfx::Rect& previous_damage_rect,
const gfx::Rect& new_damage_rect,
std::vector<gfx::Rect>* regions) {
- gfx::Rect intersection = previous_damage_rect.Intersect(new_damage_rect);
+ gfx::Rect intersection = previous_damage_rect;
+ intersection.Intersect(new_damage_rect);
if (intersection.IsEmpty()) {
regions->push_back(previous_damage_rect);
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc
index 364deed..c74af5b 100644
--- a/content/plugin/webplugin_proxy.cc
+++ b/content/plugin/webplugin_proxy.cc
@@ -176,11 +176,12 @@ void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) {
// offscreen, so constrain invalidates to the plugin rect.
gfx::Rect plugin_rect = delegate_->GetRect();
plugin_rect.set_origin(gfx::Point(0, 0));
- const gfx::Rect invalidate_rect(rect.Intersect(plugin_rect));
+ plugin_rect.Intersect(rect);
+ const gfx::Rect invalidate_rect(plugin_rect);
#else
const gfx::Rect invalidate_rect(rect);
#endif
- damaged_rect_ = damaged_rect_.Union(invalidate_rect);
+ damaged_rect_.Union(invalidate_rect);
// Ignore NPN_InvalidateRect calls with empty rects. Also don't send an
// invalidate if it's outside the clipping region, since if we did it won't
// lead to a paint and we'll be stuck waiting forever for a DidPaint response.
diff --git a/content/renderer/browser_plugin/browser_plugin_backing_store.cc b/content/renderer/browser_plugin/browser_plugin_backing_store.cc
index e29d5b3..131b0d0 100644
--- a/content/renderer/browser_plugin/browser_plugin_backing_store.cc
+++ b/content/renderer/browser_plugin/browser_plugin_backing_store.cc
@@ -37,8 +37,9 @@ void BrowserPluginBackingStore::PaintToBackingStore(
if (bitmap_rect.IsEmpty())
return;
- gfx::Rect pixel_bitmap_rect =
- gfx::ToEnclosingRect(bitmap_rect.Scale(scale_factor_));
+ gfx::RectF scaled_bitmap_rect = bitmap_rect;
+ scaled_bitmap_rect.Scale(scale_factor_);
+ gfx::Rect pixel_bitmap_rect = gfx::ToEnclosingRect(scaled_bitmap_rect);
const int width = pixel_bitmap_rect.width();
const int height = pixel_bitmap_rect.height();
@@ -57,8 +58,9 @@ void BrowserPluginBackingStore::PaintToBackingStore(
sk_bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
sk_bitmap.setPixels(dib->memory());
for (size_t i = 0; i < copy_rects.size(); i++) {
- const gfx::Rect& pixel_copy_rect =
- gfx::ToEnclosingRect(copy_rects[i].Scale(scale_factor_));
+ gfx::RectF scaled_copy_rect = copy_rects[i];
+ scaled_copy_rect.Scale(scale_factor_);
+ const gfx::Rect& pixel_copy_rect = gfx::ToEnclosingRect(scaled_copy_rect);
int x = pixel_copy_rect.x() - pixel_bitmap_rect.x();
int y = pixel_copy_rect.y() - pixel_bitmap_rect.y();
SkIRect srcrect = SkIRect::MakeXYWH(x, y,
@@ -79,7 +81,9 @@ void BrowserPluginBackingStore::ScrollBackingStore(
int dy,
const gfx::Rect& clip_rect,
const gfx::Size& view_size) {
- gfx::Rect pixel_rect = gfx::ToEnclosingRect(clip_rect.Scale(scale_factor_));
+ gfx::RectF scaled_clip_rect = clip_rect;
+ scaled_clip_rect.Scale(scale_factor_);
+ gfx::Rect pixel_rect = gfx::ToEnclosingRect(scaled_clip_rect);
int pixel_dx = dx * scale_factor_;
int pixel_dy = dy * scale_factor_;
diff --git a/content/renderer/disambiguation_popup_helper.cc b/content/renderer/disambiguation_popup_helper.cc
index 1a55414..1399518 100644
--- a/content/renderer/disambiguation_popup_helper.cc
+++ b/content/renderer/disambiguation_popup_helper.cc
@@ -92,9 +92,9 @@ float DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor(
gfx::Rect* zoom_rect) {
*zoom_rect = tap_rect;
for (size_t i = 0; i < target_rects.size(); i++)
- *zoom_rect = zoom_rect->Union(gfx::Rect(target_rects[i]));
+ zoom_rect->Union(gfx::Rect(target_rects[i]));
zoom_rect->Inset(-kDisambiguationPopupPadding, -kDisambiguationPopupPadding);
- *zoom_rect = zoom_rect->Intersect(gfx::Rect(viewport_size));
+ zoom_rect->Intersect(gfx::Rect(viewport_size));
float scale = FindOptimalScaleFactor(target_rects);
*zoom_rect = CropZoomArea(
diff --git a/content/renderer/paint_aggregator.cc b/content/renderer/paint_aggregator.cc
index 809f99b..5ed988e 100644
--- a/content/renderer/paint_aggregator.cc
+++ b/content/renderer/paint_aggregator.cc
@@ -77,13 +77,14 @@ gfx::Rect PaintAggregator::PendingUpdate::GetScrollDamage() const {
}
// In case the scroll offset exceeds the width/height of the scroll rect
- return scroll_rect.Intersect(damaged_rect);
+ damaged_rect.Intersect(scroll_rect);
+ return damaged_rect;
}
gfx::Rect PaintAggregator::PendingUpdate::GetPaintBounds() const {
gfx::Rect bounds;
for (size_t i = 0; i < paint_rects.size(); ++i)
- bounds = bounds.Union(paint_rects[i]);
+ bounds.Union(paint_rects[i]);
return bounds;
}
@@ -104,7 +105,7 @@ void PaintAggregator::PopPendingUpdate(PendingUpdate* update) {
gfx::Rect union_rect;
for (size_t i = 0; i < update_.paint_rects.size(); ++i) {
paint_area += update_.paint_rects[i].size().GetArea();
- union_rect = union_rect.Union(update_.paint_rects[i]);
+ union_rect.Union(update_.paint_rects[i]);
}
int union_area = union_rect.size().GetArea();
if (float(paint_area) / float(union_area) > kMaxPaintRectsAreaRatio)
@@ -122,7 +123,8 @@ 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.Union(rect);
+ gfx::Rect combined_rect = existing_rect;
+ combined_rect.Union(rect);
update_.paint_rects.erase(update_.paint_rects.begin() + i);
InvalidateRect(combined_rect);
return;
@@ -139,8 +141,9 @@ void PaintAggregator::InvalidateRect(const gfx::Rect& rect) {
if (ShouldInvalidateScrollRect(rect)) {
InvalidateScrollRect();
} else if (update_.scroll_rect.Contains(rect)) {
- update_.paint_rects[update_.paint_rects.size() - 1] =
- rect.Subtract(update_.GetScrollDamage());
+ gfx::Rect paint_rect = rect;
+ paint_rect.Subtract(update_.GetScrollDamage());
+ update_.paint_rects[update_.paint_rects.size() - 1] = paint_rect;
if (update_.paint_rects[update_.paint_rects.size() - 1].IsEmpty())
update_.paint_rects.erase(update_.paint_rects.end() - 1);
}
@@ -215,10 +218,11 @@ gfx::Rect PaintAggregator::ScrollPaintRect(const gfx::Rect& paint_rect,
gfx::Rect result = paint_rect;
result.Offset(dx, dy);
- result = update_.scroll_rect.Intersect(result);
+ result.Intersect(update_.scroll_rect);
// Subtract out the scroll damage rect to avoid redundant painting.
- return result.Subtract(update_.GetScrollDamage());
+ result.Subtract(update_.GetScrollDamage());
+ return result;
}
bool PaintAggregator::ShouldInvalidateScrollRect(const gfx::Rect& rect) const {
@@ -273,9 +277,9 @@ void PaintAggregator::CombinePaintRects() {
for (size_t i = 0; i < update_.paint_rects.size(); ++i) {
const gfx::Rect& existing_rect = update_.paint_rects[i];
if (update_.scroll_rect.Contains(existing_rect)) {
- inner = inner.Union(existing_rect);
+ inner.Union(existing_rect);
} else {
- outer = outer.Union(existing_rect);
+ outer.Union(existing_rect);
}
}
update_.paint_rects.clear();
diff --git a/content/renderer/paint_aggregator_unittest.cc b/content/renderer/paint_aggregator_unittest.cc
index a651f9e..7261822 100644
--- a/content/renderer/paint_aggregator_unittest.cc
+++ b/content/renderer/paint_aggregator_unittest.cc
@@ -37,7 +37,8 @@ TEST(PaintAggregator, DoubleDisjointInvalidation) {
greg.InvalidateRect(r1);
greg.InvalidateRect(r2);
- gfx::Rect expected_bounds = r1.Union(r2);
+ gfx::Rect expected_bounds = r1;
+ expected_bounds.Union(r2);
EXPECT_TRUE(greg.HasPendingUpdate());
PaintAggregator::PendingUpdate update;
@@ -61,7 +62,8 @@ TEST(PaintAggregator, DisjointInvalidationsCombined) {
greg.InvalidateRect(r1);
greg.InvalidateRect(r2);
- gfx::Rect expected_bounds = r1.Union(r2);
+ gfx::Rect expected_bounds = r1;
+ expected_bounds.Union(r2);
EXPECT_TRUE(greg.HasPendingUpdate());
PaintAggregator::PendingUpdate update;
@@ -277,7 +279,8 @@ TEST(PaintAggregator, OverlappingPaintBeforeScroll) {
gfx::Rect scroll_rect(0, 0, 10, 10);
greg.ScrollRect(2, 0, scroll_rect);
- gfx::Rect expected_paint_rect = scroll_rect.Union(paint_rect);
+ gfx::Rect expected_paint_rect = scroll_rect;
+ expected_paint_rect.Union(paint_rect);
EXPECT_TRUE(greg.HasPendingUpdate());
PaintAggregator::PendingUpdate update;
@@ -298,7 +301,8 @@ TEST(PaintAggregator, OverlappingPaintAfterScroll) {
gfx::Rect paint_rect(4, 4, 10, 2);
greg.InvalidateRect(paint_rect);
- gfx::Rect expected_paint_rect = scroll_rect.Union(paint_rect);
+ gfx::Rect expected_paint_rect = scroll_rect;
+ expected_paint_rect.Union(paint_rect);
EXPECT_TRUE(greg.HasPendingUpdate());
PaintAggregator::PendingUpdate update;
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index c7308d1..9c3872e 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -373,11 +373,13 @@ void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) {
if (resizer_rect_ != resizer_rect) {
gfx::Rect view_rect(size_);
- gfx::Rect old_damage_rect = view_rect.Intersect(resizer_rect_);
+ gfx::Rect old_damage_rect = view_rect;
+ old_damage_rect.Intersect(resizer_rect_);
if (!old_damage_rect.IsEmpty())
paint_aggregator_.InvalidateRect(old_damage_rect);
- gfx::Rect new_damage_rect = view_rect.Intersect(resizer_rect);
+ gfx::Rect new_damage_rect = view_rect;
+ new_damage_rect.Intersect(resizer_rect);
if (!new_damage_rect.IsEmpty())
paint_aggregator_.InvalidateRect(new_damage_rect);
@@ -935,7 +937,8 @@ void RenderWidget::DoDeferredUpdate() {
paint_aggregator_.PopPendingUpdate(&update);
gfx::Rect scroll_damage = update.GetScrollDamage();
- gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage);
+ gfx::Rect bounds = update.GetPaintBounds();
+ bounds.Union(scroll_damage);
// Notify derived classes that we're about to initiate a paint.
WillInitiatePaint();
@@ -974,15 +977,16 @@ void RenderWidget::DoDeferredUpdate() {
&optimized_copy_rect,
&dib_scale_factor)) {
// Only update the part of the plugin that actually changed.
- optimized_copy_rect = optimized_copy_rect.Intersect(bounds);
+ optimized_copy_rect.Intersect(bounds);
pending_update_params_->bitmap = dib->id();
pending_update_params_->bitmap_rect = optimized_copy_location;
pending_update_params_->copy_rects.push_back(optimized_copy_rect);
pending_update_params_->scale_factor = dib_scale_factor;
} else if (!is_accelerated_compositing_active_) {
// Compute a buffer for painting and cache it.
- gfx::Rect pixel_bounds =
- gfx::ToEnclosingRect(bounds.Scale(device_scale_factor_));
+ gfx::RectF scaled_bounds = bounds;
+ scaled_bounds.Scale(device_scale_factor_);
+ gfx::Rect pixel_bounds = gfx::ToEnclosingRect(scaled_bounds);
scoped_ptr<skia::PlatformCanvas> canvas(
RenderProcess::current()->GetDrawingCanvas(&current_paint_buf_,
pixel_bounds));
@@ -1060,7 +1064,8 @@ void RenderWidget::DoDeferredUpdate() {
void RenderWidget::didInvalidateRect(const WebRect& rect) {
// The invalidated rect might be outside the bounds of the view.
gfx::Rect view_rect(size_);
- gfx::Rect damaged_rect = view_rect.Intersect(rect);
+ gfx::Rect damaged_rect = view_rect;
+ damaged_rect.Intersect(rect);
if (damaged_rect.IsEmpty())
return;
@@ -1100,7 +1105,8 @@ void RenderWidget::didScrollRect(int dx, int dy, const WebRect& clip_rect) {
// The scrolled rect might be outside the bounds of the view.
gfx::Rect view_rect(size_);
- gfx::Rect damaged_rect = view_rect.Intersect(clip_rect);
+ gfx::Rect damaged_rect = view_rect;
+ damaged_rect.Intersect(clip_rect);
if (damaged_rect.IsEmpty())
return;
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index 8c23272..31365aa 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -739,7 +739,8 @@ void WebPluginDelegateProxy::Paint(WebKit::WebCanvas* canvas,
const gfx::Rect& damaged_rect) {
// Limit the damaged rectangle to whatever is contained inside the plugin
// rectangle, as that's the rectangle that we'll actually draw.
- gfx::Rect rect = damaged_rect.Intersect(plugin_rect_);
+ gfx::Rect rect = damaged_rect;
+ rect.Intersect(plugin_rect_);
// If the plugin is no longer connected (channel crashed) draw a crashed
// plugin bitmap
@@ -853,7 +854,8 @@ bool WebPluginDelegateProxy::BackgroundChanged(
// intersect their rects first.
gfx::Rect bitmap_rect(static_cast<int>(-xf.eDx), static_cast<int>(-xf.eDy),
bitmap.bmWidth, bitmap.bmHeight);
- gfx::Rect check_rect = rect.Intersect(bitmap_rect);
+ gfx::Rect check_rect = rect;
+ check_rect.Intersect(bitmap_rect);
int row_byte_size = check_rect.width() * (bitmap.bmBitsPixel / 8);
for (int y = check_rect.y(); y < check_rect.bottom(); y++) {
char* hdc_row_start = static_cast<char*>(bitmap.bmBits) +
@@ -898,7 +900,8 @@ bool WebPluginDelegateProxy::BackgroundChanged(
#endif
// According to comments in the Windows code, the damage rect that we're given
// may project outside the image, so intersect their rects.
- gfx::Rect content_rect = rect.Intersect(full_content_rect);
+ gfx::Rect content_rect = rect;
+ content_rect.Intersect(full_content_rect);
#if defined(OS_MACOSX)
const unsigned char* page_bytes = static_cast<const unsigned char*>(
@@ -1188,7 +1191,8 @@ void WebPluginDelegateProxy::OnInvalidateRect(const gfx::Rect& rect) {
// Clip the invalidation rect to the plugin bounds; the plugin may have been
// resized since the invalidate message was sent.
- const gfx::Rect clipped_rect(rect.Intersect(gfx::Rect(plugin_rect_.size())));
+ gfx::Rect clipped_rect = rect;
+ clipped_rect.Intersect(gfx::Rect(plugin_rect_.size()));
invalidate_pending_ = true;
// The plugin is blocked on the renderer because the invalidate message it has
@@ -1309,7 +1313,7 @@ void WebPluginDelegateProxy::UpdateFrontBuffer(
// Plugin has just painted "rect" into the back-buffer, so the front-buffer
// no longer holds the latest content for that rectangle.
- front_buffer_diff_ = front_buffer_diff_.Subtract(rect);
+ front_buffer_diff_.Subtract(rect);
if (allow_buffer_flipping && front_buffer_diff_.IsEmpty()) {
// Back-buffer contains the latest content for all areas; simply flip
// the buffers.
@@ -1324,7 +1328,7 @@ void WebPluginDelegateProxy::UpdateFrontBuffer(
// allowed); fall back to copying the data.
CopyFromBackBufferToFrontBuffer(rect);
}
- transport_store_painted_ = transport_store_painted_.Union(rect);
+ transport_store_painted_.Union(rect);
}
void WebPluginDelegateProxy::OnHandleURLRequest(