aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-03-25 13:03:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-25 13:03:03 -0700
commiteb3429c6cdcf77ff24eaa74ab9fcf802abd160e2 (patch)
treed744e562de633a4e8b05b08cbd4a341a4bd9ae48 /src
parentec4d4d784dbb250e572f8e04d18d0fd2ebeee851 (diff)
Re-enable CPU mipmap generation for Ganesh. Aniso mips were landed a while ago. However, the CPU builder fails when it sees Index8 (among other things), so change the code to fallback to GPU in that case. Additionally, if we're going to be mipping an sRGB image, don't use the CPU code (which is not yet gamma correct). Unfortunately, this means that we will often be using the GPU path, still - with recent codec changes, most images are coming in tagged as sRGB.
Diffstat (limited to 'src')
-rw-r--r--src/core/SkImageCacherator.cpp5
-rw-r--r--src/gpu/GrImageIDTextureAdjuster.cpp7
-rw-r--r--src/gpu/SkGr.cpp6
3 files changed, 11 insertions, 7 deletions
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index bb389e986b..7b5ff22677 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -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) {
diff --git a/src/gpu/GrImageIDTextureAdjuster.cpp b/src/gpu/GrImageIDTextureAdjuster.cpp
index 5ba99d20de..21c2f33358 100644
--- a/src/gpu/GrImageIDTextureAdjuster.cpp
+++ b/src/gpu/GrImageIDTextureAdjuster.cpp
@@ -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()) {
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 701e763b1e..71d9e620e3 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -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;