diff --git a/gm/clockwise.cpp b/gm/clockwise.cpp index 01ac28abf4..d4037f2c9d 100644 --- a/gm/clockwise.cpp +++ b/gm/clockwise.cpp @@ -242,7 +242,7 @@ private: // Test. void ClockwiseGM::onDraw(GrContext* ctx, GrRenderTargetContext* rtc, SkCanvas* canvas) { - rtc->clear(nullptr, { 0, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fBLACK); // Draw the test directly to the frame buffer. rtc->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0)); @@ -254,8 +254,7 @@ void ClockwiseGM::onDraw(GrContext* ctx, GrRenderTargetContext* rtc, SkCanvas* c ctx, rtcColorType, nullptr, SkBackingFit::kExact, {100, 200}, 1, GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes, nullptr)) { - topLeftRTC->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + topLeftRTC->clear(SK_PMColor4fTRANSPARENT); topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0)); topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, true, 100)); rtc->drawTexture(GrNoClip(), topLeftRTC->readSurfaceView(), rtc->colorInfo().alphaType(), @@ -270,8 +269,7 @@ void ClockwiseGM::onDraw(GrContext* ctx, GrRenderTargetContext* rtc, SkCanvas* c ctx, rtcColorType, nullptr, SkBackingFit::kExact, {100, 200}, 1, GrMipMapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin, SkBudgeted::kYes, nullptr)) { - topLeftRTC->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + topLeftRTC->clear(SK_PMColor4fTRANSPARENT); topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0)); topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, true, 100)); rtc->drawTexture(GrNoClip(), topLeftRTC->readSurfaceView(), rtc->colorInfo().alphaType(), diff --git a/gm/samplelocations.cpp b/gm/samplelocations.cpp index 8ae5e0327c..c5a7f66bac 100644 --- a/gm/samplelocations.cpp +++ b/gm/samplelocations.cpp @@ -354,7 +354,7 @@ DrawResult SampleLocationsGM::onDraw( 0xffff>() ); - offscreenRTC->clear(nullptr, {0,1,0,1}, GrRenderTargetContext::CanClearFullscreen::kYes); + offscreenRTC->clear({0,1,0,1}); // Stencil. offscreenRTC->priv().testingOnly_addDrawOp( diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index 95140e9dd0..5b430ab73a 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -238,7 +238,7 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo // Draw a checker pattern into the alpha mask so we can visualize the regions left untouched by // the clip mask generation. this->stencilCheckerboard(maskRTC.get(), true); - maskRTC->clear(nullptr, SK_PMColor4fWHITE, GrRenderTargetContext::CanClearFullscreen::kYes); + maskRTC->clear(SK_PMColor4fWHITE); GrPaint stencilPaint; stencilPaint.setCoverageSetOpXPFactory(SkRegion::kDifference_Op, false); maskRTC->priv().stencilRect(make_stencil_only_clip(), &GrUserStencilSettings::kUnused, @@ -288,7 +288,7 @@ void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, boo 0>() ); - rtc->priv().clearStencilClip(GrFixedClip::Disabled(), false); + rtc->priv().clearStencilClip(SkIRect::MakeSize(rtc->dimensions()), false); for (int y = 0; y < kDeviceRect.height(); y += kMaskCheckerSize) { for (int x = (y & 1) == flip ? 0 : kMaskCheckerSize; diff --git a/include/private/SkColorData.h b/include/private/SkColorData.h index 2090ab4b7e..aba610eacf 100644 --- a/include/private/SkColorData.h +++ b/include/private/SkColorData.h @@ -435,6 +435,7 @@ static inline uint32_t Sk4f_toL32(const Sk4f& px) { using SkPMColor4f = SkRGBA4f; constexpr SkPMColor4f SK_PMColor4fTRANSPARENT = { 0, 0, 0, 0 }; +constexpr SkPMColor4f SK_PMColor4fBLACK = { 0, 0, 0, 1 }; constexpr SkPMColor4f SK_PMColor4fWHITE = { 1, 1, 1, 1 }; constexpr SkPMColor4f SK_PMColor4fILLEGAL = { SK_FloatNegativeInfinity, SK_FloatNegativeInfinity, diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp index f70039a1d4..b871d14e62 100644 --- a/samplecode/SampleCCPRGeometry.cpp +++ b/samplecode/SampleCCPRGeometry.cpp @@ -198,8 +198,7 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) { auto ccbuff = GrRenderTargetContext::Make( ctx, GrColorType::kAlpha_F16, nullptr, SkBackingFit::kApprox, {width, height}); SkASSERT(ccbuff); - ccbuff->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + ccbuff->clear(SK_PMColor4fTRANSPARENT); ccbuff->priv().testingOnly_addDrawOp(pool->allocate(this)); // Visualize coverage count in main canvas. diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp index 898dcd6090..f1b86ca30c 100644 --- a/src/core/SkGpuBlurUtils.cpp +++ b/src/core/SkGpuBlurUtils.cpp @@ -191,8 +191,7 @@ static std::unique_ptr convolve_gaussian(GrRecordingConte auto clear = [&](SkIRect rect) { // Transform rect into the render target's coord system. rect.offset(-rtcToSrcOffset); - dstRenderTargetContext->clear(&rect, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + dstRenderTargetContext->priv().clearAtLeast(rect, SK_PMColor4fTRANSPARENT); }; if (!top.isEmpty()) { diff --git a/src/core/SkLegacyGpuBlurUtils.cpp b/src/core/SkLegacyGpuBlurUtils.cpp index 66a14d70eb..8be824ac12 100644 --- a/src/core/SkLegacyGpuBlurUtils.cpp +++ b/src/core/SkLegacyGpuBlurUtils.cpp @@ -242,13 +242,11 @@ static std::unique_ptr convolve_gaussian(GrRecordingConte contentRect->offset(-rtcToSrcOffset); if (!top.isEmpty()) { - dstRenderTargetContext->clear(&top, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + dstRenderTargetContext->priv().clearAtLeast(top, SK_PMColor4fTRANSPARENT); } if (!bottom.isEmpty()) { - dstRenderTargetContext->clear(&bottom, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + dstRenderTargetContext->priv().clearAtLeast(bottom, SK_PMColor4fTRANSPARENT); } if (mid.isEmpty()) { diff --git a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp index 2080c5cb87..c0f571da20 100644 --- a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp +++ b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp @@ -110,8 +110,7 @@ GrSurfaceProxyView SkAlphaThresholdFilterImpl::createMaskTexture(GrRecordingCont } SkRegion::Iterator iter(fRegion); - rtContext->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + rtContext->clear(SK_PMColor4fTRANSPARENT); GrFixedClip clip(SkIRect::MakeWH(bounds.width(), bounds.height())); while (!iter.done()) { diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp index 6e024137d6..7f3f4c8f78 100644 --- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp +++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp @@ -589,7 +589,7 @@ static sk_sp apply_morphology( dstRect.width(), radius.fHeight); SkPMColor4f clearColor = MorphType::kErode == morphType ? SK_PMColor4fWHITE : SK_PMColor4fTRANSPARENT; - dstRTContext->clear(&clearRect, clearColor, GrRenderTargetContext::CanClearFullscreen::kNo); + dstRTContext->clear(clearRect, clearColor); srcView = dstRTContext->readSurfaceView(); srcAlphaType = dstRTContext->colorInfo().alphaType(); diff --git a/src/gpu/GrDynamicAtlas.cpp b/src/gpu/GrDynamicAtlas.cpp index 881d4398cc..2bc309b773 100644 --- a/src/gpu/GrDynamicAtlas.cpp +++ b/src/gpu/GrDynamicAtlas.cpp @@ -13,7 +13,7 @@ #include "src/gpu/GrRectanizerPow2.h" #include "src/gpu/GrRectanizerSkyline.h" #include "src/gpu/GrRenderTarget.h" -#include "src/gpu/GrRenderTargetContext.h" +#include "src/gpu/GrRenderTargetContextPriv.h" // Each Node covers a sub-rectangle of the final atlas. When a GrDynamicAtlas runs out of room, we // create a new Node the same size as all combined nodes in the atlas as-is, and then place the new @@ -199,7 +199,6 @@ std::unique_ptr GrDynamicAtlas::instantiate( } SkIRect clearRect = SkIRect::MakeSize(fDrawBounds); - rtc->clear(&clearRect, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->priv().clearAtLeast(clearRect, SK_PMColor4fTRANSPARENT); return rtc; } diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 469b7f94e4..b25098e624 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -753,7 +753,15 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const { // clear the part that we care about. SkPMColor4f initialCoverage = InitialState::kAllIn == this->initialState() ? SK_PMColor4fWHITE : SK_PMColor4fTRANSPARENT; - rtc->priv().clear(clip, initialCoverage, GrRenderTargetContext::CanClearFullscreen::kYes); + if (clip.hasWindowRectangles()) { + GrPaint paint; + paint.setColor4f(initialCoverage); + paint.setPorterDuffXPFactory(SkBlendMode::kSrc); + rtc->drawRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), + SkRect::Make(clip.scissorRect())); + } else { + rtc->priv().clearAtLeast(clip.scissorRect(), initialCoverage); + } // Set the matrix so that rendered clip elements are transformed to mask space from clip space. SkMatrix translate; diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index cc5391050c..24755d1962 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -479,32 +479,6 @@ void GrRenderTargetContext::discard() { this->getOpsTask()->discard(); } -void GrRenderTargetContext::clear(const SkIRect* rect, - const SkPMColor4f& color, - CanClearFullscreen canClearFullscreen) { - ASSERT_SINGLE_OWNER - RETURN_IF_ABANDONED - SkDEBUGCODE(this->validate();) - GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "clear", fContext); - - AutoCheckFlush acf(this->drawingManager()); - this->internalClear(rect ? GrFixedClip(*rect) : GrFixedClip::Disabled(), color, - canClearFullscreen); -} - -void GrRenderTargetContextPriv::clear(const GrFixedClip& clip, - const SkPMColor4f& color, - CanClearFullscreen canClearFullscreen) { - ASSERT_SINGLE_OWNER_PRIV - RETURN_IF_ABANDONED_PRIV - SkDEBUGCODE(fRenderTargetContext->validate();) - GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContextPriv", "clear", - fRenderTargetContext->fContext); - - AutoCheckFlush acf(fRenderTargetContext->drawingManager()); - fRenderTargetContext->internalClear(clip, color, canClearFullscreen); -} - static void clear_to_grpaint(const SkPMColor4f& color, GrPaint* paint) { paint->setColor4f(color); if (color.isOpaque()) { @@ -517,19 +491,39 @@ static void clear_to_grpaint(const SkPMColor4f& color, GrPaint* paint) { } } -void GrRenderTargetContext::internalClear(const GrFixedClip& clip, +// NOTE: We currently pass the premul color unmodified to the gpu, since we assume the GrRTC has a +// premul alpha type. If we ever support different alpha type render targets, this function should +// transform the color as appropriate. +void GrRenderTargetContext::internalClear(const SkIRect* scissor, const SkPMColor4f& color, - CanClearFullscreen canClearFullscreen) { - bool isFull = false; - if (!clip.hasWindowRectangles()) { - // TODO: wrt the shouldInitializeTextures path, it would be more performant to - // only clear the entire target if we knew it had not been cleared before. As - // is this could end up doing a lot of redundant clears. - isFull = !clip.scissorEnabled() || - (CanClearFullscreen::kYes == canClearFullscreen && - (this->caps()->preferFullscreenClears() || this->caps()->shouldInitializeTextures())) || - clip.scissorRect().contains(SkIRect::MakeWH(this->width(), this->height())); + bool upgradePartialToFull) { + ASSERT_SINGLE_OWNER + RETURN_IF_ABANDONED + SkDEBUGCODE(this->validate();) + GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "clear", fContext); + + // The clear will be fullscreen if no scissor is provided, or if the scissor is larger than + // the logical bounds of the render target, or if the special flag was provided that allows + // partial clears to upgrade to full (because it's a scratch resource and the caller knows + // anything outside the scissor doesn't matter, but if full screen clears aren't free, then + // the scissor is still provided so that fewer pixels are written to). + // TODO: wrt the shouldInitializeTextures path, it would be more performant to + // only clear the entire target if we knew it had not been cleared before. As + // is this could end up doing a lot of redundant clears. + GrScissorState scissorState; + if (scissor) { + // TODO(michaelludwig) - This will get simpler when GrScissorState knows the device dims + scissorState.set(*scissor); + if (!scissorState.intersect(SkIRect::MakeWH(this->width(), this->height()))) { + // The clear is offscreen, so skip it (normally this would be handled by addDrawOp, + // except clear ops are not draw ops). + return; + } } + bool isFull = !scissorState.enabled() || + scissorState.rect().contains(SkIRect::MakeWH(this->width(), this->height())) || + (upgradePartialToFull && (this->caps()->preferFullscreenClears() || + this->caps()->shouldInitializeTextures())); if (isFull) { GrOpsTask* opsTask = this->getOpsTask(); @@ -554,20 +548,19 @@ void GrRenderTargetContext::internalClear(const GrFixedClip& clip, GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(), rtRect)); } else { - this->addOp(GrClearOp::Make( - fContext, SkIRect::MakeEmpty(), color, /* fullscreen */ true)); + this->addOp(GrClearOp::Make(fContext, GrScissorState(), color, this->asSurfaceProxy())); } } else { - if (this->caps()->performPartialClearsAsDraws() || clip.hasWindowRectangles()) { + if (this->caps()->performPartialClearsAsDraws()) { // performPartialClearsAsDraws() also returns true if any clear has to be a draw. GrPaint paint; clear_to_grpaint(color, &paint); - this->addDrawOp(clip, + this->addDrawOp(GrFixedClip::Disabled(), GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(), - SkRect::Make(clip.scissorRect()))); + SkRect::Make(scissorState.rect()))); } else { - std::unique_ptr op(GrClearOp::Make(fContext, clip.scissorState(), color, + std::unique_ptr op(GrClearOp::Make(fContext, scissorState, color, this->asSurfaceProxy())); // This version of the clear op factory can return null if the clip doesn't intersect // with the surface proxy's boundary @@ -717,14 +710,14 @@ GrRenderTargetContext::QuadOptimization GrRenderTargetContext::attemptQuadOptimi drawBounds = quad->fDevice.bounds(); if (drawBounds.contains(rtRect)) { // Fullscreen clear - this->clear(nullptr, *constColor, CanClearFullscreen::kYes); + this->clear(*constColor); return QuadOptimization::kSubmitted; } else if (GrClip::IsPixelAligned(drawBounds) && drawBounds.width() > 256 && drawBounds.height() > 256) { // Scissor + clear (round shouldn't do anything since we are pixel aligned) SkIRect scissorRect; drawBounds.round(&scissorRect); - this->clear(&scissorRect, *constColor, CanClearFullscreen::kNo); + this->clear(scissorRect, *constColor); return QuadOptimization::kSubmitted; } } @@ -956,7 +949,7 @@ void GrRenderTargetContext::setNeedsStencil(bool useMixedSamplesIfNotMSAA) { if (this->caps()->performStencilClearsAsDraws()) { // There is a driver bug with clearing stencil. We must use an op to manually clear the // stencil buffer before the op that required 'setNeedsStencil'. - this->internalStencilClear(GrFixedClip::Disabled(), /* inside mask */ false); + this->internalStencilClear(nullptr, /* inside mask */ false); } else { this->getOpsTask()->setInitialStencilContent( GrOpsTask::StencilContent::kUserBitsCleared); @@ -964,38 +957,30 @@ void GrRenderTargetContext::setNeedsStencil(bool useMixedSamplesIfNotMSAA) { } } -void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool insideStencilMask) { - ASSERT_SINGLE_OWNER_PRIV - RETURN_IF_ABANDONED_PRIV - SkDEBUGCODE(fRenderTargetContext->validate();) - GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContextPriv", "clearStencilClip", - fRenderTargetContext->fContext); - - AutoCheckFlush acf(fRenderTargetContext->drawingManager()); - - fRenderTargetContext->internalStencilClear(clip, insideStencilMask); -} - -void GrRenderTargetContext::internalStencilClear(const GrFixedClip& clip, bool insideStencilMask) { +void GrRenderTargetContext::internalStencilClear(const SkIRect* scissor, bool insideStencilMask) { this->setNeedsStencil(/* useMixedSamplesIfNotMSAA = */ false); bool clearWithDraw = this->caps()->performStencilClearsAsDraws() || - (clip.scissorEnabled() && this->caps()->performPartialClearsAsDraws()); - // TODO(michaelludwig): internalStencilClear will eventually just take a GrScissorState so - // we won't need to check window rectangles here. - if (clearWithDraw || clip.hasWindowRectangles()) { + (scissor && this->caps()->performPartialClearsAsDraws()); + if (clearWithDraw) { const GrUserStencilSettings* ss = GrStencilSettings::SetClipBitSettings(insideStencilMask); - SkRect rect = clip.scissorEnabled() ? SkRect::Make(clip.scissorRect()) - : SkRect::MakeWH(this->width(), this->height()); + SkRect rect = scissor ? SkRect::Make(*scissor) + : SkRect::MakeWH(this->width(), this->height()); // Configure the paint to have no impact on the color buffer GrPaint paint; paint.setXPFactory(GrDisableColorXPFactory::Get()); - this->addDrawOp(clip, GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(), - rect, ss)); + this->addDrawOp(GrFixedClip::Disabled(), + GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(), + rect, ss)); } else { + GrScissorState scissorState; + if (scissor) { + scissorState.set(*scissor); + } + std::unique_ptr op(GrClearStencilClipOp::Make( - fContext, clip.scissorState(), insideStencilMask, this->asRenderTargetProxy())); + fContext, scissorState, insideStencilMask, this->asRenderTargetProxy())); if (!op) { return; } diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h index ca0ac266de..abf3b8cf0d 100644 --- a/src/gpu/GrRenderTargetContext.h +++ b/src/gpu/GrRenderTargetContext.h @@ -148,22 +148,17 @@ public: */ void discard(); - enum class CanClearFullscreen : bool { - kNo = false, - kYes = true - }; - /** - * Clear the entire or rect of the render target, ignoring any clips. - * @param rect the rect to clear or the whole thing if rect is NULL. + * Clear the rect of the render target to the given color. + * @param rect the rect to clear to * @param color the color to clear to. - * @param CanClearFullscreen allows partial clears to be converted to fullscreen clears on - * tiling platforms where that is an optimization. */ - void clear(const SkIRect* rect, const SkPMColor4f& color, CanClearFullscreen); - + void clear(const SkIRect& rect, const SkPMColor4f& color) { + this->internalClear(&rect, color); + } + // Clears the entire render target to the color. void clear(const SkPMColor4f& color) { - return this->clear(nullptr, color, CanClearFullscreen::kYes); + this->internalClear(nullptr, color); } /** @@ -622,8 +617,9 @@ private: GrOpsTask::CanDiscardPreviousOps canDiscardPreviousOpsOnFullClear() const; void setNeedsStencil(bool useMixedSamplesIfNotMSAA); - void internalClear(const GrFixedClip&, const SkPMColor4f&, CanClearFullscreen); - void internalStencilClear(const GrFixedClip&, bool insideStencilMask); + void internalClear(const SkIRect* scissor, const SkPMColor4f&, + bool upgradePartialToFull = false); + void internalStencilClear(const SkIRect* scissor, bool insideStencilMask); // Only consumes the GrPaint if successful. bool drawFilledDRRect(const GrClip& clip, diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h index 188d251002..cad91f1467 100644 --- a/src/gpu/GrRenderTargetContextPriv.h +++ b/src/gpu/GrRenderTargetContextPriv.h @@ -43,11 +43,15 @@ public: opsTask->fLastClipNumAnalyticFPs != numClipAnalyticFPs; } - using CanClearFullscreen = GrRenderTargetContext::CanClearFullscreen; + // Clear at minimum the pixels within 'scissor', but is allowed to clear the full render target + // if that is the more performant option. + void clearAtLeast(const SkIRect& scissor, const SkPMColor4f& color) { + fRenderTargetContext->internalClear(&scissor, color, /* upgrade to full */ true); + } - void clear(const GrFixedClip&, const SkPMColor4f&, CanClearFullscreen); - - void clearStencilClip(const GrFixedClip&, bool insideStencilMask); + void clearStencilClip(const SkIRect& scissor, bool insideStencilMask) { + fRenderTargetContext->internalStencilClear(&scissor, insideStencilMask); + } // While this can take a general clip, since GrReducedClip relies on this function, it must take // care to only provide hard clips or we could get stuck in a loop. The general clip is needed diff --git a/src/gpu/GrStencilMaskHelper.cpp b/src/gpu/GrStencilMaskHelper.cpp index f9870f41af..3adab6d83d 100644 --- a/src/gpu/GrStencilMaskHelper.cpp +++ b/src/gpu/GrStencilMaskHelper.cpp @@ -462,7 +462,15 @@ bool GrStencilMaskHelper::drawShape(const GrShape& shape, } void GrStencilMaskHelper::clear(bool insideStencil) { - fRTC->priv().clearStencilClip(fClip.fixedClip(), insideStencil); + if (fClip.fixedClip().hasWindowRectangles()) { + // Use a draw to benefit from window rectangles when resetting the stencil buffer; for + // large buffers with MSAA this can be significant. + draw_stencil_rect(fRTC, fClip.fixedClip(), + GrStencilSettings::SetClipBitSettings(insideStencil), SkMatrix::I(), + SkRect::Make(fClip.fixedClip().scissorRect()), GrAA::kNo); + } else { + fRTC->priv().clearStencilClip(fClip.fixedClip().scissorRect(), insideStencil); + } } void GrStencilMaskHelper::finish() { diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index b316059379..2e1d9e8159 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -209,8 +209,7 @@ void SkGpuDevice::clearAll() { GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext.get()); SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); - fRenderTargetContext->clear(&rect, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + fRenderTargetContext->priv().clearAtLeast(rect, SK_PMColor4fTRANSPARENT); } void SkGpuDevice::replaceRenderTargetContext(std::unique_ptr rtc, diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp index 029472dae1..739dc40d2c 100644 --- a/src/gpu/effects/GrRRectBlurEffect.fp +++ b/src/gpu/effects/GrRRectBlurEffect.fp @@ -64,8 +64,7 @@ uniform half blurRadius; GrPaint paint; - rtc->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fTRANSPARENT); rtc->drawRRect(GrNoClip(), std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill()); diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h index 7c592c3c32..e26a5c9d32 100644 --- a/src/gpu/effects/generated/GrRRectBlurEffect.h +++ b/src/gpu/effects/generated/GrRRectBlurEffect.h @@ -66,8 +66,7 @@ public: GrPaint paint; - rtc->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fTRANSPARENT); rtc->drawRRect(GrNoClip(), std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill()); diff --git a/src/gpu/ops/GrClearOp.cpp b/src/gpu/ops/GrClearOp.cpp index dc1b93987a..753f75da41 100644 --- a/src/gpu/ops/GrClearOp.cpp +++ b/src/gpu/ops/GrClearOp.cpp @@ -17,45 +17,22 @@ std::unique_ptr GrClearOp::Make(GrRecordingContext* context, const GrScissorState& scissor, const SkPMColor4f& color, - GrSurfaceProxy* dstProxy) { + const GrSurfaceProxy* dstProxy) { const SkIRect rect = SkIRect::MakeSize(dstProxy->dimensions()); if (scissor.enabled() && !SkIRect::Intersects(scissor.rect(), rect)) { return nullptr; } GrOpMemoryPool* pool = context->priv().opMemoryPool(); - return pool->allocate(scissor, color, dstProxy); } -std::unique_ptr GrClearOp::Make(GrRecordingContext* context, - const SkIRect& rect, - const SkPMColor4f& color, - bool fullScreen) { - SkASSERT(fullScreen || !rect.isEmpty()); - - GrOpMemoryPool* pool = context->priv().opMemoryPool(); - - return pool->allocate(rect, color, fullScreen); -} - -GrClearOp::GrClearOp(const GrScissorState& scissor, const SkPMColor4f& color, GrSurfaceProxy* proxy) +GrClearOp::GrClearOp(const GrScissorState& scissor, const SkPMColor4f& color, + const GrSurfaceProxy* proxy) : INHERITED(ClassID()) , fScissor(scissor) , fColor(color) { - const SkIRect rtRect = SkIRect::MakeSize(proxy->dimensions()); - if (fScissor.enabled()) { - // Don't let scissors extend outside the RT. This may improve op combining. - if (!fScissor.intersect(rtRect)) { - SkASSERT(0); // should be caught upstream - fScissor.set(SkIRect::MakeEmpty()); - } - - if (proxy->isFunctionallyExact() && fScissor.rect() == rtRect) { - fScissor.setDisabled(); - } - } - this->setBounds(SkRect::Make(fScissor.enabled() ? fScissor.rect() : rtRect), + this->setBounds(scissor.enabled() ? SkRect::Make(scissor.rect()) : proxy->getBoundsRect(), HasAABloat::kNo, IsHairline::kNo); } diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h index 0857064555..770a7de698 100644 --- a/src/gpu/ops/GrClearOp.h +++ b/src/gpu/ops/GrClearOp.h @@ -21,12 +21,7 @@ public: static std::unique_ptr Make(GrRecordingContext* context, const GrScissorState& scissor, const SkPMColor4f& color, - GrSurfaceProxy* dstProxy); - - static std::unique_ptr Make(GrRecordingContext* context, - const SkIRect& rect, - const SkPMColor4f& color, - bool fullScreen); + const GrSurfaceProxy* dstProxy); const char* name() const override { return "Clear"; } @@ -52,18 +47,7 @@ public: private: friend class GrOpMemoryPool; // for ctors - GrClearOp(const GrScissorState& scissor, const SkPMColor4f& color, GrSurfaceProxy* proxy); - - GrClearOp(const SkIRect& rect, const SkPMColor4f& color, bool fullScreen) - : INHERITED(ClassID()) - , fScissor(rect) - , fColor(color) { - - if (fullScreen) { - fScissor.setDisabled(); - } - this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsHairline::kNo); - } + GrClearOp(const GrScissorState& scissor, const SkPMColor4f& color, const GrSurfaceProxy* proxy); CombineResult onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*, const GrCaps& caps) override { diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp index 13a696f91f..73d168d3cd 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -100,7 +100,7 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Check a full clear - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -110,8 +110,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Check two full clears, same color - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); + rtContext->clear(fullRect, kColor1f); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -121,8 +121,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Check two full clears, different colors - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&fullRect, kColor2f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); + rtContext->clear(fullRect, kColor2f); if (!check_rect(rtContext.get(), fullRect, kColor2, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue, failX, failY); @@ -132,8 +132,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a full clear followed by a same color inset clear - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&mid1Rect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); + rtContext->clear(mid1Rect, kColor1f); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -143,8 +143,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a inset clear followed by same color full clear - rtContext->clear(&mid1Rect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(mid1Rect, kColor1f); + rtContext->clear(fullRect, kColor1f); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -154,8 +154,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a full clear followed by a different color inset clear - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&mid1Rect, kColor2f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); + rtContext->clear(mid1Rect, kColor2f); if (!check_rect(rtContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue, failX, failY); @@ -172,8 +172,8 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Test a inset clear followed by a different full clear - rtContext->clear(&mid1Rect, kColor2f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(mid1Rect, kColor2f); + rtContext->clear(fullRect, kColor1f); if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -184,9 +184,9 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { // Check three nested clears from largest to smallest where outermost and innermost are same // color. - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&mid1Rect, kColor2f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&mid2Rect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); + rtContext->clear(mid1Rect, kColor2f); + rtContext->clear(mid2Rect, kColor1f); if (!check_rect(rtContext.get(), mid2Rect, kColor1, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue, failX, failY); @@ -210,9 +210,9 @@ static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) { SkASSERT(rtContext); // Swap the order of the second two clears in the above test. - rtContext->clear(&fullRect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&mid2Rect, kColor1f, GrRenderTargetContext::CanClearFullscreen::kNo); - rtContext->clear(&mid1Rect, kColor2f, GrRenderTargetContext::CanClearFullscreen::kNo); + rtContext->clear(fullRect, kColor1f); + rtContext->clear(mid2Rect, kColor1f); + rtContext->clear(mid1Rect, kColor2f); if (!check_rect(rtContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) { ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue, failX, failY); diff --git a/tests/DefaultPathRendererTest.cpp b/tests/DefaultPathRendererTest.cpp index ccf54d7395..2e886a3a7e 100644 --- a/tests/DefaultPathRendererTest.cpp +++ b/tests/DefaultPathRendererTest.cpp @@ -88,7 +88,7 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) { ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {kBigSize/2 + 1, kBigSize/2 + 1}); - rtc->clear(nullptr, { 0, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fBLACK); GrPaint paint; @@ -106,7 +106,7 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) { auto rtc = GrRenderTargetContext::Make( ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {kBigSize, kBigSize}); - rtc->clear(nullptr, { 0, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fBLACK); GrPaint paint; diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp index f7976fee3d..098c81abda 100644 --- a/tests/GrCCPRTest.cpp +++ b/tests/GrCCPRTest.cpp @@ -74,8 +74,7 @@ public: GrCoverageCountingPathRenderer* ccpr() const { return fCCPR; } bool valid() const { return fCCPR && fRTC; } - void clear() const { fRTC->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); } + void clear() const { fRTC->clear(SK_PMColor4fTRANSPARENT); } void destroyGrContext() { SkASSERT(fCtx->unique()); fRTC.reset(); diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp index 73cd4587ed..1e1639e501 100644 --- a/tests/GrMeshTest.cpp +++ b/tests/GrMeshTest.cpp @@ -600,8 +600,7 @@ static void run_test(GrContext* context, const char* testName, skiatest::Reporte } SkAutoSTMalloc resultPx(h * rowBytes); - rtc->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xbaaaaaad), - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad)); rtc->priv().testingOnly_addDrawOp(GrMeshTestOp::Make(context, prepareFn, executeFn)); rtc->readPixels(gold.info(), resultPx, rowBytes, {0, 0}); diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index f3bfe79d00..56a5ca463c 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -368,7 +368,6 @@ static std::unique_ptr draw_mipmap_into_new_render_target // Test that two opsTasks using the same mipmaps both depend on the same GrTextureResolveRenderTask. DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) { - using CanClearFullscreen = GrRenderTargetContext::CanClearFullscreen; using Enable = GrContextOptions::Enable; using Filter = GrSamplerState::Filter; @@ -406,7 +405,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) { auto mipmapRTC = GrRenderTargetContext::Make( context.get(), colorType, nullptr, mipmapProxy, kTopLeft_GrSurfaceOrigin, nullptr); - mipmapRTC->clear(nullptr, {.1f,.2f,.3f,.4f}, CanClearFullscreen::kYes); + mipmapRTC->clear({.1f,.2f,.3f,.4f}); REPORTER_ASSERT(reporter, mipmapProxy->getLastRenderTask()); // mipmapProxy's last render task should now just be the opsTask containing the clear. REPORTER_ASSERT(reporter, @@ -450,7 +449,7 @@ DEF_GPUTEST(GrManyDependentsMipMappedTest, reporter, /* options */) { REPORTER_ASSERT(reporter, rtc2Task->dependsOn(initialMipmapRegenTask)); // Render something to dirty the mips. - mipmapRTC->clear(nullptr, {.1f,.2f,.3f,.4f}, CanClearFullscreen::kYes); + mipmapRTC->clear({.1f,.2f,.3f,.4f}); auto mipmapRTCTask = sk_ref_sp(mipmapRTC->testingOnly_PeekLastOpsTask()); REPORTER_ASSERT(reporter, mipmapRTCTask); diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp index 20acef5cff..2a51c86b92 100644 --- a/tests/GrPipelineDynamicStateTest.cpp +++ b/tests/GrPipelineDynamicStateTest.cpp @@ -229,8 +229,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo uint32_t resultPx[kScreenSize * kScreenSize]; for (GrScissorTest scissorTest : {GrScissorTest::kEnabled, GrScissorTest::kDisabled}) { - rtc->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xbaaaaaad), - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad)); rtc->priv().testingOnly_addDrawOp( GrPipelineDynamicStateTestOp::Make(context, scissorTest, vbuff)); rtc->readPixels(SkImageInfo::Make(kScreenSize, kScreenSize, diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 31062f5870..e56f029140 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -383,8 +383,7 @@ DEF_GPUTEST(LazyProxyFailedInstantiationTest, reporter, /* options */) { ctx.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {100, 100}); REPORTER_ASSERT(reporter, rtc); - rtc->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xbaaaaaad), - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad)); int executeTestValue = 0; rtc->priv().testingOnly_addDrawOp(LazyFailedInstantiationTestOp::Make( diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index 386fcc8cca..b22c64bacb 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -394,8 +394,7 @@ public: nullptr); // clear the atlas - rtc->clear(nullptr, SK_PMColor4fTRANSPARENT, - GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fTRANSPARENT); int blocksInAtlas = 0; for (int i = 0; i < lists.count(); ++i) { @@ -405,7 +404,7 @@ public: // For now, we avoid the resource buffer issues and just use clears #if 1 - rtc->clear(&r, op->color(), GrRenderTargetContext::CanClearFullscreen::kNo); + rtc->clear(r, op->color()); #else GrPaint paint; paint.setColor4f(op->color()); @@ -470,7 +469,7 @@ static GrSurfaceProxyView make_upstream_image(GrContext* context, AtlasObject* o context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {3 * kDrawnTileSize, kDrawnTileSize}); - rtc->clear(nullptr, { 1, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear({ 1, 0, 0, 1 }); for (int i = 0; i < 3; ++i) { SkRect r = SkRect::MakeXYWH(i*kDrawnTileSize, 0, kDrawnTileSize, kDrawnTileSize); @@ -584,7 +583,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) { context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {kFinalWidth, kFinalHeight}); - rtc->clear(nullptr, SK_PMColor4fWHITE, GrRenderTargetContext::CanClearFullscreen::kYes); + rtc->clear(SK_PMColor4fWHITE); // Note that this doesn't include the third texture proxy for (int i = 0; i < kNumViews - 1; ++i) { diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index c784b3ec54..d4bfe1f4c5 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -35,8 +35,7 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont for (auto filter : {GrSamplerState::Filter::kNearest, GrSamplerState::Filter::kBilerp, GrSamplerState::Filter::kMipMap}) { - rtContext->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xDDCCBBAA), - GrRenderTargetContext::CanClearFullscreen::kYes); + rtContext->clear(SkPMColor4f::FromBytes_RGBA(0xDDCCBBAA)); auto fp = GrTextureEffect::Make(rectView, alphaType, SkMatrix::I(), filter); GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -51,8 +50,7 @@ static void test_clear(skiatest::Reporter* reporter, GrSurfaceContext* rectConte if (GrRenderTargetContext* rtc = rectContext->asRenderTargetContext()) { // Clear the whole thing. GrColor color0 = GrColorPackRGBA(0xA, 0xB, 0xC, 0xD); - rtc->clear(nullptr, SkPMColor4f::FromBytes_RGBA(color0), - GrRenderTargetContext::CanClearFullscreen::kNo); + rtc->clear(SkPMColor4f::FromBytes_RGBA(color0)); int w = rtc->width(); int h = rtc->height(); @@ -73,8 +71,7 @@ static void test_clear(skiatest::Reporter* reporter, GrSurfaceContext* rectConte // Clear the the top to a different color. GrColor color1 = GrColorPackRGBA(0x1, 0x2, 0x3, 0x4); SkIRect rect = SkIRect::MakeWH(w, h/2); - rtc->clear(&rect, SkPMColor4f::FromBytes_RGBA(color1), - GrRenderTargetContext::CanClearFullscreen::kNo); + rtc->clear(rect, SkPMColor4f::FromBytes_RGBA(color1)); uint32_t expectedColor1 = 0; uint8_t* expectedBytes1 = reinterpret_cast(&expectedColor1);