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

Unified Diff: chrome/browser/ui/webui/app_launcher_login_handler.cc

Issue 2760133002: ui: Remove a bunch of uses of gfx::Canvas::ExtractImageRep() (Closed)
Patch Set: canvasbounds: ashnit 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 | « chrome/browser/ui/app_list/extension_app_item.cc ('k') | components/favicon/core/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/app_launcher_login_handler.cc
diff --git a/chrome/browser/ui/webui/app_launcher_login_handler.cc b/chrome/browser/ui/webui/app_launcher_login_handler.cc
index ee7a3f257a2c6f19ea0c0e43c99bffcb34116c36..290b6c3d3d6a798f1441bc4001b81fb327281ae9 100644
--- a/chrome/browser/ui/webui/app_launcher_login_handler.cc
+++ b/chrome/browser/ui/webui/app_launcher_login_handler.cc
@@ -46,6 +46,7 @@
#include "ui/base/webui/web_ui_util.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/skia_util.h"
using content::OpenURLParams;
using content::Referrer;
@@ -59,14 +60,15 @@ SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) {
SkBitmap bmp = skia::ImageOperations::Resize(*image.ToSkBitmap(),
skia::ImageOperations::RESIZE_BEST, kLength, kLength);
- gfx::Canvas canvas(gfx::Size(kLength, kLength), 1.0f, false);
- canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bmp), 0, 0);
-
// Draw a gray border on the inside of the icon.
- SkColor color = SkColorSetARGB(83, 0, 0, 0);
- canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color);
-
- return canvas.ExtractImageRep().sk_bitmap();
+ sk_sp<SkSurface> surface =
+ SkSurface::MakeRasterDirect(bmp.info(), bmp.getPixels(), bmp.rowBytes());
+ SkPaint paint;
+ paint.setColor(SkColorSetARGB(83, 0, 0, 0));
+ paint.setStyle(SkPaint::kStroke_Style);
+ surface->getCanvas()->drawRect(
+ gfx::RectToSkRect(gfx::Rect(kLength - 1, kLength - 1)), paint);
+ return bmp;
}
// Puts the |content| into an element with the given CSS class.
« no previous file with comments | « chrome/browser/ui/app_list/extension_app_item.cc ('k') | components/favicon/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698