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

Unified Diff: ui/views/controls/label.cc

Issue 308083011: Add support for painting halos on Views Labels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Draw halos over shadows; refine function order and example. Created 6 years, 7 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/views/controls/label.h ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 0407e6410509cf4f8ba6580ac8a4dfb84b970a6c..dcabe767559061bd4eb44b45f999b4d897fc4465 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -323,12 +323,18 @@ void Label::PaintText(gfx::Canvas* canvas,
const gfx::Rect& text_bounds,
int flags) {
gfx::ShadowValues shadows;
- if (has_shadow_)
+ if (has_shadow_) {
shadows.push_back(gfx::ShadowValue(shadow_offset_, shadow_blur_,
enabled() ? enabled_shadow_color_ : disabled_shadow_color_));
- canvas->DrawStringRectWithShadows(text, font_list_,
- enabled() ? actual_enabled_color_ : actual_disabled_color_,
- text_bounds, line_height_, flags, shadows);
+ }
+ SkColor color = enabled() ? actual_enabled_color_ : actual_disabled_color_;
+ canvas->DrawStringRectWithShadows(text, font_list_, color, text_bounds,
+ line_height_, flags, shadows);
+
+ if (SkColorGetA(halo_color_) != SK_AlphaTRANSPARENT) {
+ canvas->DrawStringRectWithHalo(text, font_list_, color, halo_color_,
+ text_bounds, flags);
+ }
if (HasFocus()) {
gfx::Rect focus_bounds = text_bounds;
@@ -400,6 +406,7 @@ void Label::Init(const base::string16& text, const gfx::FontList& font_list) {
shadow_offset_.SetPoint(1, 1);
has_shadow_ = false;
shadow_blur_ = 0;
+ halo_color_ = SK_ColorTRANSPARENT;
cached_heights_.resize(kCachedSizeLimit);
ResetCachedSize();
« no previous file with comments | « ui/views/controls/label.h ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698