diff options
author | csmartdalton <csmartdalton@google.com> | 2016-07-27 13:22:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-27 13:22:27 -0700 |
commit | 34ee0c950e1aa24818632084acdb382514f98c08 (patch) | |
tree | a565c69109e84a66b622c0c1a37f882a1762ce2d | |
parent | e772aeea0809c4d3cd6335f3359a5fed10806045 (diff) |
Fix GrDrawContextPriv::stencilRect
Updates stencilRect to call drawNonAAFilledRect instead of
drawFilledRect. drawFilledRect can use coverage AA, which isn't
appropriate for stencil draws. Also modifies drawNonAAFilledRect to
take a "useHWAA" argument instead of trying to deduce whether it
should be used.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2187583002
Review-Url: https://codereview.chromium.org/2187583002
-rw-r--r-- | include/gpu/GrDrawContext.h | 3 | ||||
-rw-r--r-- | src/gpu/GrDrawContext.cpp | 20 |
2 files changed, 13 insertions, 10 deletions
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index e305cc1197..948577cffa 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -347,7 +347,8 @@ private: const SkRect& rect, const SkRect* localRect, const SkMatrix* localMatrix, - const GrUserStencilSettings* ss); + const GrUserStencilSettings* ss, + bool useHWAA); void internalDrawPath(const GrClip& clip, const GrPaint& paint, diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index 266c50d70c..fedb397200 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -277,7 +277,8 @@ void GrDrawContext::drawPaint(const GrClip& clip, AutoCheckFlush acf(fDrawingManager); - this->drawNonAAFilledRect(clip, *paint, SkMatrix::I(), r, nullptr, &localMatrix, nullptr); + this->drawNonAAFilledRect(clip, *paint, SkMatrix::I(), r, nullptr, &localMatrix, nullptr, + false /* useHWAA */); } } @@ -399,7 +400,8 @@ bool GrDrawContext::drawFilledRect(const GrClip& clip, } } } else { - this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, nullptr, nullptr, ss); + this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, nullptr, nullptr, ss, + useHWAA); return true; } @@ -566,9 +568,7 @@ void GrDrawContextPriv::stencilRect(const GrFixedClip& clip, paint.setAntiAlias(useHWAA); paint.setXPFactory(GrDisableColorXPFactory::Make()); - SkASSERT(!useHWAA || fDrawContext->isStencilBufferMultisampled()); - - fDrawContext->drawFilledRect(clip, paint, viewMatrix, rect, ss); + fDrawContext->drawNonAAFilledRect(clip, paint, viewMatrix, rect, nullptr, nullptr, ss, useHWAA); } bool GrDrawContextPriv::drawAndStencilRect(const GrFixedClip& clip, @@ -631,7 +631,7 @@ void GrDrawContext::fillRectToRect(const GrClip& clip, if (!should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, &croppedLocalRect, - nullptr, nullptr); + nullptr, nullptr, useHWAA); return; } @@ -689,7 +689,7 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip, if (!should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, nullptr, - &localMatrix, nullptr); + &localMatrix, nullptr, useHWAA); return; } @@ -1025,11 +1025,13 @@ void GrDrawContext::drawNonAAFilledRect(const GrClip& clip, const SkRect& rect, const SkRect* localRect, const SkMatrix* localMatrix, - const GrUserStencilSettings* ss) { + const GrUserStencilSettings* ss, + bool useHWAA) { + SkASSERT(!useHWAA || this->isStencilBufferMultisampled()); SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect, localRect, localMatrix)); - GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); + GrPipelineBuilder pipelineBuilder(paint, useHWAA); if (ss) { pipelineBuilder.setUserStencil(ss); } |