Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: include/core/SkImage.h

Issue 1169553003: add callbacks to Images that wrap client-provided content (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 33ae448072cbe81929f5b6342fc607978a0a1f04..bd933edf5779e51f38e57d044956fef3d10e6bc3 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -44,10 +44,23 @@ public:
SK_DECLARE_INST_COUNT(SkImage)
typedef SkImageInfo Info;
+ typedef void* ReleaseContext;
static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowBytes);
static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes);
+ typedef void (*RasterReleaseProc)(const void* pixels, ReleaseContext);
+
+ /**
robertphillips 2015/06/05 15:57:06 especified?
reed1 2015/06/17 13:25:34 Done.
+ * Return a new Image referencing th especified pixels. These must remain valid and unchanged
+ * until the specified release-proc is called, indicating that Skia no longer has a reference
+ * to the pixels.
+ *
+ * Returns NULL if the requested Info is unsupported.
+ */
+ static SkImage* NewFromRaster(const Info&, const void* pixels, size_t rowBytes,
+ RasterReleaseProc, ReleaseContext);
+
/**
* Construct a new SkImage based on the given ImageGenerator.
* This function will always take ownership of the passed
@@ -70,8 +83,25 @@ public:
*
* Will return NULL if the specified descriptor is unsupported.
*/
- static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&,
- SkAlphaType = kPremul_SkAlphaType);
+ static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc) {
+ return NewFromTexture(ctx, desc, kPremul_SkAlphaType, NULL, NULL);
+ }
+
+ static SkImage* NewFromTexture(GrContext* ctx, const GrBackendTextureDesc& de, SkAlphaType at) {
+ return NewFromTexture(ctx, de, at, NULL, NULL);
+ }
+
+ typedef void (*TextureReleaseProc)(GrBackendObject, ReleaseContext);
+
+ /**
+ * Create a new image from the specified descriptor. The underlying platform texture must stay
+ * valid and unaltered until the specified release-proc is invoked, indicating that Skia
+ * nolonger is holding a reference to it.
+ *
+ * Will return NULL if the specified descriptor is unsupported.
+ */
+ static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType,
+ TextureReleaseProc, ReleaseContext);
/**
* Create a new image by copying the pixels from the specified descriptor. No reference is
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698