| 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..a06376a0efcf9da32d25aff899f0544ac41667b8 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/core/SkXfermode.h"
|
| #include "ui/base/animation/animation.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/canvas.h"
|
| @@ -119,17 +121,27 @@ 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);
|
| + // Fade from the background to the foreground painter during state
|
| + // animations. This is done by performing an additive blending of the two
|
| + // states in an intermediate layer.
|
| + canvas->sk_canvas()->saveLayer(NULL, NULL);
|
| + SkPaint paint;
|
| + paint.setXfermode(SkXfermode::Create(SkXfermode::kPlus_Mode));
|
| +
|
| state = native_theme_delegate->GetBackgroundThemeState(&extra);
|
| - canvas->SaveLayerAlpha(static_cast<uint8>(0xff - alpha));
|
| + int alpha = animation->CurrentValueBetween(0, 0xff);
|
| + paint.setAlpha(0xff - alpha);
|
| + canvas->sk_canvas()->saveLayer(NULL, &paint);
|
| PaintHelper(this, canvas, theme, part, state, rect, extra);
|
| - canvas->Restore();
|
| + canvas->sk_canvas()->restore();
|
|
|
| state = native_theme_delegate->GetForegroundThemeState(&extra);
|
| - canvas->SaveLayerAlpha(static_cast<uint8>(alpha));
|
| + paint.setAlpha(alpha);
|
| + canvas->sk_canvas()->saveLayer(NULL, &paint);
|
| 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);
|
| }
|
|
|