diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-02 21:49:12 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-02 21:49:12 +0000 |
commit | f00fa4d766ac76419a051345a496caecfbeddc78 (patch) | |
tree | b742fc1bdaa6dfd815e3b8ad719789572bb23398 /chrome/views/chrome_menu.cc | |
parent | 50d7d7283db42b531a9df9c6f5a34b8526d4d5b0 (diff) | |
download | chromium_src-f00fa4d766ac76419a051345a496caecfbeddc78.zip chromium_src-f00fa4d766ac76419a051345a496caecfbeddc78.tar.gz chromium_src-f00fa4d766ac76419a051345a496caecfbeddc78.tar.bz2 |
Fix bookmark and menu drag images by making a halo around them. This makes
the ClearType composited on the correct color to fix the semitransparent pixels
into 1-bit transparency pixels.
Remove some unnecessary header file dependencies on ChromeCanvas I noticed
when compiling this patch.
BUG=8258
Review URL: http://codereview.chromium.org/27321
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/chrome_menu.cc')
-rw-r--r-- | chrome/views/chrome_menu.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index f226987..96b24dc 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -1479,10 +1479,20 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { ChromeFont& font = GetRootMenuItem()->font_; gfx::Rect text_bounds(label_start, top_margin, width, font.height()); text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); - canvas->DrawStringInt(GetTitle(), font, fg_color, - text_bounds.x(), text_bounds.y(), text_bounds.width(), - text_bounds.height(), - GetRootMenuItem()->GetDrawStringFlags()); + if (for_drag) { + // With different themes, it's difficult to tell what the correct foreground + // and background colors are for the text to draw the correct halo. Instead, + // just draw black on white, which will look good in most cases. + canvas->DrawStringWithHalo(GetTitle(), font, 0x00000000, 0xFFFFFFFF, + text_bounds.x(), text_bounds.y(), + text_bounds.width(), text_bounds.height(), + GetRootMenuItem()->GetDrawStringFlags()); + } else { + canvas->DrawStringInt(GetTitle(), font, fg_color, + text_bounds.x(), text_bounds.y(), text_bounds.width(), + text_bounds.height(), + GetRootMenuItem()->GetDrawStringFlags()); + } if (icon_.width() > 0) { gfx::Rect icon_bounds(kItemLeftMargin, |