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

Unified Diff: content/shell/webkit_test_runner.cc

Issue 11138024: Simplify platform_canvas.h by recognizing that PlatformCanvas does not actually extend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 | « content/renderer/webplugin_delegate_proxy.cc ('k') | content/test/mock_render_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/webkit_test_runner.cc
===================================================================
--- content/shell/webkit_test_runner.cc (revision 167659)
+++ content/shell/webkit_test_runner.cc (working copy)
@@ -113,16 +113,17 @@
return result;
}
-bool PaintViewIntoCanvas(WebView* view, skia::PlatformCanvas& canvas) {
+SkCanvas* PaintViewIntoCanvas(WebView* view) {
view->layout();
const WebSize& size = view->size();
- if (!canvas.initialize(size.width, size.height, true))
- return false;
-
- view->paint(webkit_glue::ToWebCanvas(&canvas),
- WebRect(0, 0, size.width, size.height));
- return true;
+ SkCanvas* canvas = skia::CreatePlatformCanvas(size.width, size.height, true,
+ 0, skia::RETURN_NULL_ON_FAILURE);
+ if (canvas) {
+ view->paint(webkit_glue::ToWebCanvas(canvas),
+ WebRect(0, 0, size.width, size.height));
+ }
+ return canvas;
}
#if !defined(OS_MACOSX)
@@ -138,11 +139,11 @@
#endif
void CaptureSnapshot(WebView* view, SkBitmap* snapshot) {
- skia::PlatformCanvas canvas;
- if (!PaintViewIntoCanvas(view, canvas))
+ SkCanvas* canvas = PaintViewIntoCanvas(view);
+ if (!canvas)
return;
- SkDevice* device = skia::GetTopDevice(canvas);
+ SkDevice* device = skia::GetTopDevice(*canvas);
const SkBitmap& bitmap = device->accessBitmap(false);
bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config);
« no previous file with comments | « content/renderer/webplugin_delegate_proxy.cc ('k') | content/test/mock_render_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698