Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Unified Diff: src/gpu/text/GrTextUtils.cpp

Issue 1866293003: Decouple contrast boost from fake gamma. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/text/GrTextUtils.cpp
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index ad5c0409779f79fe57ce19c9c23de6f8d7cdbd7e..0004ab577bc12b185c033c5bc6182b0a26ed7732 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, SkPaint::FakeGamma fakeGamma,
+ GrColor color, uint32_t fontWeightFlags,
const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
SkScalar x, SkScalar y) {
@@ -57,8 +57,7 @@ void GrTextUtils::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
GrBatchTextStrike* currStrike = nullptr;
// Get GrFontScaler from cache
- SkGlyphCache* cache = blob->setupCache(runIndex, props, fakeGamma,
- skPaint, &viewMatrix);
+ SkGlyphCache* cache = blob->setupCache(runIndex, props, fontWeightFlags, skPaint, &viewMatrix);
GrFontScaler* fontScaler = GrTextUtils::GetGrFontScaler(cache);
SkFindAndPlaceGlyph::ProcessText(
@@ -80,7 +79,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, SkPaint::FakeGamma fakeGamma,
+ GrColor color, uint32_t fontWeightFlags,
const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
@@ -99,8 +98,7 @@ void GrTextUtils::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex,
GrBatchTextStrike* currStrike = nullptr;
// Get GrFontScaler from cache
- SkGlyphCache* cache = blob->setupCache(runIndex, props, fakeGamma,
- skPaint, &viewMatrix);
+ SkGlyphCache* cache = blob->setupCache(runIndex, props, fontWeightFlags, skPaint, &viewMatrix);
GrFontScaler* fontScaler = GrTextUtils::GetGrFontScaler(cache);
SkFindAndPlaceGlyph::ProcessPosText(
@@ -247,7 +245,7 @@ void GrTextUtils::InitDistanceFieldPaint(GrAtlasTextBlob* blob,
void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex,
GrBatchFontCache* fontCache, const SkSurfaceProps& props,
- const SkPaint& skPaint, GrColor color, SkPaint::FakeGamma fakeGamma,
+ const SkPaint& skPaint, GrColor color, uint32_t fontWeightFlags,
const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
SkScalar x, SkScalar y) {
@@ -261,8 +259,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);
+ // passed-in font weight flags. (It's only used when we fall-back to bitmap text).
+ skPaint.getScalerContextDescriptor(&desc, props, SkPaint::kNone_FontWeightFlag, nullptr);
SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface(),
desc.getDesc());
@@ -312,14 +310,14 @@ void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex,
y -= alignY;
SkPoint offset = SkPoint::Make(x, y);
- DrawDFPosText(blob, runIndex, fontCache, props, skPaint, color, fakeGamma, viewMatrix,
+ DrawDFPosText(blob, runIndex, fontCache, props, skPaint, color, fontWeightFlags, viewMatrix,
text, byteLength, positions.begin(), 2, offset);
}
void GrTextUtils::DrawDFPosText(GrAtlasTextBlob* blob, int runIndex,
GrBatchFontCache* fontCache, const SkSurfaceProps& props,
const SkPaint& origPaint,
- GrColor color, SkPaint::FakeGamma fakeGamma,
+ GrColor color, uint32_t fontWeightFlags,
const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
@@ -345,8 +343,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,
+ // passed-in font weight flags. (It's only used when we fall-back to bitmap text).
+ SkGlyphCache* cache = blob->setupCache(runIndex, props, SkPaint::kNone_FontWeightFlag,
dfPaint, nullptr);
SkPaint::GlyphCacheProc glyphCacheProc = dfPaint.getGlyphCacheProc(true);
GrFontScaler* fontScaler = GrTextUtils::GetGrFontScaler(cache);
@@ -420,7 +418,7 @@ void GrTextUtils::DrawDFPosText(GrAtlasTextBlob* blob, int runIndex,
if (fallbackTxt.count()) {
blob->initOverride(runIndex);
GrTextUtils::DrawBmpPosText(blob, runIndex, fontCache, props,
- origPaint, origPaint.getColor(), fakeGamma, viewMatrix,
+ origPaint, origPaint.getColor(), fontWeightFlags, viewMatrix,
fallbackTxt.begin(), fallbackTxt.count(),
fallbackPos.begin(), scalarsPerPosition, offset);
}

Powered by Google App Engine
This is Rietveld 408576698