Revert "SkDevice::drawSpecial accepts arbitrary matrix v2"
This reverts commit 7c4aca04ccc3312b6fffb38c8cad93ca4176a248.
Reason for revert: cc unit tests need to be rebased
Original change's description:
> SkDevice::drawSpecial accepts arbitrary matrix v2
>
> This opens up the door to render image filter results with an arbitrary
> matrix, so we can skip the matrix filter DAG hack. It should also let
> me simplify the handling of backdrop image filters and correctly apply
> perspective to image filters.
>
> This is essentially the same as
> https://skia-review.googlesource.com/c/skia/+/317862
> but not parented to the CL that experimented with SkImagePaint.
>
> Some of the function declaration re-org that was done in its prior CL
> has been directly integrated into this CL.
>
> Bug: skia:9545
> Change-Id: Iad882bd306f3a4064fe60cfc0526226287ea7e29
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323597
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,robertphillips@google.com,reed@google.com,michaelludwig@google.com
Change-Id: I6a248fe9e02d71fa340ed3227e77fff097b7b08e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9545
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324704
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 88221a7..e54cea2 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -651,20 +651,17 @@
//////////////////////////////////////////////////////////////////////////////
-void SkGpuDevice::drawSpecial(SkSpecialImage* special, const SkMatrix& localToDevice,
- const SkPaint& paint) {
+void SkGpuDevice::drawSpecial(SkSpecialImage* special, int left, int top, const SkPaint& paint) {
SkASSERT(!paint.getMaskFilter() && !paint.getImageFilter());
SkASSERT(special->isTextureBacked());
SkRect src = SkRect::Make(special->subset());
- SkRect dst = SkRect::MakeWH(special->width(), special->height());
+ SkRect dst = SkRect::MakeXYWH(left, top, special->width(), special->height());
SkMatrix srcToDst = SkMatrix::MakeRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
- GrSamplerState sampler(GrSamplerState::WrapMode::kClamp,
- paint.getFilterQuality() >= kLow_SkFilterQuality ?
- GrSamplerState::Filter::kLinear : GrSamplerState::Filter::kNearest);
- GrAA aa = paint.isAntiAlias() ? GrAA::kYes : GrAA::kNo;
- GrQuadAAFlags aaFlags = paint.isAntiAlias() ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
+ // TODO (michaelludwig): Once drawSpecial uses arbitrary transforms between two SkGpuDevices,
+ // always using kNearest may not be the right choice anymore.
+ GrSamplerState sampler(GrSamplerState::WrapMode::kClamp, GrSamplerState::Filter::kNearest);
GrColorInfo colorInfo(SkColorTypeToGrColorType(special->colorType()),
special->alphaType(), sk_ref_sp(special->getColorSpace()));
@@ -673,10 +670,11 @@
GrTextureAdjuster texture(fContext.get(), std::move(view), colorInfo, special->uniqueID());
// In most cases this ought to hit draw_texture since there won't be a color filter,
// alpha-only texture+shader, or a high filter quality.
- SkOverrideDeviceMatrixProvider matrixProvider(this->asMatrixProvider(), localToDevice);
+ SkOverrideDeviceMatrixProvider identity(this->asMatrixProvider(), SkMatrix::I());
draw_texture_producer(fContext.get(), fRenderTargetContext.get(), this->clip(),
- matrixProvider, paint, &texture, src, dst, nullptr, srcToDst, aa,
- aaFlags, SkCanvas::kStrict_SrcRectConstraint, sampler, false);
+ identity, paint, &texture, src, dst, nullptr, srcToDst, GrAA::kNo,
+ GrQuadAAFlags::kNone, SkCanvas::kStrict_SrcRectConstraint,
+ sampler, false);
}
void SkGpuDevice::drawImageQuad(const SkImage* image, const SkRect* srcRect, const SkRect* dstRect,