diff options
Diffstat (limited to 'src/core/SkPixmap.cpp')
-rw-r--r-- | src/core/SkPixmap.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 3e89af65ed..1e24b93a60 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -10,6 +10,7 @@ #include "SkColorPriv.h" #include "SkConfig8888.h" #include "SkData.h" +#include "SkImageInfoPriv.h" #include "SkHalf.h" #include "SkMask.h" #include "SkNx.h" @@ -84,15 +85,13 @@ bool SkPixmap::extractSubset(SkPixmap* result, const SkIRect& subset) const { bool SkPixmap::readPixels(const SkImageInfo& requestedDstInfo, void* dstPixels, size_t dstRB, int x, int y) const { - if (kUnknown_SkColorType == requestedDstInfo.colorType()) { + if (!SkImageInfoValidConversion(requestedDstInfo, fInfo)) { return false; } + if (nullptr == dstPixels || dstRB < requestedDstInfo.minRowBytes()) { return false; } - if (0 == requestedDstInfo.width() || 0 == requestedDstInfo.height()) { - return false; - } SkIRect srcR = SkIRect::MakeXYWH(x, y, requestedDstInfo.width(), requestedDstInfo.height()); if (!srcR.intersect(0, 0, this->width(), this->height())) { |