remove SkCanvas::createCompatibleDevice, and add SkCanvas::newSurface

BUG=skia:
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/154163002

git-svn-id: http://skia.googlecode.com/svn/trunk@13319 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 08b09e8..6f4e88d 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -832,6 +832,26 @@
     return this->internalSaveLayer(bounds, paint, flags, false);
 }
 
+static SkBaseDevice* createCompatibleDevice(SkCanvas* canvas,
+                                            SkBitmap::Config config,
+                                            int width, int height,
+                                            bool isOpaque) {
+    SkBaseDevice* device = canvas->getDevice();
+    if (device) {
+        return device->createCompatibleDevice(config, width, height, isOpaque);
+    } else {
+        return NULL;
+    }
+}
+
+#ifdef SK_SUPPORT_LEGACY_CANVAS_CREATECOMPATIBLEDEVICE
+SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
+                                               int width, int height,
+                                               bool isOpaque) {
+    return createCompatibleDevice(this, config, width, height, isOpaque);
+}
+#endif
+
 int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
                                 SaveFlags flags, bool justForImageFilter) {
     // do this before we create the layer. We don't call the public save() since
@@ -864,8 +884,8 @@
 
     SkBaseDevice* device;
     if (paint && paint->getImageFilter()) {
-        device = this->createCompatibleDevice(config, ir.width(), ir.height(),
-                                              isOpaque);
+        device = createCompatibleDevice(this, config, ir.width(), ir.height(),
+                                        isOpaque);
     } else {
         device = this->createLayerDevice(config, ir.width(), ir.height(),
                                          isOpaque);
@@ -964,6 +984,15 @@
     return fSaveLayerCount > 0;
 }
 
+SkSurface* SkCanvas::newSurface(const SkImageInfo& info) {
+    return this->onNewSurface(info);
+}
+
+SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info) {
+    SkBaseDevice* dev = this->getDevice();
+    return dev ? dev->newSurface(info) : NULL;
+}
+
 /////////////////////////////////////////////////////////////////////////////
 
 // can't draw it if its empty, or its too big for a fixed-point width or height
@@ -1548,17 +1577,6 @@
     }
 }
 
-SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
-                                           int width, int height,
-                                           bool isOpaque) {
-    SkBaseDevice* device = this->getDevice();
-    if (device) {
-        return device->createCompatibleDevice(config, width, height, isOpaque);
-    } else {
-        return NULL;
-    }
-}
-
 GrContext* SkCanvas::getGrContext() {
 #if SK_SUPPORT_GPU
     SkBaseDevice* device = this->getTopDevice();