Reland "Refactor trimming logic for read/writePixels()"
Original CL: https://skia-review.googlesource.com/c/7326/
(1) Move trimming logic into Bitmap/Pixmap level for
raster. Everything goes through here, so we'll
only do the work once.
(2) This means it also goes to GPU level.
(3) Always use SkReadPixelsRec rather than inlining
the logic.
(4) Create an SkWritePixelsRec to encapsulate write
trimming.
(5) Disabled kIndex8 as a dst - always.
CQ_INCLUDE_TRYBOTS=skia.primary:Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug
BUG=skia:6021
Change-Id: I25a964e3c610c4e36d195a255e2150657baec649
Reviewed-on: https://skia-review.googlesource.com/7404
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 137f916..8efe91a 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -51,11 +51,7 @@
bool SkImage::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY, CachingHint chint) const {
- SkReadPixelsRec rec(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
- if (!rec.trim(this->width(), this->height())) {
- return false;
- }
- return as_IB(this)->onReadPixels(rec.fInfo, rec.fPixels, rec.fRowBytes, rec.fX, rec.fY, chint);
+ return as_IB(this)->onReadPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, chint);
}
bool SkImage::scalePixels(const SkPixmap& dst, SkFilterQuality quality, CachingHint chint) const {