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

Unified Diff: webkit/plugins/sad_plugin.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | « views/widget/widget_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/sad_plugin.cc
===================================================================
--- webkit/plugins/sad_plugin.cc (revision 82144)
+++ webkit/plugins/sad_plugin.cc (working copy)
@@ -18,18 +18,21 @@
// Make a temporary canvas for the background image.
const int width = plugin_rect.width();
const int height = plugin_rect.height();
- gfx::CanvasSkia canvas(width, height, false);
+ gfx::CanvasSkia canvas;
+ if (!canvas.Init(width, height, false))
+ return;
+
#if defined(OS_MACOSX)
// Flip the canvas, since the context expects flipped data.
- canvas.translate(0, height);
- canvas.scale(1, -1);
+ canvas.skia_canvas()->translate(0, height);
+ canvas.skia_canvas()->scale(1, -1);
#endif
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
paint.setColor(SK_ColorBLACK);
- canvas.drawRectCoords(0, 0, SkIntToScalar(width), SkIntToScalar(height),
- paint);
+ canvas.skia_canvas()->drawRectCoords(
+ 0, 0, SkIntToScalar(width), SkIntToScalar(height), paint);
canvas.DrawBitmapInt(sad_plugin_bitmap,
std::max(0, (width - sad_plugin_bitmap.width()) / 2),
std::max(0, (height - sad_plugin_bitmap.height()) / 2));
@@ -38,11 +41,12 @@
// then copy that to the screen than to use the native APIs. The small speed
// penalty is not important when drawing crashed plugins.
#if WEBKIT_USING_SKIA
- gfx::NativeDrawingContext context = skia::BeginPlatformPaint(webcanvas);
- BlitCanvasToContext(context, plugin_rect, &canvas, gfx::Point(0, 0));
+ canvas.BlitToNativeContext(gfx::Rect(plugin_rect.size()),
+ plugin_rect.origin(), skia::BeginPlatformPaint(webcanvas));
skia::EndPlatformPaint(webcanvas);
#elif WEBKIT_USING_CG
- BlitCanvasToContext(webcanvas, plugin_rect, &canvas, gfx::Point(0, 0));
+ canvas.BlitToNativeContext(gfx::Rect(plugin_rect.size()),
+ plugin_rect.origin(), webcanvas);
#endif
}
« no previous file with comments | « views/widget/widget_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698