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/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 936c6a9..f393c45 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -186,9 +186,10 @@
return GrSurfaceProxyView(std::move(texProxy), fSurfaceOrigin, readSwizzle);
}
-GrSurfaceProxyView GrAHardwareBufferImageGenerator::onGenerateTexture(
- GrRecordingContext* context, const SkImageInfo& info,
- const SkIPoint& origin, bool willNeedMipMaps) {
+GrSurfaceProxyView GrAHardwareBufferImageGenerator::onGenerateTexture(GrRecordingContext* context,
+ const SkImageInfo& info,
+ const SkIPoint& origin,
+ GrMipMapped mipMapped) {
GrSurfaceProxyView texProxyView = this->makeView(context);
if (!texProxyView.proxy()) {
return {};
@@ -204,8 +205,6 @@
// Otherwise, make a copy for the requested subset.
SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, info.width(), info.height());
- GrMipMapped mipMapped = willNeedMipMaps ? GrMipMapped::kYes : GrMipMapped::kNo;
-
GrColorType grColorType = SkColorTypeToGrColorType(this->getInfo().colorType());
return GrSurfaceProxy::Copy(context, texProxyView.proxy(), texProxyView.origin(), grColorType,
mipMapped, subset, SkBackingFit::kExact,