Index: ui/views/controls/button/label_button_border.cc |
diff --git a/ui/views/controls/button/label_button_border.cc b/ui/views/controls/button/label_button_border.cc |
index efb80df3a1b5b672855f1151b26902216cd3ac0d..6dbf1e1858cc8a6f7b9f67322f15d9309c3d2bb0 100644 |
--- a/ui/views/controls/button/label_button_border.cc |
+++ b/ui/views/controls/button/label_button_border.cc |
@@ -6,6 +6,8 @@ |
#include "base/logging.h" |
#include "grit/ui_resources.h" |
+#include "third_party/skia/include/core/SkPaint.h" |
+#include "third_party/skia/include/effects/SkLerpXfermode.h" |
#include "ui/base/animation/animation.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/gfx/canvas.h" |
@@ -119,17 +121,19 @@ void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) { |
ui::NativeTheme::State state = native_theme_delegate->GetThemeState(&extra); |
if (animation && animation->is_animating()) { |
- // Composite the background and foreground painters during state animations. |
- int alpha = animation->CurrentValueBetween(0, 0xff); |
+ // Linearly interpolate background and foreground painters during animation. |
+ canvas->sk_canvas()->saveLayer(NULL, NULL); |
reed1
2013/08/14 13:33:56
Not specific to this CL, but..
Skia definitely ta
msw
2013/08/14 16:17:11
Done.
|
state = native_theme_delegate->GetBackgroundThemeState(&extra); |
- canvas->SaveLayerAlpha(static_cast<uint8>(0xff - alpha)); |
PaintHelper(this, canvas, theme, part, state, rect, extra); |
- canvas->Restore(); |
+ SkPaint paint; |
+ paint.setXfermode(SkLerpXfermode::Create(animation->GetCurrentValue())); |
reed1
2013/08/14 13:33:56
Create returns an object of reference-count 1
setX
msw
2013/08/14 16:17:11
Done. I too easily forgot how tricky using skia in
|
+ canvas->sk_canvas()->saveLayer(NULL, &paint); |
reed1
2013/08/14 13:33:56
Same comment here about the value of passing in a
msw
2013/08/14 16:17:11
Done.
|
state = native_theme_delegate->GetForegroundThemeState(&extra); |
- canvas->SaveLayerAlpha(static_cast<uint8>(alpha)); |
PaintHelper(this, canvas, theme, part, state, rect, extra); |
- canvas->Restore(); |
+ canvas->sk_canvas()->restore(); |
+ |
+ canvas->sk_canvas()->restore(); |
} else { |
PaintHelper(this, canvas, theme, part, state, rect, extra); |
} |