summaryrefslogtreecommitdiffstats
path: root/ui/views/controls/label.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 16:34:00 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 16:34:00 +0000
commit4f885880abe4c6b21f1539fcaaab0815573016e7 (patch)
tree0a77cb3710eef8214eb7986b915b404ae43b885f /ui/views/controls/label.cc
parentfb9daa574da069d4c9bed9cba9ff86016a01a196 (diff)
downloadchromium_src-4f885880abe4c6b21f1539fcaaab0815573016e7.zip
chromium_src-4f885880abe4c6b21f1539fcaaab0815573016e7.tar.gz
chromium_src-4f885880abe4c6b21f1539fcaaab0815573016e7.tar.bz2
views: Disable subpixel rendering for transparent labels.
We can't use subpixel rendering if we don't know what's in the background. This adds a NO_SUBPIXEL_RENDERING flag to gfx::CanvasSkia::DrawStringInt() that overrides the regular configuration that's passed to Pango/Cairo on Linux. BUG=117184 TEST=manual: ash applist uses grayscale antialiasing Review URL: http://codereview.chromium.org/9662027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126150 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/label.cc')
-rw-r--r--ui/views/controls/label.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 9d51b28..567d60e 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -429,6 +429,10 @@ gfx::Rect Label::GetTextBounds() const {
int Label::ComputeDrawStringFlags() const {
int flags = 0;
+ // We can't use subpixel rendering if the background is non-opaque.
+ if (SkColorGetA(background_color_) != 0xFF)
+ flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING;
+
if (directionality_mode_ == AUTO_DETECT_DIRECTIONALITY) {
base::i18n::TextDirection direction =
base::i18n::GetFirstStrongCharacterDirection(GetText());