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

Unified Diff: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp

Issue 1889453002: Tweak distance field path renderer behavior in gamma-correct mode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebased, plumbed gamma-correctness via DrawPathArgs, fixed typos from most recent change 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/GrPathRenderer.h ('k') | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index 35d1f619773166d536ecd16355af5a859f729def..655a77127efec6a0af171a19fdab60a10aaf899e 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 gammaCorrect) {
+ return new AADistanceFieldPathBatch(geometry, viewMatrix, atlas, pathCache, pathList,
+ gammaCorrect);
}
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 |= fGammaCorrect ? kGammaCorrect_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 gammaCorrect)
: INHERITED(ClassID()) {
fBatch.fViewMatrix = viewMatrix;
fGeoData.push_back(geometry);
@@ -304,6 +308,7 @@ private:
fAtlas = atlas;
fPathCache = pathCache;
fPathList = pathList;
+ fGammaCorrect = gammaCorrect;
// Compute bounds
fBounds = geometry.fPath.getBounds();
@@ -524,6 +529,7 @@ private:
GrBatchAtlas* fAtlas;
PathCache* fPathCache;
PathDataList* fPathList;
+ bool fGammaCorrect;
typedef GrVertexBatch INHERITED;
};
@@ -562,7 +568,8 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry,
*args.fViewMatrix, fAtlas,
- &fPathCache, &fPathList));
+ &fPathCache, &fPathList,
+ args.fGammaCorrect));
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
return true;
@@ -630,6 +637,7 @@ DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
SkMatrix viewMatrix = GrTest::TestMatrix(random);
GrColor color = GrRandomColor(random);
+ bool gammaCorrect = random->nextBool();
AADistanceFieldPathBatch::Geometry geometry(GrTest::TestStrokeRec(random));
geometry.fColor = color;
@@ -640,7 +648,8 @@ DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
return AADistanceFieldPathBatch::Create(geometry, viewMatrix,
gTestStruct.fAtlas,
&gTestStruct.fPathCache,
- &gTestStruct.fPathList);
+ &gTestStruct.fPathList,
+ gammaCorrect);
}
#endif
« no previous file with comments | « src/gpu/GrPathRenderer.h ('k') | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698