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

Unified Diff: skia/ext/platform_canvas.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
Index: skia/ext/platform_canvas.cc
===================================================================
--- skia/ext/platform_canvas.cc (revision 165342)
+++ skia/ext/platform_canvas.cc (working copy)
@@ -9,35 +9,6 @@
namespace skia {
-PlatformCanvas::PlatformCanvas() {}
-
-// static
-size_t PlatformCanvas::StrideForWidth(unsigned width) {
- return 4 * width;
-}
-
-bool PlatformCanvas::initializeWithDevice(SkDevice* device) {
- if (!device)
- return false;
-
- setDevice(device);
- device->unref(); // Was created with refcount 1, and setDevice also refs.
- return true;
-}
-
-SkCanvas* CreateBitmapCanvas(int width, int height, bool is_opaque) {
- return new PlatformCanvas(width, height, is_opaque);
-}
-
-SkCanvas* TryCreateBitmapCanvas(int width, int height, bool is_opaque) {
- PlatformCanvas* canvas = new PlatformCanvas();
- if (!canvas->initialize(width, height, is_opaque)) {
- delete canvas;
- canvas = NULL;
- }
- return canvas;
-}
-
SkDevice* GetTopDevice(const SkCanvas& canvas) {
return canvas.getTopDevice(true);
}
@@ -87,6 +58,20 @@
canvas->drawRect(rect, paint);
}
+size_t PlatformCanvasStrideForWidth(unsigned width) {
+ return 4 * width;
+}
+
+SkCanvas* CreateCanvas(SkDevice* device, OnFailureType failureType) {
+ if (!device) {
+ if (CRASH_ON_FAILURE == failureType)
+ SK_CRASH();
+ return NULL;
+ }
+ SkAutoUnref aur(device);
+ return new SkCanvas(device);
+}
+
PlatformBitmap::PlatformBitmap() : surface_(0) {}
} // namespace skia

Powered by Google App Engine
This is Rietveld 408576698