Creating functions for uploading a mipmapped texture.
BUG=476416
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1249543003
Review URL: https://codereview.chromium.org/1249543003
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 155eb82..594a8e2 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -239,7 +239,8 @@
* 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) {
// Values representing the various texture lock paths we can take. Used for logging the path
// taken to a histogram.
enum LockTexturePath {
@@ -301,7 +302,12 @@
// 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) {
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kRGBA_LockTexturePath,
kLockTexturePathCount);