aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-06-08 10:08:43 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-08 10:08:43 -0700
commitecbc12b1c1c72de0cf7bba4a3f6a7cce4f43bf41 (patch)
tree82d33bb0118105ba8da507f814257b3ed44f434b /src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
parent5c7d62d431a0ad7988f05fbdb206237729c0c308 (diff)
Replace targetHasUnifiedMultisampling in GrPB constructor
Replaces targetHasUnifiedMultisampling with a simpler "useHWAA". Now the code that creates a pipeline builder needs to decide on its own whether it should enable multisampling, rather than relying on the builder to try and guess. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2041283002 Review-Url: https://codereview.chromium.org/2041283002
Diffstat (limited to 'src/gpu/batches/GrStencilAndCoverPathRenderer.cpp')
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 1e6675a9a1..344748ceca 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -75,8 +75,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
SkSafeUnref(paint.setXPFactory(GrDisableColorXPFactory::Create()));
paint.setAntiAlias(args.fIsAA);
- GrPipelineBuilder pipelineBuilder(paint, args.fDrawContext->isUnifiedMultisampled());
- pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, args.fIsAA);
+ const GrPipelineBuilder pipelineBuilder(paint, args.fIsAA);
SkASSERT(!args.fPath->isInverseFillType());
SkAutoTUnref<GrPath> path(get_gr_path(fResourceProvider, *args.fPath, GrStyle::SimpleFill()));
@@ -90,6 +89,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onDrawPath");
+ SkASSERT(!args.fPaint->isAntiAlias() || args.fDrawContext->isStencilBufferMultisampled());
SkASSERT(!args.fStyle->strokeRec().isHairlineStyle());
const SkPath& path = *args.fPath;
const SkMatrix& viewMatrix = *args.fViewMatrix;
@@ -112,13 +112,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
// fake inverse with a stencil and cover
{
- GrPipelineBuilder pipelineBuilder(*args.fPaint,
- args.fDrawContext->isUnifiedMultisampled());
+ GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kInvertedCoverPass);
- if (args.fAntiAlias) {
- SkASSERT(args.fDrawContext->isStencilBufferMultisampled());
- pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
- }
args.fDrawContext->drawContextPriv().stencilPath(pipelineBuilder, *args.fClip,
viewMatrix, p, p->getFillType());
@@ -144,23 +139,17 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
- SkAutoTUnref<GrDrawBatch> batch(
+ SkAutoTUnref<GrDrawBatch> coverBatch(
GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds, nullptr,
&invert));
{
GrPipelineBuilder pipelineBuilder(*args.fPaint,
- args.fDrawContext->isUnifiedMultisampled());
+ args.fPaint->isAntiAlias() &&
+ !args.fDrawContext->hasMixedSamples());
pipelineBuilder.setUserStencil(&kInvertedCoverPass);
- if (args.fAntiAlias) {
- SkASSERT(args.fDrawContext->isStencilBufferMultisampled());
- pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
- }
- if (args.fDrawContext->hasMixedSamples()) {
- pipelineBuilder.disableState(GrPipelineBuilder::kHWAntialias_Flag);
- }
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, coverBatch);
}
} else {
static constexpr GrUserStencilSettings kCoverPass(
@@ -176,8 +165,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkAutoTUnref<GrDrawBatch> batch(
GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(), p));
- GrPipelineBuilder pipelineBuilder(*args.fPaint,
- args.fDrawContext->isUnifiedMultisampled());
+ GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
if (args.fAntiAlias) {
SkASSERT(args.fDrawContext->isStencilBufferMultisampled());