Index: src/image/SkImage_Gpu.cpp |
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp |
index 57ee33957bf9cd6625045c9f623849e8d7b14e86..b87e50ba0ae932960422a39ce6f91a7b49c5322f 100644 |
--- a/src/image/SkImage_Gpu.cpp |
+++ b/src/image/SkImage_Gpu.cpp |
@@ -310,6 +310,19 @@ 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); |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted budgeted) { |