Chromium Code Reviews| Index: chrome/browser/ui/views/infobars/infobar_background.cc |
| diff --git a/chrome/browser/ui/views/infobars/infobar_background.cc b/chrome/browser/ui/views/infobars/infobar_background.cc |
| index 7e9fe105f810af8ee28893f3064b0fc34bf69ece..2bd8da7d21763429c95df7292cfc2d26b3b1b3c9 100644 |
| --- a/chrome/browser/ui/views/infobars/infobar_background.cc |
| +++ b/chrome/browser/ui/views/infobars/infobar_background.cc |
| @@ -8,6 +8,7 @@ |
| #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| #include "components/infobars/core/infobar.h" |
| #include "third_party/skia/include/effects/SkGradientShader.h" |
| +#include "ui/base/material_design/material_design_controller.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/color_utils.h" |
| #include "ui/views/view.h" |
| @@ -30,20 +31,22 @@ void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| gradient_points[1].iset(0, view->height()); |
| SkColor gradient_colors[2] = { top_color_, bottom_color_ }; |
| SkPaint paint; |
| - paint.setStrokeWidth( |
| - SkIntToScalar(InfoBarContainerDelegate::kSeparatorLineHeight)); |
| paint.setStyle(SkPaint::kFill_Style); |
| - paint.setStrokeCap(SkPaint::kRound_Cap); |
| paint.setShader(SkGradientShader::MakeLinear( |
| - gradient_points, gradient_colors, NULL, 2, SkShader::kClamp_TileMode)); |
| + gradient_points, gradient_colors, nullptr, 2, SkShader::kClamp_TileMode)); |
| InfoBarView* infobar = static_cast<InfoBarView*>(view); |
| SkCanvas* canvas_skia = canvas->sk_canvas(); |
| canvas_skia->drawPath(infobar->fill_path(), paint); |
| - paint.setShader(NULL); |
| + paint.setShader(nullptr); |
|
Peter Kasting
2016/03/23 00:28:17
Nit: Rather than reset this, let's just use two di
|
| paint.setColor(SkColorSetA(separator_color_, |
| SkColorGetA(gradient_colors[0]))); |
| + paint.setStrokeCap(SkPaint::kRound_Cap); |
|
Peter Kasting
2016/03/22 23:39:18
Why do we need to set the cap for a hairline?
|
| + paint.setStrokeWidth( |
| + ui::MaterialDesignController::IsModeMaterial() |
| + ? 0 |
| + : SkIntToScalar(InfoBarContainerDelegate::kSeparatorLineHeight)); |
| paint.setStyle(SkPaint::kStroke_Style); |
| // Anti-alias the path so it doesn't look goofy when the edges are not at 45 |
| // degree angles, but don't anti-alias anything else, especially not the fill, |
| @@ -53,9 +56,7 @@ void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| paint.setAntiAlias(false); |
| // Now draw the separator at the bottom. |
| - canvas->FillRect( |
| - gfx::Rect(0, |
| - view->height() - InfoBarContainerDelegate::kSeparatorLineHeight, |
| - view->width(), InfoBarContainerDelegate::kSeparatorLineHeight), |
| - separator_color_); |
| + paint.setColor(separator_color_); |
| + SkScalar bottom = SkIntToScalar(view->height()) - SK_ScalarHalf; |
|
Peter Kasting
2016/03/23 00:28:17
This seems wrong at >1x. It really wants to move
Evan Stade
2016/03/23 00:35:46
You're right, it does have bugs at >2x scales. I'l
|
| + canvas_skia->drawLine(0, bottom, SkIntToScalar(view->width()), bottom, paint); |
| } |