Reland "Add new virts, hide old ones"
This reverts commit 8f924ac0ce63806886b7297e8be554984a6e7ce5.
Reason for revert: suppressions landed for fuchsia images to rebaseline
Original change's description:
> Revert "Add new virts, hide old ones"
>
> This reverts commit c56e2e5aa65dd129e5927224d2f6c1f82edff74e.
>
> Reason for revert: suspected of breaking chrome roll
>
> Original change's description:
> > Add new virts, hide old ones
> >
> > Add virtuals for the draw methods that now take sampling/filtermode.
> >
> > drawImage
> > drawImageRect
> > drawImageLattice
> > drawAtlas
> >
> > Add a flag that can remove the older virtuals, once each client has
> > stopped overriding them. In that situation, the older public methods
> > will simplify extract the sampling from the paint, and call the new
> > public methods.
> >
> > Bug: skia:11105, skia:7650
> > Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> > Commit-Queue: Mike Reed <reed@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,fmalita@chromium.org,reed@google.com
>
> Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11105
> Bug: skia:7650
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>
TBR=djsollen@google.com,bsalomon@google.com,fmalita@chromium.org,reed@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:11105
Bug: skia:7650
Change-Id: Ia2b4537a2d330460b7554278d2c05075cf27162a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348876
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index a96b95f..6b8290e 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -321,9 +321,9 @@
* Checks whether the paint is compatible with using GrSurfaceDrawContext::drawTexture. It is more
* efficient than the GrTextureProducer general case.
*/
-static bool can_use_draw_texture(const SkPaint& paint) {
+static bool can_use_draw_texture(const SkPaint& paint, bool useCubicResampler, SkMipmapMode mm) {
return (!paint.getColorFilter() && !paint.getShader() && !paint.getMaskFilter() &&
- !paint.getImageFilter() && SkPaintPriv::GetFQ(paint) < kMedium_SkFilterQuality);
+ !paint.getImageFilter() && !useCubicResampler && mm == SkMipmapMode::kNone);
}
static SkPMColor4f texture_color(SkColor4f paintColor, float entryAlpha, GrColorType srcColorType,
@@ -428,7 +428,7 @@
const SkMatrix& ctm(matrixProvider.localToDevice());
if (sampler.wrapModeX() == GrSamplerState::WrapMode::kClamp &&
sampler.wrapModeY() == GrSamplerState::WrapMode::kClamp && !producer->isPlanar() &&
- can_use_draw_texture(paint)) {
+ can_use_draw_texture(paint, GrValidCubicResampler(cubic), sampler.mipmapMode())) {
// We've done enough checks above to allow us to pass ClampNearest() and not check for
// scaling adjustments.
auto view = producer->view(GrMipmapped::kNo);
@@ -683,11 +683,8 @@
void SkGpuDevice::drawImageQuad(const SkImage* image, const SkRect* srcRect, const SkRect* dstRect,
const SkPoint dstClip[4], GrAA aa, GrQuadAAFlags aaFlags,
- const SkMatrix* preViewMatrix, const SkPaint& paint,
- SkCanvas::SrcRectConstraint constraint) {
- // TODO: pass in sampling directly
- SkSamplingOptions sampling(paint.getFilterQuality(), SkSamplingOptions::kMedium_asMipmapLinear);
-
+ const SkMatrix* preViewMatrix, const SkSamplingOptions& sampling,
+ const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) {
SkRect src;
SkRect dst;
SkMatrix srcToDst;
@@ -805,8 +802,12 @@
void SkGpuDevice::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count,
const SkPoint dstClips[], const SkMatrix preViewMatrices[],
const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) {
+ // TODO: pass in directly
+ // pass sampling, or just filter?
+ SkSamplingOptions sampling(SkPaintPriv::GetFQ(paint));
+
SkASSERT(count > 0);
- if (!can_use_draw_texture(paint)) {
+ if (!can_use_draw_texture(paint, sampling.useCubic, sampling.mipmap)) {
// Send every entry through drawImageQuad() to handle the more complicated paint
int dstClipIndex = 0;
for (int i = 0; i < count; ++i) {
@@ -825,13 +826,13 @@
set[i].fHasClip ? dstClips + dstClipIndex : nullptr, GrAA::kYes,
SkToGrQuadAAFlags(set[i].fAAFlags),
set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
- *entryPaint, constraint);
+ sampling, *entryPaint, constraint);
dstClipIndex += 4 * set[i].fHasClip;
}
return;
}
- GrSamplerState::Filter filter = kNone_SkFilterQuality == paint.getFilterQuality()
+ GrSamplerState::Filter filter = sampling.filter == SkFilterMode::kNearest
? GrSamplerState::Filter::kNearest
: GrSamplerState::Filter::kLinear;
SkBlendMode mode = paint.getBlendMode();
@@ -904,7 +905,7 @@
image, &set[i].fSrcRect, &set[i].fDstRect, clip, GrAA::kYes,
SkToGrQuadAAFlags(set[i].fAAFlags),
set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex,
- *entryPaint, constraint);
+ sampling, *entryPaint, constraint);
continue;
}