Index: src/image/SkImage_Gpu.cpp |
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp |
index e28a31d4bf7792c457f92aa5e75f42475dcc3456..76f06660a6b184819b963b8fedc9f851173a4d5b 100644 |
--- a/src/image/SkImage_Gpu.cpp |
+++ b/src/image/SkImage_Gpu.cpp |
@@ -310,6 +310,30 @@ SkImage* SkImage::newTextureImage(GrContext *context) const { |
return create_image_from_maker(&maker, at, this->uniqueID()); |
} |
+SkImage* SkImage::NewTextureFromPixmap(GrContext* ctx, const SkPixmap& pixmap, |
+ SkBudgeted budgeted) { |
+ if (!ctx) { |
+ return nullptr; |
+ } |
+ SkAutoTUnref<GrTexture> texture(GrUploadPixmapToTexture(ctx, pixmap)); |
+ if (!texture) { |
+ return nullptr; |
+ } |
+ return new SkImage_Gpu(texture->width(), texture->height(), kNeedNewImageUniqueID, |
+ pixmap.alphaType(), texture, budgeted); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////////////////////////// |
+ |
+SkImage* SkImageTextureData::newImage(GrContext* context, SkBudgeted budgeted) const { |
+ if (context->uniqueID() != fContextUniqueID) { |
+ return nullptr; |
+ } |
+ SkPixmap pixmap; |
+ fPixmapGenerator(&pixmap); |
+ return SkImage::NewTextureFromPixmap(context, pixmap, budgeted); |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) { |