Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: src/codec/SkCodec.cpp

Issue 1010903003: Add scanline decoding to SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanups Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698