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

Unified Diff: content/browser/renderer_host/backing_store_mac.mm

Issue 10869031: mac: Use ScopedCGContextSaveGState in a few more places (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « chrome/browser/ui/cocoa/tabpose_window.mm ('k') | webkit/plugins/npapi/webplugin_delegate_impl_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/backing_store_mac.mm
diff --git a/content/browser/renderer_host/backing_store_mac.mm b/content/browser/renderer_host/backing_store_mac.mm
index 5e17e5fe024ad3e1c31dedb141323be1ae0e64ed..14e4a01c8c4bad4212ba6b9c58658b227972d673 100644
--- a/content/browser/renderer_host/backing_store_mac.mm
+++ b/content/browser/renderer_host/backing_store_mac.mm
@@ -152,12 +152,11 @@ bool BackingStoreMac::CopyFromBackingStore(const gfx::Rect& rect,
skia::ScopedPlatformPaint scoped_platform_paint(output);
CGContextRef temp_context = scoped_platform_paint.GetPlatformSurface();
- CGContextSaveGState(temp_context);
+ gfx::ScopedCGContextSaveGState save_gstate(temp_context);
CGContextTranslateCTM(temp_context, 0.0, size().height());
CGContextScaleCTM(temp_context, 1.0, -1.0);
CGContextDrawLayerAtPoint(temp_context, CGPointMake(rect.x(), rect.y()),
cg_layer());
- CGContextRestoreGState(temp_context);
return true;
}
@@ -183,19 +182,18 @@ void BackingStoreMac::ScrollBackingStore(int dx, int dy,
if ((dx || dy) && abs(dx) < size().width() && abs(dy) < size().height()) {
if (cg_layer()) {
CGContextRef layer = CGLayerGetContext(cg_layer());
- CGContextSaveGState(layer);
+ gfx::ScopedCGContextSaveGState save_gstate(layer);
CGContextClipToRect(layer,
CGRectMake(clip_rect.x(),
size().height() - clip_rect.bottom(),
clip_rect.width(),
clip_rect.height()));
CGContextDrawLayerAtPoint(layer, CGPointMake(dx, -dy), cg_layer());
- CGContextRestoreGState(layer);
} else {
// We don't have a layer, so scroll the contents of the CGBitmapContext.
base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
CGBitmapContextCreateImage(cg_bitmap_));
- CGContextSaveGState(cg_bitmap_);
+ gfx::ScopedCGContextSaveGState save_gstate(cg_bitmap_);
CGContextClipToRect(cg_bitmap_,
CGRectMake(clip_rect.x(),
size().height() - clip_rect.bottom(),
@@ -204,14 +202,13 @@ void BackingStoreMac::ScrollBackingStore(int dx, int dy,
CGContextDrawImage(cg_bitmap_,
CGRectMake(dx, -dy, size().width(), size().height()),
bitmap_image);
- CGContextRestoreGState(cg_bitmap_);
}
}
}
void BackingStoreMac::CopyFromBackingStoreToCGContext(const CGRect& dest_rect,
CGContextRef context) {
- gfx::ScopedCGContextSaveGState CGContextSaveGState(context);
+ gfx::ScopedCGContextSaveGState save_gstate(context);
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
if (cg_layer_) {
CGContextDrawLayerInRect(context, dest_rect, cg_layer_);
« no previous file with comments | « chrome/browser/ui/cocoa/tabpose_window.mm ('k') | webkit/plugins/npapi/webplugin_delegate_impl_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698