Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm |
=================================================================== |
--- chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm (revision 84308) |
+++ chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm (working copy) |
@@ -13,6 +13,7 @@ |
#include "ui/base/theme_provider.h" |
#include "ui/gfx/canvas_skia_paint.h" |
#include "ui/gfx/rect.h" |
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
const CGFloat kBorderRadius = 3.0; |
@@ -56,7 +57,7 @@ |
return; |
NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
- [context saveGraphicsState]; |
+ gfx::ScopedNSGraphicsContextSaveGState scopedGState(context); |
// Draw the background. |
{ |
@@ -101,15 +102,16 @@ |
[border fill]; |
// Fade in/out the background. |
- [context saveGraphicsState]; |
- [border setClip]; |
- CGContextRef cgContext = (CGContextRef)[context graphicsPort]; |
- CGContextBeginTransparencyLayer(cgContext, NULL); |
- CGContextSetAlpha(cgContext, 1 - morph); |
- [context setPatternPhase:[[self window] themePatternPhase]]; |
- [self drawBackground]; |
- CGContextEndTransparencyLayer(cgContext); |
- [context restoreGraphicsState]; |
+ { |
+ gfx::ScopedNSGraphicsContextSaveGState bgScopedState(context); |
+ [border setClip]; |
+ CGContextRef cgContext = (CGContextRef)[context graphicsPort]; |
+ CGContextBeginTransparencyLayer(cgContext, NULL); |
+ CGContextSetAlpha(cgContext, 1 - morph); |
+ [context setPatternPhase:[[self window] themePatternPhase]]; |
+ [self drawBackground]; |
+ CGContextEndTransparencyLayer(cgContext); |
+ } |
// Draw the border of the rounded rectangle. |
NSColor* borderColor = themeProvider->GetNSColor( |
@@ -133,9 +135,6 @@ |
[divider moveToPoint:dividerStart]; |
[divider relativeLineToPoint:NSMakePoint(dividerWidth, 0)]; |
[divider stroke]; |
- |
- // Restore the graphics context. |
- [context restoreGraphicsState]; |
} |
@end // @implementation BookmarkBarToolbarView |