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

Unified Diff: src/codec/SkJpegCodec.cpp

Issue 2161593003: Fix rewinding bug in SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: GOOGLE 3 fix - doesn't affect Android Created 4 years, 5 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
« no previous file with comments | « no previous file | tests/CodecTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkJpegCodec.cpp
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 0413f79a3c358466f4542d5812461adab209104e..b78186359abc2a86378405bd69d1d9df802de2cd 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -263,6 +263,7 @@ SkJpegCodec::SkJpegCodec(int width, int height, const SkEncodedInfo& info, SkStr
: INHERITED(width, height, info, stream, std::move(colorSpace), origin)
, fDecoderMgr(decoderMgr)
, fReadyState(decoderMgr->dinfo()->global_state)
+ , fSrcRow(nullptr)
, fSwizzlerSubset(SkIRect::MakeEmpty())
, fICCData(std::move(iccData))
{}
@@ -339,6 +340,11 @@ bool SkJpegCodec::onRewind() {
}
SkASSERT(nullptr != decoderMgr);
fDecoderMgr.reset(decoderMgr);
+
+ fSwizzler.reset(nullptr);
+ fSrcRow = nullptr;
+ fStorage.reset();
+
return true;
}
@@ -588,11 +594,6 @@ SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
return kInvalidConversion;
}
- // Remove objects used for sampling.
- fSwizzler.reset(nullptr);
- fSrcRow = nullptr;
- fStorage.reset();
-
// Now, given valid output dimensions, we can start the decompress
if (!jpeg_start_decompress(fDecoderMgr->dinfo())) {
SkCodecPrintf("start decompress failed\n");
« no previous file with comments | « no previous file | tests/CodecTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698