| Index: src/image/SkSurface.cpp
|
| diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
|
| index 2d3fa2bf7a4eeee1e0d46943c40d45e8d73ee2b7..5208fdc3342b98ffdfdbd10a443598d7d21aed42 100644
|
| --- a/src/image/SkSurface.cpp
|
| +++ b/src/image/SkSurface.cpp
|
| @@ -58,23 +58,15 @@ SkSurface_Base::SkSurface_Base(int width, int height, const SkSurfaceProps* prop
|
| : INHERITED(width, height, props)
|
| {
|
| fCachedCanvas = NULL;
|
| - fCachedImage = NULL;
|
| }
|
|
|
| SkSurface_Base::SkSurface_Base(const SkImageInfo& info, const SkSurfaceProps* props)
|
| : INHERITED(info, props)
|
| {
|
| fCachedCanvas = NULL;
|
| - fCachedImage = NULL;
|
| }
|
|
|
| SkSurface_Base::~SkSurface_Base() {
|
| - // in case the canvas outsurvives us, we null the callback
|
| - if (fCachedCanvas) {
|
| - fCachedCanvas->setSurfaceBase(NULL);
|
| - }
|
| -
|
| - SkSafeUnref(fCachedImage);
|
| SkSafeUnref(fCachedCanvas);
|
| }
|
|
|
| @@ -86,30 +78,7 @@ void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa
|
| }
|
| }
|
|
|
| -void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
|
| - this->dirtyGenerationID();
|
| -
|
| - SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
|
| -
|
| - if (fCachedImage) {
|
| - // the surface may need to fork its backend, if its sharing it with
|
| - // the cached image. Note: we only call if there is an outstanding owner
|
| - // on the image (besides us).
|
| - if (!fCachedImage->unique()) {
|
| - this->onCopyOnWrite(mode);
|
| - }
|
| -
|
| - // regardless of copy-on-write, we must drop our cached image now, so
|
| - // 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() {
|
| - SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
|
| static int32_t gID;
|
| return sk_atomic_inc(&gID) + 1;
|
| }
|
| @@ -125,7 +94,6 @@ SkSurface::SkSurface(int width, int height, const SkSurfaceProps* props)
|
| {
|
| SkASSERT(fWidth > 0);
|
| SkASSERT(fHeight > 0);
|
| - fGenerationID = 0;
|
| }
|
|
|
| SkSurface::SkSurface(const SkImageInfo& info, const SkSurfaceProps* props)
|
| @@ -133,18 +101,6 @@ SkSurface::SkSurface(const SkImageInfo& info, const SkSurfaceProps* props)
|
| {
|
| SkASSERT(fWidth > 0);
|
| SkASSERT(fHeight > 0);
|
| - fGenerationID = 0;
|
| -}
|
| -
|
| -uint32_t SkSurface::generationID() {
|
| - if (0 == fGenerationID) {
|
| - fGenerationID = asSB(this)->newGenerationID();
|
| - }
|
| - return fGenerationID;
|
| -}
|
| -
|
| -void SkSurface::notifyContentWillChange(ContentChangeMode mode) {
|
| - asSB(this)->aboutToDraw(mode);
|
| }
|
|
|
| SkCanvas* SkSurface::getCanvas() {
|
| @@ -152,9 +108,7 @@ SkCanvas* SkSurface::getCanvas() {
|
| }
|
|
|
| SkImage* SkSurface::newImageSnapshot(Budgeted budgeted) {
|
| - SkImage* image = asSB(this)->getCachedImage(budgeted);
|
| - SkSafeRef(image); // the caller will call unref() to balance this
|
| - return image;
|
| + return asSB(this)->onNewImageSnapshot(budgeted);
|
| }
|
|
|
| SkSurface* SkSurface::newSurface(const SkImageInfo& info) {
|
|
|