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

Unified Diff: src/gpu/SkGr.cpp

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index bb041312450ae278c8ede6bf70dfedc6d02be3ba..fb045caed7d139e5114b39a44f7fd934fee6db1f 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -646,6 +646,32 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx,
return NULL;
}
+
+GrTexture* GrMipmapTexture(GrContext* ctx,
+ const SkBitmap& bitmap,
+ SkDiscardableFactoryProc fact,
+ const GrTextureParams* params) {
+ GrTexture* result = bitmap.getTexture();
+ // TODO: What if the bitmap already contains a non-mitmapped texture?
scroggo 2015/07/21 14:44:23 non-mipmapped?
cblume 2015/07/21 23:07:30 I mean what if someone calls creates a regular tex
+ if (result) {
+ // TODO: Add stretching. After reading get_stretch(), it appears small
scroggo 2015/07/21 14:44:23 nit: this should be a four space indent
cblume 2015/07/21 23:07:30 Done.
+ // textures can have issues.
+ return SkRef(result);
+ }
+
+ GrSurfaceDesc desc;
+ generate_bitmap_texture_desc(bitmap, &desc);
+
+ auto mipmap = SkMipMap::Build(bitmap, fact);
+ if (mipmap == NULL) {
+ // could not create the mipmap
+ return NULL;
+ } else {
+ return ctx->textureProvider()->createMipmappedTexture(desc, true, *mipmap);
+ // TODO: BitmapInvalidator support
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
« src/gpu/GrGpu.cpp ('K') | « src/gpu/GrTextureProvider.cpp ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698