Make AHWBuffer generator responsible for MIP maps.
It already makes copies for other reason and is the only generator
relying on the caller.
Change-Id: I5dfdc3bd39040f817c0f953eecf81e8fbdc649a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274862
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index f393c45..45a7f01 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -196,13 +196,12 @@
}
SkASSERT(texProxyView.asTextureProxy());
- if (0 == origin.fX && 0 == origin.fY &&
- info.width() == this->getInfo().width() && info.height() == this->getInfo().height()) {
- // If the caller wants the full texture we're done. The caller will handle making a copy for
- // mip maps if that is required.
+ if (origin.isZero() && info.dimensions() == this->getInfo().dimensions() &&
+ mipMapped == GrMipMapped::kNo) {
+ // If the caller wants the full non-MIP mapped texture we're done.
return texProxyView;
}
- // Otherwise, make a copy for the requested subset.
+ // Otherwise, make a copy for the requested subset and/or MIP maps.
SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, info.width(), info.height());
GrColorType grColorType = SkColorTypeToGrColorType(this->getInfo().colorType());