Protect much of SkDevice and clarify usage of drawDevice.
http://codereview.appspot.com/4798069/



git-svn-id: http://skia.googlecode.com/svn/trunk@2066 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 6e879ca..823ce8f 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -71,7 +71,7 @@
     const SkMatrix*     fMVMatrix;
     const SkMatrix*     fExtMatrix;
 
-	DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint)
+    DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint)
             : fNext(NULL) {
         if (NULL != device) {
             device->ref();
@@ -79,15 +79,15 @@
         }
         fDevice = device;
         fPaint = paint ? SkNEW_ARGS(SkPaint, (*paint)) : NULL;
-	}
+    }
 
-	~DeviceCM() {
+    ~DeviceCM() {
         if (NULL != fDevice) {
             fDevice->unlockPixels();
             fDevice->unref();
         }
-		SkDELETE(fPaint);
-	}
+        SkDELETE(fPaint);
+    }
 
     void updateMC(const SkMatrix& totalMatrix, const SkRegion& totalClip,
                   const SkClipStack& clipStack, SkRegion* updateClip) {
@@ -163,7 +163,7 @@
         reference counted, since the real owner is either our fLayer field,
         or a previous one in a lower level.)
     */
-    DeviceCM*	fTopLayer;
+    DeviceCM*   fTopLayer;
 
     MCRec(const MCRec* prev, int flags) {
         if (NULL != prev) {
@@ -749,7 +749,7 @@
     fLocalBoundsCompareTypeDirtyBW = true;
 
     fClipStack.restore();
-	// reserve our layer (if any)
+    // reserve our layer (if any)
     DeviceCM* layer = fMCRec->fLayer;   // may be null
     // now detach it from fMCRec so we can pop(). Gets freed after its drawn
     fMCRec->fLayer = NULL;
@@ -772,7 +772,7 @@
             fDeviceCMDirty = true;
         }
         SkDELETE(layer);
-	}
+    }
 
     SkASSERT(fClipStack.getSaveCount() == this->getSaveCount() - 1);
 }
@@ -1153,7 +1153,7 @@
 SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
                                       int width, int height,
                                       bool isOpaque) {
-    SkDevice* device = this->getDevice();
+    SkDevice* device = this->getTopDevice();
     if (device) {
         return device->createCompatibleDeviceForSaveLayer(config, width, height,
                                                           isOpaque);