Chromium Code Reviews| Index: src/image/SkSurface.cpp |
| =================================================================== |
| --- src/image/SkSurface.cpp (revision 8402) |
| +++ src/image/SkSurface.cpp (working copy) |
| @@ -59,21 +59,19 @@ |
| return fCachedImage; |
| } |
| -void SkSurface_Base::aboutToDraw(SkCanvas* canvas) { |
| +void SkSurface_Base::aboutToDraw(SkCanvas* canvas, bool canDiscardContents) { |
| this->dirtyGenerationID(); |
| - if (canvas) { |
| - SkASSERT(canvas == fCachedCanvas); |
| - SkASSERT(canvas->getSurfaceBase() == this); |
| - canvas->setSurfaceBase(NULL); |
| - } |
| + SkASSERT(canvas == fCachedCanvas); |
| + SkASSERT(canvas->getSurfaceBase() == this || NULL == fCachedImage); |
|
reed1
2013/03/27 15:31:43
Why this || clause?
I presume it is because the p
|
| + canvas->setSurfaceBase(NULL); |
| if (fCachedImage) { |
| - // the surface may need to fork its backend, if its sharing it with |
| + // the surface may need to fork its backend, if it's sharing it with |
| // the cached image. Note: we only call if there is an outstanding owner |
| // on the image (besides us). |
| if (fCachedImage->getRefCnt() > 1) { |
| - this->onCopyOnWrite(fCachedImage, canvas); |
| + this->onCopyOnWrite(fCachedImage, canvas, canDiscardContents); |
| } |
| // regardless of copy-on-write, we must drop our cached image now, so |
| @@ -109,8 +107,8 @@ |
| return fGenerationID; |
| } |
| -void SkSurface::notifyContentChanged() { |
| - asSB(this)->aboutToDraw(NULL); |
| +void SkSurface::notifyContentChanged(bool canDiscardContents) { |
| + asSB(this)->aboutToDraw(this->getCanvas(), canDiscardContents); |
| } |
| SkCanvas* SkSurface::getCanvas() { |