Split SkDevice out of SkBitmapDevice

https://codereview.chromium.org/22978012/



git-svn-id: http://skia.googlecode.com/svn/trunk@10830 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/SkNulCanvas.h b/experimental/PdfViewer/SkNulCanvas.h
index 27dd991..6122512 100644
--- a/experimental/PdfViewer/SkNulCanvas.h
+++ b/experimental/PdfViewer/SkNulCanvas.h
@@ -8,7 +8,7 @@
     SK_DECLARE_INST_COUNT(SkNulCanvas);
 
     SkNulCanvas() {}
-    explicit SkNulCanvas(SkDevice* device) : SkCanvas(device) {}
+    explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {}
 
     explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {}
     virtual ~SkNulCanvas() {}
@@ -83,7 +83,7 @@
 
 protected:
     virtual SkCanvas* canvasForDrawIter() {return NULL;}
-    virtual SkDevice* setDevice(SkDevice* device) {return NULL;}
+    virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;}
 
 private:
     typedef SkCanvas INHERITED;
diff --git a/experimental/PdfViewer/SkPdfRenderer.cpp b/experimental/PdfViewer/SkPdfRenderer.cpp
index ef13c55..22f274a 100644
--- a/experimental/PdfViewer/SkPdfRenderer.cpp
+++ b/experimental/PdfViewer/SkPdfRenderer.cpp
@@ -242,7 +242,7 @@
 
         memcpy(bitmap.getPixels(), gDumpBitmap->getPixels(), gDumpBitmap->getSize());
 
-        SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (bitmap)));
+        SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
         SkCanvas canvas(device);
 
         // draw context stuff here
@@ -2641,7 +2641,7 @@
 
     setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(height));
 
-    SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output)));
+    SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output)));
     SkCanvas canvas(device);
 
     return renderer.renderPage(page, &canvas, rect);
diff --git a/experimental/PdfViewer/SkTrackDevice.h b/experimental/PdfViewer/SkTrackDevice.h
index 6f26121..b8c36d9 100644
--- a/experimental/PdfViewer/SkTrackDevice.h
+++ b/experimental/PdfViewer/SkTrackDevice.h
@@ -4,24 +4,24 @@
 #include "SkDevice.h"
 #include "SkTracker.h"
 
-class SkTrackDevice : public SkDevice {
+class SkTrackDevice : public SkBitmapDevice {
 public:
     SK_DECLARE_INST_COUNT(SkTrackDevice)
 
-    SkTrackDevice(const SkBitmap& bitmap) : SkDevice(bitmap)
+    SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap)
                                           , fTracker(NULL) {}
 
     SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
-        : SkDevice(bitmap, deviceProperties)
+        : SkBitmapDevice(bitmap, deviceProperties)
         , fTracker(NULL) {}
 
     SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false)
-        : SkDevice(config, width, height, isOpaque)
+        : SkBitmapDevice(config, width, height, isOpaque)
         , fTracker(NULL) {}
 
     SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
                   const SkDeviceProperties& deviceProperties)
-        : SkDevice(config, width, height, isOpaque, deviceProperties)
+        : SkBitmapDevice(config, width, height, isOpaque, deviceProperties)
         , fTracker(NULL) {}
 
     virtual ~SkTrackDevice() {}
@@ -147,7 +147,7 @@
         after();
     }
 
-    virtual void drawDevice(const SkDraw& dummy1, SkDevice* dummy2, int x, int y,
+    virtual void drawDevice(const SkDraw& dummy1, SkBaseDevice* dummy2, int x, int y,
                             const SkPaint& dummy3) {
         before();
         INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3);
@@ -171,7 +171,7 @@
 private:
     SkTracker* fTracker;
 
-    typedef SkDevice INHERITED;
+    typedef SkBitmapDevice INHERITED;
 };
 
 #endif  // EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
diff --git a/experimental/PdfViewer/pdf_viewer_main.cpp b/experimental/PdfViewer/pdf_viewer_main.cpp
index 8949e7e..7933842 100644
--- a/experimental/PdfViewer/pdf_viewer_main.cpp
+++ b/experimental/PdfViewer/pdf_viewer_main.cpp
@@ -179,7 +179,7 @@
     // Exercise all pdf codepaths as in normal rendering, but no actual bits are changed.
     if (!FLAGS_config.isEmpty() && strcmp(FLAGS_config[0], "nul") == 0) {
         SkBitmap bitmap;
-        SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (bitmap)));
+        SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
         SkNulCanvas canvas(device);
         renderer.renderPage(page < 0 ? 0 : page, &canvas, rect);
     } else {
@@ -197,9 +197,9 @@
 #else
         setup_bitmap(&bitmap, (int)SkScalarToDouble(width), (int)SkScalarToDouble(height));
 #endif
-        SkAutoTUnref<SkDevice> device;
+        SkAutoTUnref<SkBaseDevice> device;
         if (strcmp(FLAGS_config[0], "8888") == 0) {
-            device.reset(SkNEW_ARGS(SkDevice, (bitmap)));
+            device.reset(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
         }
 #if SK_SUPPORT_GPU
         else if (strcmp(FLAGS_config[0], "gpu") == 0) {