Index: src/codec/SkCodec.cpp |
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp |
index ec36bc75e94e00edd22b857b179a9033a95fe5c1..46c9bd7c97fe4c54c49d96136edacbdff20e227c 100644 |
--- a/src/codec/SkCodec.cpp |
+++ b/src/codec/SkCodec.cpp |
@@ -48,3 +48,23 @@ bool SkCodec::rewindIfNeeded() { |
fNeedsRewind = true; |
return !neededRewind || fStream->rewind(); |
} |
+ |
+SkScanlineDecoder* SkCodec::getScanlineDecoder(const SkImageInfo& dstInfo, |
+ const SkIRect* origSubset) { |
+ if (!rewindIfNeeded()) { |
+ return NULL; |
+ } |
+ SkIRect correctedSubset; |
+ if (NULL == origSubset) { |
+ // Caller wants the whole image. |
+ correctedSubset.setLTRB(0, 0, fInfo.width(), fInfo.height()); |
+ } else { |
+ correctedSubset = *origSubset; |
+ // Caller wants a subset. Make sure it intersects with the original |
+ // image. |
+ if (!correctedSubset.intersect(SkIRect::MakeSize(fInfo.dimensions()))) { |
+ return NULL; |
+ } |
+ } |
+ return this->onGetScanlineDecoder(dstInfo, correctedSubset); |
+} |