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

Unified Diff: ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm

Issue 7541043: Revert 95611 - Always call the class methods to save/restore contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | « ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm
===================================================================
--- ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm (revision 95630)
+++ ui/gfx/scoped_ns_graphics_context_save_gstate_mac.mm (working copy)
@@ -4,20 +4,19 @@
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
-#import <AppKit/AppKit.h>
+#include <AppKit/AppKit.h>
-#include "base/logging.h"
-
namespace gfx {
-ScopedNSGraphicsContextSaveGState::ScopedNSGraphicsContextSaveGState()
- : context_([NSGraphicsContext currentContext]) {
- [NSGraphicsContext saveGraphicsState];
+ScopedNSGraphicsContextSaveGState::ScopedNSGraphicsContextSaveGState(
+ NSGraphicsContext* context) : context_([context retain]) {
+ if (!context_)
+ context_.reset([[NSGraphicsContext currentContext] retain]);
+ [context_ saveGraphicsState];
}
ScopedNSGraphicsContextSaveGState::~ScopedNSGraphicsContextSaveGState() {
- [NSGraphicsContext restoreGraphicsState];
- DCHECK_EQ(context_, [NSGraphicsContext currentContext]);
+ [context_ restoreGraphicsState];
}
} // namespace gfx
« no previous file with comments | « ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698