Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: src/image/SkImage_Gpu.cpp

Issue 1776913003: Add SkImage::NewTextureFromPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try again Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage.cpp ('k') | tests/ImageTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/image/SkImage.cpp ('k') | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698