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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 // Note: All coordinates are in view units, not pixels. 2265 // Note: All coordinates are in view units, not pixels.
2266 gfx::Rect bitmapRect(0, 0, 2266 gfx::Rect bitmapRect(0, 0,
2267 backingStore->size().width(), 2267 backingStore->size().width(),
2268 backingStore->size().height()); 2268 backingStore->size().height());
2269 2269
2270 // Specify the proper y offset to ensure that the view is rooted to the 2270 // Specify the proper y offset to ensure that the view is rooted to the
2271 // upper left corner. This can be negative, if the window was resized 2271 // upper left corner. This can be negative, if the window was resized
2272 // smaller and the renderer hasn't yet repainted. 2272 // smaller and the renderer hasn't yet repainted.
2273 int yOffset = NSHeight([self bounds]) - backingStore->size().height(); 2273 int yOffset = NSHeight([self bounds]) - backingStore->size().height();
2274 2274
2275 gfx::Rect paintRect = bitmapRect.Intersect(damagedRect); 2275 gfx::Rect paintRect = bitmapRect;
2276 paintRect.Intersect(damagedRect);
2276 if (!paintRect.IsEmpty()) { 2277 if (!paintRect.IsEmpty()) {
2277 // if we have a CGLayer, draw that into the window 2278 // if we have a CGLayer, draw that into the window
2278 if (backingStore->cg_layer()) { 2279 if (backingStore->cg_layer()) {
2279 CGContextRef context = static_cast<CGContextRef>( 2280 CGContextRef context = static_cast<CGContextRef>(
2280 [[NSGraphicsContext currentContext] graphicsPort]); 2281 [[NSGraphicsContext currentContext] graphicsPort]);
2281 2282
2282 // TODO: add clipping to dirtyRect if it improves drawing performance. 2283 // TODO: add clipping to dirtyRect if it improves drawing performance.
2283 CGContextDrawLayerAtPoint(context, CGPointMake(0.0, yOffset), 2284 CGContextDrawLayerAtPoint(context, CGPointMake(0.0, yOffset),
2284 backingStore->cg_layer()); 2285 backingStore->cg_layer());
2285 } else { 2286 } else {
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
3300 if (!string) return NO; 3301 if (!string) return NO;
3301 3302
3302 // If the user is currently using an IME, confirm the IME input, 3303 // If the user is currently using an IME, confirm the IME input,
3303 // and then insert the text from the service, the same as TextEdit and Safari. 3304 // and then insert the text from the service, the same as TextEdit and Safari.
3304 [self confirmComposition]; 3305 [self confirmComposition];
3305 [self insertText:string]; 3306 [self insertText:string];
3306 return YES; 3307 return YES;
3307 } 3308 }
3308 3309
3309 @end 3310 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698