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

Unified Diff: src/codec/SkJpegCodec.cpp

Issue 1400343005: Reenable warnings in src/codec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 5 years, 2 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 | « src/codec/SkCodec_wbmp.cpp ('k') | src/codec/SkSwizzler.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 d0d11b1a08bd5a7ecc16bc8cbadbd78ce2d7be92..36a723f2d642cc9113abea2e39a71b2152488878 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -381,7 +381,7 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
}
void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
- SkSwizzler::SrcConfig srcConfig;
+ SkSwizzler::SrcConfig srcConfig = SkSwizzler::kUnknown;
switch (dstInfo.colorType()) {
case kGray_8_SkColorType:
srcConfig = SkSwizzler::kGray;
@@ -487,14 +487,17 @@ int SkJpegCodec::onGetScanlines(void* dst, int count, size_t rowBytes) {
}
#ifndef TURBO_HAS_SKIP
-// TODO (msarett): Make this a member function and avoid reallocating the
-// memory buffer on each call to skip.
-#define jpeg_skip_scanlines(dinfo, count) \
- SkAutoMalloc storage(get_row_bytes(dinfo)); \
- uint8_t* storagePtr = static_cast<uint8_t*>(storage.get()); \
- for (int y = 0; y < count; y++) { \
- jpeg_read_scanlines(dinfo, &storagePtr, 1); \
+// TODO (msarett): Avoid reallocating the memory buffer on each call to skip.
+static uint32_t jpeg_skip_scanlines(dinfo, count) {
+ SkAutoMalloc storage(get_row_bytes(dinfo));
+ uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());
+ for (int y = 0; y < count; y++) {
+ if (1 != jpeg_read_scanlines(dinfo, &storagePtr, 1)) {
+ return y;
+ }
}
+ return count;
+}
#endif
bool SkJpegCodec::onSkipScanlines(int count) {
@@ -503,5 +506,5 @@ bool SkJpegCodec::onSkipScanlines(int count) {
return fDecoderMgr->returnFalse("setjmp");
}
- return count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
+ return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
}
« no previous file with comments | « src/codec/SkCodec_wbmp.cpp ('k') | src/codec/SkSwizzler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698