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

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

Issue 1888473003: Simplify gamma-correctness for text rendering. (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
« no previous file with comments | « src/gpu/text/GrAtlasTextContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/text/GrAtlasTextContext.cpp
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 52960e879bc659b27f52c892e9af8e1017439c3a..22fd8a35811438b086ebc9869a7e113ffe3f5ac3 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -53,12 +53,10 @@ GrColor GrAtlasTextContext::ComputeCanonicalColor(const SkPaint& paint, bool lcd
return canonicalColor;
}
-uint32_t GrAtlasTextContext::ComputeScalerContextFlags(GrDrawContext* dc, const GrPaint& grPaint) {
- // If we're rendering to an sRGB render target, and we aren't forcing sRGB blending off,
- // then we can disable the gamma hacks. Otherwise, leave them on. In either case, we still
- // want the contrast boost:
- if (GrPixelConfigIsSRGB(dc->accessRenderTarget()->config()) &&
- !grPaint.getDisableOutputConversionToSRGB()) {
+uint32_t GrAtlasTextContext::ComputeScalerContextFlags(GrDrawContext* dc) {
+ // If we're doing gamma-correct rendering, then we can disable the gamma hacks.
+ // Otherwise, leave them on. In either case, we still want the contrast boost:
+ if (dc->isGammaCorrect()) {
return SkPaint::kBoostContrast_ScalerContextFlag;
} else {
return SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags;
@@ -128,7 +126,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
return;
}
- uint32_t scalerContextFlags = ComputeScalerContextFlags(dc, grPaint);
+ uint32_t scalerContextFlags = ComputeScalerContextFlags(dc);
if (cacheBlob) {
if (cacheBlob->mustRegenerate(skPaint, grPaint.getColor(), blurRec, viewMatrix, x, y)) {
@@ -329,7 +327,7 @@ void GrAtlasTextContext::drawText(GrContext* context,
CreateDrawTextBlob(context->getTextBlobCache(), context->getBatchFontCache(),
*context->caps()->shaderCaps(),
paint, skPaint,
- ComputeScalerContextFlags(dc, paint),
+ ComputeScalerContextFlags(dc),
viewMatrix, props,
text, byteLength, x, y));
blob->flushThrowaway(context, dc, props, fDistanceAdjustTable, skPaint, paint,
@@ -359,7 +357,7 @@ void GrAtlasTextContext::drawPosText(GrContext* context,
context->getBatchFontCache(),
*context->caps()->shaderCaps(),
paint, skPaint,
- ComputeScalerContextFlags(dc, paint),
+ ComputeScalerContextFlags(dc),
viewMatrix, props,
text, byteLength,
pos, scalarsPerPosition,
« no previous file with comments | « src/gpu/text/GrAtlasTextContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698