| Index: src/gpu/SkGr.cpp
|
| diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
|
| index bb041312450ae278c8ede6bf70dfedc6d02be3ba..d94f4d3768c1ee62b67adb05dd80a897d48a47ec 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-mipmapped texture?
|
| + if (result) {
|
| + // TODO: Add stretching. After reading get_stretch(), it appears small
|
| + // 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
|
|
|