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

Unified Diff: ui/base/cocoa/scoped_cg_context_smooth_fonts.h

Issue 1368883002: Mac: restore subpixel AA in the find bar when it doesn't have focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 5 years, 3 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/base/cocoa/controls/blue_label_button.mm ('k') | ui/base/cocoa/scoped_cg_context_smooth_fonts.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/scoped_cg_context_smooth_fonts.h
diff --git a/ui/base/cocoa/scoped_cg_context_smooth_fonts.h b/ui/base/cocoa/scoped_cg_context_smooth_fonts.h
new file mode 100644
index 0000000000000000000000000000000000000000..1624d463970d9a7909f5f2d74bb69e9fd69e1af4
--- /dev/null
+++ b/ui/base/cocoa/scoped_cg_context_smooth_fonts.h
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_COCOA_SCOPED_CG_CONTEXT_SMOOTH_FONTS_H_
+#define UI_BASE_COCOA_SCOPED_CG_CONTEXT_SMOOTH_FONTS_H_
+
+#include "ui/base/ui_base_export.h"
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
+
+namespace ui {
+
+// Ensures LCD font smoothing is enabled before drawing text. This allows Cocoa
+// drawing code to override a decision made by AppKit to disable font smoothing.
+// E.g. this occurs when a view is layer-backed or, since 10.8, when a view
+// returns NO from -[NSView isOpaque]. For this to look nice, there must be an
+// opaque background already drawn in the graphics context at the location of
+// the text (but it doesn't need to fill the view bounds, which is required when
+// -[NSView isOpaque] returns YES).
+class UI_BASE_EXPORT ScopedCGContextSmoothFonts {
+ public:
+ ScopedCGContextSmoothFonts();
+ ~ScopedCGContextSmoothFonts();
+
+ private:
+ gfx::ScopedNSGraphicsContextSaveGState save_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedCGContextSmoothFonts);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_COCOA_SCOPED_CG_CONTEXT_SMOOTH_FONTS_H_
« no previous file with comments | « ui/base/cocoa/controls/blue_label_button.mm ('k') | ui/base/cocoa/scoped_cg_context_smooth_fonts.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698