Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 5 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 6 | 6 |
| 7 #include <AppKit/AppKit.h> | 7 #include <AppKit/AppKit.h> |
|
Mark Mentovai
2011/08/04 23:20:17
#import
Avi (use Gerrit)
2011/08/05 00:18:50
Done.
| |
| 8 | 8 |
| 9 namespace gfx { | 9 namespace gfx { |
| 10 | 10 |
| 11 ScopedNSGraphicsContextSaveGState::ScopedNSGraphicsContextSaveGState( | 11 ScopedNSGraphicsContextSaveGState::ScopedNSGraphicsContextSaveGState() { |
| 12 NSGraphicsContext* context) : context_([context retain]) { | 12 [NSGraphicsContext saveGraphicsState]; |
| 13 if (!context_) | |
| 14 context_.reset([[NSGraphicsContext currentContext] retain]); | |
| 15 [context_ saveGraphicsState]; | |
| 16 } | 13 } |
| 17 | 14 |
| 18 ScopedNSGraphicsContextSaveGState::~ScopedNSGraphicsContextSaveGState() { | 15 ScopedNSGraphicsContextSaveGState::~ScopedNSGraphicsContextSaveGState() { |
| 19 [context_ restoreGraphicsState]; | 16 [NSGraphicsContext restoreGraphicsState]; |
| 20 } | 17 } |
| 21 | 18 |
| 22 } // namespace gfx | 19 } // namespace gfx |
| OLD | NEW |