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

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

Issue 6927058: Merge 83125 - Add and use gfx::ScopedNSGraphicsContextState (ui/gfx/scoped_ns_graphics_context_st... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: 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
===================================================================
--- 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
« 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