diff options
author | bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-08-08 19:41:56 +0000 |
---|---|---|
committer | bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-08-08 19:41:56 +0000 |
commit | 88edf1e50794e6d8cd7cc671ffce4f5e329ef888 (patch) | |
tree | b9cca618d42206f6755504e9ad05c2daf9408528 /src/core | |
parent | 3f69b54d4575b62bb41d77089a9cf6bb19321067 (diff) |
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
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkCanvas.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 6e879cadc4..823ce8f996 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -71,7 +71,7 @@ struct DeviceCM { 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 @@ struct DeviceCM { } 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 @@ public: 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 @@ void SkCanvas::internalRestore() { 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 @@ void SkCanvas::internalRestore() { fDeviceCMDirty = true; } SkDELETE(layer); - } + } SkASSERT(fClipStack.getSaveCount() == this->getSaveCount() - 1); } @@ -1153,7 +1153,7 @@ void SkCanvas::setExternalMatrix(const SkMatrix* matrix) { 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); |