Index: chrome/browser/chromeos/drop_shadow_label.cc |
=================================================================== |
--- chrome/browser/chromeos/drop_shadow_label.cc (revision 104959) |
+++ chrome/browser/chromeos/drop_shadow_label.cc (working copy) |
@@ -14,19 +14,9 @@ |
static const int kDefaultDropShadowSize = 2; |
-// Default color is black. |
-static const SkColor kDefaultColor = 0x000000; |
- |
-static const float kShadowOpacity = 0.2; |
- |
-DropShadowLabel::DropShadowLabel() : Label() { |
- Init(); |
+DropShadowLabel::DropShadowLabel() : drop_shadow_size_(kDefaultDropShadowSize) { |
} |
-void DropShadowLabel::Init() { |
- drop_shadow_size_ = kDefaultDropShadowSize; |
-} |
- |
void DropShadowLabel::SetDropShadowSize(int drop_shadow_size) { |
if (drop_shadow_size != drop_shadow_size_) { |
drop_shadow_size_ = drop_shadow_size; |
@@ -39,27 +29,26 @@ |
const string16& text, |
const gfx::Rect& text_bounds, |
int flags) { |
+ SkColor text_color = IsEnabled() ? enabled_color() : disabled_color(); |
if (drop_shadow_size_ > 0) { |
- SkColor color = SkColorSetARGB(kShadowOpacity * SkColorGetA(GetColor()), |
- SkColorGetR(kDefaultColor), |
- SkColorGetG(kDefaultColor), |
- SkColorGetB(kDefaultColor)); |
+ const float kShadowOpacity = 0.2; |
+ const SkColor shadow_color = |
+ SkColorSetA(SK_ColorBLACK, kShadowOpacity * SkColorGetA(text_color)); |
for (int i = 0; i < drop_shadow_size_; i++) { |
- canvas->DrawStringInt(text, font(), color, |
+ canvas->DrawStringInt(text, font(), shadow_color, |
text_bounds.x() + i, text_bounds.y(), |
text_bounds.width(), text_bounds.height(), flags); |
- canvas->DrawStringInt(text, font(), color, |
+ canvas->DrawStringInt(text, font(), shadow_color, |
text_bounds.x() + i, text_bounds.y() + i, |
text_bounds.width(), text_bounds.height(), flags); |
- canvas->DrawStringInt(text, font(), color, |
+ canvas->DrawStringInt(text, font(), shadow_color, |
text_bounds.x(), text_bounds.y() + i, |
text_bounds.width(), text_bounds.height(), flags); |
} |
} |
- canvas->DrawStringInt(text, font(), GetColor(), |
- text_bounds.x(), text_bounds.y(), |
- text_bounds.width(), text_bounds.height(), flags); |
+ canvas->DrawStringInt(text, font(), text_color, text_bounds.x(), |
+ text_bounds.y(), text_bounds.width(), text_bounds.height(), flags); |
if (HasFocus() || paint_as_focused()) { |
gfx::Rect focus_bounds = text_bounds; |