diff options
author | 2016-12-08 10:35:19 -0500 | |
---|---|---|
committer | 2016-12-08 16:27:44 +0000 | |
commit | 9f549358b3ac9f61e78b194e39d6ac6eb322e35e (patch) | |
tree | 870b370b9985b1863abf4b1df0cce6d6f6ad5ac5 /src/gpu/text | |
parent | 978ccebd8af61417ecdb6d45a31cc68657eee752 (diff) |
Remove antialiasing control from GrPaint.
This adds an additional param (of new enum type GrAA) to draws that can antialias and a new enum GrAAType to indicate the AA technique (none, fragment shader computed coverage, msaa).
Some GMs change due to this:
1) In some places we weren't disabling MSAA when the draw was supposed to be unantialiased.
2) Some bounding rect draws that use GrFragmentProcessors were unnecessarily turning on antialiasing, by disabling it a very small number of pixel LSBs change.
Change-Id: I7d8d8793dda70bcd373d09055beb9949c1a8a4d0
Reviewed-on: https://skia-review.googlesource.com/5608
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.cpp | 5 | ||||
-rw-r--r-- | src/gpu/text/GrStencilAndCoverTextContext.cpp | 16 | ||||
-rw-r--r-- | src/gpu/text/GrStencilAndCoverTextContext.h | 2 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index 5b35f845c1..10f563a1c1 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -323,8 +323,9 @@ void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrPaint& grPain distanceAdjustTable, rtc->isGammaCorrect(), cache)); - - GrPipelineBuilder pipelineBuilder(grPaint, rtc->mustUseHWAA(grPaint)); + GrAAType aaType = skPaint.isAntiAlias() && rtc->isUnifiedMultisampled() ? GrAAType::kHW + : GrAAType::kNone; + GrPipelineBuilder pipelineBuilder(grPaint, aaType); rtc->addDrawOp(pipelineBuilder, clip, batch.get()); } diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index ba98784c71..b4e087f788 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -224,10 +224,8 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrRenderTarg TextBlob::Iter iter(blob); for (TextRun* run = iter.get(); run; run = iter.next()) { - // The run's "font" overrides the anti-aliasing of the passed in paint! - paint.setAntiAlias(run->isAntiAlias()); - run->draw(context, rtc, paint, clip, viewMatrix, props, x, y, - clipBounds, fFallbackTextContext, skPaint); + run->draw(context, rtc, paint, clip, viewMatrix, props, x, y, clipBounds, + fFallbackTextContext, skPaint); run->releaseGlyphCache(); } } @@ -605,8 +603,9 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, const SkIRect& clipBounds, GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const { + GrAA runAA = this->isAntiAlias(); SkASSERT(fInstanceData); - SkASSERT(renderTargetContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias()); + SkASSERT(renderTargetContext->isStencilBufferMultisampled() || GrAA::kNo == runAA); if (fInstanceData->count()) { static constexpr GrUserStencilSettings kCoverPass( @@ -640,8 +639,11 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, GrPathRendering::kWinding_FillType, glyphs.get(), fInstanceData.get(), bounds)); - GrPipelineBuilder pipelineBuilder(grPaint); - pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.isAntiAlias()); + // The run's "font" overrides the anti-aliasing of the passed in SkPaint! + GrAAType aaType = renderTargetContext->isStencilBufferMultisampled() && GrAA::kYes == runAA + ? GrAAType::kHW + : GrAAType::kNone; + GrPipelineBuilder pipelineBuilder(grPaint, aaType); pipelineBuilder.setUserStencil(&kCoverPass); renderTargetContext->addDrawOp(pipelineBuilder, clip, batch.get()); diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h index f4773ffa5b..1ba113b59b 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.h +++ b/src/gpu/text/GrStencilAndCoverTextContext.h @@ -88,7 +88,7 @@ private: size_t computeSizeInCache() const; - bool isAntiAlias() const { return fFont.isAntiAlias(); } + GrAA isAntiAlias() const { return fFont.isAntiAlias() ? GrAA::kYes : GrAA::kNo; } private: typedef GrDrawPathRangeBatch::InstanceData InstanceData; |