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

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

Issue 2796153002: ui: Replace a use of ExtractImageRep with a canvas SaveLayer (Closed)
Patch Set: tabindicator: constants-back Created 3 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..36cc8cd5388f55619ae37abd035f03d83eaee74c 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -1277,33 +1277,33 @@ void Tab::PaintPinnedTabTitleChangedIndicatorAndIcon(
const gfx::Rect& favicon_draw_bounds) {
// 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);
+ const float kIndicatorCropRadius = 4.5f;
+ 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));
indicator_flags.setAntiAlias(true);
+ const int kIndicatorRadius = 3;
const int indicator_x = GetMirroredXWithWidthInView(
favicon_bounds_.right() - kIndicatorRadius, kIndicatorRadius * 2);
const int indicator_y = favicon_bounds_.bottom() - kIndicatorRadius;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698