Fix SkJpegCodec::onSkipScanlines when TURBO_HAS_SKIP is not defined
I think I just broke this in:
https://codereview.chromium.org/2174493002/
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2202763002
Review-Url: https://codereview.chromium.org/2202763002
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 2eea46b..8096a29 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -353,6 +353,10 @@
fStorage.reset();
fColorXform.reset(nullptr);
+#if !defined(TURBO_HAS_SKIP)
+ fSkipStorage.reset();
+#endif
+
return true;
}
@@ -788,13 +792,14 @@
#ifdef TURBO_HAS_SKIP
return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
#else
- if (!fSwizzleSrcRow) {
- fStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
- fSwizzleSrcRow = fStorage.get();
+ uint8_t* ptr = fSkipStorage.get();
+ if (!ptr) {
+ fSkipStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
+ ptr = fSkipStorage.get();
}
for (int y = 0; y < count; y++) {
- if (1 != jpeg_read_scanlines(fDecoderMgr->dinfo(), &fSwizzleSrcRow, 1)) {
+ if (1 != jpeg_read_scanlines(fDecoderMgr->dinfo(), &ptr, 1)) {
return false;
}
}
diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h
index 7eb5100..f178590 100644
--- a/src/codec/SkJpegCodec.h
+++ b/src/codec/SkJpegCodec.h
@@ -8,6 +8,13 @@
#ifndef SkJpegCodec_DEFINED
#define SkJpegCodec_DEFINED
+// For testing.
+#ifdef SKNX_NO_SIMD
+#undef TURBO_HAS_CROP
+#undef TURBO_HAS_SKIP
+#undef TURBO_HAS_565
+#endif
+
#include "SkCodec.h"
#include "SkColorSpace.h"
#include "SkColorSpaceXform.h"
@@ -141,6 +148,10 @@
sk_sp<SkData> fICCData;
+#if !defined(TURBO_HAS_SKIP)
+ SkAutoTMalloc<uint8_t> fSkipStorage;
+#endif
+
typedef SkCodec INHERITED;
};