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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 1534303002: CustomButton cleanup: make protected members private, create accessors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy up Created 5 years 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
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 99b804179e95f6b799f31577b89dc624f6bb4b6e..bbfb7e82c39e1dafa9a46fa9f8ce87d3d579707f 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -308,7 +308,6 @@ class NewTabButton : public views::ImageButton,
// Paints the fill region of the button into |canvas|, according to the
// supplied values from GetImage() and the given |fill| path.
void PaintFill(bool pressed,
- double hover_value,
float scale,
const SkPath& fill,
gfx::Canvas* canvas) const;
@@ -372,10 +371,6 @@ void NewTabButton::OnPaint(gfx::Canvas* canvas) {
canvas->Translate(gfx::Vector2d(0, height() - kNewTabButtonHeight));
const bool pressed = state() == views::CustomButton::STATE_PRESSED;
- double hover_value =
- (state() == views::CustomButton::STATE_HOVERED) ? 1 : 0;
- if (hover_animation_->is_animating())
- hover_value = hover_animation_->GetCurrentValue();
const float scale = canvas->image_scale();
SkPath fill;
@@ -392,7 +387,7 @@ void NewTabButton::OnPaint(gfx::Canvas* canvas) {
fill.rLineTo(5.75 * scale, 12.5 * scale);
fill.rCubicTo(0, 0.5 * scale, -0.25 * scale, scale, -scale, scale);
fill.close();
- PaintFill(pressed, hover_value, scale, fill, canvas);
+ PaintFill(pressed, scale, fill, canvas);
// Stroke.
gfx::ScopedCanvas scoped_canvas(canvas);
@@ -423,7 +418,7 @@ void NewTabButton::OnPaint(gfx::Canvas* canvas) {
const float fill_canvas_scale = mask->HasRepresentation(scale) ?
scale : ui::GetScaleForScaleFactor(ui::SCALE_FACTOR_100P);
gfx::Canvas fill_canvas(GetNewTabButtonSize(), fill_canvas_scale, false);
- PaintFill(pressed, hover_value, fill_canvas_scale, fill, &fill_canvas);
+ PaintFill(pressed, fill_canvas_scale, fill, &fill_canvas);
gfx::ImageSkia image(fill_canvas.ExtractImageRep());
canvas->DrawImageInt(
gfx::ImageSkiaOperations::CreateMaskedImage(image, *mask), 0, 0);
@@ -511,7 +506,6 @@ void NewTabButton::GetBorderPath(float button_y,
}
void NewTabButton::PaintFill(bool pressed,
- double hover_value,
float scale,
const SkPath& fill,
gfx::Canvas* canvas) const {
@@ -591,12 +585,10 @@ void NewTabButton::PaintFill(bool pressed,
}
// White highlight on hover.
- if (hover_value) {
- const int alpha =
- gfx::Tween::LinearIntValueBetween(hover_value, 0x00, md ? 0x4D : 0x40);
- canvas->FillRect(GetLocalBounds(),
- SkColorSetA(SK_ColorWHITE, static_cast<SkAlpha>(alpha)));
- }
+ const SkAlpha alpha = static_cast<SkAlpha>(
+ hover_animation().CurrentValueBetween(0x00, md ? 0x4D : 0x40));
+ if (alpha != SK_AlphaTRANSPARENT)
Peter Kasting 2015/12/21 20:34:18 I suspect that Skia detects a transparent fill and
Evan Stade 2015/12/21 22:27:16 I followed the callstack for a while and couldn't
+ canvas->FillRect(GetLocalBounds(), SkColorSetA(SK_ColorWHITE, alpha));
// For MD, most states' opacities are adjusted using an opacity recorder in
// TabStrip::PaintChildren(), but the pressed state is excluded there and

Powered by Google App Engine
This is Rietveld 408576698