diff options
author | Brian Salomon <bsalomon@google.com> | 2017-01-11 13:42:54 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-11 19:56:48 +0000 |
commit | 82f44319159bb98dcacdbbec7ea643dde5ed024b (patch) | |
tree | dcd8c8a5caaac2675fcfdf48c5af67f946200c24 /gm/windowrectangles.cpp | |
parent | ab273facbfe496a3d5dd798e6b4b57c41eed7f16 (diff) |
Make GrPaints move their GrProcessor ownership into GrPipelineBuilder.
This makes GrPaints usable only once. In some places we must make copies in order to issue draws with the same paint state.
Change-Id: Ie816e5185ce93a064111cad64c6880e1e21184c2
Reviewed-on: https://skia-review.googlesource.com/6844
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'gm/windowrectangles.cpp')
-rw-r--r-- | gm/windowrectangles.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index 156da58bf2..29356fc72a 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -127,10 +127,8 @@ private: constexpr static int kMaskCheckerSize = 5; SkString onShortName() final { return SkString("windowrectangles_mask"); } void onCoverClipStack(const SkClipStack&, SkCanvas*) final; - void visualizeAlphaMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&, - const GrPaint&); - void visualizeStencilMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&, - const GrPaint&); + void visualizeAlphaMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&, GrPaint&&); + void visualizeStencilMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&, GrPaint&&); void stencilCheckerboard(GrRenderTargetContext*, bool flip); void fail(SkCanvas*); }; @@ -192,16 +190,15 @@ void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas GrPaint paint; if (!rtc->isStencilBufferMultisampled()) { paint.setColor4f(GrColor4f(0, 0.25f, 1, 1)); - this->visualizeAlphaMask(ctx, rtc, reducedClip, paint); + this->visualizeAlphaMask(ctx, rtc, reducedClip, std::move(paint)); } else { paint.setColor4f(GrColor4f(1, 0.25f, 0.25f, 1)); - this->visualizeStencilMask(ctx, rtc, reducedClip, paint); + this->visualizeStencilMask(ctx, rtc, reducedClip, std::move(paint)); } } void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetContext* rtc, - const GrReducedClip& reducedClip, - const GrPaint& paint) { + const GrReducedClip& reducedClip, GrPaint&& paint) { sk_sp<GrRenderTargetContext> maskRTC( ctx->makeRenderTargetContextWithFallback(SkBackingFit::kExact, kLayerRect.width(), kLayerRect.height(), kAlpha_8_GrPixelConfig, @@ -228,13 +225,13 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo // inside window rectangles or outside the scissor should still have the initial checkerboard // intact. (This verifies we didn't spend any time modifying those pixels in the mask.) AlphaOnlyClip clip(mask.get(), x, y); - rtc->drawRect(clip, paint, GrAA::kYes, SkMatrix::I(), - SkRect::Make(SkIRect::MakeXYWH(x, y, mask->width(), mask->height()))); + rtc->drawRect(clip, std::move(paint), GrAA::kYes, SkMatrix::I(), + SkRect::Make(SkIRect::MakeXYWH(x, y, mask->width(), mask->height()))); } void WindowRectanglesMaskGM::visualizeStencilMask(GrContext* ctx, GrRenderTargetContext* rtc, const GrReducedClip& reducedClip, - const GrPaint& paint) { + GrPaint&& paint) { if (!ctx->resourceProvider()->attachStencilAttachment(rtc->accessRenderTarget())) { return; } @@ -247,7 +244,7 @@ void WindowRectanglesMaskGM::visualizeStencilMask(GrContext* ctx, GrRenderTarget // Now visualize the stencil mask by covering the entire render target. The regions inside // window rectangless or outside the scissor should still have the initial checkerboard intact. // (This verifies we didn't spend any time modifying those pixels in the mask.) - rtc->drawPaint(StencilOnlyClip(), paint, SkMatrix::I()); + rtc->drawPaint(StencilOnlyClip(), std::move(paint), SkMatrix::I()); } void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, bool flip) { |