Index: include/core/SkPixelRef.h |
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h |
index 8319ec6da5acd7776e00b623938f4215fbb7d648..3c83bbf93c5c2186fb66465ba41c4fec62aff082 100644 |
--- a/include/core/SkPixelRef.h |
+++ b/include/core/SkPixelRef.h |
@@ -50,6 +50,79 @@ class SK_API SkPixelRef : public SkFlattenable { |
public: |
SK_DECLARE_INST_COUNT(SkPixelRef) |
+ /** |
+ * Return a new pre-locked SkPixelRef, automatically allocating |
+ * storage for the pixels. If rowBytes are 0, an optimal value |
+ * will be chosen automatically. If rowBytes is > 0, then it |
+ * will be respected, or NULL will be returned if rowBytes is |
+ * invalid for the specified info. |
+ * |
+ * This pixelref will ref() the specified colortable (if not NULL). |
+ * |
+ * Returns NULL on failure. |
+ */ |
+ static SkPixelRef* NewPrelockedAllocate( |
scroggo
2014/04/04 21:21:06
I know the goal is to hide SkMallocPixelRef, but I
|
+ const SkImageInfo& info, |
+ size_t rowBytes, |
+ SkColorTable* colorTable); |
+ |
+ /** |
+ * Return a new pre-locked immutable SkPixelRef that will use |
+ * the provided SkData, rowBytes, and optional colortable as |
+ * pixel storage. The SkData will be ref()ed, and on destruction |
+ * of the PixelRef, the SkData will be unref()ed. |
+ * |
+ * @param offset (in bytes) into the provided SkData that the |
+ * first pixel is located at. |
+ * |
+ * This pixelref will ref() the specified colortable (if not NULL). |
+ * |
+ * Returns NULL on failure. |
+ */ |
+ static SkPixelRef* NewPrelockedWithData( |
scroggo
2014/04/04 21:21:06
I thought Mike wanted to move people away from dea
|
+ const SkImageInfo& info, |
+ size_t rowBytes, |
+ SkColorTable* colorTable, |
+ SkData* data, |
+ size_t offset = 0); |
scroggo
2014/04/04 21:21:06
This seems like an odd choice, given that we switc
hal.canary
2014/04/07 14:43:02
Look at our existing use of SkMallocPixelRef::NewW
mtklein
2014/04/07 14:51:01
Yep, exactly. x and y don't make sense until you'
|
+ |
+ /** |
+ * Return a new pre-locked SkPixelRef with the provided pixel |
+ * storage, rowBytes, and optional colortable. On destruction, |
+ * ReleaseProc will be called. If this function fails, |
+ * ReleaseProc will be called before returning NULL. |
+ * |
+ * This pixelref will ref() the specified colortable (if not NULL). |
+ * |
+ * Returns NULL on failure. |
+ */ |
+ static SkPixelRef* NewPrelockedDirectWithProc( |
+ const SkImageInfo& info, |
+ size_t rowBytes, |
+ SkColorTable* colorTable, |
+ void* pixelAddress, |
+ void (*releaseProcedure)(void* pixelAddress, void* context), |
+ void* releaseProcedureContext); |
+ |
+ /** |
+ * Return a new pre-locked SkPixelRef with the provided pixel |
+ * storage, rowBytes, and optional colortable. The caller is |
+ * responsible for managing the lifetime of the pixel storage |
+ * buffer, as this pixelref will not try to delete it. |
+ * |
+ * The pixelref will ref() the colortable (if not NULL). |
+ * |
+ * Returns NULL on failure. |
+ */ |
+ static SkPixelRef* NewPrelockedDirect( |
+ const SkImageInfo& info, |
+ size_t rowBytes, |
+ SkColorTable* colorTable, |
+ void* pixelAddress) { |
+ return SkPixelRef::NewPrelockedDirectWithProc( |
+ info, rowBytes, colorTable, pixelAddress, NULL, NULL); |
+ } |
+ |
explicit SkPixelRef(const SkImageInfo&); |
SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex); |
virtual ~SkPixelRef(); |