diff options
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 57ee33957b..b87e50ba0a 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) { |