aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2016-12-09 20:02:08 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-09 20:02:22 +0000
commit073285c0595d46205d1482cc19af2d7d891bfeae (patch)
treef127dd2c03ef707cd47396be0bf1cbf911403849 /src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
parent3944484020d98ff8f386378296106c321279482b (diff)
Revert "Reland "Remove antialiasing control from GrPaint.""
This reverts commit 3944484020d98ff8f386378296106c321279482b. Reason for revert: Merges badly with a recent change. Will rebase and reland. Original change's description: > Reland "Remove antialiasing control from GrPaint." > > This contains fixes for GLPrograms test and mixed samples rendering. > > This reverts commit 419d81eed4a010e6080db199795117cbedf9e6e4. > > BUG=skia: > > Change-Id: If8f002fbfaaaab6d1607403f2b15ccc7f1e17e87 > Reviewed-on: https://skia-review.googlesource.com/5763 > Commit-Queue: Brian Salomon <bsalomon@google.com> > Reviewed-by: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org BUG=skia: NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Iff9657041e28604a845bc5a9acec7c9b248c53bd Reviewed-on: https://skia-review.googlesource.com/5772 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/batches/GrAADistanceFieldPathRenderer.cpp')
-rw-r--r--src/gpu/batches/GrAADistanceFieldPathRenderer.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index 71b9000482..0aa451df86 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -90,8 +90,8 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
if (!args.fShape->style().isSimpleFill()) {
return false;
}
- // This does non-inverse coverage-based antialiased fills.
- if (GrAAType::kCoverage != args.fAAType) {
+ // This does non-inverse antialiased fills.
+ if (!args.fAntiAlias) {
return false;
}
// TODO: Support inverse fill
@@ -128,6 +128,7 @@ public:
AADistanceFieldPathBatch(GrColor color,
const GrShape& shape,
+ bool antiAlias,
const SkMatrix& viewMatrix,
GrBatchAtlas* atlas,
ShapeCache* shapeCache, ShapeDataList* shapeList,
@@ -135,7 +136,7 @@ public:
: INHERITED(ClassID()) {
SkASSERT(shape.hasUnstyledKey());
fBatch.fViewMatrix = viewMatrix;
- fGeoData.emplace_back(Geometry{color, shape});
+ fGeoData.emplace_back(Geometry{color, shape, antiAlias});
fAtlas = atlas;
fShapeCache = shapeCache;
@@ -156,7 +157,7 @@ public:
SkString dumpInfo() const override {
SkString string;
for (const auto& geo : fGeoData) {
- string.appendf("Color: 0x%08x\n", geo.fColor);
+ string.appendf("Color: 0x%08x AA:%d\n", geo.fColor, geo.fAntiAlias);
}
string.append(DumpPipelineInfo(*this->pipeline()));
string.append(INHERITED::dumpInfo());
@@ -273,6 +274,7 @@ private:
atlas,
shapeData,
args.fShape,
+ args.fAntiAlias,
desiredDimension,
scale)) {
delete shapeData;
@@ -298,8 +300,8 @@ private:
}
bool addPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo, GrBatchAtlas* atlas,
- ShapeData* shapeData, const GrShape& shape, uint32_t dimension,
- SkScalar scale) const {
+ ShapeData* shapeData, const GrShape& shape, bool antiAlias,
+ uint32_t dimension, SkScalar scale) const {
const SkRect& bounds = shape.bounds();
// generate bounding rect for bitmap draw
@@ -346,7 +348,7 @@ private:
// rasterize path
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
- paint.setAntiAlias(true);
+ paint.setAntiAlias(antiAlias);
SkDraw draw;
sk_bzero(&draw, sizeof(draw));
@@ -500,6 +502,7 @@ private:
struct Geometry {
GrColor fColor;
GrShape fShape;
+ bool fAntiAlias;
};
BatchTracker fBatch;
@@ -515,6 +518,8 @@ private:
bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrAADistanceFieldPathRenderer::onDrawPath");
+ SkASSERT(!args.fRenderTargetContext->isUnifiedMultisampled());
+ SkASSERT(args.fShape->style().isSimpleFill());
// we've already bailed on inverse filled paths, so this is safe
SkASSERT(!args.fShape->isEmpty());
@@ -531,10 +536,11 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
sk_sp<GrDrawOp> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(),
- *args.fShape, *args.fViewMatrix,
+ *args.fShape,
+ args.fAntiAlias, *args.fViewMatrix,
fAtlas.get(), &fShapeCache, &fShapeList,
args.fGammaCorrect));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
+ GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get());
@@ -608,9 +614,11 @@ DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
// This path renderer only allows fill styles.
GrShape shape(GrTest::TestPath(random), GrStyle::SimpleFill());
+ bool antiAlias = random->nextBool();
return new AADistanceFieldPathBatch(color,
shape,
+ antiAlias,
viewMatrix,
gTestStruct.fAtlas.get(),
&gTestStruct.fShapeCache,