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/gpu/GrImageIDTextureAdjuster.cpp b/src/gpu/GrImageIDTextureAdjuster.cpp
index 2edff60..58dc5b9 100644
--- a/src/gpu/GrImageIDTextureAdjuster.cpp
+++ b/src/gpu/GrImageIDTextureAdjuster.cpp
@@ -81,7 +81,7 @@
}
}
-GrTexture* GrBitmapTextureMaker::refOriginalTexture() {
+GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) {
GrTexture* tex;
if (fOriginalKey.isValid()) {
@@ -91,7 +91,11 @@
}
}
- tex = GrUploadBitmapToTexture(this->context(), fBitmap);
+ if (willBeMipped) {
+ tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap);
+ } else {
+ tex = GrUploadBitmapToTexture(this->context(), fBitmap);
+ }
if (tex && fOriginalKey.isValid()) {
tex->resourcePriv().setUniqueKey(fOriginalKey);
GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
@@ -126,8 +130,8 @@
}
}
-GrTexture* GrImageTextureMaker::refOriginalTexture() {
- return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint);
+GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped) {
+ return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, willBeMipped);
}
void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) {