| Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| index 35d1f619773166d536ecd16355af5a859f729def..83e82871bf257cbb2e82a6b0d009e5ebf0622d4e 100644
|
| --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| @@ -148,8 +148,10 @@ public:
|
| };
|
|
|
| static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
|
| - GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList) {
|
| - return new AADistanceFieldPathBatch(geometry, viewMatrix, atlas, pathCache, pathList);
|
| + GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList,
|
| + bool srgbOutput) {
|
| + return new AADistanceFieldPathBatch(geometry, viewMatrix, atlas, pathCache, pathList,
|
| + srgbOutput);
|
| }
|
|
|
| const char* name() const override { return "AADistanceFieldPathBatch"; }
|
| @@ -196,6 +198,7 @@ private:
|
| uint32_t flags = 0;
|
| flags |= ctm.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
| flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
|
| + flags |= fSRGBOutput ? kSRGB_DistanceFieldEffectFlag : 0;
|
|
|
| GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode);
|
|
|
| @@ -296,7 +299,8 @@ private:
|
| AADistanceFieldPathBatch(const Geometry& geometry,
|
| const SkMatrix& viewMatrix,
|
| GrBatchAtlas* atlas,
|
| - PathCache* pathCache, PathDataList* pathList)
|
| + PathCache* pathCache, PathDataList* pathList,
|
| + bool srgbOutput)
|
| : INHERITED(ClassID()) {
|
| fBatch.fViewMatrix = viewMatrix;
|
| fGeoData.push_back(geometry);
|
| @@ -304,6 +308,7 @@ private:
|
| fAtlas = atlas;
|
| fPathCache = pathCache;
|
| fPathList = pathList;
|
| + fSRGBOutput = srgbOutput;
|
|
|
| // Compute bounds
|
| fBounds = geometry.fPath.getBounds();
|
| @@ -524,6 +529,7 @@ private:
|
| GrBatchAtlas* fAtlas;
|
| PathCache* fPathCache;
|
| PathDataList* fPathList;
|
| + bool fSRGBOutput;
|
|
|
| typedef GrVertexBatch INHERITED;
|
| };
|
| @@ -560,9 +566,13 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
| // for caching.
|
| geometry.fGenID = args.fPath->getGenerationID();
|
|
|
| + bool srgbOutput = GrPixelConfigIsSRGB(args.fTarget->fRenderTarget->config()) &&
|
| + !args.fPipelineBuilder->getDisableOutputConversionToSRGB();
|
| +
|
| SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry,
|
| *args.fViewMatrix, fAtlas,
|
| - &fPathCache, &fPathList));
|
| + &fPathCache, &fPathList,
|
| + srgbOutput));
|
| args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
|
|
| return true;
|
| @@ -637,10 +647,13 @@ DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
|
| geometry.fAntiAlias = random->nextBool();
|
| geometry.fGenID = random->nextU();
|
|
|
| + bool srgbOutput = random->nextBool();
|
| +
|
| return AADistanceFieldPathBatch::Create(geometry, viewMatrix,
|
| gTestStruct.fAtlas,
|
| &gTestStruct.fPathCache,
|
| - &gTestStruct.fPathList);
|
| + &gTestStruct.fPathList,
|
| + srgbOutput);
|
| }
|
|
|
| #endif
|
|
|