Simplify view getters on GrTextureProducer.
The only thing that affects the view returned is whether it ought to
be MIP mapped or not. So don't take a whole GrSamplerState.
The view() function won't ever change the colortype so just query
GrTextureProducer rather than having view() return a tuple.
The rest is transitively reaching through callers and callees of
GrTextureProducer::view() to only pass filter or GrMipMapped instead of
GrSamplerState. Also, some params that indicate whether MIPs are
requested are changed from bool to GrMipMapped. And some minor style
stuff (mainly de-yoda-ifying GrMipMapped checks, using
GrSurfaceProxyView operator bool()).
Change-Id: Ia184aa793cf51d42642ea3bb0521ce06da2efb10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274205
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 7b2b1a9..2eb7788 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -241,14 +241,14 @@
if (attemptDrawTexture && can_use_draw_texture(paint)) {
// We've done enough checks above to allow us to pass ClampNearest() and not check for
// scaling adjustments.
- auto[view, ct] = producer->view(GrMipMapped::kNo);
+ auto view = producer->view(GrMipMapped::kNo);
if (!view) {
return;
}
- draw_texture(rtc, clip, ctm, paint, src, dst, dstClip, aa, aaFlags, constraint,
- std::move(view),
- {ct, producer->alphaType(), sk_ref_sp(producer->colorSpace())});
+ draw_texture(
+ rtc, clip, ctm, paint, src, dst, dstClip, aa, aaFlags, constraint, std::move(view),
+ {producer->colorType(), producer->alphaType(), sk_ref_sp(producer->colorSpace())});
return;
}
@@ -537,7 +537,7 @@
uint32_t uniqueID;
view = image->refPinnedView(this->context(), &uniqueID);
if (!view) {
- view = image->refView(this->context(), GrSamplerState::Filter::kBilerp);
+ view = image->refView(this->context(), GrMipMapped::kNo);
}
}