aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkMallocPixelRef.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-18 10:53:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-18 15:50:43 +0000
commit086a427b0cee3862f25c492fc5082ff24105dc53 (patch)
tree79d4311c12309e5bc34950a0131771d3cb8f6171 /include/core/SkMallocPixelRef.h
parent918ad9d5f19efdbd57486b8f931f7af197896010 (diff)
guard references to SkColorTable
Bug: skia:6828 Change-Id: I0c8c78e70b118f51cb59dc45675e4ddcd4776108 Reviewed-on: https://skia-review.googlesource.com/24260 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'include/core/SkMallocPixelRef.h')
-rw-r--r--include/core/SkMallocPixelRef.h47
1 files changed, 33 insertions, 14 deletions
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index e6d9727952..07a5483e25 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -5,11 +5,13 @@
* found in the LICENSE file.
*/
-
#ifndef SkMallocPixelRef_DEFINED
#define SkMallocPixelRef_DEFINED
#include "SkPixelRef.h"
+#ifdef SK_SUPPORT_LEGACY_COLORTABLE
+ #include "SkData.h"
+#endif
/** We explicitly use the same allocator for our pixels that SkMask does,
so that we can freely assign memory allocated by one class to the other.
@@ -24,8 +26,7 @@ public:
*
* Returns NULL on failure.
*/
- static sk_sp<SkPixelRef> MakeDirect(const SkImageInfo&, void* addr,
- size_t rowBytes, sk_sp<SkColorTable>);
+ static sk_sp<SkPixelRef> MakeDirect(const SkImageInfo&, void* addr, size_t rowBytes);
/**
* Return a new SkMallocPixelRef, automatically allocating storage for the
@@ -37,12 +38,12 @@ public:
*
* Returns NULL on failure.
*/
- static sk_sp<SkPixelRef> MakeAllocate(const SkImageInfo&, size_t rowBytes, sk_sp<SkColorTable>);
+ static sk_sp<SkPixelRef> MakeAllocate(const SkImageInfo&, size_t rowBytes);
/**
* Identical to MakeAllocate, except all pixel bytes are zeroed.
*/
- static sk_sp<SkPixelRef> MakeZeroed(const SkImageInfo&, size_t rowBytes, sk_sp<SkColorTable>);
+ static sk_sp<SkPixelRef> MakeZeroed(const SkImageInfo&, size_t rowBytes);
/**
* Return a new SkMallocPixelRef with the provided pixel storage,
@@ -57,10 +58,8 @@ public:
* Returns NULL on failure.
*/
typedef void (*ReleaseProc)(void* addr, void* context);
- static sk_sp<SkPixelRef> MakeWithProc(const SkImageInfo& info,
- size_t rowBytes, sk_sp<SkColorTable>,
- void* addr, ReleaseProc proc,
- void* context);
+ static sk_sp<SkPixelRef> MakeWithProc(const SkImageInfo& info, size_t rowBytes, void* addr,
+ ReleaseProc proc, void* context);
/**
* Return a new SkMallocPixelRef that will use the provided
@@ -70,10 +69,32 @@ public:
*
* Returns NULL on failure.
*/
+ static sk_sp<SkPixelRef> MakeWithData(const SkImageInfo&, size_t rowBytes, sk_sp<SkData> data);
+
+#ifdef SK_SUPPORT_LEGACY_COLORTABLE
+ static sk_sp<SkPixelRef> MakeDirect(const SkImageInfo& info, void* addr,
+ size_t rowBytes, sk_sp<SkColorTable>) {
+ return MakeDirect(info, addr, rowBytes);
+ }
+ static sk_sp<SkPixelRef> MakeAllocate(const SkImageInfo& info, size_t rb, sk_sp<SkColorTable>) {
+ return MakeAllocate(info, rb);
+ }
+ static sk_sp<SkPixelRef> MakeZeroed(const SkImageInfo& info, size_t rb, sk_sp<SkColorTable>) {
+ return MakeZeroed(info, rb);
+ }
+ static sk_sp<SkPixelRef> MakeWithProc(const SkImageInfo& info,
+ size_t rowBytes, sk_sp<SkColorTable>,
+ void* addr, ReleaseProc proc,
+ void* context) {
+ return MakeWithProc(info, rowBytes, addr, proc, context);
+ }
static sk_sp<SkPixelRef> MakeWithData(const SkImageInfo& info,
size_t rowBytes,
sk_sp<SkColorTable>,
- sk_sp<SkData> data);
+ sk_sp<SkData> data) {
+ return MakeWithData(info, rowBytes, data);
+ }
+#endif
protected:
~SkMallocPixelRef() override;
@@ -82,14 +103,12 @@ private:
// Uses alloc to implement NewAllocate or NewZeroed.
static sk_sp<SkPixelRef> MakeUsing(void*(*alloc)(size_t),
const SkImageInfo&,
- size_t rowBytes,
- sk_sp<SkColorTable>);
+ size_t rowBytes);
ReleaseProc fReleaseProc;
void* fReleaseProcContext;
- SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, sk_sp<SkColorTable>,
- ReleaseProc proc, void* context);
+ SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, ReleaseProc proc, void* context);
typedef SkPixelRef INHERITED;
};