diff options
Diffstat (limited to 'src/core/SkPixelRef.cpp')
-rw-r--r-- | src/core/SkPixelRef.cpp | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp index 487779c67f..c6d59eab19 100644 --- a/src/core/SkPixelRef.cpp +++ b/src/core/SkPixelRef.cpp @@ -26,12 +26,6 @@ uint32_t SkNextID::ImageID() { /////////////////////////////////////////////////////////////////////////////// -#ifdef SK_TRACE_PIXELREF_LIFETIME - static int32_t gInstCounter; -#endif - -#ifdef SK_SUPPORT_LEGACY_PIXELREF_API - static SkImageInfo validate_info(const SkImageInfo& info) { SkAlphaType newAlphaType = info.alphaType(); SkAssertResult(SkColorTypeValidateAlphaType(info.colorType(), info.alphaType(), &newAlphaType)); @@ -49,6 +43,10 @@ static void validate_pixels_ctable(const SkImageInfo& info, const SkColorTable* } } +#ifdef SK_TRACE_PIXELREF_LIFETIME + static int32_t gInstCounter; +#endif + SkPixelRef::SkPixelRef(const SkImageInfo& info, void* pixels, size_t rowBytes, sk_sp<SkColorTable> ctable) : fInfo(validate_info(info)) @@ -70,27 +68,6 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info, void* pixels, size_t rowBytes, fAddedToCache.store(false); } -#endif - -SkPixelRef::SkPixelRef(int width, int height, void* pixels, size_t rowBytes, - sk_sp<SkColorTable> ctable) - : fInfo(SkImageInfo::MakeUnknown(width, height)) - , fCTable(std::move(ctable)) - , fPixels(pixels) - , fRowBytes(rowBytes) -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - , fStableID(SkNextID::ImageID()) -#endif -{ -#ifdef SK_TRACE_PIXELREF_LIFETIME - SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter)); -#endif - - this->needsNewGenID(); - fMutability = kMutable; - fAddedToCache.store(false); -} - SkPixelRef::~SkPixelRef() { #ifdef SK_TRACE_PIXELREF_LIFETIME SkDebugf("~pixelref %d\n", sk_atomic_dec(&gInstCounter) - 1); @@ -99,25 +76,12 @@ SkPixelRef::~SkPixelRef() { } #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - -#ifdef SK_SUPPORT_LEGACY_PIXELREF_API // This is undefined if there are clients in-flight trying to use us void SkPixelRef::android_only_reset(const SkImageInfo& info, size_t rowBytes, sk_sp<SkColorTable> ctable) { - *const_cast<SkImageInfo*>(&fInfo) = info; - fRowBytes = rowBytes; - fCTable = std::move(ctable); - // note: we do not change fPixels - - // conservative, since its possible the "new" settings are the same as the old. - this->notifyPixelsChanged(); -} -#endif + validate_pixels_ctable(info, ctable.get()); -// This is undefined if there are clients in-flight trying to use us -void SkPixelRef::android_only_reset(int width, int height, size_t rowBytes, - sk_sp<SkColorTable> ctable) { - *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeWH(width, height); + *const_cast<SkImageInfo*>(&fInfo) = info; fRowBytes = rowBytes; fCTable = std::move(ctable); // note: we do not change fPixels @@ -125,7 +89,6 @@ void SkPixelRef::android_only_reset(int width, int height, size_t rowBytes, // conservative, since its possible the "new" settings are the same as the old. this->notifyPixelsChanged(); } - #endif void SkPixelRef::needsNewGenID() { @@ -186,11 +149,9 @@ void SkPixelRef::notifyPixelsChanged() { this->onNotifyPixelsChanged(); } -#ifdef SK_SUPPORT_LEGACY_PIXELREF_API void SkPixelRef::changeAlphaType(SkAlphaType at) { *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeAlphaType(at); } -#endif void SkPixelRef::setImmutable() { fMutability = kImmutable; @@ -218,3 +179,7 @@ void SkPixelRef::restoreMutability() { } void SkPixelRef::onNotifyPixelsChanged() { } + +size_t SkPixelRef::getAllocatedSizeInBytes() const { + return 0; +} |