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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_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/tabs/tab_view.mm
===================================================================
--- chrome/browser/ui/cocoa/tabs/tab_view.mm (revision 84308)
+++ chrome/browser/ui/cocoa/tabs/tab_view.mm (working copy)
@@ -16,6 +16,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
namespace {
@@ -651,7 +652,7 @@
const CGFloat lineWidth = [self cr_lineWidth];
NSGraphicsContext* context = [NSGraphicsContext currentContext];
- [context saveGraphicsState];
+ gfx::ScopedNSGraphicsContextSaveGState scopedGState(context);
ThemeService* themeProvider =
static_cast<ThemeService*>([[self window] themeProvider]);
@@ -700,7 +701,7 @@
CGFloat alertAlpha = [self alertAlpha];
if (selected || hoverAlpha > 0 || alertAlpha > 0) {
// Draw the selected background / glow overlay.
- [context saveGraphicsState];
+ gfx::ScopedNSGraphicsContextSaveGState drawHoverState(context);
CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]);
CGContextBeginTransparencyLayer(cgContext, 0);
if (!selected) {
@@ -711,9 +712,10 @@
CGContextSetAlpha(cgContext, backgroundAlpha);
}
[path addClip];
- [context saveGraphicsState];
- [super drawBackground];
- [context restoreGraphicsState];
+ {
+ gfx::ScopedNSGraphicsContextSaveGState drawBackgroundState(context);
+ [super drawBackground];
+ }
// Draw a mouse hover gradient for the default themes.
if (!selected && hoverAlpha > 0) {
@@ -737,7 +739,6 @@
}
CGContextEndTransparencyLayer(cgContext);
- [context restoreGraphicsState];
}
BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow];
@@ -767,11 +768,12 @@
[context restoreGraphicsState];
// Draw the top stroke.
- [context saveGraphicsState];
- [borderColor set];
- [path setLineWidth:lineWidth];
- [path stroke];
- [context restoreGraphicsState];
+ {
+ gfx::ScopedNSGraphicsContextSaveGState drawBorderState(context);
+ [borderColor set];
+ [path setLineWidth:lineWidth];
+ [path stroke];
+ }
// Mimic the tab strip's bottom border, which consists of a dark border
// and light highlight.
@@ -787,8 +789,6 @@
[highlightColor set];
NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
}
-
- [context restoreGraphicsState];
}
- (void)viewDidMoveToWindow {
« no previous file with comments | « chrome/browser/ui/cocoa/styled_text_field_cell.mm ('k') | chrome/browser/ui/cocoa/wrench_menu/wrench_menu_button_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698