Chromium Code Reviews| Index: include/core/SkImage.h |
| diff --git a/include/core/SkImage.h b/include/core/SkImage.h |
| index 0474195ae2f1ad2d69bf9494f1111afff570eb7f..27b1a023f1ef97a665afc19db57dbf4a3a22dae3 100644 |
| --- a/include/core/SkImage.h |
| +++ b/include/core/SkImage.h |
| @@ -25,6 +25,7 @@ class SkPixelSerializer; |
| class SkString; |
| class SkSurface; |
| class GrContext; |
| +class GrContextThreadSafeProxy; |
| class GrTexture; |
| /** |
| @@ -316,6 +317,46 @@ public: |
| */ |
| SkImage* newTextureImage(GrContext*) const; |
| + /** Drawing params for which a deferred texture image data should be optimized. */ |
| + struct DeferredTextureImageUsageParams { |
| + SkMatrix fViewMatrix; |
|
reed1
2016/03/09 18:28:41
ViewMatrix is not really a term we use in the skia
bsalomon
2016/03/09 18:35:21
Sure, "CTM" or "CanvasMatrix" would work.
|
| + SkFilterQuality fQuality; |
| + SkRect fSrcRect; |
| + SkRect fDstRect; |
| + }; |
| + |
| + /** |
| + * This method allows clients to capture the data necessary to turn a SkImage into a texture- |
| + * backed image. If the original image is codec-backed this will decode into a format optimized |
| + * for the context represented by the proxy. This method is thread safe with respect to the |
| + * GrContext whence the proxy came. Clients allocate and manage the storage of the deferred |
| + * texture data and control its lifetime. No cleanup is required, thus it is safe to simply free |
| + * the memory out from under the data. |
| + * |
|
robertphillips
2016/03/09 18:54:16
to for -> for ?
bsalomon
2016/03/10 15:30:07
Done.
|
| + * The same method is used to for both getting the size necessary for pre-uploaded texture data |
| + * and to retrieve the data. The params array represents the set of draws over which to optimize |
| + * the pre-upload data. |
| + * |
| + * When called with a null buffer this returns the size that the client must allocate in order |
| + * to create deferred texture data for this image (or zero if this is an inappropriate |
| + * candidate). The buffer allocated by the client should be 8 byte aligned. |
| + * |
| + * When buffer is not null this fills in the deferred texture data for this image in the |
| + * provided buffer (assuming this is an appropriate candidate image and the buffer is |
| + * appropriately aligned). Upon success the size written is returned, otherwise 0. |
| + */ |
| + size_t getDeferredTextureImageData(const GrContextThreadSafeProxy&, |
| + const DeferredTextureImageUsageParams[], |
| + int paramCnt, |
| + void* buffer) const; |
| + |
| + /** |
|
robertphillips
2016/03/09 18:54:16
produce -> produced ?
bsalomon
2016/03/10 15:30:07
Done.
|
| + * Returns a texture-backed image from data produce in SkImage::getDeferredTextureImageData. |
| + * The context must be the context that provided the proxy passed to |
| + * getDeferredTextureImageData. |
| + */ |
| + static SkImage* NewFromDeferredTextureImageData(GrContext*, const void*, SkBudgeted); |
| + |
| // Helper functions to convert to SkBitmap |
| enum LegacyBitmapMode { |