| Index: src/gpu/text/GrTextUtils.cpp
|
| diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
|
| index 0b26c84168624931c42ee4f8b907df4fb519e972..ad5c0409779f79fe57ce19c9c23de6f8d7cdbd7e 100644
|
| --- a/src/gpu/text/GrTextUtils.cpp
|
| +++ b/src/gpu/text/GrTextUtils.cpp
|
| @@ -40,7 +40,7 @@ static const int kLargeDFFontLimit = 2 * kLargeDFFontSize;
|
| void GrTextUtils::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
|
| GrBatchFontCache* fontCache,
|
| const SkSurfaceProps& props, const SkPaint& skPaint,
|
| - GrColor color,
|
| + GrColor color, SkPaint::FakeGamma fakeGamma,
|
| const SkMatrix& viewMatrix,
|
| const char text[], size_t byteLength,
|
| SkScalar x, SkScalar y) {
|
| @@ -57,7 +57,7 @@ void GrTextUtils::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
|
| GrBatchTextStrike* currStrike = nullptr;
|
|
|
| // Get GrFontScaler from cache
|
| - SkGlyphCache* cache = blob->setupCache(runIndex, props, SkPaint::FakeGamma::On,
|
| + SkGlyphCache* cache = blob->setupCache(runIndex, props, fakeGamma,
|
| skPaint, &viewMatrix);
|
| GrFontScaler* fontScaler = GrTextUtils::GetGrFontScaler(cache);
|
|
|
| @@ -80,7 +80,7 @@ void GrTextUtils::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
|
| void GrTextUtils::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex,
|
| GrBatchFontCache* fontCache,
|
| const SkSurfaceProps& props, const SkPaint& skPaint,
|
| - GrColor color,
|
| + GrColor color, SkPaint::FakeGamma fakeGamma,
|
| const SkMatrix& viewMatrix,
|
| const char text[], size_t byteLength,
|
| const SkScalar pos[], int scalarsPerPosition,
|
| @@ -99,7 +99,7 @@ void GrTextUtils::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex,
|
| GrBatchTextStrike* currStrike = nullptr;
|
|
|
| // Get GrFontScaler from cache
|
| - SkGlyphCache* cache = blob->setupCache(runIndex, props, SkPaint::FakeGamma::On,
|
| + SkGlyphCache* cache = blob->setupCache(runIndex, props, fakeGamma,
|
| skPaint, &viewMatrix);
|
| GrFontScaler* fontScaler = GrTextUtils::GetGrFontScaler(cache);
|
|
|
| @@ -247,7 +247,7 @@ void GrTextUtils::InitDistanceFieldPaint(GrAtlasTextBlob* blob,
|
|
|
| void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex,
|
| GrBatchFontCache* fontCache, const SkSurfaceProps& props,
|
| - const SkPaint& skPaint, GrColor color,
|
| + const SkPaint& skPaint, GrColor color, SkPaint::FakeGamma fakeGamma,
|
| const SkMatrix& viewMatrix,
|
| const char text[], size_t byteLength,
|
| SkScalar x, SkScalar y) {
|
| @@ -260,6 +260,8 @@ void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex,
|
|
|
| SkPaint::GlyphCacheProc glyphCacheProc = skPaint.getGlyphCacheProc(true);
|
| SkAutoDescriptor desc;
|
| + // We apply the fake-gamma by altering the distance in the shader, so we ignore the
|
| + // fakeGamma parameter. (It's only used when we fall-back to bitmap text).
|
| skPaint.getScalerContextDescriptor(&desc, props, SkPaint::FakeGamma::Off, nullptr);
|
| SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface(),
|
| desc.getDesc());
|
| @@ -310,14 +312,15 @@ void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex,
|
| y -= alignY;
|
| SkPoint offset = SkPoint::Make(x, y);
|
|
|
| - DrawDFPosText(blob, runIndex, fontCache, props, skPaint, color, viewMatrix, text, byteLength,
|
| - positions.begin(), 2, offset);
|
| + DrawDFPosText(blob, runIndex, fontCache, props, skPaint, color, fakeGamma, viewMatrix,
|
| + text, byteLength, positions.begin(), 2, offset);
|
| }
|
|
|
| void GrTextUtils::DrawDFPosText(GrAtlasTextBlob* blob, int runIndex,
|
| GrBatchFontCache* fontCache, const SkSurfaceProps& props,
|
| const SkPaint& origPaint,
|
| - GrColor color, const SkMatrix& viewMatrix,
|
| + GrColor color, SkPaint::FakeGamma fakeGamma,
|
| + const SkMatrix& viewMatrix,
|
| const char text[], size_t byteLength,
|
| const SkScalar pos[], int scalarsPerPosition,
|
| const SkPoint& offset) {
|
| @@ -341,6 +344,8 @@ void GrTextUtils::DrawDFPosText(GrAtlasTextBlob* blob, int runIndex,
|
|
|
| GrBatchTextStrike* currStrike = nullptr;
|
|
|
| + // We apply the fake-gamma by altering the distance in the shader, so we ignore the
|
| + // fakeGamma parameter. (It's only used when we fall-back to bitmap text).
|
| SkGlyphCache* cache = blob->setupCache(runIndex, props, SkPaint::FakeGamma::Off,
|
| dfPaint, nullptr);
|
| SkPaint::GlyphCacheProc glyphCacheProc = dfPaint.getGlyphCacheProc(true);
|
| @@ -415,7 +420,7 @@ void GrTextUtils::DrawDFPosText(GrAtlasTextBlob* blob, int runIndex,
|
| if (fallbackTxt.count()) {
|
| blob->initOverride(runIndex);
|
| GrTextUtils::DrawBmpPosText(blob, runIndex, fontCache, props,
|
| - origPaint, origPaint.getColor(), viewMatrix,
|
| + origPaint, origPaint.getColor(), fakeGamma, viewMatrix,
|
| fallbackTxt.begin(), fallbackTxt.count(),
|
| fallbackPos.begin(), scalarsPerPosition, offset);
|
| }
|
|
|