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

Unified Diff: components/favicon/core/fallback_icon_service.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 | « components/favicon/core/DEPS ('k') | ui/message_center/message_center_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/fallback_icon_service.cc
diff --git a/components/favicon/core/fallback_icon_service.cc b/components/favicon/core/fallback_icon_service.cc
index 5164f97aa14f7a22223da40804138670f1014bf1..291e1fac8a9ddd9cd3f8e6eb2c7aa8a7990e2db7 100644
--- a/components/favicon/core/fallback_icon_service.cc
+++ b/components/favicon/core/fallback_icon_service.cc
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "cc/paint/skia_paint_canvas.h"
#include "components/favicon/core/fallback_icon_client.h"
#include "components/favicon/core/fallback_url_util.h"
#include "components/favicon_base/fallback_icon_style.h"
@@ -40,14 +41,16 @@ std::vector<unsigned char> FallbackIconService::RenderFallbackIconBitmap(
int size,
const favicon_base::FallbackIconStyle& style) {
int size_to_use = std::min(kMaxFallbackFaviconSize, size);
- gfx::Canvas canvas(gfx::Size(size_to_use, size_to_use), 1.0f, false);
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(size_to_use, size_to_use, false);
+ cc::SkiaPaintCanvas paint_canvas(bitmap);
+ gfx::Canvas canvas(&paint_canvas, 1.f);
+
DrawFallbackIcon(icon_url, size_to_use, style, &canvas);
std::vector<unsigned char> bitmap_data;
- if (!gfx::PNGCodec::EncodeBGRASkBitmap(canvas.ExtractImageRep().sk_bitmap(),
- false, &bitmap_data)) {
+ if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &bitmap_data))
bitmap_data.clear();
- }
return bitmap_data;
}
« no previous file with comments | « components/favicon/core/DEPS ('k') | ui/message_center/message_center_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698