diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h index 4c564e40c2..2a31b152a7 100644 --- a/include/core/SkPixelRef.h +++ b/include/core/SkPixelRef.h @@ -16,6 +16,8 @@ #include "SkFlattenable.h" #include "SkTDArray.h" +#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR + #ifdef SK_DEBUG /** * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref @@ -49,7 +51,13 @@ class SK_API SkPixelRef : public SkFlattenable { public: SK_DECLARE_INST_COUNT(SkPixelRef) +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR + // DEPRECATED -- use a constructor that takes SkImageInfo explicit SkPixelRef(SkBaseMutex* mutex = NULL); +#endif + + explicit SkPixelRef(const SkImageInfo&); + explicit SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex); virtual ~SkPixelRef(); /** Return the pixel memory returned from lockPixels, or null if the diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp index 1afc3360a2..b5daf0b57a 100644 --- a/src/core/SkPixelRef.cpp +++ b/src/core/SkPixelRef.cpp @@ -82,6 +82,28 @@ void SkPixelRef::setMutex(SkBaseMutex* mutex) { // just need a > 0 value, so pick a funny one to aid in debugging #define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789 +SkPixelRef::SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex) { + this->setMutex(mutex); + fPixels = NULL; + fColorTable = NULL; // we do not track ownership of this + fLockCount = 0; + this->needsNewGenID(); + fIsImmutable = false; + fPreLocked = false; +} + +SkPixelRef::SkPixelRef(const SkImageInfo&) { + this->setMutex(NULL); + fPixels = NULL; + fColorTable = NULL; // we do not track ownership of this + fLockCount = 0; + this->needsNewGenID(); + fIsImmutable = false; + fPreLocked = false; +} + +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR +// THIS GUY IS DEPRECATED -- don't use me! SkPixelRef::SkPixelRef(SkBaseMutex* mutex) { this->setMutex(mutex); fPixels = NULL; @@ -91,6 +113,7 @@ SkPixelRef::SkPixelRef(SkBaseMutex* mutex) { fIsImmutable = false; fPreLocked = false; } +#endif SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex) : INHERITED(buffer) {