diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index a6fb9a47b6..354aacf906 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -931,9 +931,12 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_spvalidate();) GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawTexture", fContext); + + const SkRect* domain = nullptr; if (constraint == SkCanvas::kStrict_SrcRectConstraint && - srcRect.contains(proxy->getWorstCaseBoundsRect())) { - constraint = SkCanvas::kFast_SrcRectConstraint; + !srcRect.contains(proxy->getWorstCaseBoundsRect())) { + // The domain coordinates will be the original src rect, not the clipped src rect + domain = &srcRect; } GrAAType aaType = this->chooseAAType(aa); @@ -945,9 +948,10 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_spdrawingManager()); - auto op = GrTextureOp::Make(fContext, std::move(proxy), filter, color, clippedSrcRect, - clippedDstRect, aaType, aaFlags, constraint, viewMatrix, - std::move(textureColorSpaceXform), mode); + auto op = GrTextureOp::Make( + fContext, std::move(proxy), std::move(textureColorSpaceXform), filter, color, mode, + aaType, aaFlags, GrQuad::MakeFromRect(clippedDstRect, viewMatrix), + GrQuad(clippedSrcRect), domain); this->addDrawOp(clip, std::move(op)); } @@ -971,8 +975,9 @@ void GrRenderTargetContext::drawTextureQuad(const GrClip& clip, sk_spdrawingManager()); - auto op = GrTextureOp::MakeQuad(fContext, std::move(proxy), filter, color, srcQuad, dstQuad, - aaType, aaFlags, domain, viewMatrix, std::move(texXform), mode); + auto op = GrTextureOp::Make(fContext, std::move(proxy), std::move(texXform), filter, color, + mode, aaType, aaFlags, GrQuad::MakeFromSkQuad(dstQuad, viewMatrix), + GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), domain); this->addDrawOp(clip, std::move(op)); } diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp index daede5fdce..f46ff2535f 100644 --- a/src/gpu/ops/GrTextureOp.cpp +++ b/src/gpu/ops/GrTextureOp.cpp @@ -607,17 +607,17 @@ private: namespace GrTextureOp { -std::unique_ptr MakeGeneral(GrRecordingContext* context, - sk_sp proxy, - sk_sp textureXform, - GrSamplerState::Filter filter, - const SkPMColor4f& color, - SkBlendMode blendMode, - GrAAType aaType, - GrQuadAAFlags aaFlags, - const GrQuad& deviceQuad, - const GrQuad& localQuad, - const SkRect* domain) { +std::unique_ptr Make(GrRecordingContext* context, + sk_sp proxy, + sk_sp textureXform, + GrSamplerState::Filter filter, + const SkPMColor4f& color, + SkBlendMode blendMode, + GrAAType aaType, + GrQuadAAFlags aaFlags, + const GrQuad& deviceQuad, + const GrQuad& localQuad, + const SkRect* domain) { // Apply optimizations that are valid whether or not using GrTextureOp or GrFillRectOp if (domain && domain->contains(proxy->getWorstCaseBoundsRect())) { // No need for a shader-based domain if hardware clamping achieves the same effect @@ -658,40 +658,6 @@ std::unique_ptr MakeGeneral(GrRecordingContext* context, } } -std::unique_ptr Make(GrRecordingContext* context, - sk_sp proxy, - GrSamplerState::Filter filter, - const SkPMColor4f& color, - const SkRect& srcRect, - const SkRect& dstRect, - GrAAType aaType, - GrQuadAAFlags aaFlags, - SkCanvas::SrcRectConstraint constraint, - const SkMatrix& viewMatrix, - sk_sp textureColorSpaceXform, - SkBlendMode blendMode) { - return MakeGeneral(context, std::move(proxy), textureColorSpaceXform, filter, color, blendMode, - aaType, aaFlags, GrQuad::MakeFromRect(dstRect, viewMatrix), GrQuad(srcRect), - constraint == SkCanvas::kStrict_SrcRectConstraint ? &srcRect : nullptr); -} - -std::unique_ptr MakeQuad(GrRecordingContext* context, - sk_sp proxy, - GrSamplerState::Filter filter, - const SkPMColor4f& color, - const SkPoint srcQuad[4], - const SkPoint dstQuad[4], - GrAAType aaType, - GrQuadAAFlags aaFlags, - const SkRect* domain, - const SkMatrix& viewMatrix, - sk_sp textureXform, - SkBlendMode blendMode) { - return MakeGeneral(context, std::move(proxy), textureXform, filter, color, blendMode, - aaType, aaFlags, GrQuad::MakeFromSkQuad(dstQuad, viewMatrix), - GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), domain); -} - std::unique_ptr MakeSet(GrRecordingContext* context, const GrRenderTargetContext::TextureSetEntry set[], int cnt, @@ -755,10 +721,11 @@ GR_DRAW_OP_TEST_DEFINE(TextureOp) { aaFlags |= random->nextBool() ? GrQuadAAFlags::kTop : GrQuadAAFlags::kNone; aaFlags |= random->nextBool() ? GrQuadAAFlags::kRight : GrQuadAAFlags::kNone; aaFlags |= random->nextBool() ? GrQuadAAFlags::kBottom : GrQuadAAFlags::kNone; - auto constraint = random->nextBool() ? SkCanvas::kStrict_SrcRectConstraint - : SkCanvas::kFast_SrcRectConstraint; - return GrTextureOp::Make(context, std::move(proxy), filter, color, srcRect, rect, aaType, - aaFlags, constraint, viewMatrix, std::move(texXform)); + bool useDomain = random->nextBool(); + return GrTextureOp::Make(context, std::move(proxy), std::move(texXform), filter, color, + SkBlendMode::kSrcOver, aaType, aaFlags, + GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(srcRect), + useDomain ? &srcRect : nullptr); } #endif diff --git a/src/gpu/ops/GrTextureOp.h b/src/gpu/ops/GrTextureOp.h index 2bf43b4bd1..038c10acff 100644 --- a/src/gpu/ops/GrTextureOp.h +++ b/src/gpu/ops/GrTextureOp.h @@ -31,48 +31,17 @@ namespace GrTextureOp { * deconstructed into the texture, filter, modulating color, and blend mode. When blend mode is * src over, this will return a GrFillRectOp with a paint that samples the proxy. */ -std::unique_ptr MakeGeneral(GrRecordingContext* context, - sk_sp proxy, - sk_sp textureXform, - GrSamplerState::Filter filter, - const SkPMColor4f& color, - SkBlendMode blendMode, - GrAAType aaType, - GrQuadAAFlags aaFlags, - const GrQuad& deviceQuad, - const GrQuad& localQuad, - const SkRect* domain = nullptr); - -// FIXME (michaelludwig) - To be removed -std::unique_ptr Make(GrRecordingContext*, - sk_sp, - GrSamplerState::Filter, - const SkPMColor4f&, - const SkRect& srcRect, - const SkRect& dstRect, - GrAAType, - GrQuadAAFlags, - SkCanvas::SrcRectConstraint, - const SkMatrix& viewMatrix, +std::unique_ptr Make(GrRecordingContext* context, + sk_sp proxy, sk_sp textureXform, - SkBlendMode blendMode = SkBlendMode::kSrcOver); - -// Generalizes the above subrect drawing operation to draw a subquad of an image, where srcQuad -// and dstQuad correspond to srcRect and dstRect. If domain is not null, this behaves as if it -// had a strict constraint relying on the given domain. -// FIXME (michaelludwig) - To be removed -std::unique_ptr MakeQuad(GrRecordingContext* context, - sk_sp, - GrSamplerState::Filter, - const SkPMColor4f&, - const SkPoint srcQuad[4], - const SkPoint dstQuad[4], - GrAAType, - GrQuadAAFlags, - const SkRect* domain, - const SkMatrix& viewMatrix, - sk_sp textureXform, - SkBlendMode blendMode = SkBlendMode::kSrcOver); + GrSamplerState::Filter filter, + const SkPMColor4f& color, + SkBlendMode blendMode, + GrAAType aaType, + GrQuadAAFlags aaFlags, + const GrQuad& deviceQuad, + const GrQuad& localQuad, + const SkRect* domain = nullptr); // Unlike the single-proxy factory, this only supports src-over blending. std::unique_ptr MakeSet(GrRecordingContext*,