Index: src/core/SkImageCacherator.cpp |
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp |
index 572778e19ca16a02e1e99ff89415b6aff390fc19..1b18c190a5967d60d197971ee7d53d366b3bd9ea 100644 |
--- a/src/core/SkImageCacherator.cpp |
+++ b/src/core/SkImageCacherator.cpp |
@@ -239,7 +239,8 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) { |
* 5. Ask the generator to return RGB(A) data, which the GPU can convert |
*/ |
GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key, |
- const SkImage* client, SkImage::CachingHint chint) { |
+ const SkImage* client, SkImage::CachingHint chint, |
+ bool willBeMipped) { |
// 1. Check the cache for a pre-existing one |
if (key.isValid()) { |
if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(key)) { |
@@ -280,7 +281,12 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key |
// 5. Ask the generator to return RGB(A) data, which the GPU can convert |
SkBitmap bitmap; |
if (this->tryLockAsBitmap(&bitmap, client, chint)) { |
- GrTexture* tex = GrUploadBitmapToTexture(ctx, bitmap); |
+ GrTexture* tex = nullptr; |
+ if (willBeMipped) { |
+ tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap); |
+ } else { |
+ tex = GrUploadBitmapToTexture(ctx, bitmap); |
+ } |
if (tex) { |
return set_key_and_return(tex, key); |
} |