Chromium Code Reviews| Index: chrome/browser/ui/views/tabs/tab.cc |
| diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc |
| index 2ffdb637649a0ae160fef1571625e00f30de891b..6cd306addc21062d764eb5af2e1f0df3af4e0b1b 100644 |
| --- a/chrome/browser/ui/views/tabs/tab.cc |
| +++ b/chrome/browser/ui/views/tabs/tab.cc |
| @@ -1275,31 +1275,32 @@ void Tab::PaintTabBackgroundUsingFillId(gfx::Canvas* fill_canvas, |
| void Tab::PaintPinnedTabTitleChangedIndicatorAndIcon( |
| gfx::Canvas* canvas, |
| const gfx::Rect& favicon_draw_bounds) { |
| + const float kIndicatorCropRadius = 4.5f; |
|
sky
2017/04/04 22:02:41
Is there a reason to move these from where they we
danakj
2017/04/04 22:10:44
Oh, putting them together shows their relationship
|
| + const int kIndicatorRadius = 3; |
| + |
| // The pinned tab title changed indicator consists of two parts: |
| // . a clear (totally transparent) part over the bottom right (or left in rtl) |
| - // of the favicon. This is done by drawing the favicon to a canvas, then |
| + // of the favicon. This is done by drawing the favicon to a layer, then |
| // drawing the clear part on top of the favicon. |
| // . a circle in the bottom right (or left in rtl) of the favicon. |
| if (!favicon_.isNull()) { |
| - const float kIndicatorCropRadius = 4.5; |
| - gfx::Canvas icon_canvas(gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), |
| - canvas->image_scale(), false); |
| - icon_canvas.DrawImageInt(favicon_, 0, 0); |
| - cc::PaintFlags clear_flags; |
| - clear_flags.setAntiAlias(true); |
| - clear_flags.setBlendMode(SkBlendMode::kClear); |
| - const int circle_x = base::i18n::IsRTL() ? 0 : gfx::kFaviconSize; |
| - icon_canvas.DrawCircle(gfx::PointF(circle_x, gfx::kFaviconSize), |
| - kIndicatorCropRadius, clear_flags); |
| - canvas->DrawImageInt(gfx::ImageSkia(icon_canvas.ExtractImageRep()), 0, 0, |
| - favicon_draw_bounds.width(), |
| + canvas->SaveLayerAlpha(0xff); |
| + canvas->DrawImageInt(favicon_, 0, 0, favicon_draw_bounds.width(), |
| favicon_draw_bounds.height(), favicon_draw_bounds.x(), |
| favicon_draw_bounds.y(), favicon_draw_bounds.width(), |
| favicon_draw_bounds.height(), false); |
| + cc::PaintFlags clear_flags; |
| + clear_flags.setAntiAlias(true); |
| + clear_flags.setBlendMode(SkBlendMode::kClear); |
| + int circle_x = |
| + favicon_draw_bounds.x() + (base::i18n::IsRTL() ? 0 : gfx::kFaviconSize); |
| + int circle_y = favicon_draw_bounds.y() + gfx::kFaviconSize; |
| + canvas->DrawCircle(gfx::Point(circle_x, circle_y), kIndicatorCropRadius, |
| + clear_flags); |
| + canvas->Restore(); |
| } |
| // Draws the actual pinned tab title changed indicator. |
| - const int kIndicatorRadius = 3; |
| cc::PaintFlags indicator_flags; |
| indicator_flags.setColor(GetNativeTheme()->GetSystemColor( |
| ui::NativeTheme::kColorId_ProminentButtonColor)); |