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

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: DISALLOW_COPY.etc 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
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..0a079ad957fd12596ee93805e0bdd40da97b753e
--- /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
Robert Sesek 2015/09/25 23:00:52 "namespace ui"
tapted 2015/09/28 04:30:38 Done.
+
+#endif // UI_BASE_COCOA_SCOPED_CG_CONTEXT_SMOOTH_FONTS_H_

Powered by Google App Engine
This is Rietveld 408576698