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.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1835003002

Review URL: https://codereview.chromium.org/1835003002
This commit is contained in:
brianosman 2016-03-25 11:26:26 -07:00 committed by Commit bot
parent 77a9cc1dea
commit b0ac1af7fa
3 changed files with 10 additions and 6 deletions

View 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) {

View File

@ -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()) {

View 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;