diff options
author | Brian Salomon <bsalomon@google.com> | 2016-12-09 20:02:08 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-09 20:02:22 +0000 |
commit | 073285c0595d46205d1482cc19af2d7d891bfeae (patch) | |
tree | f127dd2c03ef707cd47396be0bf1cbf911403849 /src/gpu/GrReducedClip.cpp | |
parent | 3944484020d98ff8f386378296106c321279482b (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/GrReducedClip.cpp')
-rw-r--r-- | src/gpu/GrReducedClip.cpp | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 8b9090f427..c5d764d3b7 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -529,7 +529,8 @@ static bool stencil_element(GrRenderTargetContext* rtc, const GrUserStencilSettings* ss, const SkMatrix& viewMatrix, const SkClipStack::Element* element) { - GrAA aa = GrBoolToAA(element->isAA()); + + // TODO: Draw rrects directly here. switch (element->getType()) { case Element::kEmpty_Type: SkDEBUGFAIL("Should never get here with an empty element."); @@ -537,7 +538,9 @@ static bool stencil_element(GrRenderTargetContext* rtc, case Element::kRect_Type: return rtc->priv().drawAndStencilRect(clip, ss, (SkRegion::Op)element->getOp(), - element->isInverseFilled(), aa, viewMatrix, + element->isInverseFilled(), + element->isAA(), + viewMatrix, element->getRect()); break; default: { @@ -547,8 +550,11 @@ static bool stencil_element(GrRenderTargetContext* rtc, path.toggleInverseFillType(); } - return rtc->priv().drawAndStencilPath(clip, ss, (SkRegion::Op)element->getOp(), - element->isInverseFilled(), aa, viewMatrix, path); + return rtc->priv().drawAndStencilPath(clip, ss, + (SkRegion::Op)element->getOp(), + element->isInverseFilled(), + element->isAA(), viewMatrix, + path); break; } } @@ -559,7 +565,6 @@ static bool stencil_element(GrRenderTargetContext* rtc, static void draw_element(GrRenderTargetContext* rtc, const GrClip& clip, // TODO: can this just always be WideOpen? const GrPaint &paint, - GrAA aa, const SkMatrix& viewMatrix, const SkClipStack::Element* element) { @@ -569,7 +574,7 @@ static void draw_element(GrRenderTargetContext* rtc, SkDEBUGFAIL("Should never get here with an empty element."); break; case Element::kRect_Type: - rtc->drawRect(clip, paint, aa, viewMatrix, element->getRect()); + rtc->drawRect(clip, paint, viewMatrix, element->getRect()); break; default: { SkPath path; @@ -578,7 +583,7 @@ static void draw_element(GrRenderTargetContext* rtc, path.toggleInverseFillType(); } - rtc->drawPath(clip, paint, aa, viewMatrix, path, GrStyle::SimpleFill()); + rtc->drawPath(clip, paint, viewMatrix, path, GrStyle::SimpleFill()); break; } } @@ -607,7 +612,6 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const { for (ElementList::Iter iter(fElements); iter.get(); iter.next()) { const Element* element = iter.get(); SkRegion::Op op = (SkRegion::Op)element->getOp(); - GrAA aa = GrBoolToAA(element->isAA()); bool invert = element->isInverseFilled(); if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op) { // draw directly into the result with the stencil set to make the pixels affected @@ -635,16 +639,17 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const { GrUserStencilOp::kZero, 0xffff>() ); - if (!rtc->priv().drawAndStencilRect(clip, &kDrawOutsideElement, op, !invert, GrAA::kNo, + if (!rtc->priv().drawAndStencilRect(clip, &kDrawOutsideElement, op, !invert, false, translate, SkRect::Make(fIBounds))) { return false; } } else { // all the remaining ops can just be directly draw into the accumulation buffer GrPaint paint; + paint.setAntiAlias(element->isAA()); paint.setCoverageSetOpXPFactory(op, false); - draw_element(rtc, clip, paint, aa, translate, element); + draw_element(rtc, clip, paint, translate, element); } } @@ -671,7 +676,7 @@ private: void getConservativeBounds(int width, int height, SkIRect* bounds, bool* iior) const override { fFixedClip.getConservativeBounds(width, height, bounds, iior); } - bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const override { + bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override { return false; } bool apply(GrContext* context, GrRenderTargetContext* renderTargetContext, bool useHWAA, @@ -706,13 +711,11 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, SkMatrix viewMatrix; viewMatrix.setTranslate(SkIntToScalar(-clipOrigin.x()), SkIntToScalar(-clipOrigin.y())); - // walk through each clip element and perform its set op with the existing clip. + // walk through each clip element and perform its set op + // with the existing clip. for (ElementList::Iter iter(fElements); iter.get(); iter.next()) { const Element* element = iter.get(); - GrAAType aaType = GrAAType::kNone; - if (element->isAA() && renderTargetContext->isStencilBufferMultisampled()) { - aaType = GrAAType::kMSAA; - } + bool useHWAA = element->isAA() && renderTargetContext->isStencilBufferMultisampled(); bool fillInverted = false; @@ -739,8 +742,9 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, canDrawArgs.fShaderCaps = context->caps()->shaderCaps(); canDrawArgs.fViewMatrix = &viewMatrix; canDrawArgs.fShape = &shape; - canDrawArgs.fAAType = aaType; + canDrawArgs.fAntiAlias = false; canDrawArgs.fHasUserStencilSettings = false; + canDrawArgs.fIsStencilBufferMSAA = renderTargetContext->isStencilBufferMultisampled(); GrDrawingManager* dm = context->contextPriv().drawingManager(); pr = dm->getPathRenderer(canDrawArgs, false, @@ -774,13 +778,14 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, ); if (Element::kRect_Type == element->getType()) { renderTargetContext->priv().stencilRect(stencilClip.fixedClip(), &kDrawToStencil, - aaType, viewMatrix, element->getRect()); + useHWAA, viewMatrix, element->getRect()); } else { if (!clipPath.isEmpty()) { GrShape shape(clipPath, GrStyle::SimpleFill()); if (canRenderDirectToStencil) { GrPaint paint; paint.setXPFactory(GrDisableColorXPFactory::Make()); + paint.setAntiAlias(element->isAA()); GrPathRenderer::DrawPathArgs args; args.fResourceProvider = context->resourceProvider(); @@ -790,7 +795,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, args.fClip = &stencilClip.fixedClip(); args.fViewMatrix = &viewMatrix; args.fShape = &shape; - args.fAAType = aaType; + args.fAntiAlias = false; args.fGammaCorrect = false; pr->drawPath(args); } else { @@ -799,7 +804,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, args.fRenderTargetContext = renderTargetContext; args.fClip = &stencilClip.fixedClip(); args.fViewMatrix = &viewMatrix; - args.fAAType = aaType; + args.fIsAA = element->isAA(); args.fShape = &shape; pr->stencilPath(args); } @@ -812,12 +817,13 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, for (GrUserStencilSettings const* const* pass = stencilPasses; *pass; ++pass) { if (drawDirectToClip) { if (Element::kRect_Type == element->getType()) { - renderTargetContext->priv().stencilRect(stencilClip, *pass, aaType, viewMatrix, + renderTargetContext->priv().stencilRect(stencilClip, *pass, useHWAA, viewMatrix, element->getRect()); } else { GrShape shape(clipPath, GrStyle::SimpleFill()); GrPaint paint; paint.setXPFactory(GrDisableColorXPFactory::Make()); + paint.setAntiAlias(element->isAA()); GrPathRenderer::DrawPathArgs args; args.fResourceProvider = context->resourceProvider(); args.fPaint = &paint; @@ -826,14 +832,14 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, args.fClip = &stencilClip; args.fViewMatrix = &viewMatrix; args.fShape = &shape; - args.fAAType = aaType; + args.fAntiAlias = false; args.fGammaCorrect = false; pr->drawPath(args); } } else { // The view matrix is setup to do clip space -> stencil space translation, so // draw rect in clip space. - renderTargetContext->priv().stencilRect(stencilClip, *pass, aaType, viewMatrix, + renderTargetContext->priv().stencilRect(stencilClip, *pass, false, viewMatrix, SkRect::Make(fIBounds)); } } |