Chromium Code Reviews| 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 |