Reland "GrClips provided as pointers to GrRTC"

This reverts commit 074414fed5.

Reason for revert: updated to guard against nullptr before calling
quickContains(rrect).

Original change's description:
> Revert "GrClips provided as pointers to GrRTC"
>
> This reverts commit 226b689471.
>
> Reason for revert: Breaks Android roller
>
> Original change's description:
> > GrClips provided as pointers to GrRTC
> >
> > A null clip represents no high-level clipping is necessary (the implicit
> > clip to the render target's logical dimensions is fine).
> >
> > This also removes GrNoClip and GrFixedClip::Disabled() since they are
> > replaced with just nullptr.
> >
> > By allowing nullptr to represent no intended clipping, it makes it easier
> > to require GrClip and GrAppliedClip objects to know about the dimensions
> > of the device. If we required a non-null clip object to represent no
> > clipping, we'd have to have an instance for each device based on its
> > size and that just became cumbersome.
> >
> > Bug: skia:10205
> > Change-Id: Ie30cc71820b92d99356d393a4c98c8677082e761
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290539
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I42c4828bcf016ee3d30d5c20b771be96e125817b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10205
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292856
> Reviewed-by: Weston Tracey <westont@google.com>
> Commit-Queue: Weston Tracey <westont@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com,westont@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:10205
Change-Id: I5715a4de3b7c8847b73020dc4937d3816d879803
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292876
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Michael Ludwig 2020-05-29 09:54:07 -04:00 committed by Skia Commit-Bot
parent c0d88a12d1
commit 7c12e28cf4
79 changed files with 336 additions and 396 deletions

View File

@ -12,7 +12,6 @@
#include "include/gpu/GrContext.h"
#include "include/utils/SkRandom.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/SkGr.h"
@ -150,7 +149,7 @@ protected:
SkSimpleMatrixProvider matrixProvider(view);
GrPaint grPaint;
SkPaintToGrPaint(context, rtc->colorInfo(), paint, matrixProvider, &grPaint);
rtc->drawQuadSet(GrNoClip(), std::move(grPaint), GrAA::kYes, view, batch, kRectCount);
rtc->drawQuadSet(nullptr, std::move(grPaint), GrAA::kYes, view, batch, kRectCount);
}
void drawSolidColorsRef(SkCanvas* canvas) const {

View File

@ -23,7 +23,6 @@
#include "include/private/SkColorData.h"
#include "src/gpu/GrBuffer.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGeometryProcessor.h"
@ -257,7 +256,7 @@ void ClockwiseGM::onDraw(GrContext* ctx, GrRenderTargetContext* rtc, SkCanvas* c
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(),
rtc->drawTexture(nullptr, topLeftRTC->readSurfaceView(), rtc->colorInfo().alphaType(),
GrSamplerState::Filter::kNearest, SkBlendMode::kSrcOver, SK_PMColor4fWHITE,
{0, 0, 100, 200}, {100, 0, 200, 200}, GrAA::kNo, GrQuadAAFlags::kNone,
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint, SkMatrix::I(),
@ -272,7 +271,7 @@ void ClockwiseGM::onDraw(GrContext* ctx, GrRenderTargetContext* rtc, SkCanvas* c
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(),
rtc->drawTexture(nullptr, topLeftRTC->readSurfaceView(), rtc->colorInfo().alphaType(),
GrSamplerState::Filter::kNearest, SkBlendMode::kSrcOver, SK_PMColor4fWHITE,
{0, 0, 100, 200}, {200, 0, 300, 200}, GrAA::kNo, GrQuadAAFlags::kNone,
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint, SkMatrix::I(),

View File

@ -25,7 +25,6 @@
#include "include/gpu/GrContext.h"
#include "include/private/GrTypesPriv.h"
#include "src/core/SkMatrixProvider.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/SkGr.h"
@ -87,7 +86,7 @@ static void draw_gradient_tiles(SkCanvas* canvas, bool alignGradients) {
SkSimpleMatrixProvider matrixProvider(view);
GrPaint grPaint;
SkPaintToGrPaint(context, rtc->colorInfo(), paint, matrixProvider, &grPaint);
rtc->fillRectWithEdgeAA(GrNoClip(), std::move(grPaint), GrAA::kYes,
rtc->fillRectWithEdgeAA(nullptr, std::move(grPaint), GrAA::kYes,
static_cast<GrQuadAAFlags>(aa), view, tile);
} else {
// Fallback to solid color on raster backend since the public API only has color

View File

@ -9,7 +9,6 @@
#include "include/effects/SkGradientShader.h"
#include "src/core/SkGpuBlurUtils.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/SkGr.h"
@ -153,7 +152,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool
paint.addColorFragmentProcessor(std::move(fp));
static constexpr float kAlpha = 0.2f;
paint.setColor4f({kAlpha, kAlpha, kAlpha, kAlpha});
rtc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, m, SkRect::Make(testArea));
rtc->drawRect(nullptr, std::move(paint), GrAA::kNo, m, SkRect::Make(testArea));
}
// If we're in ref mode we will create a temp image that has the original image
// tiled into it and then do a clamp blur with adjusted params that should produce
@ -174,7 +173,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool
SkRect::Make(srcRect), caps);
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
refSrc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
refSrc->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(refRect.size()));
}
// Do a blur for each dstRect in the set over our testArea-sized background.
@ -209,7 +208,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool
SkBlendMode::kSrcOver);
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
rtc->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, m,
rtc->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, m,
SkRect::Make(dstRect), SkRect::Make(blurView.dimensions()));
}
// Show the outline of the dst rect. Mostly for kDecal but also allows visual
@ -223,7 +222,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool
stroke.setStrokeWidth(1.f);
GrStyle style(stroke);
auto dstR = SkRect::Make(dstRect).makeOutset(0.5f, 0.5f);
rtc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, m, dstR, &style);
rtc->drawRect(nullptr, std::move(paint), GrAA::kNo, m, dstR, &style);
}
}
// Show the rect that's being blurred.
@ -236,7 +235,7 @@ static void run(GrContext* ctx, GrRenderTargetContext* rtc, bool subsetSrc, bool
stroke.setStrokeWidth(1.f);
GrStyle style(stroke);
auto srcR = SkRect::Make(srcRect).makeOutset(0.5f, 0.5f);
rtc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, m, srcR, &style);
rtc->drawRect(nullptr, std::move(paint), GrAA::kNo, m, srcR, &style);
}
trans.fX += testArea.width() + kPad;
}

View File

@ -9,7 +9,6 @@
#include "include/effects/SkGradientShader.h"
#include "src/core/SkMatrixProvider.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
@ -72,7 +71,7 @@ DEF_SIMPLE_GPU_GM(sample_matrix_constant, ctx, rtCtx, canvas, 512, 256) {
GrPaint paint;
paint.addCoverageFragmentProcessor(std::move(fp));
rtCtx->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
rtCtx->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
}
{
@ -93,7 +92,6 @@ DEF_SIMPLE_GPU_GM(sample_matrix_constant, ctx, rtCtx, canvas, 512, 256) {
auto fp = std::unique_ptr<GrFragmentProcessor>(
new SampleMatrixConstantEffect(std::move(gradientFP)));
paint.addCoverageFragmentProcessor(std::move(fp));
rtCtx->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
rtCtx->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
}
}

View File

@ -9,7 +9,6 @@
#include "include/effects/SkGradientShader.h"
#include "src/core/SkMatrixProvider.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
@ -88,7 +87,7 @@ DEF_SIMPLE_GPU_GM(sample_matrix_variable, ctx, rtCtx, canvas, 512, 256) {
GrPaint paint;
paint.addCoverageFragmentProcessor(std::move(fp));
rtCtx->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
rtCtx->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
}
{
@ -110,6 +109,6 @@ DEF_SIMPLE_GPU_GM(sample_matrix_variable, ctx, rtCtx, canvas, 512, 256) {
auto fp = std::unique_ptr<GrFragmentProcessor>(
new SampleMatrixVariableEffect(std::move(gradientFP), -0.5, 1));
paint.addCoverageFragmentProcessor(std::move(fp));
rtCtx->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
rtCtx->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), bounds);
}
}

View File

@ -22,7 +22,6 @@
#include "include/private/SkColorData.h"
#include "src/gpu/GrBuffer.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGeometryProcessor.h"
@ -364,11 +363,11 @@ DrawResult SampleLocationsGM::onDraw(
GrPaint coverPaint;
coverPaint.setColor4f({1,0,0,1});
coverPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver));
rtc->priv().stencilRect(GrNoClip(), &kStencilCover, std::move(coverPaint), GrAA::kNo,
rtc->priv().stencilRect(nullptr, &kStencilCover, std::move(coverPaint), GrAA::kNo,
SkMatrix::I(), SkRect::MakeWH(200, 200));
// Copy offscreen texture to canvas.
rtc->drawTexture(GrNoClip(), offscreenRTC->readSurfaceView(),
rtc->drawTexture(nullptr, offscreenRTC->readSurfaceView(),
offscreenRTC->colorInfo().alphaType(),
GrSamplerState::Filter::kNearest, SkBlendMode::kSrc, SK_PMColor4fWHITE,
{0,0,200,200}, {0,0,200,200}, GrAA::kNo, GrQuadAAFlags::kNone,

View File

@ -193,9 +193,10 @@ private:
/**
* Makes a clip object that enforces the stencil clip bit. Used to visualize the stencil mask.
*/
static GrStencilClip make_stencil_only_clip() {
return GrStencilClip(SkClipStack::kEmptyGenID);
};
static const GrStencilClip* make_stencil_only_clip() {
static const GrStencilClip kClip(SkClipStack::kEmptyGenID);
return &kClip;
}
DrawResult WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas* canvas,
SkString* errorMsg) {
@ -253,7 +254,7 @@ 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(maskRTC->readSurfaceView(), x, y);
rtc->drawRect(clip, std::move(paint), GrAA::kYes, SkMatrix::I(),
rtc->drawRect(&clip, std::move(paint), GrAA::kYes, SkMatrix::I(),
SkRect::Make(SkIRect::MakeXYWH(x, y, maskRTC->width(), maskRTC->height())));
}
@ -296,7 +297,7 @@ void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, boo
SkIRect checker = SkIRect::MakeXYWH(x, y, kMaskCheckerSize, kMaskCheckerSize);
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
rtc->priv().stencilRect(GrNoClip(), &kSetClip, std::move(paint), GrAA::kNo,
rtc->priv().stencilRect(nullptr, &kSetClip, std::move(paint), GrAA::kNo,
SkMatrix::I(), SkRect::Make(checker));
}
}

View File

@ -24,7 +24,6 @@
#include "include/gpu/GrContext.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
@ -362,7 +361,7 @@ protected:
GrPaint grPaint;
grPaint.addColorFragmentProcessor(std::move(fp));
renderTargetContext->drawRect(
GrNoClip(), std::move(grPaint), GrAA::kYes, ctm, rect);
nullptr, std::move(grPaint), GrAA::kYes, ctm, rect);
}
x += rect.width() + kTestPad;
}

View File

@ -14,7 +14,6 @@
#include "include/core/SkPath.h"
#include "samplecode/Sample.h"
#include "src/core/SkRectPriv.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrMemoryPool.h"
@ -208,7 +207,7 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) {
paint.addColorFragmentProcessor(
std::make_unique<VisualizeCoverageCountFP>());
paint.setPorterDuffXPFactory(SkBlendMode::kSrcOver);
rtc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
rtc->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeIWH(this->width(), this->height()));
// Add label.

View File

@ -96,9 +96,9 @@ public:
/** GrTextTarget overrides */
void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) override;
void addDrawOp(const GrClip*, std::unique_ptr<GrAtlasTextOp> op) override;
void drawShape(const GrClip&,
void drawShape(const GrClip*,
const SkPaint&,
const SkMatrixProvider&,
const GrStyledShape&) override {
@ -170,13 +170,13 @@ void SkInternalAtlasTextTarget::drawText(const SkGlyphID glyphs[], const SkPoint
auto glyphRunList = builder.useGlyphRunList();
if (!glyphRunList.empty()) {
SkSimpleMatrixProvider matrixProvider(this->ctm());
atlasTextContext->drawGlyphRunList(grContext, this, GrNoClip(), matrixProvider, props,
atlasTextContext->drawGlyphRunList(grContext, this, nullptr, matrixProvider, props,
glyphRunList);
}
}
void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) {
SkASSERT(clip.quickContains(SkRect::MakeIWH(fWidth, fHeight)));
void SkInternalAtlasTextTarget::addDrawOp(const GrClip* clip, std::unique_ptr<GrAtlasTextOp> op) {
SkASSERT(!clip || clip->quickContains(SkRect::MakeIWH(fWidth, fHeight)));
// The SkAtlasTextRenderer currently only handles grayscale SDF glyphs.
if (op->maskType() != GrAtlasTextOp::kGrayscaleDistanceField_MaskType) {
return;

View File

@ -21,7 +21,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -58,7 +57,7 @@ public:
bool directFilterMaskGPU(GrRecordingContext*,
GrRenderTargetContext* renderTargetContext,
GrPaint&&,
const GrClip&,
const GrClip*,
const SkMatrix& viewMatrix,
const GrStyledShape& shape) const override;
GrSurfaceProxyView filterMaskGPU(GrRecordingContext*,
@ -722,7 +721,7 @@ void SkBlurMaskFilterImpl::flatten(SkWriteBuffer& buffer) const {
bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const GrStyledShape& shape) const {
SkASSERT(renderTargetContext);
@ -917,7 +916,7 @@ GrSurfaceProxyView SkBlurMaskFilterImpl::filterMaskGPU(GrRecordingContext* conte
paint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
}
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(clipRect));
}

View File

@ -275,7 +275,7 @@ SkPMColor4f generate_filtered_color(const SkPaint& paint, const GrColorInfo& col
void GrTextContext::drawGlyphRunList(GrRecordingContext* context,
GrTextTarget* target,
const GrClip& clip,
const GrClip* clip,
const SkMatrixProvider& matrixProvider,
const SkSurfaceProps& props,
const SkGlyphRunList& glyphRunList) const {

View File

@ -12,7 +12,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
@ -52,7 +51,7 @@ static void convolve_gaussian_1d(GrRenderTargetContext* renderTargetContext,
*renderTargetContext->caps()));
paint.addColorFragmentProcessor(std::move(conv));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
renderTargetContext->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(rtcRect), SkRect::Make(srcRect));
}
@ -89,7 +88,7 @@ static std::unique_ptr<GrRenderTargetContext> convolve_gaussian_2d(GrRecordingCo
// 'dstBounds' is actually in 'srcView' proxy space. It represents the blurred area from src
// space that we want to capture in the new RTC at {0, 0}. Hence, we use its size as the rect to
// draw and it directly as the local rect.
renderTargetContext->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstBounds.size()), SkRect::Make(dstBounds));
return renderTargetContext;
@ -253,7 +252,7 @@ static std::unique_ptr<GrRenderTargetContext> reexpand(GrRecordingContext* conte
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
dstRenderTargetContext->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
dstRenderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstSize), srcBounds);
return dstRenderTargetContext;
@ -458,7 +457,7 @@ std::unique_ptr<GrRenderTargetContext> GaussianBlur(GrRecordingContext* context,
SkRect::Make(dstBounds), *context->priv().caps());
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
result->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
result->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstBounds.size()));
return result;
}

View File

@ -26,7 +26,6 @@
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTextureProxy.h"
@ -586,9 +585,8 @@ sk_sp<SkSpecialImage> SkImageFilter_Base::DrawWithFP(GrRecordingContext* context
SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height());
SkRect srcRect = SkRect::Make(bounds);
SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
GrFixedClip clip(dstIRect);
renderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), dstRect,
srcRect);
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
dstRect, srcRect);
return SkSpecialImage::MakeDeferredFromGpu(
context, dstIRect, kNeedNewImageUniqueID_SpecialImage,

View File

@ -12,7 +12,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
@ -100,7 +99,7 @@ static void convolve_gaussian_1d(GrRenderTargetContext* renderTargetContext,
paint.addColorFragmentProcessor(std::move(conv));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
auto srcRect = SkRect::Make(rtcRect.makeOffset(rtcToSrcOffset));
renderTargetContext->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(rtcRect), srcRect);
}
@ -137,7 +136,7 @@ static std::unique_ptr<GrRenderTargetContext> convolve_gaussian_2d(GrRecordingCo
// 'dstBounds' is actually in 'srcView' proxy space. It represents the blurred area from src
// space that we want to capture in the new RTC at {0, 0}. Hence, we use its size as the rect to
// draw and it directly as the local rect.
renderTargetContext->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstBounds.size()), SkRect::Make(dstBounds));
return renderTargetContext;
@ -317,7 +316,7 @@ static GrSurfaceProxyView decimate(GrRecordingContext* context,
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
dstRenderTargetContext->fillRectToRect(GrFixedClip::Disabled(), std::move(paint), GrAA::kNo,
dstRenderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo,
SkMatrix::I(), SkRect::Make(dstRect),
SkRect::Make(srcRect));
@ -373,13 +372,12 @@ static std::unique_ptr<GrRenderTargetContext> reexpand(GrRecordingContext* conte
caps);
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
GrFixedClip clip(SkIRect::MakeSize(dstSize));
// TODO: using dstII as dstRect results in some image diffs - why?
SkIRect dstRect(srcRect);
scale_irect(&dstRect, scaleFactorX, scaleFactorY);
dstRenderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
dstRenderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstRect), SkRect::Make(srcRect));
return dstRenderTargetContext;

View File

@ -335,7 +335,7 @@ bool SkMaskFilterBase::canFilterMaskGPU(const GrStyledShape& shape,
bool SkMaskFilterBase::directFilterMaskGPU(GrRecordingContext*,
GrRenderTargetContext*,
GrPaint&&,
const GrClip&,
const GrClip*,
const SkMatrix& viewMatrix,
const GrStyledShape&) const {
return false;

View File

@ -116,7 +116,7 @@ public:
virtual bool directFilterMaskGPU(GrRecordingContext*,
GrRenderTargetContext*,
GrPaint&& paint,
const GrClip&,
const GrClip*,
const SkMatrix& viewMatrix,
const GrStyledShape& shape) const;

View File

@ -19,7 +19,6 @@
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTextureProxy.h"
@ -112,14 +111,13 @@ GrSurfaceProxyView SkAlphaThresholdFilterImpl::createMaskTexture(GrRecordingCont
SkRegion::Iterator iter(fRegion);
rtContext->clear(SK_PMColor4fTRANSPARENT);
GrFixedClip clip(SkIRect::MakeWH(bounds.width(), bounds.height()));
while (!iter.done()) {
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkRect rect = SkRect::Make(iter.rect());
rtContext->drawRect(clip, std::move(paint), GrAA::kNo, inMatrix, rect);
rtContext->drawRect(nullptr, std::move(paint), GrAA::kNo, inMatrix, rect);
iter.next();
}

View File

@ -18,7 +18,6 @@
#if SK_SUPPORT_GPU
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -403,7 +402,7 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, matrix,
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, matrix,
SkRect::Make(bounds));
return SkSpecialImage::MakeDeferredFromGpu(context,

View File

@ -17,7 +17,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrRecordingContextPriv.h"
@ -367,7 +366,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffectImpl::onFilterImage(const Context&
return nullptr;
}
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, matrix,
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, matrix,
SkRect::Make(colorBounds));
offset->fX = bounds.left();

View File

@ -19,7 +19,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRecordingContextPriv.h"
@ -444,7 +443,6 @@ private:
void drawRect(GrRenderTargetContext*,
GrSurfaceProxyView srcView,
const SkMatrix& matrix,
const GrClip& clip,
const SkRect& dstRect,
BoundaryMode boundaryMode,
const SkIRect* srcBounds,
@ -461,7 +459,6 @@ private:
void SkLightingImageFilterInternal::drawRect(GrRenderTargetContext* renderTargetContext,
GrSurfaceProxyView srcView,
const SkMatrix& matrix,
const GrClip& clip,
const SkRect& dstRect,
BoundaryMode boundaryMode,
const SkIRect* srcBounds,
@ -472,8 +469,8 @@ void SkLightingImageFilterInternal::drawRect(GrRenderTargetContext* renderTarget
*renderTargetContext->caps());
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
renderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), dstRect,
srcRect);
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
dstRect, srcRect);
}
sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
@ -499,9 +496,6 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
SkIRect dstIRect = SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height());
SkRect dstRect = SkRect::Make(dstIRect);
// setup new clip
GrFixedClip clip(dstIRect);
const SkIRect inputBounds = SkIRect::MakeWH(input->width(), input->height());
SkRect topLeft = SkRect::MakeXYWH(0, 0, 1, 1);
SkRect top = SkRect::MakeXYWH(1, 0, dstRect.width() - 2, 1);
@ -514,23 +508,23 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
SkRect bottomRight = SkRect::MakeXYWH(dstRect.width() - 1, dstRect.height() - 1, 1, 1);
const SkIRect* pSrcBounds = inputBounds.contains(offsetBounds) ? nullptr : &inputBounds;
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, topLeft,
this->drawRect(renderTargetContext.get(), inputView, matrix, topLeft,
kTopLeft_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, top,
this->drawRect(renderTargetContext.get(), inputView, matrix, top,
kTop_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, topRight,
this->drawRect(renderTargetContext.get(), inputView, matrix, topRight,
kTopRight_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, left,
this->drawRect(renderTargetContext.get(), inputView, matrix, left,
kLeft_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, interior,
this->drawRect(renderTargetContext.get(), inputView, matrix, interior,
kInterior_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, right,
this->drawRect(renderTargetContext.get(), inputView, matrix, right,
kRight_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, bottomLeft,
this->drawRect(renderTargetContext.get(), inputView, matrix, bottomLeft,
kBottomLeft_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), inputView, matrix, clip, bottom,
this->drawRect(renderTargetContext.get(), inputView, matrix, bottom,
kBottom_BoundaryMode, pSrcBounds, offsetBounds);
this->drawRect(renderTargetContext.get(), std::move(inputView), matrix, clip, bottomRight,
this->drawRect(renderTargetContext.get(), std::move(inputView), matrix, bottomRight,
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
return SkSpecialImage::MakeDeferredFromGpu(

View File

@ -20,7 +20,6 @@
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTexture.h"
@ -473,7 +472,6 @@ std::unique_ptr<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorT
#endif
static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
const SkIRect& srcRect,
@ -486,12 +484,11 @@ static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(std::move(view), srcAlphaType,
direction, radius, morphType, bounds));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
renderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstRect), SkRect::Make(srcRect));
}
static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
const SkIRect& srcRect,
@ -503,12 +500,11 @@ static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetC
paint.addColorFragmentProcessor(
GrMorphologyEffect::Make(std::move(view), srcAlphaType, direction, radius, morphType));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
renderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstRect), SkRect::Make(srcRect));
}
static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
const SkIRect& srcRect,
@ -541,17 +537,16 @@ static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
}
if (middleSrcRect.width() <= 0) {
// radius covers srcRect; use bounds over entire draw
apply_morphology_rect(renderTargetContext, clip, std::move(view), srcAlphaType, srcRect,
apply_morphology_rect(renderTargetContext, std::move(view), srcAlphaType, srcRect,
dstRect, radius, morphType, bounds, direction);
} else {
// Draw upper and lower margins with bounds; middle without.
apply_morphology_rect(renderTargetContext, clip, view, srcAlphaType, lowerSrcRect,
apply_morphology_rect(renderTargetContext, view, srcAlphaType, lowerSrcRect,
lowerDstRect, radius, morphType, bounds, direction);
apply_morphology_rect(renderTargetContext, clip, view, srcAlphaType, upperSrcRect,
apply_morphology_rect(renderTargetContext, view, srcAlphaType, upperSrcRect,
upperDstRect, radius, morphType, bounds, direction);
apply_morphology_rect_no_bounds(renderTargetContext, clip, std::move(view),
srcAlphaType, middleSrcRect, middleDstRect, radius,
morphType, direction);
apply_morphology_rect_no_bounds(renderTargetContext, std::move(view), srcAlphaType,
middleSrcRect, middleDstRect, radius, morphType, direction);
}
}
@ -566,9 +561,6 @@ static sk_sp<SkSpecialImage> apply_morphology(
GrSurfaceProxy* proxy = srcView.proxy();
// setup new clip
const GrFixedClip clip(SkIRect::MakeSize(proxy->dimensions()));
const SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
SkIRect srcRect = rect;
// Map into proxy space
@ -583,7 +575,7 @@ static sk_sp<SkSpecialImage> apply_morphology(
return nullptr;
}
apply_morphology_pass(dstRTContext.get(), clip, std::move(srcView), srcAlphaType,
apply_morphology_pass(dstRTContext.get(), std::move(srcView), srcAlphaType,
srcRect, dstRect, radius.fWidth, morphType, MorphDirection::kX);
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
dstRect.width(), radius.fHeight);
@ -603,7 +595,7 @@ static sk_sp<SkSpecialImage> apply_morphology(
return nullptr;
}
apply_morphology_pass(dstRTContext.get(), clip, std::move(srcView), srcAlphaType,
apply_morphology_pass(dstRTContext.get(), std::move(srcView), srcAlphaType,
srcRect, dstRect, radius.fHeight, morphType, MorphDirection::kY);
srcView = dstRTContext->readSurfaceView();

View File

@ -17,7 +17,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -310,7 +309,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilterImpl::filterImageGPU(
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, matrix,
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, matrix,
SkRect::Make(bounds));
return SkSpecialImage::MakeDeferredFromGpu(context,

View File

@ -43,7 +43,7 @@ static GrSurfaceProxyView find_filtered_mask(GrProxyProvider* provider, const Gr
// is already burnt into the mask this boils down to a rect draw.
// Return true if the mask was successfully drawn.
static bool draw_mask(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIRect& maskRect,
GrPaint&& paint,
@ -70,7 +70,7 @@ static void mask_release_proc(void* addr, void* /*context*/) {
static bool sw_draw_with_mask_filter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clipData,
const GrClip* clipData,
const SkMatrix& viewMatrix,
const GrStyledShape& shape,
const SkMaskFilter* filter,
@ -207,7 +207,7 @@ static std::unique_ptr<GrRenderTargetContext> create_mask_GPU(GrRecordingContext
// maskPaint.
SkMatrix viewMatrix = origViewMatrix;
viewMatrix.postTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop));
rtContext->drawShape(clip, std::move(maskPaint), GrAA::kYes, viewMatrix, shape);
rtContext->drawShape(&clip, std::move(maskPaint), GrAA::kYes, viewMatrix, shape);
return rtContext;
}
@ -239,14 +239,16 @@ static bool get_unclipped_shape_dev_bounds(const GrStyledShape& shape, const SkM
// Gets the shape bounds, the clip bounds, and the intersection (if any). Returns false if there
// is no intersection.
static bool get_shape_and_clip_bounds(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrClip* clip,
const GrStyledShape& shape,
const SkMatrix& matrix,
SkIRect* unclippedDevShapeBounds,
SkIRect* devClipBounds) {
// compute bounds as intersection of rt size, clip, and path
*devClipBounds = clip.getConservativeBounds(renderTargetContext->width(),
renderTargetContext->height());
*devClipBounds = clip ? clip->getConservativeBounds(renderTargetContext->width(),
renderTargetContext->height())
: SkIRect::MakeWH(renderTargetContext->width(),
renderTargetContext->height());
if (!get_unclipped_shape_dev_bounds(shape, matrix, unclippedDevShapeBounds)) {
*unclippedDevShapeBounds = SkIRect::MakeEmpty();
@ -258,7 +260,7 @@ static bool get_shape_and_clip_bounds(GrRenderTargetContext* renderTargetContext
static void draw_shape_with_mask_filter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
const SkMaskFilterBase* maskFilter,
@ -282,12 +284,8 @@ static void draw_shape_with_mask_filter(GrRecordingContext* context,
shape = tmpShape.get();
}
if (maskFilter->directFilterMaskGPU(context,
renderTargetContext,
std::move(paint),
clip,
viewMatrix,
*shape)) {
if (maskFilter->directFilterMaskGPU(context, renderTargetContext, std::move(paint), clip,
viewMatrix, *shape)) {
// the mask filter was able to draw itself directly, so there's nothing
// left to do.
return;
@ -301,8 +299,7 @@ static void draw_shape_with_mask_filter(GrRecordingContext* context,
SkIRect unclippedDevShapeBounds, devClipBounds;
if (!get_shape_and_clip_bounds(renderTargetContext, clip, *shape, viewMatrix,
&unclippedDevShapeBounds,
&devClipBounds)) {
&unclippedDevShapeBounds, &devClipBounds)) {
// TODO: just cons up an opaque mask here
if (!inverseFilled) {
return;
@ -439,7 +436,7 @@ static void draw_shape_with_mask_filter(GrRecordingContext* context,
void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrClip* clip,
const GrStyledShape& shape,
GrPaint&& paint,
const SkMatrix& viewMatrix,
@ -450,7 +447,7 @@ void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrClip* clip,
const SkPaint& paint,
const SkMatrixProvider& matrixProvider,
const GrStyledShape& shape) {

View File

@ -36,7 +36,7 @@ namespace GrBlurUtils {
*/
void drawShapeWithMaskFilter(GrRecordingContext*,
GrRenderTargetContext*,
const GrClip&,
const GrClip*,
const SkPaint&,
const SkMatrixProvider&,
const GrStyledShape&);
@ -47,7 +47,7 @@ namespace GrBlurUtils {
*/
void drawShapeWithMaskFilter(GrRecordingContext*,
GrRenderTargetContext*,
const GrClip&,
const GrClip*,
const GrStyledShape&,
GrPaint&&,
const SkMatrix& viewMatrix,

View File

@ -160,15 +160,4 @@ private:
}
};
/**
* Specialized implementation for no clip.
*/
class GrNoClip final : public GrHardClip {
private:
bool quickContains(const SkRect&) const final { return true; }
bool quickContains(const SkRRect&) const final { return true; }
bool apply(int rtWidth, int rtHeight, GrAppliedHardClip*, SkRect*) const final { return true; }
bool isRRect(const SkRect&, SkRRect*, GrAA*) const override { return false; }
};
#endif

View File

@ -63,8 +63,3 @@ bool GrFixedClip::apply(int rtWidth, int rtHeight, GrAppliedHardClip* out, SkRec
return true;
}
const GrFixedClip& GrFixedClip::Disabled() {
static const GrFixedClip disabled = GrFixedClip();
return disabled;
}

View File

@ -47,8 +47,6 @@ public:
bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const override;
bool apply(int rtWidth, int rtHeight, GrAppliedHardClip*, SkRect*) const override;
static const GrFixedClip& Disabled();
private:
GrScissorState fScissorState;
GrWindowRectsState fWindowRectsState;

View File

@ -127,7 +127,6 @@ public:
SkASSERT(fContext);
SkASSERT(fUserStencilSettings);
SkASSERT(fRenderTargetContext);
SkASSERT(fClip);
SkASSERT(fClipConservativeBounds);
SkASSERT(fViewMatrix);
SkASSERT(fShape);

View File

@ -693,7 +693,7 @@ static bool stencil_element(GrRenderTargetContext* rtc,
GrPaint paint;
paint.setCoverageSetOpXPFactory((SkRegion::Op)element->getOp(),
element->isInverseFilled());
rtc->priv().stencilRect(clip, ss, std::move(paint), aa, viewMatrix,
rtc->priv().stencilRect(&clip, ss, std::move(paint), aa, viewMatrix,
element->getDeviceSpaceRect());
return true;
}
@ -704,7 +704,7 @@ static bool stencil_element(GrRenderTargetContext* rtc,
path.toggleInverseFillType();
}
return rtc->priv().drawAndStencilPath(clip, ss, (SkRegion::Op)element->getOp(),
return rtc->priv().drawAndStencilPath(&clip, ss, (SkRegion::Op)element->getOp(),
element->isInverseFilled(), aa, viewMatrix, path);
}
}
@ -724,7 +724,7 @@ static void draw_element(GrRenderTargetContext* rtc,
SkDEBUGFAIL("Should never get here with an empty element.");
break;
case SkClipStack::Element::DeviceSpaceType::kRect:
rtc->drawRect(clip, std::move(paint), aa, viewMatrix, element->getDeviceSpaceRect());
rtc->drawRect(&clip, std::move(paint), aa, viewMatrix, element->getDeviceSpaceRect());
break;
default: {
SkPath path;
@ -733,7 +733,7 @@ static void draw_element(GrRenderTargetContext* rtc,
path.toggleInverseFillType();
}
rtc->drawPath(clip, std::move(paint), aa, viewMatrix, path, GrStyle::SimpleFill());
rtc->drawPath(&clip, std::move(paint), aa, viewMatrix, path, GrStyle::SimpleFill());
break;
}
}
@ -757,7 +757,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
GrPaint paint;
paint.setColor4f(initialCoverage);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
rtc->drawRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
rtc->drawRect(&clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(clip.scissorRect()));
} else {
rtc->priv().clearAtLeast(clip.scissorRect(), initialCoverage);
@ -802,7 +802,7 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
GrPaint paint;
paint.setCoverageSetOpXPFactory(op, !invert);
rtc->priv().stencilRect(clip, &kDrawOutsideElement, std::move(paint), GrAA::kNo,
rtc->priv().stencilRect(&clip, &kDrawOutsideElement, std::move(paint), GrAA::kNo,
translate, SkRect::Make(fScissor));
} else {
// all the remaining ops can just be directly draw into the accumulation buffer

View File

@ -81,11 +81,11 @@ public:
, fRenderTargetContext(renderTargetContext)
, fGlyphPainter{*renderTargetContext} {}
void addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) override {
void addDrawOp(const GrClip* clip, std::unique_ptr<GrAtlasTextOp> op) override {
fRenderTargetContext->addDrawOp(clip, std::move(op));
}
void drawShape(const GrClip& clip,
void drawShape(const GrClip* clip,
const SkPaint& paint,
const SkMatrixProvider& matrixProvider,
const GrStyledShape& shape) override {
@ -448,7 +448,7 @@ GrOpsTask* GrRenderTargetContext::getOpsTask() {
return fOpsTask.get();
}
void GrRenderTargetContext::drawGlyphRunList(const GrClip& clip,
void GrRenderTargetContext::drawGlyphRunList(const GrClip* clip,
const SkMatrixProvider& matrixProvider,
const SkGlyphRunList& blob) {
ASSERT_SINGLE_OWNER
@ -544,7 +544,7 @@ void GrRenderTargetContext::internalClear(const SkIRect* scissor,
SkRect rtRect = SkRect::MakeWH(this->width(), this->height());
GrPaint paint;
clear_to_grpaint(color, &paint);
this->addDrawOp(GrFixedClip::Disabled(),
this->addDrawOp(nullptr,
GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
rtRect));
} else {
@ -556,7 +556,7 @@ void GrRenderTargetContext::internalClear(const SkIRect* scissor,
GrPaint paint;
clear_to_grpaint(color, &paint);
this->addDrawOp(GrFixedClip::Disabled(),
this->addDrawOp(nullptr,
GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
SkRect::Make(scissorState.rect())));
} else {
@ -572,7 +572,7 @@ void GrRenderTargetContext::internalClear(const SkIRect* scissor,
}
}
void GrRenderTargetContext::drawPaint(const GrClip& clip,
void GrRenderTargetContext::drawPaint(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix) {
// Start with the render target, since that is the maximum content we could possibly fill.
@ -623,8 +623,13 @@ static bool make_vertex_finite(float* value) {
return true;
}
static SkIRect get_clip_bounds(const GrRenderTargetContext* rtc, const GrClip* clip) {
return clip ? clip->getConservativeBounds(rtc->width(), rtc->height())
: SkIRect::MakeWH(rtc->width(), rtc->height());
}
GrRenderTargetContext::QuadOptimization GrRenderTargetContext::attemptQuadOptimization(
const GrClip& clip, const SkPMColor4f* constColor,
const GrClip* clip, const SkPMColor4f* constColor,
const GrUserStencilSettings* stencilSettings, GrAA* aa, DrawQuad* quad) {
// Optimization requirements:
// 1. kDiscard applies when clip bounds and quad bounds do not intersect
@ -685,8 +690,8 @@ GrRenderTargetContext::QuadOptimization GrRenderTargetContext::attemptQuadOptimi
// regular draws so that if we fully cover the render target, that can stop being anti-aliased.
GrAA clipAA = stencilSettings ? *aa : GrAA::kNo;
bool axisAlignedClip = true;
if (!clip.quickContains(rtRect)) {
if (!clip.isRRect(rtRect, &clipRRect, &clipAA)) {
if (clip && !clip->quickContains(rtRect)) {
if (!clip->isRRect(rtRect, &clipRRect, &clipAA)) {
axisAlignedClip = false;
}
}
@ -752,7 +757,7 @@ GrRenderTargetContext::QuadOptimization GrRenderTargetContext::attemptQuadOptimi
// we can draw the rrect directly and ignore the edge flags
GrPaint paint;
clear_to_grpaint(*constColor, &paint);
this->drawRRect(GrFixedClip::Disabled(), std::move(paint), clipAA, SkMatrix::I(),
this->drawRRect(nullptr, std::move(paint), clipAA, SkMatrix::I(),
clipRRect, GrStyle::SimpleFill());
return QuadOptimization::kSubmitted;
} else {
@ -764,7 +769,7 @@ GrRenderTargetContext::QuadOptimization GrRenderTargetContext::attemptQuadOptimi
}
// Crop the quad to the conservative bounds of the clip.
SkRect clipBounds = SkRect::Make(clip.getConservativeBounds(rtRect.width(), rtRect.height()));
SkRect clipBounds = SkRect::Make(get_clip_bounds(this, clip));
// One final check for discarding, since we may have gone here directly due to a complex clip
if (!clipBounds.intersects(drawBounds)) {
@ -779,7 +784,7 @@ GrRenderTargetContext::QuadOptimization GrRenderTargetContext::attemptQuadOptimi
return QuadOptimization::kCropped;
}
void GrRenderTargetContext::drawFilledQuad(const GrClip& clip,
void GrRenderTargetContext::drawFilledQuad(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
DrawQuad* quad,
@ -802,8 +807,7 @@ void GrRenderTargetContext::drawFilledQuad(const GrClip& clip,
QuadOptimization opt = this->attemptQuadOptimization(clip, constColor, ss, &aa, quad);
if (opt >= QuadOptimization::kClipApplied) {
// These optimizations require caller to add an op themselves
const GrClip& finalClip = opt == QuadOptimization::kClipApplied ? GrFixedClip::Disabled()
: clip;
const GrClip* finalClip = opt == QuadOptimization::kClipApplied ? nullptr : clip;
GrAAType aaType = ss ? (aa == GrAA::kYes ? GrAAType::kMSAA : GrAAType::kNone)
: this->chooseAAType(aa);
this->addDrawOp(finalClip, GrFillRectOp::Make(fContext, std::move(paint), aaType,
@ -812,7 +816,7 @@ void GrRenderTargetContext::drawFilledQuad(const GrClip& clip,
// All other optimization levels were completely handled inside attempt(), so no extra op needed
}
void GrRenderTargetContext::drawTexturedQuad(const GrClip& clip,
void GrRenderTargetContext::drawTexturedQuad(const GrClip* clip,
GrSurfaceProxyView proxyView,
SkAlphaType srcAlphaType,
sk_sp<GrColorSpaceXform> textureXform,
@ -837,8 +841,7 @@ void GrRenderTargetContext::drawTexturedQuad(const GrClip& clip,
SkASSERT(opt != QuadOptimization::kSubmitted);
if (opt != QuadOptimization::kDiscarded) {
// And the texture op if not discarded
const GrClip& finalClip = opt == QuadOptimization::kClipApplied ? GrFixedClip::Disabled()
: clip;
const GrClip* finalClip = opt == QuadOptimization::kClipApplied ? nullptr : clip;
GrAAType aaType = this->chooseAAType(aa);
auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
auto saturate = clampType == GrClampType::kManual ? GrTextureOp::Saturate::kYes
@ -852,7 +855,7 @@ void GrRenderTargetContext::drawTexturedQuad(const GrClip& clip,
}
}
void GrRenderTargetContext::drawRect(const GrClip& clip,
void GrRenderTargetContext::drawRect(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -897,7 +900,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
GrStyledShape(rect, *style));
}
void GrRenderTargetContext::drawQuadSet(const GrClip& clip, GrPaint&& paint, GrAA aa,
void GrRenderTargetContext::drawQuadSet(const GrClip* clip, GrPaint&& paint, GrAA aa,
const SkMatrix& viewMatrix, const QuadSetEntry quads[],
int cnt) {
GrAAType aaType = this->chooseAAType(aa);
@ -970,9 +973,8 @@ void GrRenderTargetContext::internalStencilClear(const SkIRect* scissor, bool in
// Configure the paint to have no impact on the color buffer
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
this->addDrawOp(GrFixedClip::Disabled(),
GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
rect, ss));
this->addDrawOp(nullptr, GrFillRectOp::MakeNonAARect(fContext, std::move(paint),
SkMatrix::I(), rect, ss));
} else {
GrScissorState scissorState;
if (scissor) {
@ -988,7 +990,7 @@ void GrRenderTargetContext::internalStencilClear(const SkIRect* scissor, bool in
}
}
void GrRenderTargetContextPriv::stencilPath(const GrHardClip& clip,
void GrRenderTargetContextPriv::stencilPath(const GrHardClip* clip,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
sk_sp<const GrPath> path) {
@ -1006,12 +1008,17 @@ void GrRenderTargetContextPriv::stencilPath(const GrHardClip& clip,
// https://bugs.chromium.org/p/skia/issues/detail?id=5640 is resolved.
SkRect bounds = SkRect::MakeIWH(fRenderTargetContext->width(), fRenderTargetContext->height());
// Setup clip
// Setup clip and reject offscreen paths; we do this explicitly instead of relying on addDrawOp
// because GrStencilPathOp is not a draw op as its state depends directly on the choices made
// during this clip application.
GrAppliedHardClip appliedClip;
if (!clip.apply(fRenderTargetContext->width(), fRenderTargetContext->height(), &appliedClip,
&bounds)) {
if (clip && !clip->apply(fRenderTargetContext->width(), fRenderTargetContext->height(),
&appliedClip, &bounds)) {
return;
}
// else see FIXME above; we'd normally want to check path bounds with render target bounds,
// but as it is, we're just using the full render target so intersecting the two bounds would
// do nothing.
std::unique_ptr<GrOp> op = GrStencilPathOp::Make(fRenderTargetContext->fContext,
viewMatrix,
@ -1028,7 +1035,7 @@ void GrRenderTargetContextPriv::stencilPath(const GrHardClip& clip,
fRenderTargetContext->addOp(std::move(op));
}
void GrRenderTargetContext::drawTextureSet(const GrClip& clip, TextureSetEntry set[],
void GrRenderTargetContext::drawTextureSet(const GrClip* clip, TextureSetEntry set[],
int cnt, int proxyRunCnt,
GrSamplerState::Filter filter, SkBlendMode mode,
GrAA aa, SkCanvas::SrcRectConstraint constraint,
@ -1050,7 +1057,7 @@ void GrRenderTargetContext::drawTextureSet(const GrClip& clip, TextureSetEntry s
mode, aaType, constraint, viewMatrix, std::move(texXform));
}
void GrRenderTargetContext::drawVertices(const GrClip& clip,
void GrRenderTargetContext::drawVertices(const GrClip* clip,
GrPaint&& paint,
const SkMatrixProvider& matrixProvider,
sk_sp<SkVertices> vertices,
@ -1074,7 +1081,7 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip,
///////////////////////////////////////////////////////////////////////////////
void GrRenderTargetContext::drawAtlas(const GrClip& clip,
void GrRenderTargetContext::drawAtlas(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
int spriteCount,
@ -1096,7 +1103,7 @@ void GrRenderTargetContext::drawAtlas(const GrClip& clip,
///////////////////////////////////////////////////////////////////////////////
void GrRenderTargetContext::drawRRect(const GrClip& origClip,
void GrRenderTargetContext::drawRRect(const GrClip* origClip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -1112,8 +1119,7 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
return;
}
GrNoClip noclip;
const GrClip* clip = &origClip;
const GrClip* clip = origClip;
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
// The Android framework frequently clips rrects to themselves where the clip is non-aa and the
// draw is aa. Since our lower level clip code works from op bounds, which are SkRects, it
@ -1122,9 +1128,9 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
// can be ignored. We'd prefer to fix this in the framework by removing the clips calls. This
// only works for filled rrects since the stroke width outsets beyond the rrect itself.
SkRRect devRRect;
if (stroke.getStyle() == SkStrokeRec::kFill_Style && rrect.transform(viewMatrix, &devRRect) &&
clip->quickContains(devRRect)) {
clip = &noclip;
if (clip && stroke.getStyle() == SkStrokeRec::kFill_Style &&
rrect.transform(viewMatrix, &devRRect) && clip->quickContains(devRRect)) {
clip = nullptr;
}
#endif
SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
@ -1153,12 +1159,12 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
fContext, std::move(paint), viewMatrix, rrect, stroke, this->caps()->shaderCaps());
}
if (op) {
this->addDrawOp(*clip, std::move(op));
this->addDrawOp(clip, std::move(op));
return;
}
assert_alive(paint);
this->drawShapeUsingPathRenderer(*clip, std::move(paint), aa, viewMatrix,
this->drawShapeUsingPathRenderer(clip, std::move(paint), aa, viewMatrix,
GrStyledShape(rrect, style));
}
@ -1171,7 +1177,7 @@ static SkPoint3 map(const SkMatrix& m, const SkPoint3& pt) {
return result;
}
bool GrRenderTargetContext::drawFastShadow(const GrClip& clip,
bool GrRenderTargetContext::drawFastShadow(const GrClip* clip,
const SkMatrix& viewMatrix,
const SkPath& path,
const SkDrawShadowRec& rec) {
@ -1366,7 +1372,7 @@ bool GrRenderTargetContext::drawFastShadow(const GrClip& clip,
///////////////////////////////////////////////////////////////////////////////
bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip,
bool GrRenderTargetContext::drawFilledDRRect(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -1455,7 +1461,7 @@ bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip,
return true;
}
void GrRenderTargetContext::drawDRRect(const GrClip& clip,
void GrRenderTargetContext::drawDRRect(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -1486,7 +1492,7 @@ void GrRenderTargetContext::drawDRRect(const GrClip& clip,
///////////////////////////////////////////////////////////////////////////////
void GrRenderTargetContext::drawRegion(const GrClip& clip,
void GrRenderTargetContext::drawRegion(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -1522,7 +1528,7 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip,
this->addDrawOp(clip, std::move(op));
}
void GrRenderTargetContext::drawOval(const GrClip& clip,
void GrRenderTargetContext::drawOval(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -1583,7 +1589,7 @@ void GrRenderTargetContext::drawOval(const GrClip& clip,
GrStyledShape(SkRRect::MakeOval(oval), SkPathDirection::kCW, 2, false, style));
}
void GrRenderTargetContext::drawArc(const GrClip& clip,
void GrRenderTargetContext::drawArc(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -1622,7 +1628,7 @@ void GrRenderTargetContext::drawArc(const GrClip& clip,
GrStyledShape::MakeArc(oval, startAngle, sweepAngle, useCenter, style));
}
void GrRenderTargetContext::drawImageLattice(const GrClip& clip,
void GrRenderTargetContext::drawImageLattice(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
GrSurfaceProxyView view,
@ -1745,7 +1751,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixels(
callback(context, nullptr);
return;
}
tempRTC->drawTexture(GrNoClip(), std::move(texProxyView), this->colorInfo().alphaType(),
tempRTC->drawTexture(nullptr, std::move(texProxyView), this->colorInfo().alphaType(),
GrSamplerState::Filter::kNearest, SkBlendMode::kSrc,
SK_PMColor4fWHITE, srcRectToDraw,
SkRect::MakeWH(srcRect.width(), srcRect.height()), GrAA::kNo,
@ -1969,7 +1975,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
callback(context, nullptr);
return;
}
tempRTC->drawTexture(GrNoClip(), std::move(srcView), this->colorInfo().alphaType(),
tempRTC->drawTexture(nullptr, std::move(srcView), this->colorInfo().alphaType(),
GrSamplerState::Filter::kNearest, SkBlendMode::kSrc,
SK_PMColor4fWHITE, srcRectToDraw, SkRect::Make(srcRect.size()),
GrAA::kNo, GrQuadAAFlags::kNone, SkCanvas::kFast_SrcRectConstraint,
@ -2019,7 +2025,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
auto yFP = GrColorMatrixFragmentProcessor::Make(yM, false, true, false);
yPaint.addColorFragmentProcessor(std::move(yFP));
yPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
yRTC->fillRectToRect(GrNoClip(), std::move(yPaint), GrAA::kNo, SkMatrix::I(),
yRTC->fillRectToRect(nullptr, std::move(yPaint), GrAA::kNo, SkMatrix::I(),
dstRectY, dstRectY);
if (!doSynchronousRead) {
yTransfer = yRTC->transferPixels(GrColorType::kAlpha_8,
@ -2041,7 +2047,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
auto uFP = GrColorMatrixFragmentProcessor::Make(uM, false, true, false);
uPaint.addColorFragmentProcessor(std::move(uFP));
uPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
uRTC->fillRectToRect(GrNoClip(), std::move(uPaint), GrAA::kNo, SkMatrix::I(),
uRTC->fillRectToRect(nullptr, std::move(uPaint), GrAA::kNo, SkMatrix::I(),
dstRectUV, dstRectUV);
if (!doSynchronousRead) {
uTransfer = uRTC->transferPixels(GrColorType::kAlpha_8,
@ -2063,7 +2069,7 @@ void GrRenderTargetContext::asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvC
auto vFP = GrColorMatrixFragmentProcessor::Make(vM, false, true, false);
vPaint.addColorFragmentProcessor(std::move(vFP));
vPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
vRTC->fillRectToRect(GrNoClip(), std::move(vPaint), GrAA::kNo, SkMatrix::I(),
vRTC->fillRectToRect(nullptr, std::move(vPaint), GrAA::kNo, SkMatrix::I(),
dstRectUV, dstRectUV);
if (!doSynchronousRead) {
vTransfer = vRTC->transferPixels(GrColorType::kAlpha_8,
@ -2197,7 +2203,7 @@ bool GrRenderTargetContext::waitOnSemaphores(int numSemaphores,
return true;
}
void GrRenderTargetContext::drawPath(const GrClip& clip,
void GrRenderTargetContext::drawPath(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -2213,7 +2219,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip,
this->drawShape(clip, std::move(paint), aa, viewMatrix, shape);
}
void GrRenderTargetContext::drawShape(const GrClip& clip,
void GrRenderTargetContext::drawShape(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -2271,7 +2277,7 @@ void GrRenderTargetContext::drawShape(const GrClip& clip,
/* attempt fallback */ false);
}
bool GrRenderTargetContextPriv::drawAndStencilPath(const GrHardClip& clip,
bool GrRenderTargetContextPriv::drawAndStencilPath(const GrHardClip* clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,
@ -2302,8 +2308,7 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrHardClip& clip,
GrAAType aaType = fRenderTargetContext->chooseAAType(aa);
bool hasUserStencilSettings = !ss->isUnused();
SkIRect clipConservativeBounds = clip.getConservativeBounds(fRenderTargetContext->width(),
fRenderTargetContext->height());
SkIRect clipConservativeBounds = get_clip_bounds(fRenderTargetContext, clip);
GrPaint paint;
paint.setCoverageSetOpXPFactory(op, invert);
@ -2332,7 +2337,7 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrHardClip& clip,
std::move(paint),
ss,
fRenderTargetContext,
&clip,
clip,
&clipConservativeBounds,
&viewMatrix,
&shape,
@ -2354,7 +2359,7 @@ SkBudgeted GrRenderTargetContextPriv::isBudgeted() const {
return fRenderTargetContext->asSurfaceProxy()->isBudgeted();
}
void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip& clip,
void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -2376,7 +2381,7 @@ void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip& clip,
return;
}
SkIRect clipConservativeBounds = clip.getConservativeBounds(this->width(), this->height());
SkIRect clipConservativeBounds = get_clip_bounds(this, clip);
GrStyledShape tempShape;
GrAAType aaType = this->chooseAAType(aa);
@ -2441,7 +2446,7 @@ void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip& clip,
std::move(paint),
&GrUserStencilSettings::kUnused,
this,
&clip,
clip,
&clipConservativeBounds,
&viewMatrix,
canDrawArgs.fShape,
@ -2481,7 +2486,7 @@ void GrRenderTargetContext::addOp(std::unique_ptr<GrOp> op) {
std::move(op), GrTextureResolveManager(this->drawingManager()), *this->caps());
}
void GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<GrDrawOp> op,
void GrRenderTargetContext::addDrawOp(const GrClip* clip, std::unique_ptr<GrDrawOp> op,
const std::function<WillAddOpFn>& willAddFn) {
ASSERT_SINGLE_OWNER
if (fContext->priv().abandoned()) {
@ -2504,7 +2509,20 @@ void GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<GrDraw
this->setNeedsStencil(usesHWAA);
}
if (!clip.apply(fContext, this, usesHWAA, usesUserStencilBits, &appliedClip, &bounds)) {
bool skipDraw = false;
if (clip) {
// Have a complex clip, so defer to its early clip culling
if (!clip->apply(fContext, this, usesHWAA, usesUserStencilBits, &appliedClip, &bounds)) {
skipDraw = true;
}
} else {
// No clipping, so just clip the bounds against the logical render target dimensions
if (!bounds.intersect(this->asSurfaceProxy()->getBoundsRect())) {
skipDraw = true;
}
}
if (skipDraw) {
fContext->priv().opMemoryPool()->release(std::move(op));
return;
}
@ -2541,7 +2559,7 @@ void GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<GrDraw
GrTextureResolveManager(this->drawingManager()), *this->caps());
}
bool GrRenderTargetContext::setupDstProxyView(const GrClip& clip, const GrOp& op,
bool GrRenderTargetContext::setupDstProxyView(const GrClip* clip, const GrOp& op,
GrXferProcessor::DstProxyView* dstProxyView) {
// If we are wrapping a vulkan secondary command buffer, we can't make a dst copy because we
// don't actually have a VkImage to make a copy of. Additionally we don't have the power to
@ -2563,7 +2581,7 @@ bool GrRenderTargetContext::setupDstProxyView(const GrClip& clip, const GrOp& op
SkIRect copyRect = SkIRect::MakeSize(this->asSurfaceProxy()->dimensions());
SkIRect clippedRect = clip.getConservativeBounds(this->width(), this->height());
SkIRect clippedRect = get_clip_bounds(this, clip);
SkRect opBounds = op.bounds();
// If the op has aa bloating or is a infinitely thin geometry (hairline) outset the bounds by
// 0.5 pixels.
@ -2633,7 +2651,7 @@ bool GrRenderTargetContext::blitTexture(GrSurfaceProxyView view, const SkIRect&
paint.addColorFragmentProcessor(std::move(fp));
this->fillRectToRect(
GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeXYWH(clippedDstPoint.fX, clippedDstPoint.fY, clippedSrcRect.width(),
clippedSrcRect.height()),
SkRect::Make(clippedSrcRect));

View File

@ -140,7 +140,7 @@ public:
~GrRenderTargetContext() override;
virtual void drawGlyphRunList(const GrClip&, const SkMatrixProvider&, const SkGlyphRunList&);
virtual void drawGlyphRunList(const GrClip*, const SkMatrixProvider&, const SkGlyphRunList&);
/**
* Provides a perfomance hint that the render target's contents are allowed
@ -164,7 +164,7 @@ public:
/**
* Draw everywhere (respecting the clip) with the paint.
*/
void drawPaint(const GrClip&, GrPaint&&, const SkMatrix& viewMatrix);
void drawPaint(const GrClip*, GrPaint&&, const SkMatrix& viewMatrix);
/**
* Draw the rect using a paint.
@ -175,7 +175,7 @@ public:
* allowed.
* The rects coords are used to access the paint (through texture matrix)
*/
void drawRect(const GrClip&,
void drawRect(const GrClip*,
GrPaint&& paint,
GrAA,
const SkMatrix& viewMatrix,
@ -191,7 +191,7 @@ public:
* @param rectToDraw the rectangle to draw
* @param localRect the rectangle of shader coordinates applied to rectToDraw
*/
void fillRectToRect(const GrClip& clip,
void fillRectToRect(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -205,7 +205,7 @@ public:
/**
* Fills a rect with a paint and a localMatrix.
*/
void fillRectWithLocalMatrix(const GrClip& clip,
void fillRectWithLocalMatrix(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -223,7 +223,7 @@ public:
* This is a specialized version of fillQuadWithEdgeAA, but is kept separate since knowing
* the geometry is a rectangle affords more optimizations.
*/
void fillRectWithEdgeAA(const GrClip& clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
void fillRectWithEdgeAA(const GrClip* clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
const SkMatrix& viewMatrix, const SkRect& rect,
const SkRect* optionalLocalRect = nullptr) {
const SkRect& localRect = optionalLocalRect ? *optionalLocalRect : rect;
@ -243,7 +243,7 @@ public:
* The last argument, 'optionalLocalQuad', can be null if no separate local coordinates are
* necessary.
*/
void fillQuadWithEdgeAA(const GrClip& clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
void fillQuadWithEdgeAA(const GrClip* clip, GrPaint&& paint, GrAA aa, GrQuadAAFlags edgeAA,
const SkMatrix& viewMatrix, const SkPoint points[4],
const SkPoint optionalLocalPoints[4]) {
const SkPoint* localPoints = optionalLocalPoints ? optionalLocalPoints : points;
@ -261,7 +261,7 @@ public:
};
// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
void drawQuadSet(const GrClip& clip, GrPaint&& paint, GrAA aa, const SkMatrix& viewMatrix,
void drawQuadSet(const GrClip* clip, GrPaint&& paint, GrAA aa, const SkMatrix& viewMatrix,
const QuadSetEntry[], int cnt);
/**
@ -270,7 +270,7 @@ public:
* specifies the rectangle to draw in local coords which will be transformed by 'viewMatrix' to
* device space.
*/
void drawTexture(const GrClip& clip, GrSurfaceProxyView view, SkAlphaType srcAlphaType,
void drawTexture(const GrClip* clip, GrSurfaceProxyView view, SkAlphaType srcAlphaType,
GrSamplerState::Filter filter, SkBlendMode mode, const SkPMColor4f& color,
const SkRect& srcRect, const SkRect& dstRect, GrAA aa, GrQuadAAFlags edgeAA,
SkCanvas::SrcRectConstraint constraint, const SkMatrix& viewMatrix,
@ -289,7 +289,7 @@ public:
* 'subset' is null, it's equivalent to using the fast src rect constraint. If 'subset' is
* provided, the strict src rect constraint is applied using 'subset'.
*/
void drawTextureQuad(const GrClip& clip, GrSurfaceProxyView view, GrColorType srcColorType,
void drawTextureQuad(const GrClip* clip, GrSurfaceProxyView view, GrColorType srcColorType,
SkAlphaType srcAlphaType, GrSamplerState::Filter filter, SkBlendMode mode,
const SkPMColor4f& color, const SkPoint srcQuad[4],
const SkPoint dstQuad[4], GrAA aa, GrQuadAAFlags edgeAA,
@ -323,7 +323,7 @@ public:
* can be inferred from the array within this function, but the information is already known
* by SkGpuDevice, so no need to incur another iteration over the array.
*/
void drawTextureSet(const GrClip&, TextureSetEntry[], int cnt, int proxyRunCnt,
void drawTextureSet(const GrClip*, TextureSetEntry[], int cnt, int proxyRunCnt,
GrSamplerState::Filter, SkBlendMode mode, GrAA aa,
SkCanvas::SrcRectConstraint, const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> texXform);
@ -337,7 +337,7 @@ public:
* @param rrect the roundrect to draw
* @param style style to apply to the rrect. Currently path effects are not allowed.
*/
void drawRRect(const GrClip&,
void drawRRect(const GrClip*,
GrPaint&&,
GrAA,
const SkMatrix& viewMatrix,
@ -352,7 +352,7 @@ public:
* @param path the path to shadow
* @param rec parameters for shadow rendering
*/
bool drawFastShadow(const GrClip&,
bool drawFastShadow(const GrClip*,
const SkMatrix& viewMatrix,
const SkPath& path,
const SkDrawShadowRec& rec);
@ -367,7 +367,7 @@ public:
* @param outer the outer roundrect
* @param inner the inner roundrect
*/
void drawDRRect(const GrClip&,
void drawDRRect(const GrClip*,
GrPaint&&,
GrAA,
const SkMatrix& viewMatrix,
@ -383,7 +383,7 @@ public:
* @param path the path to draw
* @param style style to apply to the path.
*/
void drawPath(const GrClip&,
void drawPath(const GrClip*,
GrPaint&&,
GrAA,
const SkMatrix& viewMatrix,
@ -398,7 +398,7 @@ public:
* @param viewMatrix transformation matrix
* @param shape the shape to draw
*/
void drawShape(const GrClip&,
void drawShape(const GrClip*,
GrPaint&&,
GrAA,
const SkMatrix& viewMatrix,
@ -414,7 +414,7 @@ public:
* @param overridePrimType primitive type to draw. If NULL, derive prim type from vertices.
* @param effect runtime effect that will handle custom vertex attributes.
*/
void drawVertices(const GrClip&,
void drawVertices(const GrClip*,
GrPaint&& paint,
const SkMatrixProvider& matrixProvider,
sk_sp<SkVertices> vertices,
@ -433,7 +433,7 @@ public:
* @param colors optional array of per-sprite colors, supercedes
* the paint's color field.
*/
void drawAtlas(const GrClip&,
void drawAtlas(const GrClip*,
GrPaint&& paint,
const SkMatrix& viewMatrix,
int spriteCount,
@ -450,7 +450,7 @@ public:
* @param region the region to be drawn
* @param style style to apply to the region
*/
void drawRegion(const GrClip&,
void drawRegion(const GrClip*,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
@ -467,7 +467,7 @@ public:
* @param oval the bounding rect of the oval.
* @param style style to apply to the oval. Currently path effects are not allowed.
*/
void drawOval(const GrClip&,
void drawOval(const GrClip*,
GrPaint&& paint,
GrAA,
const SkMatrix& viewMatrix,
@ -488,7 +488,7 @@ public:
* omitted.
* @param style style to apply to the oval.
*/
void drawArc(const GrClip&,
void drawArc(const GrClip*,
GrPaint&& paint,
GrAA,
const SkMatrix& viewMatrix,
@ -501,7 +501,7 @@ public:
/**
* Draw the image as a set of rects, specified by |iter|.
*/
void drawImageLattice(const GrClip&,
void drawImageLattice(const GrClip*,
GrPaint&&,
const SkMatrix& viewMatrix,
GrSurfaceProxyView,
@ -622,7 +622,7 @@ private:
void internalStencilClear(const SkIRect* scissor, bool insideStencilMask);
// Only consumes the GrPaint if successful.
bool drawFilledDRRect(const GrClip& clip,
bool drawFilledDRRect(const GrClip* clip,
GrPaint&& paint,
GrAA,
const SkMatrix& viewMatrix,
@ -638,7 +638,7 @@ private:
//
// 'stencilSettings' are provided merely for decision making purposes; When non-null,
// optimization strategies that submit special ops are avoided.
QuadOptimization attemptQuadOptimization(const GrClip& clip,
QuadOptimization attemptQuadOptimization(const GrClip* clip,
const SkPMColor4f* constColor,
const GrUserStencilSettings* stencilSettings,
GrAA* aa,
@ -648,7 +648,7 @@ private:
// can choose between coverage, MSAA as per chooseAAType(). This will always attempt to apply
// quad optimizations, so all quad/rect public APIs should rely on this function for consistent
// clipping behavior. 'quad' will be modified in place to reflect final rendered geometry.
void drawFilledQuad(const GrClip& clip,
void drawFilledQuad(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
DrawQuad* quad,
@ -656,7 +656,7 @@ private:
// Like drawFilledQuad but does not require using a GrPaint or FP for texturing.
// 'quad' may be modified in place to reflect final geometry.
void drawTexturedQuad(const GrClip& clip,
void drawTexturedQuad(const GrClip* clip,
GrSurfaceProxyView proxyView,
SkAlphaType alphaType,
sk_sp<GrColorSpaceXform> textureXform,
@ -669,7 +669,7 @@ private:
// If 'attemptShapeFallback' is true, and the original shape had been simplfied, this
// will re-route through drawShape() to see if we can avoid path rendering one more time.
void drawShapeUsingPathRenderer(const GrClip&, GrPaint&&, GrAA, const SkMatrix&,
void drawShapeUsingPathRenderer(const GrClip*, GrPaint&&, GrAA, const SkMatrix&,
const GrStyledShape&, bool attemptShapeFallback = true);
void addOp(std::unique_ptr<GrOp>);
@ -680,13 +680,15 @@ private:
// op list. Before adding the op to an op list the WillAddOpFn is called. Note that it
// will not be called in the event that the op is discarded. Moreover, the op may merge into
// another op after the function is called (either before addDrawOp returns or some time later).
void addDrawOp(const GrClip&, std::unique_ptr<GrDrawOp>,
//
// If the clip pointer is null, no clipping will be performed.
void addDrawOp(const GrClip*, std::unique_ptr<GrDrawOp>,
const std::function<WillAddOpFn>& = std::function<WillAddOpFn>());
// Makes a copy of the proxy if it is necessary for the draw and places the texture that should
// be used by GrXferProcessor to access the destination color in 'result'. If the return
// value is false then a texture copy could not be made.
bool SK_WARN_UNUSED_RESULT setupDstProxyView(const GrClip&, const GrOp& op,
bool SK_WARN_UNUSED_RESULT setupDstProxyView(const GrClip*, const GrOp& op,
GrXferProcessor::DstProxyView* result);
class AsyncReadResult;

View File

@ -57,7 +57,7 @@ public:
// care to only provide hard clips or we could get stuck in a loop. The general clip is needed
// so that path renderers can use this function.
void stencilRect(
const GrClip& clip, const GrUserStencilSettings* ss, GrPaint&& paint,
const GrClip* clip, const GrUserStencilSettings* ss, GrPaint&& paint,
GrAA doStencilMSAA, const SkMatrix& viewMatrix, const SkRect& rect,
const SkMatrix* localMatrix = nullptr) {
// Since this provides stencil settings to drawFilledQuad, it performs a different AA type
@ -69,13 +69,13 @@ public:
}
void stencilPath(
const GrHardClip&, GrAA doStencilMSAA, const SkMatrix& viewMatrix, sk_sp<const GrPath>);
const GrHardClip*, GrAA doStencilMSAA, const SkMatrix& viewMatrix, sk_sp<const GrPath>);
/**
* Draws a path, either AA or not, and touches the stencil buffer with the user stencil settings
* for each color sample written.
*/
bool drawAndStencilPath(const GrHardClip&,
bool drawAndStencilPath(const GrHardClip*,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
@ -99,7 +99,7 @@ public:
using WillAddOpFn = GrRenderTargetContext::WillAddOpFn;
void testingOnly_addDrawOp(std::unique_ptr<GrDrawOp>);
void testingOnly_addDrawOp(const GrClip&, std::unique_ptr<GrDrawOp>,
void testingOnly_addDrawOp(const GrClip*, std::unique_ptr<GrDrawOp>,
const std::function<WillAddOpFn>& = std::function<WillAddOpFn>());
bool refsWrappedObjects() const {

View File

@ -68,15 +68,17 @@ static bool get_unclipped_shape_dev_bounds(const GrStyledShape& shape, const SkM
// Gets the shape bounds, the clip bounds, and the intersection (if any). Returns false if there
// is no intersection.
bool GrSoftwarePathRenderer::GetShapeAndClipBounds(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrClip* clip,
const GrStyledShape& shape,
const SkMatrix& matrix,
SkIRect* unclippedDevShapeBounds,
SkIRect* clippedDevShapeBounds,
SkIRect* devClipBounds) {
// compute bounds as intersection of rt size, clip, and path
*devClipBounds = clip.getConservativeBounds(renderTargetContext->width(),
renderTargetContext->height());
*devClipBounds = clip ? clip->getConservativeBounds(renderTargetContext->width(),
renderTargetContext->height())
: SkIRect::MakeWH(renderTargetContext->width(),
renderTargetContext->height());
if (!get_unclipped_shape_dev_bounds(shape, matrix, unclippedDevShapeBounds)) {
*unclippedDevShapeBounds = SkIRect::MakeEmpty();
@ -95,7 +97,7 @@ bool GrSoftwarePathRenderer::GetShapeAndClipBounds(GrRenderTargetContext* render
void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
@ -106,7 +108,7 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetCo
void GrSoftwarePathRenderer::DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds) {
@ -147,7 +149,7 @@ void GrSoftwarePathRenderer::DrawToTargetWithShapeMask(
GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIPoint& textureOriginInDeviceSpace,
const SkIRect& deviceSpaceRectToDraw) {
@ -241,13 +243,13 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
args.fShape->hasUnstyledKey() && (GrAAType::kCoverage == args.fAAType);
if (!GetShapeAndClipBounds(args.fRenderTargetContext,
*args.fClip, *args.fShape,
args.fClip, *args.fShape,
*args.fViewMatrix, &unclippedDevShapeBounds,
&clippedDevShapeBounds,
&devClipBounds)) {
if (inverseFilled) {
DrawAroundInvPath(args.fRenderTargetContext, std::move(args.fPaint),
*args.fUserStencilSettings, *args.fClip, *args.fViewMatrix,
*args.fUserStencilSettings, args.fClip, *args.fViewMatrix,
devClipBounds, unclippedDevShapeBounds);
}
return true;
@ -382,11 +384,11 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
SkASSERT(view);
if (inverseFilled) {
DrawAroundInvPath(args.fRenderTargetContext, GrPaint::Clone(args.fPaint),
*args.fUserStencilSettings, *args.fClip, *args.fViewMatrix, devClipBounds,
*args.fUserStencilSettings, args.fClip, *args.fViewMatrix, devClipBounds,
unclippedDevShapeBounds);
}
DrawToTargetWithShapeMask(std::move(view), args.fRenderTargetContext, std::move(args.fPaint),
*args.fUserStencilSettings, *args.fClip, *args.fViewMatrix,
*args.fUserStencilSettings, args.fClip, *args.fViewMatrix,
SkIPoint{boundsForMask->fLeft, boundsForMask->fTop}, *boundsForMask);
return true;

View File

@ -27,7 +27,7 @@ public:
}
static bool GetShapeAndClipBounds(GrRenderTargetContext*,
const GrClip& clip,
const GrClip* clip,
const GrStyledShape& shape,
const SkMatrix& matrix,
SkIRect* unclippedDevShapeBounds,
@ -38,14 +38,14 @@ private:
static void DrawNonAARect(GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix);
static void DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds);
@ -57,7 +57,7 @@ private:
GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIPoint& textureOriginInDeviceSpace,
const SkIRect& deviceSpaceRectToDraw);

View File

@ -278,7 +278,7 @@ static void draw_stencil_rect(GrRenderTargetContext* rtc, const GrHardClip& clip
const SkRect& rect, GrAA aa) {
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
rtc->priv().stencilRect(clip, ss, std::move(paint), aa, matrix, rect);
rtc->priv().stencilRect(&clip, ss, std::move(paint), aa, matrix, rect);
}
static void draw_path(GrRecordingContext* context, GrRenderTargetContext* rtc,

View File

@ -10,7 +10,6 @@
#include "include/private/GrRecordingContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDataUtils.h"
#include "src/gpu/GrDrawingManager.h"
@ -240,7 +239,7 @@ bool GrSurfaceContext::readPixels(const GrImageInfo& origDstInfo, void* dst, siz
paint.addColorFragmentProcessor(std::move(fp));
tempCtx->asRenderTargetContext()->fillRectToRect(
GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeWH(dstInfo.width(), dstInfo.height()),
SkRect::MakeXYWH(pt.fX, pt.fY, dstInfo.width(), dstInfo.height()));
@ -426,7 +425,7 @@ bool GrSurfaceContext::writePixels(const GrImageInfo& origSrcInfo, const void* s
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
this->asRenderTargetContext()->fillRectToRect(
GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeXYWH(pt.fX, pt.fY, srcInfo.width(), srcInfo.height()),
SkRect::MakeWH(srcInfo.width(), srcInfo.height()));
} else {
@ -553,7 +552,7 @@ std::unique_ptr<GrRenderTargetContext> GrSurfaceContext::rescale(
return nullptr;
}
// 1-to-1 draw can always be kFast.
linearRTC->drawTexture(GrNoClip(), std::move(texView), srcAlphaType,
linearRTC->drawTexture(nullptr, std::move(texView), srcAlphaType,
GrSamplerState::Filter::kNearest, SkBlendMode::kSrc,
SK_PMColor4fWHITE, SkRect::Make(srcRect),
SkRect::Make(srcRect.size()), GrAA::kNo, GrQuadAAFlags::kNone,
@ -619,8 +618,8 @@ std::unique_ptr<GrRenderTargetContext> GrSurfaceContext::rescale(
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
tempB->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), dstRect,
dstRect);
tempB->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), dstRect,
dstRect);
} else {
auto filter = rescaleQuality == kNone_SkFilterQuality ? GrSamplerState::Filter::kNearest
: GrSamplerState::Filter::kBilerp;
@ -629,10 +628,9 @@ std::unique_ptr<GrRenderTargetContext> GrSurfaceContext::rescale(
if (nextDims.width() <= srcRect.width() && nextDims.height() <= srcRect.height()) {
constraint = SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint;
}
tempB->drawTexture(GrNoClip(), std::move(texView), srcAlphaType, filter,
SkBlendMode::kSrc, SK_PMColor4fWHITE, SkRect::Make(srcRect), dstRect,
GrAA::kNo, GrQuadAAFlags::kNone, constraint, SkMatrix::I(),
std::move(xform));
tempB->drawTexture(nullptr, std::move(texView), srcAlphaType, filter, SkBlendMode::kSrc,
SK_PMColor4fWHITE, SkRect::Make(srcRect), dstRect, GrAA::kNo,
GrQuadAAFlags::kNone, constraint, SkMatrix::I(), std::move(xform));
}
texView = tempB->readSurfaceView();
tempA = std::move(tempB);
@ -715,4 +713,3 @@ void GrSurfaceContext::validate() const {
this->onValidate();
}
#endif

View File

@ -16,7 +16,6 @@
#include "src/core/SkYUVPlanesCache.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
@ -191,7 +190,7 @@ GrSurfaceProxyView GrYUVProvider::refAsTextureProxyView(GrRecordingContext* ctx,
yuvSizeInfo.fSizes[0].fHeight);
SkMatrix m = SkEncodedOriginToMatrix(yuvSizeInfo.fOrigin, r.width(), r.height());
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, m, r);
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, m, r);
SkASSERT(renderTargetContext->asTextureProxy());
return renderTargetContext->readSurfaceView();

View File

@ -125,7 +125,8 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
: INHERITED(make_info(renderTargetContext.get(), SkToBool(flags & kIsOpaque_Flag)),
renderTargetContext->surfaceProps())
, fContext(SkRef(context))
, fRenderTargetContext(std::move(renderTargetContext)) {
, fRenderTargetContext(std::move(renderTargetContext))
, fClip(&this->cs()) {
if (flags & kNeedClear_Flag) {
this->clearAll();
}
@ -721,13 +722,16 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special, int left, int top, const
SkRect clipGeometry = SkRect::MakeWH(clipImage->width(), clipImage->height());
if (!clipGeometry.contains(inverseClipMatrix.mapRect(dstRect))) {
// Draw the clip geometry since it is smaller, using dstRect as an extra scissor
SkClipStack clip(this->cs());
clip.clipDevRect(SkIRect::MakeXYWH(left, top, subset.width(), subset.height()),
SkClipOp::kIntersect);
SkClipStack dstRectClip(this->cs());
dstRectClip.clipDevRect(
SkIRect::MakeXYWH(left, top, subset.width(), subset.height()),
SkClipOp::kIntersect);
GrClipStackClip clip(&dstRectClip);
SkMatrix local = SkMatrix::Concat(SkMatrix::MakeRectToRect(
dstRect, srcRect, SkMatrix::kFill_ScaleToFit), ctm);
fRenderTargetContext->fillRectWithLocalMatrix(GrClipStackClip(&clip),
std::move(grPaint), GrAA(paint.isAntiAlias()), ctm, clipGeometry, local);
fRenderTargetContext->fillRectWithLocalMatrix(&clip, std::move(grPaint),
GrAA(paint.isAntiAlias()), ctm,
clipGeometry, local);
return;
}
// Else fall through and draw the subset since that is contained in the clip geometry
@ -1136,7 +1140,6 @@ bool SkGpuDevice::android_utils_clipWithStencil() {
}
GrPaint grPaint;
grPaint.setXPFactory(GrDisableColorXPFactory::Get());
GrNoClip noClip;
static constexpr GrUserStencilSettings kDrawToStencil(
GrUserStencilSettings::StaticInit<
0x1,
@ -1146,7 +1149,7 @@ bool SkGpuDevice::android_utils_clipWithStencil() {
GrUserStencilOp::kReplace,
0x1>()
);
rtc->drawRegion(noClip, std::move(grPaint), GrAA::kNo, SkMatrix::I(), clipRegion,
rtc->drawRegion(nullptr, std::move(grPaint), GrAA::kNo, SkMatrix::I(), clipRegion,
GrStyle::SimpleFill(), &kDrawToStencil);
return true;
}

View File

@ -129,6 +129,7 @@ private:
// We want these unreffed in RenderTargetContext, GrContext order.
sk_sp<GrContext> fContext;
std::unique_ptr<GrRenderTargetContext> fRenderTargetContext;
GrClipStackClip fClip;
enum Flags {
kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
@ -148,7 +149,7 @@ private:
bool forceConservativeRasterClip() const override { return true; }
GrClipStackClip clip() const { return GrClipStackClip(&this->cs()); }
const GrClip* clip() const { return &fClip; }
sk_sp<SkSpecialImage> filterTexture(SkSpecialImage*,
int left, int top,

View File

@ -125,12 +125,13 @@ static int determine_tile_size(const SkIRect& src, int maxTileSize) {
// Given a bitmap, an optional src rect, and a context with a clip and matrix determine what
// pixels from the bitmap are necessary.
static SkIRect determine_clipped_src_rect(int width, int height,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkMatrix& srcToDstRect,
const SkISize& imageDimensions,
const SkRect* srcRectPtr) {
SkIRect clippedSrcIRect = clip.getConservativeBounds(width, height);
SkIRect clippedSrcIRect = clip ? clip->getConservativeBounds(width, height)
: SkIRect::MakeWH(width, height);
SkMatrix inv = SkMatrix::Concat(viewMatrix, srcToDstRect);
if (!inv.invert(&inv)) {
return SkIRect::MakeEmpty();
@ -154,7 +155,7 @@ static SkIRect determine_clipped_src_rect(int width, int height,
// tileSize and clippedSubset are valid if true is returned
static bool should_tile_image_id(GrContext* context,
SkISize rtSize,
const GrClip& clip,
const GrClip* clip,
uint32_t imageID,
const SkISize& imageSize,
const SkMatrix& ctm,
@ -319,7 +320,7 @@ static bool can_use_draw_texture(const SkPaint& paint) {
}
// Assumes srcRect and dstRect have already been optimized to fit the proxy
static void draw_texture(GrRenderTargetContext* rtc, const GrClip& clip, const SkMatrix& ctm,
static void draw_texture(GrRenderTargetContext* rtc, const GrClip* clip, const SkMatrix& ctm,
const SkPaint& paint, const SkRect& srcRect, const SkRect& dstRect,
const SkPoint dstClip[4], GrAA aa, GrQuadAAFlags aaFlags,
SkCanvas::SrcRectConstraint constraint, GrSurfaceProxyView view,
@ -382,7 +383,7 @@ static void draw_texture(GrRenderTargetContext* rtc, const GrClip& clip, const S
// Assumes srcRect and dstRect have already been optimized to fit the proxy.
static void draw_texture_producer(GrContext* context,
GrRenderTargetContext* rtc,
const GrClip& clip,
const GrClip* clip,
const SkMatrixProvider& matrixProvider,
const SkPaint& paint,
GrTextureProducer* producer,
@ -510,7 +511,7 @@ static void draw_texture_producer(GrContext* context,
void draw_tiled_bitmap(GrContext* context,
GrRenderTargetContext* rtc,
const GrClip& clip,
const GrClip* clip,
const SkBitmap& bitmap,
int tileSize,
const SkMatrixProvider& matrixProvider,

View File

@ -8,7 +8,6 @@
#include "src/gpu/ccpr/GrCCPerFlushResources.h"
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrOnFlushResourceProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
@ -541,7 +540,7 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP) {
auto op = CopyAtlasOp::Make(
rtc->surfPriv().getContext(), sk_ref_sp(this), copyRange.fSrcProxy,
baseCopyInstance, endCopyInstance, atlas.drawBounds());
rtc->addDrawOp(GrNoClip(), std::move(op));
rtc->addDrawOp(nullptr, std::move(op));
}
baseCopyInstance = endCopyInstance;
}
@ -580,7 +579,7 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP) {
rtc->surfPriv().getContext(), sk_ref_sp(this), atlas.getFillBatchID(),
atlas.getStrokeBatchID(), atlas.drawBounds());
}
rtc->addDrawOp(GrNoClip(), std::move(op));
rtc->addDrawOp(nullptr, std::move(op));
if (rtc->asSurfaceProxy()->requiresManualMSAAResolve()) {
onFlushRP->addTextureResolveTask(sk_ref_sp(rtc->asTextureProxy()),
GrSurfaceProxy::ResolveFlags::kMSAA);

View File

@ -9,8 +9,8 @@
#include "include/pathops/SkPathOps.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/ccpr/GrCCClipProcessor.h"
#include "src/gpu/ccpr/GrCCDrawPathsOp.h"
#include "src/gpu/ccpr/GrCCPathCache.h"
@ -167,11 +167,8 @@ GrPathRenderer::CanDrawPath GrCoverageCountingPathRenderer::onCanDrawPath(
bool GrCoverageCountingPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkASSERT(!fFlushing);
GrRenderTargetContext* rtc = args.fRenderTargetContext;
SkIRect clipIBounds = args.fClip->getConservativeBounds(rtc->width(), rtc->height());
auto op = GrCCDrawPathsOp::Make(args.fContext, clipIBounds, *args.fViewMatrix, *args.fShape,
std::move(args.fPaint));
auto op = GrCCDrawPathsOp::Make(args.fContext, *args.fClipConservativeBounds, *args.fViewMatrix,
*args.fShape, std::move(args.fPaint));
this->recordOp(std::move(op), args);
return true;
}
@ -183,7 +180,7 @@ void GrCoverageCountingPathRenderer::recordOp(std::unique_ptr<GrCCDrawPathsOp> o
op->cast<GrCCDrawPathsOp>()->addToOwningPerOpsTaskPaths(
sk_ref_sp(this->lookupPendingPaths(opsTaskID)));
};
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op),
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op),
addToOwningPerOpsTaskPaths);
}
}

View File

@ -8,7 +8,6 @@
@header {
#include "include/gpu/GrContext.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -84,8 +83,7 @@
paint1.addColorFragmentProcessor(pmToUPM->clone());
paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
readRTC->fillRectToRect(GrNoClip(), std::move(paint1), GrAA::kNo, SkMatrix::I(), kRect,
kRect);
readRTC->fillRectToRect(nullptr, std::move(paint1), GrAA::kNo, SkMatrix::I(), kRect, kRect);
if (!readRTC->readPixels(ii, firstRead, 0, {0, 0})) {
return false;
}
@ -99,16 +97,14 @@
paint2.addColorFragmentProcessor(std::move(upmToPM));
paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
tempRTC->fillRectToRect(GrNoClip(), std::move(paint2), GrAA::kNo, SkMatrix::I(), kRect,
kRect);
tempRTC->fillRectToRect(nullptr, std::move(paint2), GrAA::kNo, SkMatrix::I(), kRect, kRect);
paint3.addColorFragmentProcessor(GrTextureEffect::Make(tempRTC->readSurfaceView(),
kPremul_SkAlphaType));
paint3.addColorFragmentProcessor(std::move(pmToUPM));
paint3.setPorterDuffXPFactory(SkBlendMode::kSrc);
readRTC->fillRectToRect(GrNoClip(), std::move(paint3), GrAA::kNo, SkMatrix::I(), kRect,
kRect);
readRTC->fillRectToRect(nullptr, std::move(paint3), GrAA::kNo, SkMatrix::I(), kRect, kRect);
if (!readRTC->readPixels(ii, secondRead, 0, {0, 0})) {
return false;

View File

@ -19,7 +19,6 @@ uniform half blurRadius;
#include "src/core/SkGpuBlurUtils.h"
#include "src/core/SkRRectPriv.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
@ -65,7 +64,7 @@ uniform half blurRadius;
GrPaint paint;
rtc->clear(SK_PMColor4fTRANSPARENT);
rtc->drawRRect(GrNoClip(), std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw,
rtc->drawRRect(nullptr, std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw,
GrStyle::SimpleFill());
GrSurfaceProxyView srcView = rtc->readSurfaceView();

View File

@ -15,7 +15,6 @@
#include "include/gpu/GrContext.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -93,8 +92,7 @@ public:
paint1.addColorFragmentProcessor(pmToUPM->clone());
paint1.setPorterDuffXPFactory(SkBlendMode::kSrc);
readRTC->fillRectToRect(GrNoClip(), std::move(paint1), GrAA::kNo, SkMatrix::I(), kRect,
kRect);
readRTC->fillRectToRect(nullptr, std::move(paint1), GrAA::kNo, SkMatrix::I(), kRect, kRect);
if (!readRTC->readPixels(ii, firstRead, 0, {0, 0})) {
return false;
}
@ -108,16 +106,14 @@ public:
paint2.addColorFragmentProcessor(std::move(upmToPM));
paint2.setPorterDuffXPFactory(SkBlendMode::kSrc);
tempRTC->fillRectToRect(GrNoClip(), std::move(paint2), GrAA::kNo, SkMatrix::I(), kRect,
kRect);
tempRTC->fillRectToRect(nullptr, std::move(paint2), GrAA::kNo, SkMatrix::I(), kRect, kRect);
paint3.addColorFragmentProcessor(
GrTextureEffect::Make(tempRTC->readSurfaceView(), kPremul_SkAlphaType));
paint3.addColorFragmentProcessor(std::move(pmToUPM));
paint3.setPorterDuffXPFactory(SkBlendMode::kSrc);
readRTC->fillRectToRect(GrNoClip(), std::move(paint3), GrAA::kNo, SkMatrix::I(), kRect,
kRect);
readRTC->fillRectToRect(nullptr, std::move(paint3), GrAA::kNo, SkMatrix::I(), kRect, kRect);
if (!readRTC->readPixels(ii, secondRead, 0, {0, 0})) {
return false;

View File

@ -19,7 +19,6 @@
#include "src/core/SkGpuBlurUtils.h"
#include "src/core/SkRRectPriv.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
@ -67,7 +66,7 @@ public:
GrPaint paint;
rtc->clear(SK_PMColor4fTRANSPARENT);
rtc->drawRRect(GrNoClip(), std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw,
rtc->drawRRect(nullptr, std::move(paint), GrAA::kYes, SkMatrix::I(), rrectToDraw,
GrStyle::SimpleFill());
GrSurfaceProxyView srcView = rtc->readSurfaceView();

View File

@ -915,7 +915,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
std::unique_ptr<GrDrawOp> op = AAConvexPathOp::Make(args.fContext, std::move(args.fPaint),
*args.fViewMatrix,
path, args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}

View File

@ -15,12 +15,12 @@
#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrBuffer.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrDrawOpTest.h"
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrProcessor.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/effects/GrBezierEffect.h"
@ -1272,14 +1272,13 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
"GrAAHairlinePathRenderer::onDrawPath");
SkASSERT(args.fRenderTargetContext->numSamples() <= 1);
SkIRect devClipBounds = args.fClip->getConservativeBounds(args.fRenderTargetContext->width(),
args.fRenderTargetContext->height());
SkPath path;
args.fShape->asPath(&path);
std::unique_ptr<GrDrawOp> op =
AAHairlineOp::Make(args.fContext, std::move(args.fPaint), *args.fViewMatrix, path,
args.fShape->style(), devClipBounds, args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fShape->style(), *args.fClipConservativeBounds,
args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}

View File

@ -405,7 +405,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
std::unique_ptr<GrDrawOp> op = AAFlatteningConvexPathOp::Make(
args.fContext, std::move(args.fPaint), *args.fViewMatrix, path, strokeWidth,
stroke.getStyle(), join, miterLimit, args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}

View File

@ -53,6 +53,6 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
if (!op) {
return false;
}
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}

View File

@ -537,7 +537,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
GrPaint&& paint,
GrAAType aaType,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const GrClip* clip,
const SkMatrix& viewMatrix,
const GrStyledShape& shape,
bool stencilOnly) {
@ -705,7 +705,7 @@ bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
return this->internalDrawPath(
args.fRenderTargetContext, std::move(args.fPaint), aaType, *args.fUserStencilSettings,
*args.fClip, *args.fViewMatrix, *args.fShape, false);
args.fClip, *args.fViewMatrix, *args.fShape, false);
}
void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
@ -720,7 +720,7 @@ void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
this->internalDrawPath(
args.fRenderTargetContext, std::move(paint), aaType, GrUserStencilSettings::kUnused,
*args.fClip, *args.fViewMatrix, *args.fShape, true);
args.fClip, *args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@ private:
GrPaint&&,
GrAAType,
const GrUserStencilSettings&,
const GrClip&,
const GrClip*,
const SkMatrix& viewMatrix,
const GrStyledShape&,
bool stencilOnly);

View File

@ -524,7 +524,7 @@ std::unique_ptr<GrDrawOp> GrFillRectOp::MakeOp(GrRecordingContext* context,
}
void GrFillRectOp::AddFillRectOps(GrRenderTargetContext* rtc,
const GrClip& clip,
const GrClip* clip,
GrRecordingContext* context,
GrPaint&& paint,
GrAAType aaType,

View File

@ -49,7 +49,7 @@ public:
// Bulk API for drawing quads with a single op
// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
static void AddFillRectOps(GrRenderTargetContext*,
const GrClip& clip,
const GrClip* clip,
GrRecordingContext*,
GrPaint&&,
GrAAType,

View File

@ -885,7 +885,7 @@ bool GrSmallPathRenderer::onDrawPath(const DrawPathArgs& args) {
std::unique_ptr<GrDrawOp> op = SmallPathOp::Make(
args.fContext, std::move(args.fPaint), *args.fShape, *args.fViewMatrix, fAtlas.get(),
&fShapeCache, &fShapeList, args.fGammaCorrect, args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}

View File

@ -101,7 +101,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
"GrStencilAndCoverPathRenderer::onStencilPath");
sk_sp<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
args.fRenderTargetContext->priv().stencilPath(
*args.fClip, args.fDoStencilMSAA, *args.fViewMatrix, std::move(p));
args.fClip, args.fDoStencilMSAA, *args.fViewMatrix, std::move(p));
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
@ -126,7 +126,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
// fake inverse with a stencil and cover
GrAppliedClip appliedClip;
if (!args.fClip->apply(
if (args.fClip && !args.fClip->apply(
args.fContext, args.fRenderTargetContext, doStencilMSAA, true, &appliedClip,
&devBounds)) {
return true;
@ -142,7 +142,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
// Just ignore the analytic FPs (if any) during the stencil pass. They will still clip the
// final draw and it is meaningless to multiply by coverage when drawing to stencil.
args.fRenderTargetContext->priv().stencilPath(
stencilClip, GrAA(doStencilMSAA), viewMatrix, std::move(path));
&stencilClip, GrAA(doStencilMSAA), viewMatrix, std::move(path));
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@ -179,14 +179,14 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
doStencilMSAA = GrAA::kYes;
}
args.fRenderTargetContext->priv().stencilRect(
*args.fClip, &kInvertedCoverPass, std::move(args.fPaint), doStencilMSAA,
args.fClip, &kInvertedCoverPass, std::move(args.fPaint), doStencilMSAA,
coverMatrix, coverBounds, &localMatrix);
}
} else {
std::unique_ptr<GrDrawOp> op = GrDrawPathOp::Make(
args.fContext, viewMatrix, std::move(args.fPaint), GrAA(doStencilMSAA),
std::move(path));
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
}
return true;

View File

@ -1057,7 +1057,7 @@ std::unique_ptr<GrDrawOp> GrTextureOp::Make(GrRecordingContext* context,
class GrTextureOp::BatchSizeLimiter {
public:
BatchSizeLimiter(GrRenderTargetContext* rtc,
const GrClip& clip,
const GrClip* clip,
GrRecordingContext* context,
int numEntries,
GrSamplerState::Filter filter,
@ -1095,7 +1095,7 @@ public:
private:
GrRenderTargetContext* fRTC;
const GrClip& fClip;
const GrClip* fClip;
GrRecordingContext* fContext;
GrSamplerState::Filter fFilter;
GrTextureOp::Saturate fSaturate;
@ -1109,7 +1109,7 @@ private:
// Greedily clump quad draws together until the index buffer limit is exceeded.
void GrTextureOp::AddTextureSetOps(GrRenderTargetContext* rtc,
const GrClip& clip,
const GrClip* clip,
GrRecordingContext* context,
GrRenderTargetContext::TextureSetEntry set[],
int cnt,

View File

@ -56,7 +56,7 @@ public:
// supported, or if the blend mode is not src-over. 'cnt' is the size of the entry array.
// 'proxyCnt' <= 'cnt' and represents the number of proxy switches within the array.
static void AddTextureSetOps(GrRenderTargetContext*,
const GrClip& clip,
const GrClip* clip,
GrRecordingContext*,
GrRenderTargetContext::TextureSetEntry[],
int cnt,

View File

@ -11,12 +11,12 @@
#include "src/core/SkGeometry.h"
#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrDrawOpTest.h"
#include "src/gpu/GrEagerVertexAllocator.h"
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSimpleMesh.h"
@ -419,12 +419,11 @@ private:
bool GrTriangulatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrTriangulatingPathRenderer::onDrawPath");
SkIRect clipBoundsI = args.fClip->getConservativeBounds(args.fRenderTargetContext->width(),
args.fRenderTargetContext->height());
std::unique_ptr<GrDrawOp> op = TriangulatingPathOp::Make(
args.fContext, std::move(args.fPaint), *args.fShape, *args.fViewMatrix, clipBoundsI,
args.fAAType, args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fContext, std::move(args.fPaint), *args.fShape, *args.fViewMatrix,
*args.fClipConservativeBounds, args.fAAType, args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}

View File

@ -74,13 +74,14 @@ bool GrTessellationPathRenderer::onDrawPath(const DrawPathArgs& args) {
auto op = pool->allocate<GrDrawAtlasPathOp>(
renderTargetContext->numSamples(), sk_ref_sp(fAtlas.textureProxy()),
devIBounds, locationInAtlas, transposedInAtlas, *args.fViewMatrix,
std::move(args.fPaint)); renderTargetContext->addDrawOp(*args.fClip, std::move(op));
std::move(args.fPaint));
renderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}
auto op = pool->allocate<GrTessellatePathOp>(
*args.fViewMatrix, path, std::move(args.fPaint), args.fAAType);
renderTargetContext->addDrawOp(*args.fClip, std::move(op));
renderTargetContext->addDrawOp(args.fClip, std::move(op));
return true;
}
@ -149,7 +150,7 @@ void GrTessellationPathRenderer::onStencilPath(const StencilPathArgs& args) {
auto op = args.fContext->priv().opMemoryPool()->allocate<GrTessellatePathOp>(
*args.fViewMatrix, path, GrPaint(), aaType, GrTessellatePathOp::Flags::kStencilOnly);
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
args.fRenderTargetContext->addDrawOp(args.fClip, std::move(op));
}
void GrTessellationPathRenderer::preFlush(GrOnFlushResourceProvider* onFlushRP,
@ -199,7 +200,7 @@ void GrTessellationPathRenderer::renderAtlas(GrOnFlushResourceProvider* onFlushR
auto op = onFlushRP->opMemoryPool()->allocate<GrTessellatePathOp>(
SkMatrix::I(), *uberPath, GrPaint(), aaType,
GrTessellatePathOp::Flags::kStencilOnly);
rtc->addDrawOp(GrNoClip(), std::move(op));
rtc->addDrawOp(nullptr, std::move(op));
}
}
@ -235,7 +236,7 @@ void GrTessellationPathRenderer::renderAtlas(GrOnFlushResourceProvider* onFlushR
auto coverOp = GrFillRectOp::Make(rtc->surfPriv().getContext(), std::move(paint),
GrAAType::kMSAA, &drawQuad, stencil, fillRectFlags);
rtc->addDrawOp(GrNoClip(), std::move(coverOp));
rtc->addDrawOp(nullptr, std::move(coverOp));
if (rtc->asSurfaceProxy()->requiresManualMSAAResolve()) {
onFlushRP->addTextureResolveTask(sk_ref_sp(rtc->asTextureProxy()),

View File

@ -502,7 +502,7 @@ void GrTextBlob::addOp(GrTextTarget* target,
const SkSurfaceProps& props,
const SkPaint& paint,
const SkPMColor4f& filteredColor,
const GrClip& clip,
const GrClip* clip,
const SkMatrixProvider& deviceMatrix,
SkPoint drawOrigin) {
for (SubRun* subRun = fFirstSubRun; subRun != nullptr; subRun = subRun->fNextSubRun) {
@ -560,15 +560,14 @@ void GrTextBlob::addOp(GrTextTarget* target,
bool skipClip = false;
SkIRect clipRect = SkIRect::MakeEmpty();
SkRect rtBounds = SkRect::MakeWH(target->width(), target->height());
SkRRect clipRRect;
SkRRect clipRRect = SkRRect::MakeRect(rtBounds);
GrAA aa;
// We can clip geometrically if we're not using SDFs or transformed glyphs,
// and we have an axis-aligned rectangular non-AA clip
if (!subRun->drawAsDistanceFields() &&
!subRun->needsTransform() &&
clip.isRRect(rtBounds, &clipRRect, &aa) &&
clipRRect.isRect() && GrAA::kNo == aa) {
skipClip = true;
(!clip || (clip->isRRect(rtBounds, &clipRRect, &aa) &&
clipRRect.isRect() && GrAA::kNo == aa))) {
// We only need to do clipping work if the subrun isn't contained by the clip
SkRect subRunBounds = subRun->deviceRect(deviceMatrix.localToDevice(), drawOrigin);
if (!clipRRect.getBounds().contains(subRunBounds)) {
@ -579,17 +578,13 @@ void GrTextBlob::addOp(GrTextTarget* target,
clipRRect.getBounds().round(&clipRect);
}
}
skipClip = true;
}
auto op = this->makeOp(subRun, deviceMatrix, drawOrigin, clipRect,
paint, filteredColor, props, target);
if (op) {
if (skipClip) {
target->addDrawOp(GrNoClip(), std::move(op));
}
else {
target->addDrawOp(clip, std::move(op));
}
target->addDrawOp(skipClip ? nullptr : clip, std::move(op));
}
}
}

View File

@ -131,7 +131,7 @@ public:
const SkSurfaceProps& props,
const SkPaint& paint,
const SkPMColor4f& filteredColor,
const GrClip& clip,
const GrClip* clip,
const SkMatrixProvider& deviceMatrix,
SkPoint drawOrigin);

View File

@ -47,7 +47,7 @@ public:
void drawGlyphRunList(GrRecordingContext*,
GrTextTarget*,
const GrClip&,
const GrClip*,
const SkMatrixProvider&,
const SkSurfaceProps&,
const SkGlyphRunList&) const;

View File

@ -31,9 +31,9 @@ public:
const GrColorInfo& colorInfo() const { return fColorInfo; }
virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
virtual void addDrawOp(const GrClip*, std::unique_ptr<GrAtlasTextOp> op) = 0;
virtual void drawShape(const GrClip&,
virtual void drawShape(const GrClip*,
const SkPaint&,
const SkMatrixProvider&,
const GrStyledShape&) = 0;

View File

@ -24,7 +24,6 @@
#include "src/gpu/GrBackendTextureImageGenerator.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
@ -105,7 +104,7 @@ sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(GrRecordingContext* con
paint.addColorFragmentProcessor(std::move(xform));
}
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(),
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::MakeIWH(this->width(), this->height()));
if (!renderTargetContext->asTextureProxy()) {
return nullptr;

View File

@ -13,7 +13,6 @@
#include "include/private/GrRecordingContext.h"
#include "src/core/SkBitmapCache.h"
#include "src/core/SkTLList.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrProxyProvider.h"
@ -323,7 +322,7 @@ bool SkImage_GpuBase::RenderYUVAToRGBA(GrContext* ctx, GrRenderTargetContext* re
}
paint.addColorFragmentProcessor(std::move(fp));
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), rect);
renderTargetContext->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), rect);
return true;
}

View File

@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
#include "src/core/SkBlendModePriv.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -54,7 +53,7 @@ static void bulk_fill_rect_create_test(skiatest::Reporter* reporter, GrContext*
GrPaint paint;
paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
GrFillRectOp::AddFillRectOps(rtc.get(), GrNoClip(), context, std::move(paint), overallAA,
GrFillRectOp::AddFillRectOps(rtc.get(), nullptr, context, std::move(paint), overallAA,
SkMatrix::I(), quads, requestedTotNumQuads);
GrOpsTask* opsTask = rtc->testingOnly_PeekLastOpsTask();
@ -105,7 +104,7 @@ static void bulk_texture_rect_create_test(skiatest::Reporter* reporter, GrContex
set[i].fAAFlags = perQuadAA(i);
}
GrTextureOp::AddTextureSetOps(rtc.get(), GrNoClip(), context, set, requestedTotNumQuads,
GrTextureOp::AddTextureSetOps(rtc.get(), nullptr, context, set, requestedTotNumQuads,
requestedTotNumQuads, // We alternate so proxyCnt == cnt
GrSamplerState::Filter::kNearest,
GrTextureOp::Saturate::kYes,

View File

@ -23,7 +23,6 @@
#include "include/private/GrTypesPriv.h"
#include "include/private/SkColorData.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrImageInfo.h"
@ -96,7 +95,7 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) {
auto fp = GrConstColorProcessor::Make(color, GrConstColorProcessor::InputMode::kIgnore);
paint.addColorFragmentProcessor(std::move(fp));
rtc->drawPath(GrNoClip(), std::move(paint), GrAA::kNo,
rtc->drawPath(nullptr, std::move(paint), GrAA::kNo,
SkMatrix::I(), invPath, style);
rtc->flush(SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());
@ -114,7 +113,7 @@ static void run_test(GrContext* ctx, skiatest::Reporter* reporter) {
auto fp = GrConstColorProcessor::Make(color, GrConstColorProcessor::InputMode::kIgnore);
paint.addColorFragmentProcessor(std::move(fp));
rtc->drawPath(GrNoClip(), std::move(paint), GrAA::kNo,
rtc->drawPath(nullptr, std::move(paint), GrAA::kNo,
SkMatrix::I(), path, style);
SkBitmap bm = read_back(rtc.get(), kBigSize, kBigSize);

View File

@ -88,7 +88,6 @@ public:
GrPaint paint;
paint.setColor4f({ 0, 1, 0, 1 });
GrNoClip noClip;
SkIRect clipBounds = SkIRect::MakeWH(kCanvasSize, kCanvasSize);
GrStyledShape shape;
@ -104,7 +103,7 @@ public:
}
fCCPR->testingOnly_drawPathDirectly({
fCtx.get(), std::move(paint), &GrUserStencilSettings::kUnused, fRTC.get(), &noClip,
fCtx.get(), std::move(paint), &GrUserStencilSettings::kUnused, fRTC.get(), nullptr,
&clipBounds, &matrix, &shape, GrAAType::kCoverage, false});
}
@ -114,7 +113,8 @@ public:
GrPaint paint;
paint.setColor4f(color);
fRTC->drawRect(CCPRClip(fCCPR, clipPath), std::move(paint), GrAA::kYes, SkMatrix::I(),
CCPRClip clip(fCCPR, clipPath);
fRTC->drawRect(&clip, std::move(paint), GrAA::kYes, SkMatrix::I(),
SkRect::MakeIWH(kCanvasSize, kCanvasSize));
}

View File

@ -359,7 +359,7 @@ static std::unique_ptr<GrRenderTargetContext> draw_mipmap_into_new_render_target
context, colorType, nullptr, std::move(renderTarget), kTopLeft_GrSurfaceOrigin,
nullptr);
rtc->drawTexture(GrNoClip(), std::move(mipmapView), alphaType, filter, SkBlendMode::kSrcOver,
rtc->drawTexture(nullptr, std::move(mipmapView), alphaType, filter, SkBlendMode::kSrcOver,
{1,1,1,1}, SkRect::MakeWH(4, 4), SkRect::MakeWH(1,1), GrAA::kYes,
GrQuadAAFlags::kAll, SkCanvas::kFast_SrcRectConstraint, SkMatrix::I(),
nullptr);

View File

@ -11,12 +11,12 @@
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/GrTexturePriv.h"
@ -570,7 +570,7 @@ DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(
backendFormat, GrColorType::kRGBA_8888);
GrSurfaceProxyView view(std::move(proxy), kTopLeft_GrSurfaceOrigin, readSwizzle);
rtc->drawTexture(GrNoClip(), view, kPremul_SkAlphaType,
rtc->drawTexture(nullptr, view, kPremul_SkAlphaType,
GrSamplerState::Filter::kNearest, SkBlendMode::kSrcOver,
SkPMColor4f(), SkRect::MakeWH(w, h), SkRect::MakeWH(w, h),
GrAA::kNo, GrQuadAAFlags::kNone, SkCanvas::kFast_SrcRectConstraint,
@ -584,7 +584,7 @@ DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
REPORTER_ASSERT(reporter, idleIDs.find(2) == idleIDs.end());
// This time we move the proxy into the draw.
rtc->drawTexture(GrNoClip(), std::move(view), kPremul_SkAlphaType,
rtc->drawTexture(nullptr, std::move(view), kPremul_SkAlphaType,
GrSamplerState::Filter::kNearest, SkBlendMode::kSrcOver,
SkPMColor4f(), SkRect::MakeWH(w, h), SkRect::MakeWH(w, h),
GrAA::kNo, GrQuadAAFlags::kNone,
@ -635,7 +635,7 @@ DEF_GPUTEST(TextureIdleProcTest, reporter, options) {
GrSurfaceProxyView view(std::move(proxy), kTopLeft_GrSurfaceOrigin,
swizzle);
rtc->drawTexture(
GrNoClip(), std::move(view), kPremul_SkAlphaType,
nullptr, std::move(view), kPremul_SkAlphaType,
GrSamplerState::Filter::kNearest, SkBlendMode::kSrcOver,
SkPMColor4f(), SkRect::MakeWH(w, h), SkRect::MakeWH(w, h),
GrAA::kNo, GrQuadAAFlags::kNone,

View File

@ -212,8 +212,9 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
auto mockAtlas = GrRenderTargetContext::Make(
ctx.get(), GrColorType::kAlpha_F16, nullptr, SkBackingFit::kExact, {10, 10});
REPORTER_ASSERT(reporter, mockAtlas);
rtc->priv().testingOnly_addDrawOp(LazyProxyTest::Clip(&test, mockAtlas->asTextureProxy()),
LazyProxyTest::Op::Make(ctx.get(), proxyProvider, &test, nullTexture));
LazyProxyTest::Clip clip(&test, mockAtlas->asTextureProxy());
rtc->priv().testingOnly_addDrawOp(
&clip, LazyProxyTest::Op::Make(ctx.get(), proxyProvider, &test, nullTexture));
ctx->priv().testingOnly_flushAndRemoveOnFlushCallbackObject(&test);
}
}

View File

@ -10,7 +10,6 @@
#include "include/core/SkBitmap.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "src/core/SkPointPriv.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrImageInfo.h"
@ -484,7 +483,7 @@ static GrSurfaceProxyView make_upstream_image(GrContext* context, AtlasObject* o
AtlasedRectOp* sparePtr = op.get();
uint32_t opsTaskID;
rtc->priv().testingOnly_addDrawOp(GrNoClip(), std::move(op),
rtc->priv().testingOnly_addDrawOp(nullptr, std::move(op),
[&opsTaskID](GrOp* op, uint32_t id) { opsTaskID = id; });
SkASSERT(SK_InvalidUniqueID != opsTaskID);
@ -596,7 +595,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
rtc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), r);
rtc->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), r);
}
rtc->flush(SkSurface::BackendSurfaceAccess::kNoAccess, GrFlushInfo());

View File

@ -9,8 +9,8 @@
#include "include/core/SkPath.h"
#include "include/gpu/GrContext.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrStyle.h"
@ -38,7 +38,6 @@ static void draw_path(GrContext* ctx,
GrPaint paint;
paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
GrNoClip noClip;
SkIRect clipConservativeBounds = SkIRect::MakeWH(renderTargetContext->width(),
renderTargetContext->height());
GrStyledShape shape(path, style);
@ -51,7 +50,7 @@ static void draw_path(GrContext* ctx,
std::move(paint),
&GrUserStencilSettings::kUnused,
renderTargetContext,
&noClip,
nullptr,
&clipConservativeBounds,
&matrix,
&shape,

View File

@ -9,7 +9,6 @@
#include "tests/TestUtils.h"
#include "include/gpu/GrContext.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
@ -40,7 +39,7 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
rtContext->drawPaint(nullptr, std::move(paint), SkMatrix::I());
TestReadPixels(reporter, rtContext.get(), expectedPixelValues,
"RectangleTexture-basic-draw");
}

View File

@ -10,8 +10,8 @@
#include "include/core/SkPath.h"
#include "include/effects/SkGradientShader.h"
#include "include/gpu/GrContext.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/geometry/GrStyledShape.h"
@ -714,7 +714,6 @@ static void test_path(GrContext* ctx,
paint.addColorFragmentProcessor(std::move(fp));
}
GrNoClip noClip;
SkIRect clipConservativeBounds = SkIRect::MakeWH(renderTargetContext->width(),
renderTargetContext->height());
GrStyle style(SkStrokeRec::kFill_InitStyle);
@ -723,7 +722,7 @@ static void test_path(GrContext* ctx,
std::move(paint),
&GrUserStencilSettings::kUnused,
renderTargetContext,
&noClip,
nullptr,
&clipConservativeBounds,
&matrix,
&shape,

View File

@ -63,11 +63,11 @@ uint32_t GrRenderTargetContextPriv::testingOnly_getOpsTaskID() {
}
void GrRenderTargetContextPriv::testingOnly_addDrawOp(std::unique_ptr<GrDrawOp> op) {
this->testingOnly_addDrawOp(GrNoClip(), std::move(op));
this->testingOnly_addDrawOp(nullptr, std::move(op), {});
}
void GrRenderTargetContextPriv::testingOnly_addDrawOp(
const GrClip& clip,
const GrClip* clip,
std::unique_ptr<GrDrawOp> op,
const std::function<GrRenderTargetContext::WillAddOpFn>& willAddFn) {
ASSERT_SINGLE_OWNER