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

Unified Diff: chrome/browser/ui/app_list/extension_app_item.cc

Issue 2769203002: Use SaveLayerWithFlags to avoid cpu bitmaps in RoundedCornersImageSource (Closed)
Patch Set: Created 3 years, 9 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/app_list/extension_app_item.cc
diff --git a/chrome/browser/ui/app_list/extension_app_item.cc b/chrome/browser/ui/app_list/extension_app_item.cc
index 93e2bd530558b92bc1040aa0a357b3d67a35b903..277256f5879bd5a6e8c54d7f723e4f227c97896e 100644
--- a/chrome/browser/ui/app_list/extension_app_item.cc
+++ b/chrome/browser/ui/app_list/extension_app_item.cc
@@ -84,20 +84,17 @@ class RoundedCornersImageSource : public gfx::CanvasImageSource {
canvas->DrawImageInt(icon_, 0, 0);
- SkBitmap mask_bitmap;
- mask_bitmap.allocN32Pixels(icon_.width(), icon_.height(), false);
- SkCanvas mask_canvas(mask_bitmap);
- mask_canvas.clear(SK_ColorTRANSPARENT);
- SkPaint mask_paint;
- mask_paint.setAntiAlias(true);
- mask_paint.setColor(SK_ColorWHITE);
- mask_canvas.drawRoundRect(
- gfx::RectToSkRect(gfx::Rect(icon_.width(), icon_.height())),
- kRoundingRadius, kRoundingRadius, mask_paint);
-
cc::PaintFlags masking_flags;
masking_flags.setBlendMode(SkBlendMode::kDstIn);
- canvas->sk_canvas()->drawBitmap(mask_bitmap, 0, 0, &masking_flags);
+ canvas->SaveLayerWithFlags(masking_flags);
+
+ cc::PaintFlags mask_flags;
+ mask_flags.setAntiAlias(true);
+ mask_flags.setColor(SK_ColorWHITE);
+ canvas->DrawRoundRect(gfx::Rect(icon_.width(), icon_.height()),
+ kRoundingRadius, mask_flags);
+
+ canvas->Restore();
}
gfx::ImageSkia icon_;
« 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