Split SkDevice into SkBaseDevice and SkBitmapDevice

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



git-svn-id: http://skia.googlecode.com/svn/trunk/src@10995 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkBBoxHierarchyRecord.cpp b/core/SkBBoxHierarchyRecord.cpp
index 9c02468..61a82ce 100644
--- a/core/SkBBoxHierarchyRecord.cpp
+++ b/core/SkBBoxHierarchyRecord.cpp
@@ -11,7 +11,7 @@
 
 SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags,
                                              SkBBoxHierarchy* h,
-                                             SkDevice* device)
+                                             SkBaseDevice* device)
     : INHERITED(recordFlags, device) {
     fStateTree = SkNEW(SkPictureStateTree);
     fBoundingHierarchy = h;
diff --git a/core/SkBBoxHierarchyRecord.h b/core/SkBBoxHierarchyRecord.h
index 27da3c9..7284ab0 100644
--- a/core/SkBBoxHierarchyRecord.h
+++ b/core/SkBBoxHierarchyRecord.h
@@ -20,7 +20,7 @@
 public:
     /** This will take a ref of h */
     SkBBoxHierarchyRecord(uint32_t recordFlags, SkBBoxHierarchy* h,
-                          SkDevice*);
+                          SkBaseDevice*);
 
     virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE;
 
diff --git a/core/SkBBoxRecord.h b/core/SkBBoxRecord.h
index 7859df1..fa8b282 100644
--- a/core/SkBBoxRecord.h
+++ b/core/SkBBoxRecord.h
@@ -19,7 +19,7 @@
 class SkBBoxRecord : public SkPictureRecord {
 public:
 
-    SkBBoxRecord(uint32_t recordFlags, SkDevice* device)
+    SkBBoxRecord(uint32_t recordFlags, SkBaseDevice* device)
             : INHERITED(recordFlags, device) { }
     virtual ~SkBBoxRecord() { }
 
diff --git a/core/SkCanvas.cpp b/core/SkCanvas.cpp
index ff688f5..7add524 100644
--- a/core/SkCanvas.cpp
+++ b/core/SkCanvas.cpp
@@ -8,8 +8,8 @@
 
 
 #include "SkCanvas.h"
+#include "SkBitmapDevice.h"
 #include "SkBounder.h"
-#include "SkDevice.h"
 #include "SkDeviceImageFilterProxy.h"
 #include "SkDraw.h"
 #include "SkDrawFilter.h"
@@ -129,7 +129,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-/*  This is the record we keep for each SkDevice that the user installs.
+/*  This is the record we keep for each SkBaseDevice that the user installs.
     The clip/matrix/proc are fields that reflect the top of the save/restore
     stack. Whenever the canvas changes, it marks a dirty flag, and then before
     these are used (assuming we're not on a layer) we rebuild these cache
@@ -138,12 +138,12 @@
 */
 struct DeviceCM {
     DeviceCM*           fNext;
-    SkDevice*           fDevice;
+    SkBaseDevice*       fDevice;
     SkRasterClip        fClip;
     const SkMatrix*     fMatrix;
     SkPaint*            fPaint; // may be null (in the future)
 
-    DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
+    DeviceCM(SkBaseDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
             : fNext(NULL) {
         if (NULL != device) {
             device->ref();
@@ -315,7 +315,7 @@
         return false;
     }
 
-    SkDevice* getDevice() const { return fDevice; }
+    SkBaseDevice* getDevice() const { return fDevice; }
     int getX() const { return fDevice->getOrigin().x(); }
     int getY() const { return fDevice->getOrigin().y(); }
     const SkMatrix& getMatrix() const { return *fMatrix; }
@@ -482,7 +482,7 @@
 
 ////////////////////////////////////////////////////////////////////////////
 
-SkDevice* SkCanvas::init(SkDevice* device) {
+SkBaseDevice* SkCanvas::init(SkBaseDevice* device) {
     fBounder = NULL;
     fLocalBoundsCompareType.setEmpty();
     fLocalBoundsCompareTypeDirty = true;
@@ -511,7 +511,7 @@
     this->init(NULL);
 }
 
-SkCanvas::SkCanvas(SkDevice* device)
+SkCanvas::SkCanvas(SkBaseDevice* device)
         : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
     inc_canvas();
 
@@ -522,7 +522,7 @@
         : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
     inc_canvas();
 
-    this->init(SkNEW_ARGS(SkDevice, (bitmap)))->unref();
+    this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
 }
 
 SkCanvas::~SkCanvas() {
@@ -564,37 +564,37 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void SkCanvas::flush() {
-    SkDevice* device = this->getDevice();
+    SkBaseDevice* device = this->getDevice();
     if (device) {
         device->flush();
     }
 }
 
 SkISize SkCanvas::getDeviceSize() const {
-    SkDevice* d = this->getDevice();
+    SkBaseDevice* d = this->getDevice();
     return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
 }
 
-SkDevice* SkCanvas::getDevice() const {
+SkBaseDevice* SkCanvas::getDevice() const {
     // return root device
     MCRec* rec = (MCRec*) fMCStack.front();
     SkASSERT(rec && rec->fLayer);
     return rec->fLayer->fDevice;
 }
 
-SkDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
+SkBaseDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
     if (updateMatrixClip) {
         const_cast<SkCanvas*>(this)->updateDeviceCMCache();
     }
     return fMCRec->fTopLayer->fDevice;
 }
 
-SkDevice* SkCanvas::setDevice(SkDevice* device) {
+SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) {
     // return root device
     SkDeque::F2BIter iter(fMCStack);
     MCRec*           rec = (MCRec*)iter.next();
     SkASSERT(rec && rec->fLayer);
-    SkDevice*       rootDevice = rec->fLayer->fDevice;
+    SkBaseDevice*    rootDevice = rec->fLayer->fDevice;
 
     if (rootDevice == device) {
         return device;
@@ -644,7 +644,7 @@
 bool SkCanvas::readPixels(SkBitmap* bitmap,
                           int x, int y,
                           Config8888 config8888) {
-    SkDevice* device = this->getDevice();
+    SkBaseDevice* device = this->getDevice();
     if (!device) {
         return false;
     }
@@ -652,7 +652,7 @@
 }
 
 bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
-    SkDevice* device = this->getDevice();
+    SkBaseDevice* device = this->getDevice();
     if (!device) {
         return false;
     }
@@ -676,7 +676,7 @@
 
 void SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y,
                            Config8888 config8888) {
-    SkDevice* device = this->getDevice();
+    SkBaseDevice* device = this->getDevice();
     if (device) {
         if (SkIRect::Intersects(SkIRect::MakeSize(this->getDeviceSize()),
                                 SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()))) {
@@ -748,7 +748,7 @@
     uint32_t configMask = 0;
     for (int i = canvas->countLayerDevices() - 1; i >= 0; --i)
     {
-        SkDevice* device = canvas->getLayerDevice(i);
+        SkBaseDevice* device = canvas->getLayerDevice(i);
         if (device->intersects(bounds))
             configMask |= 1 << device->config();
     }
@@ -849,7 +849,7 @@
     bool isOpaque;
     SkBitmap::Config config = resolve_config(this, ir, flags, &isOpaque);
 
-    SkDevice* device;
+    SkBaseDevice* device;
     if (paint && paint->getImageFilter()) {
         device = this->createCompatibleDevice(config, ir.width(), ir.height(),
                                               isOpaque);
@@ -981,7 +981,7 @@
     LOOPER_END
 }
 
-void SkCanvas::internalDrawDevice(SkDevice* srcDev, int x, int y,
+void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
                                   const SkPaint* paint) {
     SkPaint tmp;
     if (NULL == paint) {
@@ -991,7 +991,7 @@
 
     LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type)
     while (iter.next()) {
-        SkDevice* dstDev = iter.fDevice;
+        SkBaseDevice* dstDev = iter.fDevice;
         paint = &looper.paint();
         SkImageFilter* filter = paint->getImageFilter();
         SkIPoint pos = { x - iter.getX(), y - iter.getY() };
@@ -1167,7 +1167,7 @@
             return currClip->op(clip, op);
         }
     } else {
-        const SkDevice* device = canvas->getDevice();
+        const SkBaseDevice* device = canvas->getDevice();
         if (!device) {
             return currClip->setEmpty();
         }
@@ -1361,7 +1361,7 @@
 #ifdef SK_DEBUG
 void SkCanvas::validateClip() const {
     // construct clipRgn from the clipstack
-    const SkDevice* device = this->getDevice();
+    const SkBaseDevice* device = this->getDevice();
     if (!device) {
         SkASSERT(this->getTotalClip().isEmpty());
         return;
@@ -1546,10 +1546,10 @@
     return fMCRec->fRasterClip->forceGetBW();
 }
 
-SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
+SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
                                       int width, int height,
                                       bool isOpaque) {
-    SkDevice* device = this->getTopDevice();
+    SkBaseDevice* device = this->getTopDevice();
     if (device) {
         return device->createCompatibleDeviceForSaveLayer(config, width, height,
                                                           isOpaque);
@@ -1558,10 +1558,10 @@
     }
 }
 
-SkDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
+SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
                                            int width, int height,
                                            bool isOpaque) {
-    SkDevice* device = this->getDevice();
+    SkBaseDevice* device = this->getDevice();
     if (device) {
         return device->createCompatibleDevice(config, width, height, isOpaque);
     } else {
@@ -1877,8 +1877,8 @@
 
 class SkDeviceFilteredPaint {
 public:
-    SkDeviceFilteredPaint(SkDevice* device, const SkPaint& paint) {
-        SkDevice::TextFlags flags;
+    SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) {
+        SkBaseDevice::TextFlags flags;
         if (device->filterTextFlags(paint, &flags)) {
             SkPaint* newPaint = fLazy.set(paint);
             newPaint->setFlags(flags.fFlags);
@@ -2206,7 +2206,7 @@
     fDone = !fImpl->next();
 }
 
-SkDevice* SkCanvas::LayerIter::device() const {
+SkBaseDevice* SkCanvas::LayerIter::device() const {
     return fImpl->getDevice();
 }
 
diff --git a/core/SkDevice.cpp b/core/SkDevice.cpp
index d06f6e6..69b0f6a 100644
--- a/core/SkDevice.cpp
+++ b/core/SkDevice.cpp
@@ -5,6 +5,7 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+#include "SkBitmapDevice.h"
 #include "SkDevice.h"
 #include "SkDeviceProperties.h"
 #include "SkDraw.h"
@@ -15,7 +16,8 @@
 #include "SkRRect.h"
 #include "SkShader.h"
 
-SK_DEFINE_INST_COUNT(SkDevice)
+SK_DEFINE_INST_COUNT(SkBaseDevice)
+SK_DEFINE_INST_COUNT(SkBitmapDevice)
 
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -24,20 +26,13 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkDevice::SkDevice(const SkBitmap& bitmap)
-    : fBitmap(bitmap), fLeakyProperties(SkDeviceProperties::MakeDefault())
-#ifdef SK_DEBUG
-    , fAttachedToCanvas(false)
-#endif
-{
-    fOrigin.setZero();
-    fMetaData = NULL;
-
+SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) 
+    : fBitmap(bitmap) {
     SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config());
 }
 
-SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
-    : fBitmap(bitmap), fLeakyProperties(deviceProperties)
+SkBaseDevice::SkBaseDevice()
+    : fLeakyProperties(SkDeviceProperties::MakeDefault()) 
 #ifdef SK_DEBUG
     , fAttachedToCanvas(false)
 #endif
@@ -46,25 +41,12 @@
     fMetaData = NULL;
 }
 
-SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque)
-    : fLeakyProperties(SkDeviceProperties::MakeDefault())
-#ifdef SK_DEBUG
-    , fAttachedToCanvas(false)
-#endif
-{
-    fOrigin.setZero();
-    fMetaData = NULL;
-
-    fBitmap.setConfig(config, width, height);
-    fBitmap.allocPixels();
-    fBitmap.setIsOpaque(isOpaque);
-    if (!isOpaque) {
-        fBitmap.eraseColor(SK_ColorTRANSPARENT);
-    }
+SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
+    : SkBaseDevice(deviceProperties)
+    , fBitmap(bitmap) {
 }
 
-SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
-                   const SkDeviceProperties& deviceProperties)
+SkBaseDevice::SkBaseDevice(const SkDeviceProperties& deviceProperties)
     : fLeakyProperties(deviceProperties)
 #ifdef SK_DEBUG
     , fAttachedToCanvas(false)
@@ -72,6 +54,20 @@
 {
     fOrigin.setZero();
     fMetaData = NULL;
+}
+
+SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque) {
+    fBitmap.setConfig(config, width, height);
+    fBitmap.allocPixels();
+    fBitmap.setIsOpaque(isOpaque);
+    if (!isOpaque) {
+        fBitmap.eraseColor(SK_ColorTRANSPARENT);
+    }
+}
+
+SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+                         const SkDeviceProperties& deviceProperties)
+    : SkBaseDevice(deviceProperties) {
 
     fBitmap.setConfig(config, width, height);
     fBitmap.allocPixels();
@@ -81,39 +77,43 @@
     }
 }
 
-SkDevice::~SkDevice() {
+SkBaseDevice::~SkBaseDevice() {
     delete fMetaData;
 }
 
-void SkDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
+SkBitmapDevice::~SkBitmapDevice() {
+}
+
+void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
     SkASSERT(bm.width() == fBitmap.width());
     SkASSERT(bm.height() == fBitmap.height());
     fBitmap = bm;   // intent is to use bm's pixelRef (and rowbytes/config)
     fBitmap.lockPixels();
 }
 
-SkDevice* SkDevice::createCompatibleDevice(SkBitmap::Config config,
-                                           int width, int height,
-                                           bool isOpaque) {
+SkBaseDevice* SkBaseDevice::createCompatibleDevice(SkBitmap::Config config,
+                                                   int width, int height,
+                                                   bool isOpaque) {
     return this->onCreateCompatibleDevice(config, width, height,
                                           isOpaque, kGeneral_Usage);
 }
 
-SkDevice* SkDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
-                                                       int width, int height,
-                                                       bool isOpaque) {
+SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
+                                                               int width, int height,
+                                                               bool isOpaque) {
     return this->onCreateCompatibleDevice(config, width, height,
                                           isOpaque, kSaveLayer_Usage);
 }
 
-SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config,
-                                             int width, int height,
-                                             bool isOpaque,
-                                             Usage usage) {
-    return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque, fLeakyProperties));
+SkBaseDevice* SkBitmapDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+                                                       int width, int height,
+                                                       bool isOpaque,
+                                                       Usage usage) {
+    return SkNEW_ARGS(SkBitmapDevice,(config, width, height, isOpaque, 
+                                      this->getDeviceProperties()));
 }
 
-SkMetaData& SkDevice::getMetaData() {
+SkMetaData& SkBaseDevice::getMetaData() {
     // metadata users are rare, so we lazily allocate it. If that changes we
     // can decide to just make it a field in the device (rather than a ptr)
     if (NULL == fMetaData) {
@@ -122,61 +122,60 @@
     return *fMetaData;
 }
 
-void SkDevice::lockPixels() {
+void SkBitmapDevice::lockPixels() {
     if (fBitmap.lockPixelsAreWritable()) {
         fBitmap.lockPixels();
     }
 }
 
-void SkDevice::unlockPixels() {
+void SkBitmapDevice::unlockPixels() {
     if (fBitmap.lockPixelsAreWritable()) {
         fBitmap.unlockPixels();
     }
 }
 
-const SkBitmap& SkDevice::accessBitmap(bool changePixels) {
-    const SkBitmap& bitmap = this->onAccessBitmap(&fBitmap);
+const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
+    const SkBitmap& bitmap = this->onAccessBitmap();
     if (changePixels) {
         bitmap.notifyPixelsChanged();
     }
     return bitmap;
 }
 
-void SkDevice::getGlobalBounds(SkIRect* bounds) const {
+void SkBitmapDevice::getGlobalBounds(SkIRect* bounds) const {
     if (bounds) {
-        bounds->setXYWH(fOrigin.x(), fOrigin.y(),
+        const SkIPoint& origin = this->getOrigin();
+        bounds->setXYWH(origin.x(), origin.y(),
                         fBitmap.width(), fBitmap.height());
     }
 }
 
-void SkDevice::clear(SkColor color) {
+void SkBitmapDevice::clear(SkColor color) {
     fBitmap.eraseColor(color);
 }
 
-const SkBitmap& SkDevice::onAccessBitmap(SkBitmap* bitmap) {return *bitmap;}
-
-void SkDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& region,
-                             const SkClipStack& clipStack) {
+const SkBitmap& SkBitmapDevice::onAccessBitmap() {
+    return fBitmap;
 }
 
-bool SkDevice::canHandleImageFilter(SkImageFilter*) {
+bool SkBitmapDevice::canHandleImageFilter(SkImageFilter*) {
     return false;
 }
 
-bool SkDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
-                           const SkMatrix& ctm, SkBitmap* result,
-                           SkIPoint* offset) {
+bool SkBitmapDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
+                                 const SkMatrix& ctm, SkBitmap* result,
+                                 SkIPoint* offset) {
     return false;
 }
 
-bool SkDevice::allowImageFilter(SkImageFilter*) {
+bool SkBitmapDevice::allowImageFilter(SkImageFilter*) {
     return true;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
-bool SkDevice::readPixels(SkBitmap* bitmap, int x, int y,
-                          SkCanvas::Config8888 config8888) {
+bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y,
+                              SkCanvas::Config8888 config8888) {
     if (SkBitmap::kARGB_8888_Config != bitmap->config() ||
         NULL != bitmap->getTexture()) {
         return false;
@@ -220,21 +219,21 @@
 }
 
 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
-    const SkCanvas::Config8888 SkDevice::kPMColorAlias =
+    const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
         SkCanvas::kBGRA_Premul_Config8888;
 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
-    const SkCanvas::Config8888 SkDevice::kPMColorAlias =
+    const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
         SkCanvas::kRGBA_Premul_Config8888;
 #else
-    const SkCanvas::Config8888 SkDevice::kPMColorAlias =
+    const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
         (SkCanvas::Config8888) -1;
 #endif
 
 #include <SkConfig8888.h>
 
-bool SkDevice::onReadPixels(const SkBitmap& bitmap,
-                            int x, int y,
-                            SkCanvas::Config8888 config8888) {
+bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap,
+                                  int x, int y,
+                                  SkCanvas::Config8888 config8888) {
     SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
     SkASSERT(!bitmap.isNull());
     SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height())));
@@ -257,9 +256,9 @@
     return true;
 }
 
-void SkDevice::writePixels(const SkBitmap& bitmap,
-                           int x, int y,
-                           SkCanvas::Config8888 config8888) {
+void SkBitmapDevice::writePixels(const SkBitmap& bitmap,
+                                 int x, int y,
+                                 SkCanvas::Config8888 config8888) {
     if (bitmap.isNull() || bitmap.getTexture()) {
         return;
     }
@@ -328,22 +327,22 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void SkDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
+void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
     draw.drawPaint(paint);
 }
 
-void SkDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
-                          const SkPoint pts[], const SkPaint& paint) {
+void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
+                                const SkPoint pts[], const SkPaint& paint) {
     CHECK_FOR_NODRAW_ANNOTATION(paint);
     draw.drawPoints(mode, count, pts, paint);
 }
 
-void SkDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
+void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
     CHECK_FOR_NODRAW_ANNOTATION(paint);
     draw.drawRect(r, paint);
 }
 
-void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
+void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
     CHECK_FOR_NODRAW_ANNOTATION(paint);
 
     SkPath path;
@@ -353,7 +352,7 @@
     this->drawPath(draw, path, paint, NULL, true);
 }
 
-void SkDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
+void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
     CHECK_FOR_NODRAW_ANNOTATION(paint);
 
     SkPath  path;
@@ -363,22 +362,22 @@
     this->drawPath(draw, path, paint, NULL, true);
 }
 
-void SkDevice::drawPath(const SkDraw& draw, const SkPath& path,
-                        const SkPaint& paint, const SkMatrix* prePathMatrix,
-                        bool pathIsMutable) {
+void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
+                              const SkPaint& paint, const SkMatrix* prePathMatrix,
+                              bool pathIsMutable) {
     CHECK_FOR_NODRAW_ANNOTATION(paint);
     draw.drawPath(path, paint, prePathMatrix, pathIsMutable);
 }
 
-void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
-                          const SkMatrix& matrix, const SkPaint& paint) {
+void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
+                                const SkMatrix& matrix, const SkPaint& paint) {
     draw.drawBitmap(bitmap, matrix, paint);
 }
 
-void SkDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
-                              const SkRect* src, const SkRect& dst,
-                              const SkPaint& paint,
-                              SkCanvas::DrawBitmapRectFlags flags) {
+void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
+                                    const SkRect* src, const SkRect& dst,
+                                    const SkPaint& paint,
+                                    SkCanvas::DrawBitmapRectFlags flags) {
     SkMatrix    matrix;
     SkRect      bitmapBounds, tmpSrc, tmpDst;
     SkBitmap    tmpBitmap;
@@ -462,56 +461,56 @@
     this->drawRect(draw, *dstPtr, paintWithShader);
 }
 
-void SkDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
-                              int x, int y, const SkPaint& paint) {
+void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
+                                int x, int y, const SkPaint& paint) {
     draw.drawSprite(bitmap, x, y, paint);
 }
 
-void SkDevice::drawText(const SkDraw& draw, const void* text, size_t len,
-                            SkScalar x, SkScalar y, const SkPaint& paint) {
+void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len,
+                              SkScalar x, SkScalar y, const SkPaint& paint) {
     draw.drawText((const char*)text, len, x, y, paint);
 }
 
-void SkDevice::drawPosText(const SkDraw& draw, const void* text, size_t len,
-                               const SkScalar xpos[], SkScalar y,
-                               int scalarsPerPos, const SkPaint& paint) {
+void SkBitmapDevice::drawPosText(const SkDraw& draw, const void* text, size_t len,
+                                 const SkScalar xpos[], SkScalar y,
+                                 int scalarsPerPos, const SkPaint& paint) {
     draw.drawPosText((const char*)text, len, xpos, y, scalarsPerPos, paint);
 }
 
-void SkDevice::drawTextOnPath(const SkDraw& draw, const void* text,
-                                  size_t len, const SkPath& path,
-                                  const SkMatrix* matrix,
-                                  const SkPaint& paint) {
+void SkBitmapDevice::drawTextOnPath(const SkDraw& draw, const void* text,
+                                    size_t len, const SkPath& path,
+                                    const SkMatrix* matrix,
+                                    const SkPaint& paint) {
     draw.drawTextOnPath((const char*)text, len, path, matrix, paint);
 }
 
 #ifdef SK_BUILD_FOR_ANDROID
-void SkDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
-                                     const SkPoint pos[], const SkPaint& paint,
-                                     const SkPath& path, const SkMatrix* matrix) {
+void SkBitmapDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
+                                       const SkPoint pos[], const SkPaint& paint,
+                                       const SkPath& path, const SkMatrix* matrix) {
     draw.drawPosTextOnPath((const char*)text, len, pos, paint, path, matrix);
 }
 #endif
 
-void SkDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
-                                int vertexCount,
-                                const SkPoint verts[], const SkPoint textures[],
-                                const SkColor colors[], SkXfermode* xmode,
-                                const uint16_t indices[], int indexCount,
-                                const SkPaint& paint) {
+void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
+                                  int vertexCount,
+                                  const SkPoint verts[], const SkPoint textures[],
+                                  const SkColor colors[], SkXfermode* xmode,
+                                  const uint16_t indices[], int indexCount,
+                                  const SkPaint& paint) {
     draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode,
                       indices, indexCount, paint);
 }
 
-void SkDevice::drawDevice(const SkDraw& draw, SkDevice* device,
-                              int x, int y, const SkPaint& paint) {
+void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
+                                int x, int y, const SkPaint& paint) {
     const SkBitmap& src = device->accessBitmap(false);
     draw.drawSprite(src, x, y, paint);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
-bool SkDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
+bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
     if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
         // we're cool with the paint as is
         return false;
diff --git a/core/SkDeviceImageFilterProxy.h b/core/SkDeviceImageFilterProxy.h
index 98a120c..03fcb68 100644
--- a/core/SkDeviceImageFilterProxy.h
+++ b/core/SkDeviceImageFilterProxy.h
@@ -12,9 +12,9 @@
 
 class SkDeviceImageFilterProxy : public SkImageFilter::Proxy {
 public:
-    SkDeviceImageFilterProxy(SkDevice* device) : fDevice(device) {}
+    SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {}
 
-    virtual SkDevice* createDevice(int w, int h) SK_OVERRIDE {
+    virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE {
         return fDevice->createCompatibleDevice(SkBitmap::kARGB_8888_Config,
                                                w, h, false);
     }
@@ -28,7 +28,7 @@
     }
 
 private:
-    SkDevice* fDevice;
+    SkBaseDevice* fDevice;
 };
 
 #endif
diff --git a/core/SkPicture.cpp b/core/SkPicture.cpp
index c94641b..1aa4528 100644
--- a/core/SkPicture.cpp
+++ b/core/SkPicture.cpp
@@ -11,9 +11,9 @@
 #include "SkPicturePlayback.h"
 #include "SkPictureRecord.h"
 
+#include "SkBitmapDevice.h"
 #include "SkCanvas.h"
 #include "SkChunkAlloc.h"
-#include "SkDevice.h"
 #include "SkPicture.h"
 #include "SkRegion.h"
 #include "SkStream.h"
@@ -205,7 +205,7 @@
 
     SkBitmap bm;
     bm.setConfig(SkBitmap::kNo_Config, width, height);
-    SkAutoTUnref<SkDevice> dev(SkNEW_ARGS(SkDevice, (bm)));
+    SkAutoTUnref<SkBaseDevice> dev(SkNEW_ARGS(SkBitmapDevice, (bm)));
 
     // Must be set before calling createBBoxHierarchy
     fWidth = width;
diff --git a/core/SkPictureRecord.cpp b/core/SkPictureRecord.cpp
index 4134f8d..92a1448 100644
--- a/core/SkPictureRecord.cpp
+++ b/core/SkPictureRecord.cpp
@@ -28,7 +28,7 @@
 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect);
 
-SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* device) :
+SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) :
         INHERITED(device),
         fBoundingHierarchy(NULL),
         fStateTree(NULL),
@@ -138,7 +138,7 @@
     return gPaintOffsets[op] * sizeof(uint32_t) + overflow;
 }
 
-SkDevice* SkPictureRecord::setDevice(SkDevice* device) {
+SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) {
     SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas");
     return this->INHERITED::setDevice(device);
 }
diff --git a/core/SkPictureRecord.h b/core/SkPictureRecord.h
index b900f4f..a1eb40a 100644
--- a/core/SkPictureRecord.h
+++ b/core/SkPictureRecord.h
@@ -30,10 +30,10 @@
 
 class SkPictureRecord : public SkCanvas {
 public:
-    SkPictureRecord(uint32_t recordFlags, SkDevice*);
+    SkPictureRecord(uint32_t recordFlags, SkBaseDevice*);
     virtual ~SkPictureRecord();
 
-    virtual SkDevice* setDevice(SkDevice* device) SK_OVERRIDE;
+    virtual SkBaseDevice* setDevice(SkBaseDevice* device) SK_OVERRIDE;
 
     virtual int save(SaveFlags) SK_OVERRIDE;
     virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE;
diff --git a/device/xps/SkXPSDevice.cpp b/device/xps/SkXPSDevice.cpp
index 79bb6ef..0881a0f 100644
--- a/device/xps/SkXPSDevice.cpp
+++ b/device/xps/SkXPSDevice.cpp
@@ -111,7 +111,7 @@
 }
 
 SkXPSDevice::SkXPSDevice()
-    : SkDevice(make_fake_bitmap(10000, 10000))
+    : SkBitmapDevice(make_fake_bitmap(10000, 10000))
     , fCurrentPage(0) {
 }
 
@@ -2375,7 +2375,7 @@
      d.drawTextOnPath((const char*)text, len, path, matrix, paint);
 }
 
-void SkXPSDevice::drawDevice(const SkDraw& d, SkDevice* dev,
+void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev,
                              int x, int y,
                              const SkPaint&) {
     SkXPSDevice* that = static_cast<SkXPSDevice*>(dev);
@@ -2407,11 +2407,11 @@
     return false;
 }
 
-SkDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
-                                                int width, int height,
-                                                bool isOpaque,
-                                                Usage usage) {
-    if (SkDevice::kGeneral_Usage == usage) {
+SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+                                                    int width, int height,
+                                                    bool isOpaque,
+                                                    Usage usage) {
+    if (SkBaseDevice::kGeneral_Usage == usage) {
         return NULL;
         SK_CRASH();
         //To what stream do we write?
@@ -2425,7 +2425,7 @@
 }
 
 SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory)
-    : SkDevice(make_fake_bitmap(10000, 10000))
+    : SkBitmapDevice(make_fake_bitmap(10000, 10000))
     , fCurrentPage(0) {
 
     HRVM(CoCreateInstance(
diff --git a/effects/SkColorFilterImageFilter.cpp b/effects/SkColorFilterImageFilter.cpp
index 16a36bb..cfda0b7 100755
--- a/effects/SkColorFilterImageFilter.cpp
+++ b/effects/SkColorFilterImageFilter.cpp
@@ -111,7 +111,7 @@
         return false;
     }
 
-    SkAutoTUnref<SkDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
+    SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
     SkCanvas canvas(device.get());
     SkPaint paint;
 
diff --git a/effects/SkDropShadowImageFilter.cpp b/effects/SkDropShadowImageFilter.cpp
index b8bbfd6..75a8668 100644
--- a/effects/SkDropShadowImageFilter.cpp
+++ b/effects/SkDropShadowImageFilter.cpp
@@ -46,7 +46,7 @@
     if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc))
         return false;
 
-    SkAutoTUnref<SkDevice> device(proxy->createDevice(src.width(), src.height()));
+    SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(src.width(), src.height()));
     SkCanvas canvas(device.get());
 
     SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigma, fSigma));
diff --git a/effects/SkMergeImageFilter.cpp b/effects/SkMergeImageFilter.cpp
index 0c1388f..0c47c91 100755
--- a/effects/SkMergeImageFilter.cpp
+++ b/effects/SkMergeImageFilter.cpp
@@ -109,7 +109,7 @@
     const int x0 = bounds.left();
     const int y0 = bounds.top();
 
-    SkAutoTUnref<SkDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
+    SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
     if (NULL == dst) {
         return false;
     }
diff --git a/effects/SkRectShaderImageFilter.cpp b/effects/SkRectShaderImageFilter.cpp
index ada861f..2ee1d4a 100644
--- a/effects/SkRectShaderImageFilter.cpp
+++ b/effects/SkRectShaderImageFilter.cpp
@@ -56,8 +56,8 @@
         return false;
     }
 
-    SkAutoTUnref<SkDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()),
-                                                      SkScalarCeilToInt(rect.height())));
+    SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()),
+                                                          SkScalarCeilToInt(rect.height())));
     SkCanvas canvas(device.get());
     SkPaint paint;
     paint.setShader(fShader);
diff --git a/effects/SkTestImageFilters.cpp b/effects/SkTestImageFilters.cpp
index a919ded..788c33a 100755
--- a/effects/SkTestImageFilters.cpp
+++ b/effects/SkTestImageFilters.cpp
@@ -9,11 +9,11 @@
 // with the following:
 //
 //  SkCanvas canvas(device);
-//  SkAutoTUnref<SkDevice> aur(device);
+//  SkAutoTUnref<SkBaseDevice> aur(device);
 //
 class OwnDeviceCanvas : public SkCanvas {
 public:
-    OwnDeviceCanvas(SkDevice* device) : SkCanvas(device) {
+    OwnDeviceCanvas(SkBaseDevice* device) : SkCanvas(device) {
         SkSafeUnref(device);
     }
 };
@@ -41,7 +41,7 @@
 
     // downsample
     {
-        SkDevice* dev = proxy->createDevice(dstW, dstH);
+        SkBaseDevice* dev = proxy->createDevice(dstW, dstH);
         if (NULL == dev) {
             return false;
         }
@@ -56,7 +56,7 @@
 
     // upscale
     {
-        SkDevice* dev = proxy->createDevice(src.width(), src.height());
+        SkBaseDevice* dev = proxy->createDevice(src.width(), src.height());
         if (NULL == dev) {
             return false;
         }
diff --git a/gpu/SkGpuDevice.cpp b/gpu/SkGpuDevice.cpp
index f77fdf7..571b8a0 100644
--- a/gpu/SkGpuDevice.cpp
+++ b/gpu/SkGpuDevice.cpp
@@ -161,12 +161,12 @@
 }
 
 SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture)
-: SkDevice(make_bitmap(context, texture->asRenderTarget())) {
+    : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
     this->initFromRenderTarget(context, texture->asRenderTarget(), false);
 }
 
 SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget)
-: SkDevice(make_bitmap(context, renderTarget)) {
+    : SkBitmapDevice(make_bitmap(context, renderTarget)) {
     this->initFromRenderTarget(context, renderTarget, false);
 }
 
@@ -203,7 +203,7 @@
                          int width,
                          int height,
                          int sampleCount)
-    : SkDevice(config, width, height, false /*isOpaque*/) {
+    : SkBitmapDevice(config, width, height, false /*isOpaque*/) {
 
     fDrawProcs = NULL;
 
@@ -1436,7 +1436,7 @@
     fContext->drawRectToRect(grPaint, dstRect, paintRect, &m);
 }
 
-static bool filter_texture(SkDevice* device, GrContext* context,
+static bool filter_texture(SkBaseDevice* device, GrContext* context,
                            GrTexture* texture, SkImageFilter* filter,
                            int w, int h, const SkMatrix& ctm, SkBitmap* result,
                            SkIPoint* offset) {
@@ -1537,7 +1537,7 @@
     this->drawBitmapCommon(draw, bitmap, &tmpSrc, matrix, paint, flags);
 }
 
-void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
+void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
                              int x, int y, const SkPaint& paint) {
     // clear of the source device must occur before CHECK_SHOULD_DRAW
     SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
@@ -1822,10 +1822,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
-                                                int width, int height,
-                                                bool isOpaque,
-                                                Usage usage) {
+SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+                                                    int width, int height,
+                                                    bool isOpaque,
+                                                    Usage usage) {
     GrTextureDesc desc;
     desc.fConfig = fRenderTarget->config();
     desc.fFlags = kRenderTarget_GrTextureFlagBit;
@@ -1858,7 +1858,7 @@
 SkGpuDevice::SkGpuDevice(GrContext* context,
                          GrTexture* texture,
                          bool needClear)
-    : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
+    : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
 
     SkASSERT(texture && texture->asRenderTarget());
     // This constructor is called from onCreateCompatibleDevice. It has locked the RT in the texture
diff --git a/pdf/SkPDFDevice.cpp b/pdf/SkPDFDevice.cpp
index a24c4ec..02dda02 100644
--- a/pdf/SkPDFDevice.cpp
+++ b/pdf/SkPDFDevice.cpp
@@ -566,10 +566,10 @@
     }
 }
 
-SkDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
-                                                int width, int height,
-                                                bool isOpaque,
-                                                Usage usage) {
+SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+                                                    int width, int height,
+                                                    bool isOpaque,
+                                                    Usage usage) {
     SkMatrix initialTransform;
     initialTransform.reset();
     SkISize size = SkISize::Make(width, height);
@@ -672,7 +672,7 @@
 // TODO(vandebo) change pageSize to SkSize.
 SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
                          const SkMatrix& initialTransform)
-    : SkDevice(makeContentBitmap(contentSize, &initialTransform)),
+    : SkBitmapDevice(makeContentBitmap(contentSize, &initialTransform)),
       fPageSize(pageSize),
       fContentSize(contentSize),
       fLastContentEntry(NULL),
@@ -696,7 +696,7 @@
 SkPDFDevice::SkPDFDevice(const SkISize& layerSize,
                          const SkClipStack& existingClipStack,
                          const SkRegion& existingClipRegion)
-    : SkDevice(makeContentBitmap(layerSize, NULL)),
+    : SkBitmapDevice(makeContentBitmap(layerSize, NULL)),
       fPageSize(layerSize),
       fContentSize(layerSize),
       fExistingClipStack(existingClipStack),
@@ -1153,11 +1153,11 @@
     NOT_IMPLEMENTED("drawVerticies", true);
 }
 
-void SkPDFDevice::drawDevice(const SkDraw& d, SkDevice* device, int x, int y,
+void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, int x, int y,
                              const SkPaint& paint) {
     if ((device->getDeviceCapabilities() & kVector_Capability) == 0) {
         // If we somehow get a raster device, do what our parent would do.
-        SkDevice::drawDevice(d, device, x, y, paint);
+        INHERITED::drawDevice(d, device, x, y, paint);
         return;
     }
 
diff --git a/pipe/SkGPipeWrite.cpp b/pipe/SkGPipeWrite.cpp
index f646bab..58ba102 100644
--- a/pipe/SkGPipeWrite.cpp
+++ b/pipe/SkGPipeWrite.cpp
@@ -7,12 +7,12 @@
  */
 
 #include "SkAnnotation.h"
+#include "SkBitmapDevice.h"
 #include "SkBitmapHeap.h"
 #include "SkCanvas.h"
 #include "SkColorFilter.h"
 #include "SkData.h"
 #include "SkDrawLooper.h"
-#include "SkDevice.h"
 #include "SkGPipe.h"
 #include "SkGPipePriv.h"
 #include "SkImageFilter.h"
@@ -432,7 +432,7 @@
     // We don't allocate pixels for the bitmap
     SkBitmap bitmap;
     bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
-    SkDevice* device = SkNEW_ARGS(SkDevice, (bitmap));
+    SkBaseDevice* device = SkNEW_ARGS(SkBitmapDevice, (bitmap));
     this->setDevice(device)->unref();
 
     // Tell the reader the appropriate flags to use.
diff --git a/pipe/utils/SamplePipeControllers.cpp b/pipe/utils/SamplePipeControllers.cpp
index a23d775..1e25cb6 100644
--- a/pipe/utils/SamplePipeControllers.cpp
+++ b/pipe/utils/SamplePipeControllers.cpp
@@ -7,8 +7,8 @@
 
 #include "SamplePipeControllers.h"
 
+#include "SkBitmapDevice.h"
 #include "SkCanvas.h"
-#include "SkDevice.h"
 #include "SkGPipe.h"
 #include "SkMatrix.h"
 
@@ -55,7 +55,7 @@
 
         SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect);
         SkASSERT(extracted);
-        SkDevice* device = new SkDevice(fBitmaps[i]);
+        SkBaseDevice* device = new SkBitmapDevice(fBitmaps[i]);
         SkCanvas* canvas = new SkCanvas(device);
         device->unref();
         if (initial != NULL) {
diff --git a/utils/SkDeferredCanvas.cpp b/utils/SkDeferredCanvas.cpp
index e3b761f..4509038 100644
--- a/utils/SkDeferredCanvas.cpp
+++ b/utils/SkDeferredCanvas.cpp
@@ -8,9 +8,9 @@
 
 #include "SkDeferredCanvas.h"
 
+#include "SkBitmapDevice.h"
 #include "SkChunkAlloc.h"
 #include "SkColorFilter.h"
-#include "SkDevice.h"
 #include "SkDrawFilter.h"
 #include "SkGPipe.h"
 #include "SkPaint.h"
@@ -137,16 +137,16 @@
 //-----------------------------------------------------------------------------
 // DeferredDevice
 //-----------------------------------------------------------------------------
-class DeferredDevice : public SkDevice {
+class DeferredDevice : public SkBitmapDevice {
 public:
-    explicit DeferredDevice(SkDevice* immediateDevice);
+    explicit DeferredDevice(SkBaseDevice* immediateDevice);
     explicit DeferredDevice(SkSurface* surface);
     ~DeferredDevice();
 
     void setNotificationClient(SkDeferredCanvas::NotificationClient* notificationClient);
     SkCanvas* recordingCanvas();
     SkCanvas* immediateCanvas() const {return fImmediateCanvas;}
-    SkDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
+    SkBaseDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
     SkImage* newImageSnapshot();
     void setSurface(SkSurface* surface);
     bool isFreshFrame();
@@ -165,24 +165,24 @@
     virtual int height() const SK_OVERRIDE;
     virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
 
-    virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
-                                               int width, int height,
-                                               bool isOpaque,
-                                               Usage usage) SK_OVERRIDE;
+    virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
+                                                   int width, int height,
+                                                   bool isOpaque,
+                                                   Usage usage) SK_OVERRIDE;
 
     virtual void writePixels(const SkBitmap& bitmap, int x, int y,
                                 SkCanvas::Config8888 config8888) SK_OVERRIDE;
 
 protected:
-    virtual const SkBitmap& onAccessBitmap(SkBitmap*) SK_OVERRIDE;
+    virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
     virtual bool onReadPixels(const SkBitmap& bitmap,
                                 int x, int y,
                                 SkCanvas::Config8888 config8888) SK_OVERRIDE;
 
     // The following methods are no-ops on a deferred device
-    virtual bool filterTextFlags(const SkPaint& paint, TextFlags*)
-        SK_OVERRIDE
-        {return false;}
+    virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
+        return false;
+    }
 
     // None of the following drawing methods should ever get called on the
     // deferred device
@@ -234,7 +234,7 @@
                                 SkXfermode* xmode, const uint16_t indices[],
                                 int indexCount, const SkPaint& paint) SK_OVERRIDE
         {SkASSERT(0);}
-    virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
+    virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
                             const SkPaint&) SK_OVERRIDE
         {SkASSERT(0);}
 private:
@@ -258,11 +258,11 @@
     size_t fBitmapSizeThreshold;
 };
 
-DeferredDevice::DeferredDevice(SkDevice* immediateDevice)
-    : SkDevice(SkBitmap::kNo_Config,
-               immediateDevice->width(), immediateDevice->height(),
-               immediateDevice->isOpaque(),
-               immediateDevice->getDeviceProperties()) {
+DeferredDevice::DeferredDevice(SkBaseDevice* immediateDevice)
+    : SkBitmapDevice(SkBitmap::kNo_Config,
+                     immediateDevice->width(), immediateDevice->height(),
+                     immediateDevice->isOpaque(),
+                     immediateDevice->getDeviceProperties()) {
     fSurface = NULL;
     fImmediateCanvas = SkNEW_ARGS(SkCanvas, (immediateDevice));
     fPipeController.setPlaybackCanvas(fImmediateCanvas);
@@ -270,11 +270,11 @@
 }
 
 DeferredDevice::DeferredDevice(SkSurface* surface)
-    : SkDevice(SkBitmap::kNo_Config,
-               surface->getCanvas()->getDevice()->width(),
-               surface->getCanvas()->getDevice()->height(),
-               surface->getCanvas()->getDevice()->isOpaque(),
-               surface->getCanvas()->getDevice()->getDeviceProperties()) {
+    : SkBitmapDevice(SkBitmap::kNo_Config,
+                     surface->getCanvas()->getDevice()->width(),
+                     surface->getCanvas()->getDevice()->height(),
+                     surface->getCanvas()->getDevice()->isOpaque(),
+                     surface->getCanvas()->getDevice()->getDeviceProperties()) {
     fMaxRecordingStorageBytes = kDefaultMaxRecordingStorageBytes;
     fNotificationClient = NULL;
     fImmediateCanvas = NULL;
@@ -492,12 +492,12 @@
     }
 }
 
-const SkBitmap& DeferredDevice::onAccessBitmap(SkBitmap*) {
+const SkBitmap& DeferredDevice::onAccessBitmap() {
     this->flushPendingCommands(kNormal_PlaybackMode);
     return immediateDevice()->accessBitmap(false);
 }
 
-SkDevice* DeferredDevice::onCreateCompatibleDevice(
+SkBaseDevice* DeferredDevice::onCreateCompatibleDevice(
     SkBitmap::Config config, int width, int height, bool isOpaque,
     Usage usage) {
 
@@ -555,7 +555,7 @@
     return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
 }
 
-SkDeferredCanvas* SkDeferredCanvas::Create(SkDevice* device) {
+SkDeferredCanvas* SkDeferredCanvas::Create(SkBaseDevice* device) {
     SkAutoTUnref<DeferredDevice> deferredDevice(SkNEW_ARGS(DeferredDevice, (device)));
     return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
 }
diff --git a/utils/SkPictureUtils.cpp b/utils/SkPictureUtils.cpp
index 45d3f1b..ce51614 100644
--- a/utils/SkPictureUtils.cpp
+++ b/utils/SkPictureUtils.cpp
@@ -5,13 +5,13 @@
  * found in the LICENSE file.
  */
 
-#include "SkPictureUtils.h"
+#include "SkBitmapDevice.h"
 #include "SkCanvas.h"
 #include "SkData.h"
-#include "SkDevice.h"
+#include "SkPictureUtils.h"
 #include "SkPixelRef.h"
-#include "SkShader.h"
 #include "SkRRect.h"
+#include "SkShader.h"
 
 class PixelRefSet {
 public:
@@ -47,7 +47,7 @@
  *  It should never actually draw anything, so there need not be any pixels
  *  behind its device-bitmap.
  */
-class GatherPixelRefDevice : public SkDevice {
+class GatherPixelRefDevice : public SkBitmapDevice {
 private:
     PixelRefSet*  fPRSet;
 
@@ -70,7 +70,7 @@
     }
 
 public:
-    GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkDevice(bm) {
+    GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkBitmapDevice(bm) {
         fPRSet = prset;
     }
 
@@ -138,7 +138,7 @@
                               const SkPaint& paint) SK_OVERRIDE {
         this->addBitmapFromPaint(paint);
     }
-    virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
+    virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
                             const SkPaint&) SK_OVERRIDE {
         nothing_to_do();
     }
@@ -150,11 +150,14 @@
         not_supported();
         return false;
     }
+
+private:
+    typedef SkBitmapDevice INHERITED;
 };
 
 class NoSaveLayerCanvas : public SkCanvas {
 public:
-    NoSaveLayerCanvas(SkDevice* device) : INHERITED(device) {}
+    NoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
 
     // turn saveLayer() into save() for speed, should not affect correctness.
     virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,