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>
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 6b73f3c..3ec3023 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -280,10 +280,8 @@
#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
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp
index e0828a4..e478ca1 100644
--- a/src/gpu/GrBatchAtlas.cpp
+++ b/src/gpu/GrBatchAtlas.cpp
@@ -62,11 +62,19 @@
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);
diff --git a/src/gpu/text/GrBatchFontCache.h b/src/gpu/text/GrBatchFontCache.h
index 9e08c53..9bb19f5 100644
--- a/src/gpu/text/GrBatchFontCache.h
+++ b/src/gpu/text/GrBatchFontCache.h
@@ -194,7 +194,7 @@
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;