Chromium Code Reviews| 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 |