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/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 43ab458..2cfe5c2 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -169,7 +169,7 @@
GrSurfaceProxyView SkImage_GpuYUVA::refMippedView(GrRecordingContext* context) const {
// if invalid or already has miplevels
this->flattenToRGB(context);
- if (!fRGBView.proxy() || GrMipMapped::kYes == fRGBView.asTextureProxy()->mipMapped()) {
+ if (!fRGBView || fRGBView.asTextureProxy()->mipMapped() == GrMipMapped::kYes) {
return fRGBView;
}
@@ -177,7 +177,7 @@
GrColorType srcColorType = SkColorTypeToGrColorType(this->colorType());
GrSurfaceProxyView mippedView = GrCopyBaseMipMapToTextureProxy(context, fRGBView.proxy(),
fRGBView.origin(), srcColorType);
- if (mippedView.proxy()) {
+ if (mippedView) {
fRGBView = std::move(mippedView);
return fRGBView;
}
@@ -294,10 +294,11 @@
GrBitmapTextureMaker bitmapMaker(context, bmp);
GrMipMapped mipMapped = buildMips ? GrMipMapped::kYes : GrMipMapped::kNo;
GrSurfaceProxyView view;
- std::tie(tempViews[i], proxyColorTypes[i]) = bitmapMaker.view(mipMapped);
+ tempViews[i] = bitmapMaker.view(mipMapped);
if (!tempViews[i]) {
return nullptr;
}
+ proxyColorTypes[i] = bitmapMaker.colorType();
}
return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(context), imageSize, kNeedNewImageUniqueID,