Index: include/core/SkImage.h |
diff --git a/include/core/SkImage.h b/include/core/SkImage.h |
index c2896beab19a0ded8a625ebd6aa70de15fe71cae..14a055f85264be5f38714b5ea515c8fd3c943446 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; |
/** |
@@ -145,6 +146,8 @@ public: |
static SkImage* NewFromPicture(const SkPicture*, const SkISize& dimensions, |
const SkMatrix*, const SkPaint*); |
+ static SkImage* NewTextureFromPixmap(GrContext*, const SkPixmap&, SkBudgeted budgeted); |
+ |
/////////////////////////////////////////////////////////////////////////////////////////////// |
int width() const { return fWidth; } |
@@ -314,6 +317,46 @@ public: |
*/ |
SkImage* newTextureImage(GrContext*) const; |
+ /** |
+ * This captures the data necessary to turn a SkImage into a texture-backed image. If the image |
+ * is codec-backed decoding into the format desired to create a texture-backed image is |
+ * performed. Constructing one of these does not make calls to the underlying 3D API |
robertphillips
2016/03/08 18:43:10
the of - the ?
bsalomon
2016/03/08 19:49:31
Done.
|
+ * (e.g. OpenGL). Clients allocate and manage the of storage for the DeferredTextureImage and |
+ * control its lifetime. No cleanup is required, thus it is safe to simply free the memory |
+ * associated with a DeferredTextureImage. |
+ */ |
+ class DeferredTextureImage; |
+ |
+ /** Drawing params for which a DeferredTextureImage should be optimized. */ |
+ struct DeferredTextureImageUsageParams { |
+ SkMatrix fViewMatrix; |
+ SkFilterQuality fQuality; |
+ SkRect fSrcRect; |
+ SkRect fDstRect; |
+ }; |
+ |
robertphillips
2016/03/08 18:43:10
Are their any constraints on the proxy we hand to
bsalomon
2016/03/08 19:49:31
Added comment that the size of the buffer must be
|
+ /** |
+ * Computes the size that the client must allocate in order to create a DeferredTextureImage |
robertphillips
2016/03/08 18:43:10
tee -> te ?
bsalomon
2016/03/08 19:49:31
Done.
|
+ * for this image (or zero if this is an inappropriatee candidate for a DeferredTextureImage). |
+ */ |
+ size_t getDeferredTextureImageSize(const GrContextThreadSafeProxy&, |
robertphillips
2016/03/08 18:43:10
Why an array of usage parameters?
bsalomon
2016/03/08 19:49:31
The client may have multiple draws with the same i
|
+ const DeferredTextureImageUsageParams[], |
+ int paramCnt) const; |
+ |
+ /** |
+ * Creates a DeferredTextureImage for this image (or returns nullptr if this is an inappropriate |
+ * candidate for a DeferredTextureImage or the provided buffer is too small). |
+ */ |
+ const DeferredTextureImage* createDeferredTextureImageInClientStorage( |
+ const GrContextThreadSafeProxy&, |
+ const DeferredTextureImageUsageParams[], |
+ int paramCnt, |
+ void* imageTextureDataBuffer, |
+ size_t imageTextureDataBufferSize) const; |
+ |
+ static SkImage* NewFromDeferredTextureImage(GrContext*, const DeferredTextureImage&, |
+ SkBudgeted); |
+ |
// Helper functions to convert to SkBitmap |
enum LegacyBitmapMode { |