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

Side by Side Diff: src/codec/SkJpegCodec.cpp

Issue 2202763002: Fix SkJpegCodec::onSkipScanlines when TURBO_HAS_SKIP is not defined (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Comments Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/codec/SkJpegCodec.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkMSAN.h" 9 #include "SkMSAN.h"
10 #include "SkJpegCodec.h" 10 #include "SkJpegCodec.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 346 }
347 SkASSERT(nullptr != decoderMgr); 347 SkASSERT(nullptr != decoderMgr);
348 fDecoderMgr.reset(decoderMgr); 348 fDecoderMgr.reset(decoderMgr);
349 349
350 fSwizzler.reset(nullptr); 350 fSwizzler.reset(nullptr);
351 fSwizzleSrcRow = nullptr; 351 fSwizzleSrcRow = nullptr;
352 fColorXformSrcRow = nullptr; 352 fColorXformSrcRow = nullptr;
353 fStorage.reset(); 353 fStorage.reset();
354 fColorXform.reset(nullptr); 354 fColorXform.reset(nullptr);
355 355
356 #if !defined(TURBO_HAS_SKIP)
357 fSkipStorage.reset();
358 #endif
359
356 return true; 360 return true;
357 } 361 }
358 362
359 /* 363 /*
360 * Checks if the conversion between the input image and the requested output 364 * Checks if the conversion between the input image and the requested output
361 * image has been implemented 365 * image has been implemented
362 * Sets the output color space 366 * Sets the output color space
363 */ 367 */
364 bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dstInfo, bool needsColo rXform) { 368 bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dstInfo, bool needsColo rXform) {
365 if (kUnknown_SkAlphaType == dstInfo.alphaType()) { 369 if (kUnknown_SkAlphaType == dstInfo.alphaType()) {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 785
782 bool SkJpegCodec::onSkipScanlines(int count) { 786 bool SkJpegCodec::onSkipScanlines(int count) {
783 // Set the jump location for libjpeg errors 787 // Set the jump location for libjpeg errors
784 if (setjmp(fDecoderMgr->getJmpBuf())) { 788 if (setjmp(fDecoderMgr->getJmpBuf())) {
785 return fDecoderMgr->returnFalse("onSkipScanlines"); 789 return fDecoderMgr->returnFalse("onSkipScanlines");
786 } 790 }
787 791
788 #ifdef TURBO_HAS_SKIP 792 #ifdef TURBO_HAS_SKIP
789 return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count); 793 return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
790 #else 794 #else
791 if (!fSwizzleSrcRow) { 795 uint8_t* ptr = fSkipStorage.get();
792 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); 796 if (!ptr) {
793 fSwizzleSrcRow = fStorage.get(); 797 fSkipStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
798 ptr = fSkipStorage.get();
794 } 799 }
795 800
796 for (int y = 0; y < count; y++) { 801 for (int y = 0; y < count; y++) {
797 if (1 != jpeg_read_scanlines(fDecoderMgr->dinfo(), &fSwizzleSrcRow, 1)) { 802 if (1 != jpeg_read_scanlines(fDecoderMgr->dinfo(), &ptr, 1)) {
798 return false; 803 return false;
799 } 804 }
800 } 805 }
801 return true; 806 return true;
802 #endif 807 #endif
803 } 808 }
804 809
805 static bool is_yuv_supported(jpeg_decompress_struct* dinfo) { 810 static bool is_yuv_supported(jpeg_decompress_struct* dinfo) {
806 // Scaling is not supported in raw data mode. 811 // Scaling is not supported in raw data mode.
807 SkASSERT(dinfo->scale_num == dinfo->scale_denom); 812 SkASSERT(dinfo->scale_num == dinfo->scale_denom);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 997
993 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 998 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
994 if (linesRead < remainingRows) { 999 if (linesRead < remainingRows) {
995 // FIXME: Handle incomplete YUV decodes without signalling an error. 1000 // FIXME: Handle incomplete YUV decodes without signalling an error.
996 return kInvalidInput; 1001 return kInvalidInput;
997 } 1002 }
998 } 1003 }
999 1004
1000 return kSuccess; 1005 return kSuccess;
1001 } 1006 }
OLDNEW
« no previous file with comments | « src/codec/SkJpegCodec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698