void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
this->dirtyGenerationID();
- if (NULL != fCachedCanvas) {
- SkASSERT(fCachedCanvas->getSurfaceBase() == this || \
- NULL == fCachedCanvas->getSurfaceBase());
- fCachedCanvas->setSurfaceBase(NULL);
- }
+ SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
if (NULL != fCachedImage) {
// the surface may need to fork its backend, if its sharing it with
// that the next request will get our new contents.
fCachedImage->unref();
fCachedImage = NULL;
+ } else if (kDiscard_ContentChangeMode == mode) {
+ this->onDiscard();
}
}
uint32_t SkSurface_Base::newGenerationID() {
- this->installIntoCanvasForDirtyNotification();
-
+ SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
static int32_t gID;
return sk_atomic_inc(&gID) + 1;
}