diff options
author | Mike Reed <reed@google.com> | 2017-07-17 17:33:53 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-17 23:19:09 +0000 |
commit | 26e9dddf590bff620de38de752f15534b09ff951 (patch) | |
tree | 88e3249cb2024dd641fcdeffa91affd1fd8712f1 /include/core | |
parent | 63b6f8b93209e593f60b235577f5b3d660396d5f (diff) |
Don't store colortables in pixmaps or pixelrefs
Lots more changes coming later (need to remove colortable parameters from bitmaps and pixmaps)
Bug: skia:6828
Change-Id: Ic63e89570644839fab068141f49915b3f66d1053
Reviewed-on: https://skia-review.googlesource.com/24127
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkBitmap.h | 22 | ||||
-rw-r--r-- | include/core/SkPixelRef.h | 3 | ||||
-rw-r--r-- | include/core/SkPixmap.h | 14 |
3 files changed, 17 insertions, 22 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index bcb77f6278..0009641c9f 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -249,8 +249,8 @@ public: */ bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info, sk_sp<SkColorTable> ctable, uint32_t flags = 0); - void allocPixels(const SkImageInfo& info, sk_sp<SkColorTable> ctable, uint32_t flags = 0) { - if (!this->tryAllocPixels(info, std::move(ctable), flags)) { + void allocPixels(const SkImageInfo& info, sk_sp<SkColorTable>, uint32_t flags = 0) { + if (!this->tryAllocPixels(info, nullptr, flags)) { sk_throw(); } } @@ -292,8 +292,8 @@ public: } // TEMPORARY -- remove after updating Android BitmapTests.cpp:35 - void allocPixels(const SkImageInfo& info, std::nullptr_t, SkColorTable* ctable) { - this->allocPixels(info, sk_ref_sp(ctable)); + void allocPixels(const SkImageInfo& info, std::nullptr_t, SkColorTable*) { + this->allocPixels(info); } /** @@ -358,12 +358,12 @@ public: @return true if the allocation succeeds. If not the pixelref field of the bitmap will be unchanged. */ - bool SK_WARN_UNUSED_RESULT tryAllocPixels(SkColorTable* ctable = NULL) { - return this->tryAllocPixels(NULL, ctable); + bool SK_WARN_UNUSED_RESULT tryAllocPixels(SkColorTable* = NULL) { + return this->tryAllocPixels(nullptr, nullptr); } - void allocPixels(SkColorTable* ctable = NULL) { - this->allocPixels(NULL, ctable); + void allocPixels(SkColorTable* = NULL) { + this->allocPixels(nullptr, nullptr); } /** Use the specified Allocator to create the pixelref that manages the @@ -386,8 +386,8 @@ public: */ bool SK_WARN_UNUSED_RESULT tryAllocPixels(Allocator* allocator, SkColorTable* ctable); - void allocPixels(Allocator* allocator, SkColorTable* ctable) { - if (!this->tryAllocPixels(allocator, ctable)) { + void allocPixels(Allocator* allocator, SkColorTable*) { + if (!this->tryAllocPixels(allocator, nullptr)) { sk_throw(); } } @@ -432,7 +432,7 @@ public: Otherwise returns NULL. Does not affect the colortable's reference count. */ - SkColorTable* getColorTable() const; + SkColorTable* getColorTable() const { return nullptr; } /** Returns a non-zero, unique value corresponding to the pixels in our pixelref. Each time the pixels are changed (and notifyPixelsChanged diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h index 4613209f06..5055c04367 100644 --- a/include/core/SkPixelRef.h +++ b/include/core/SkPixelRef.h @@ -40,7 +40,7 @@ public: int width() const { return fWidth; } int height() const { return fHeight; } void* pixels() const { return fPixels; } - SkColorTable* colorTable() const { return fCTable.get(); } + SkColorTable* colorTable() const { return nullptr; } size_t rowBytes() const { return fRowBytes; } /** Returns a non-zero, unique value corresponding to the pixels in this @@ -115,7 +115,6 @@ protected: private: int fWidth; int fHeight; - sk_sp<SkColorTable> fCTable; void* fPixels; size_t fRowBytes; diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h index 9ad04c1fef..b21df6efb6 100644 --- a/include/core/SkPixmap.h +++ b/include/core/SkPixmap.h @@ -23,15 +23,12 @@ struct SkMask; class SK_API SkPixmap { public: SkPixmap() - : fPixels(NULL), fCTable(NULL), fRowBytes(0), fInfo(SkImageInfo::MakeUnknown(0, 0)) + : fPixels(NULL), fRowBytes(0), fInfo(SkImageInfo::MakeUnknown(0, 0)) {} - SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes, - SkColorTable* ctable = NULL) - : fPixels(addr), fCTable(ctable), fRowBytes(rowBytes), fInfo(info) - { - SkASSERT(NULL == ctable); - } + SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes, SkColorTable* = NULL) + : fPixels(addr), fRowBytes(rowBytes), fInfo(info) + {} void reset(); void reset(const SkImageInfo& info, const void* addr, size_t rowBytes, @@ -60,7 +57,7 @@ public: const SkImageInfo& info() const { return fInfo; } size_t rowBytes() const { return fRowBytes; } const void* addr() const { return fPixels; } - SkColorTable* ctable() const { return fCTable; } + SkColorTable* ctable() const { return nullptr; } int width() const { return fInfo.width(); } int height() const { return fInfo.height(); } @@ -215,7 +212,6 @@ public: private: const void* fPixels; - SkColorTable* fCTable; size_t fRowBytes; SkImageInfo fInfo; }; |