Always use RGBA textures for color font atlases

This is the last use of kSkiaGamma8888_GrPixelConfig

BUG=skia:

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

Change-Id: I307479c41f1ca437733dfafd044bb1baeb42f31d
Reviewed-on: https://skia-review.googlesource.com/3417
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2016-10-14 11:42:20 -04:00 committed by Skia Commit-Bot
parent a54401da54
commit cce3e58f66
3 changed files with 14 additions and 8 deletions

View File

@ -280,10 +280,8 @@ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
#endif
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSBGRA_8888_GrPixelConfig;
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig;
static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSRGBA_8888_GrPixelConfig;
#else
#error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
#endif

View File

@ -62,11 +62,19 @@ bool GrBatchAtlas::BatchPlot::addSubImage(int width, int height, const void* ima
unsigned char* dataPtr = fData;
dataPtr += fBytesPerPixel * fWidth * loc->fY;
dataPtr += fBytesPerPixel * loc->fX;
// copy into the data buffer
for (int i = 0; i < height; ++i) {
memcpy(dataPtr, imagePtr, rowBytes);
dataPtr += fBytesPerPixel * fWidth;
imagePtr += rowBytes;
// copy into the data buffer, swizzling as we go if this is ARGB data
if (4 == fBytesPerPixel && kSkia8888_GrPixelConfig == kBGRA_8888_GrPixelConfig) {
for (int i = 0; i < height; ++i) {
SkOpts::RGBA_to_BGRA(reinterpret_cast<uint32_t*>(dataPtr), imagePtr, width);
dataPtr += fBytesPerPixel * fWidth;
imagePtr += rowBytes;
}
} else {
for (int i = 0; i < height; ++i) {
memcpy(dataPtr, imagePtr, rowBytes);
dataPtr += fBytesPerPixel * fWidth;
imagePtr += rowBytes;
}
}
fDirtyRect.join(loc->fX, loc->fY, loc->fX + width, loc->fY + height);

View File

@ -194,7 +194,7 @@ private:
case kA565_GrMaskFormat:
return kRGB_565_GrPixelConfig;
case kARGB_GrMaskFormat:
return caps.srgbSupport() ? kSkiaGamma8888_GrPixelConfig : kSkia8888_GrPixelConfig;
return caps.srgbSupport() ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
default:
SkDEBUGFAIL("unsupported GrMaskFormat");
return kAlpha_8_GrPixelConfig;