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

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

Issue 1885613002: sRGB support for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Break long line 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/GrAtlasTextBlob.cpp
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index afbff46994a30f7a175da8b1674ff06f25533902..60f905df5f2946657ad0f150f05197a43603fada 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -257,6 +257,7 @@ inline GrDrawBatch* GrAtlasTextBlob::createBatch(
GrColor color,
const SkPaint& skPaint, const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
+ bool useSRGBDistanceTable,
GrBatchFontCache* cache) {
GrMaskFormat format = info.maskFormat();
GrColor subRunColor;
@@ -278,8 +279,8 @@ inline GrDrawBatch* GrAtlasTextBlob::createBatch(
}
bool useBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
batch = GrAtlasTextBatch::CreateDistanceField(glyphCount, cache,
- distanceAdjustTable, filteredColor,
- info.hasUseLCDText(), useBGR);
+ distanceAdjustTable, useSRGBDistanceTable,
+ filteredColor, info.hasUseLCDText(), useBGR);
} else {
batch = GrAtlasTextBatch::CreateBitmap(format, glyphCount, cache);
}
@@ -310,10 +311,14 @@ void GrAtlasTextBlob::flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBui
continue;
}
+ bool useSRGBDistanceTable = GrPixelConfigIsSRGB(dc->accessRenderTarget()->config()) &&
+ !pipelineBuilder->getDisableOutputConversionToSRGB();
+
SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run,
subRun, viewMatrix, x, y, color,
skPaint, props,
- distanceAdjustTable, cache));
+ distanceAdjustTable, useSRGBDistanceTable,
+ cache));
dc->drawBatch(pipelineBuilder, batch);
}
}
@@ -463,7 +468,7 @@ GrDrawBatch* GrAtlasTextBlob::test_createBatch(
GrBatchFontCache* cache) {
const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun];
return this->createBatch(info, glyphCount, run, subRun, viewMatrix, x, y, color, skPaint,
- props, distanceAdjustTable, cache);
+ props, distanceAdjustTable, false, cache);
}
void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlob& r) {

Powered by Google App Engine
This is Rietveld 408576698