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

Unified Diff: chrome/browser/ui/cocoa/styled_text_field_cell.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: 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/styled_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/styled_text_field_cell.mm b/chrome/browser/ui/cocoa/styled_text_field_cell.mm
index 387d24302c703af2f90c5e8fe03b851c2e5d9b95..6e3dab0e655c0042f1450dcb158e0c589a644cd5 100644
--- a/chrome/browser/ui/cocoa/styled_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/styled_text_field_cell.mm
@@ -12,6 +12,7 @@
#import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font.h"
+#include "ui/gfx/scoped_ns_graphics_context_state_mac.h"
namespace {
@@ -68,25 +69,6 @@ void FrameRectWithInset(StyledTextFieldCellRoundedFlags roundedFlags,
[path stroke];
}
-// TODO(shess): Maybe we need a |cocoa_util.h|?
-class ScopedSaveGraphicsState {
- public:
- ScopedSaveGraphicsState()
- : context_([NSGraphicsContext currentContext]) {
- [context_ saveGraphicsState];
- }
- explicit ScopedSaveGraphicsState(NSGraphicsContext* context)
- : context_(context) {
- [context_ saveGraphicsState];
- }
- ~ScopedSaveGraphicsState() {
- [context_ restoreGraphicsState];
- }
-
-private:
- NSGraphicsContext* context_;
-};
-
} // namespace
@implementation StyledTextFieldCell
@@ -189,7 +171,7 @@ private:
// outer border line on the bottom and right. The clipping change
// will clip the bottom and right edges (and corner).
{
- ScopedSaveGraphicsState state;
+ gfx::ScopedNSGraphicsContextState state;
[RectPathWithInset(roundedFlags, frame, lineWidth, radius) addClip];
const NSRect shadowFrame =
NSOffsetRect(frame, halfLineWidth, halfLineWidth);

Powered by Google App Engine
This is Rietveld 408576698