| Index: src/gpu/SkGr.cpp
|
| diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
|
| index c2e284154a584dea54f71f323114a4e7391b5b12..befdc83bb0b2ad36f6884a8552a8bcf78a36633e 100644
|
| --- a/src/gpu/SkGr.cpp
|
| +++ b/src/gpu/SkGr.cpp
|
| @@ -243,8 +243,8 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
|
| GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
|
|
|
| if (caps->srgbSupport() && !GrPixelConfigIsSRGB(desc.fConfig) &&
|
| - kSRGB_SkColorProfileType == pixmap.info().profileType()) {
|
| - // We were supplied sRGB as the profile type, but we don't have a suitable pixel config.
|
| + pixmap.info().colorSpace() && pixmap.info().colorSpace()->gammaCloseToSRGB()) {
|
| + // We were supplied an sRGB-like color space, but we don't have a suitable pixel config.
|
| // Convert to 8888 sRGB so we can handle the data correctly. The raster backend doesn't
|
| // handle sRGB Index8 -> sRGB 8888 correctly (yet), so lie about both the source and
|
| // destination (claim they're linear):
|
| @@ -252,8 +252,10 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
|
| pixmap.colorType(), pixmap.alphaType());
|
| SkPixmap linSrcPixmap(linSrcInfo, pixmap.addr(), pixmap.rowBytes(), pixmap.ctable());
|
|
|
| - SkImageInfo dstInfo = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap.height(),
|
| - kSRGB_SkColorProfileType);
|
| + SkImageInfo dstInfo = SkImageInfo::Make(pixmap.width(), pixmap.height(),
|
| + kN32_SkColorType, kPremul_SkAlphaType,
|
| + sk_ref_sp(pixmap.info().colorSpace()));
|
| +
|
| tmpBitmap.allocPixels(dstInfo);
|
|
|
| SkImageInfo linDstInfo = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap.height());
|
| @@ -270,7 +272,8 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
|
| // We don't have Gray8 support as a pixel config, so expand to 8888
|
|
|
| // We should have converted sRGB Gray8 above (if we have sRGB support):
|
| - SkASSERT(!caps->srgbSupport() || kLinear_SkColorProfileType == pixmap.info().profileType());
|
| + SkASSERT(!caps->srgbSupport() || !pixmap.info().colorSpace() ||
|
| + !pixmap.info().colorSpace()->gammaCloseToSRGB());
|
|
|
| SkImageInfo info = SkImageInfo::MakeN32(pixmap.width(), pixmap.height(),
|
| kOpaque_SkAlphaType);
|
| @@ -418,7 +421,7 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
|
|
|
| // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
|
| // alpha info, that will be considered.
|
| -GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, SkColorProfileType pt,
|
| +GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, const SkColorSpace* cs,
|
| const GrCaps& caps) {
|
| // We intentionally ignore profile type for non-8888 formats. Anything we can't support
|
| // in hardware will be expanded to sRGB 8888 in GrUploadPixmapToTexture.
|
| @@ -432,10 +435,10 @@ GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, SkColorProf
|
| case kARGB_4444_SkColorType:
|
| return kRGBA_4444_GrPixelConfig;
|
| case kRGBA_8888_SkColorType:
|
| - return (kSRGB_SkColorProfileType == pt && caps.srgbSupport())
|
| + return (caps.srgbSupport() && cs && cs->gammaCloseToSRGB())
|
| ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
|
| case kBGRA_8888_SkColorType:
|
| - return (kSRGB_SkColorProfileType == pt && caps.srgbSupport())
|
| + return (caps.srgbSupport() && cs && cs->gammaCloseToSRGB())
|
| ? kSBGRA_8888_GrPixelConfig : kBGRA_8888_GrPixelConfig;
|
| case kIndex_8_SkColorType:
|
| return kIndex_8_GrPixelConfig;
|
|
|