new image from backend desc
BUG=485243
Review URL: https://codereview.chromium.org/1121813002
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index ebc9a29..7128f6e 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -64,6 +64,24 @@
*/
static SkImage* NewFromData(SkData* data);
+ /**
+ * Create a new image from the specified descriptor. Note - the caller is responsible for
+ * managing the lifetime of the underlying platform texture.
+ *
+ * Will return NULL if the specified descriptor is unsupported.
+ */
+ static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&,
+ SkAlphaType = kPremul_SkAlphaType);
+
+ /**
+ * Create a new image by copying the pixels from the specified descriptor. No reference is
+ * kept to the original platform texture.
+ *
+ * Will return NULL if the specified descriptor is unsupported.
+ */
+ static SkImage* NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&,
+ SkAlphaType = kPremul_SkAlphaType);
+
int width() const { return fWidth; }
int height() const { return fHeight; }
uint32_t uniqueID() const { return fUniqueID; }
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index c73701e..4de61af 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -90,6 +90,12 @@
bool SkPaint2GrPaint(GrContext* context, GrRenderTarget*, const SkPaint& skPaint,
const SkMatrix& viewM, bool constantColor, GrPaint* grPaint);
+
+SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque);
+
+// Using the dreaded SkGrPixelRef ...
+void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap* dst);
+
////////////////////////////////////////////////////////////////////////////////
// Classes