Use sRGB pixel config for ARGB masks (color emoji)

Fixes over-bright color emoji and GM:colortype in sRGB mode

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2129913004

Committed: https://skia.googlesource.com/skia/+/920af9fac3d9e275a93910d9c626ee7bc23ed17a
Review-Url: https://codereview.chromium.org/2129913004
This commit is contained in:
brianosman 2016-07-08 06:15:45 -07:00 committed by Commit bot
parent 4b4a7cca63
commit 86dc226b60
2 changed files with 13 additions and 10 deletions

View File

@ -18,7 +18,7 @@
bool GrBatchFontCache::initAtlas(GrMaskFormat format) {
int index = MaskFormatToAtlasIndex(format);
if (!fAtlases[index]) {
GrPixelConfig config = MaskFormatToPixelConfig(format);
GrPixelConfig config = MaskFormatToPixelConfig(format, *fContext->caps());
int width = fAtlasConfigs[index].fWidth;
int height = fAtlasConfigs[index].fHeight;
int numPlotsX = fAtlasConfigs[index].numPlotsX();

View File

@ -186,15 +186,18 @@ public:
void setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]);
private:
static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format) {
static const GrPixelConfig kPixelConfigs[] = {
kAlpha_8_GrPixelConfig,
kRGB_565_GrPixelConfig,
kSkia8888_GrPixelConfig
};
static_assert(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, "array_size_mismatch");
return kPixelConfigs[format];
static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format, const GrCaps& caps) {
switch (format) {
case kA8_GrMaskFormat:
return kAlpha_8_GrPixelConfig;
case kA565_GrMaskFormat:
return kRGB_565_GrPixelConfig;
case kARGB_GrMaskFormat:
return caps.srgbSupport() ? kSkiaGamma8888_GrPixelConfig : kSkia8888_GrPixelConfig;
default:
SkDEBUGFAIL("unsupported GrMaskFormat");
return kAlpha_8_GrPixelConfig;
}
}
// There is a 1:1 mapping between GrMaskFormats and atlas indices