Re-enable CPU mipmap generation for Ganesh. Aniso mips were landed a while ago. Howev...
authorbrianosman <brianosman@google.com>
Fri, 25 Mar 2016 20:03:03 +0000 (13:03 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 25 Mar 2016 20:03:03 +0000 (13:03 -0700)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1835003002

Committed: https://skia.googlesource.com/skia/+/b0ac1af7fab467aacbc27d20d14a09bcb960472f

Review URL: https://codereview.chromium.org/1835003002

src/core/SkImageCacherator.cpp
src/gpu/GrImageIDTextureAdjuster.cpp
src/gpu/SkGr.cpp

index bb389e9..7b5ff22 100644 (file)
@@ -303,11 +303,10 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
     SkBitmap bitmap;
     if (this->tryLockAsBitmap(&bitmap, client, chint)) {
         GrTexture* tex = nullptr;
-        // disable mipmapping until we generate anisotropic mipmap levels
-        willBeMipped = false;
         if (willBeMipped) {
             tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap);
-        } else {
+        }
+        if (!tex) {
             tex = GrUploadBitmapToTexture(ctx, bitmap);
         }
         if (tex) {
index 5ba99d2..21c2f33 100644 (file)
@@ -82,7 +82,7 @@ GrBitmapTextureMaker::GrBitmapTextureMaker(GrContext* context, const SkBitmap& b
 }
 
 GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) {
-    GrTexture* tex;
+    GrTexture* tex = nullptr;
 
     if (fOriginalKey.isValid()) {
         tex = this->context()->textureProvider()->findAndRefTextureByUniqueKey(fOriginalKey);
@@ -90,11 +90,10 @@ GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) {
             return tex;
         }
     }
-    // disable mipmapping until we generate anisotropic mipmap levels
-    willBeMipped = false;
     if (willBeMipped) {
         tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap);
-    } else {
+    }
+    if (!tex) {
         tex = GrUploadBitmapToTexture(this->context(), fBitmap);
     }
     if (tex && fOriginalKey.isValid()) {
index 701e763..71d9e62 100644 (file)
@@ -344,6 +344,12 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b
         return texture;
     }
 
+    // SkMipMap::Build doesn't handle sRGB data correctly (yet).
+    // Failover to the GL code-path for now.
+    if (kLinear_SkColorProfileType != bitmap.profileType()) {
+        return nullptr;
+    }
+
     SkASSERT(sizeof(int) <= sizeof(uint32_t));
     if (bitmap.width() < 0 || bitmap.height() < 0) {
         return nullptr;