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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 147232: Corrects RWHVCocoa to convert from flipped to unflipped... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 19517)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -450,21 +450,44 @@
// Fill the remaining portion of the damaged_rect with white
if (damaged_rect.right() > bitmap_rect.right()) {
- NSRect r;
- r.origin.x = std::max(bitmap_rect.right(), damaged_rect.x());
- r.origin.y = std::min(bitmap_rect.bottom(), damaged_rect.bottom());
- r.size.width = damaged_rect.right() - r.origin.x;
- r.size.height = damaged_rect.y() - r.origin.y;
+ int x = std::max(bitmap_rect.right(), damaged_rect.x());
+ int y = std::min(bitmap_rect.bottom(), damaged_rect.bottom());
+ int width = damaged_rect.right() - x;
+ int height = damaged_rect.y() - y;
+
+ // Extra fun to get around the fact that gfx::Rects can't have
+ // negative sizes.
+ if (width < 0) {
+ x += width;
+ width = -width;
+ }
+ if (height < 0) {
+ y += height;
+ height = -height;
+ }
+
+ NSRect r = [self RectToNSRect:gfx::Rect(x, y, width, height)];
[[NSColor whiteColor] set];
NSRectFill(r);
}
if (damaged_rect.bottom() > bitmap_rect.bottom()) {
- NSRect r;
- r.origin.x = damaged_rect.x();
- r.origin.y = damaged_rect.bottom();
- r.size.width = damaged_rect.right() - r.origin.x;
- r.size.height = std::max(bitmap_rect.bottom(), damaged_rect.y()) -
- r.origin.y;
+ int x = damaged_rect.x();
+ int y = damaged_rect.bottom();
+ int width = damaged_rect.right() - x;
+ int height = std::max(bitmap_rect.bottom(), damaged_rect.y()) - y;
+
+ // Extra fun to get around the fact that gfx::Rects can't have
+ // negative sizes.
+ if (width < 0) {
+ x += width;
+ width = -width;
+ }
+ if (height < 0) {
+ y += height;
+ height = -height;
+ }
+
+ NSRect r = [self RectToNSRect:gfx::Rect(x, y, width, height)];
[[NSColor whiteColor] set];
NSRectFill(r);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698