Fix GPU text colors when color spaces are involved
1) Only store GrColors in GrTextUtils::Paint. We still store
premul and unpremul versions, but this is slightly clearer.
2) GrTextUtils::Paint also needs info from the render target
context to linearize and transform the color to dst space.
Bug: skia:6605
Change-Id: I6e12c55eafaecd2a090c82b4f56827401305bf3a
Reviewed-on: https://skia-review.googlesource.com/16486
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index d3aa7e4..be9bb27 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -179,7 +179,7 @@
// to regenerate the blob on any color change
// We use the grPaint to get any color filter effects
if (fKey.fCanonicalColor == SK_ColorTRANSPARENT &&
- fFilteredPaintColor != paint.filteredSkColor()) {
+ fFilteredPaintColor != paint.filteredUnpremulColor()) {
return true;
}
@@ -266,7 +266,7 @@
std::unique_ptr<GrAtlasTextOp> op;
if (info.drawAsDistanceFields()) {
- SkColor filteredColor = paint.filteredSkColor();
+ GrColor filteredColor = paint.filteredUnpremulColor();
bool useBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
op = GrAtlasTextOp::MakeDistanceField(glyphCount, cache, distanceAdjustTable,
useGammaCorrectDistanceTable, filteredColor,
@@ -280,7 +280,7 @@
geometry.fRun = run;
geometry.fSubRun = subRun;
geometry.fColor =
- info.maskFormat() == kARGB_GrMaskFormat ? GrColor_WHITE : paint.filteredPremulGrColor();
+ info.maskFormat() == kARGB_GrMaskFormat ? GrColor_WHITE : paint.filteredPremulColor();
geometry.fX = x;
geometry.fY = y;
op->init();