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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm

Issue 6904026: Add and use gfx::ScopedNSGraphicsContextState (ui/gfx/scoped_ns_graphics_context_state_mac.h). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename Created 9 years, 8 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
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm
index 1060e590d2dab876b05844d87e9f5d6eeab167bf..8ae613de662720bea51cac2128a2f5d9c88fdca9 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm
@@ -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 @@ const CGFloat kBorderRadius = 3.0;
return;
NSGraphicsContext* context = [NSGraphicsContext currentContext];
- [context saveGraphicsState];
+ gfx::ScopedNSGraphicsContextSaveGState scopedGState(context);
// Draw the background.
{
@@ -101,15 +102,16 @@ const CGFloat kBorderRadius = 3.0;
[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 @@ const CGFloat kBorderRadius = 3.0;
[divider moveToPoint:dividerStart];
[divider relativeLineToPoint:NSMakePoint(dividerWidth, 0)];
[divider stroke];
-
- // Restore the graphics context.
- [context restoreGraphicsState];
}
@end // @implementation BookmarkBarToolbarView
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.mm ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698