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

Unified Diff: src/image/SkImage_Gpu.cpp

Issue 1738513002: start on pre-upload data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: stuff Created 4 years, 10 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 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) {
« 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