| OLD | NEW |
| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 406 } |
| 407 | 407 |
| 408 // Check if we can decode to the requested destination and set the output co
lor space | 408 // Check if we can decode to the requested destination and set the output co
lor space |
| 409 if (!this->setOutputColorSpace(dstInfo)) { | 409 if (!this->setOutputColorSpace(dstInfo)) { |
| 410 return kInvalidConversion; | 410 return kInvalidConversion; |
| 411 } | 411 } |
| 412 | 412 |
| 413 // Remove objects used for sampling. | 413 // Remove objects used for sampling. |
| 414 fSwizzler.reset(nullptr); | 414 fSwizzler.reset(nullptr); |
| 415 fSrcRow = nullptr; | 415 fSrcRow = nullptr; |
| 416 fStorage.free(); | 416 fStorage.reset(); |
| 417 | 417 |
| 418 // Now, given valid output dimensions, we can start the decompress | 418 // Now, given valid output dimensions, we can start the decompress |
| 419 if (!jpeg_start_decompress(fDecoderMgr->dinfo())) { | 419 if (!jpeg_start_decompress(fDecoderMgr->dinfo())) { |
| 420 SkCodecPrintf("start decompress failed\n"); | 420 SkCodecPrintf("start decompress failed\n"); |
| 421 return kInvalidInput; | 421 return kInvalidInput; |
| 422 } | 422 } |
| 423 | 423 |
| 424 if (options.fSubset) { | 424 if (options.fSubset) { |
| 425 fSwizzlerSubset = *options.fSubset; | 425 fSwizzlerSubset = *options.fSubset; |
| 426 } | 426 } |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 729 |
| 730 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 730 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
| 731 if (linesRead < remainingRows) { | 731 if (linesRead < remainingRows) { |
| 732 // FIXME: Handle incomplete YUV decodes without signalling an error. | 732 // FIXME: Handle incomplete YUV decodes without signalling an error. |
| 733 return kInvalidInput; | 733 return kInvalidInput; |
| 734 } | 734 } |
| 735 } | 735 } |
| 736 | 736 |
| 737 return kSuccess; | 737 return kSuccess; |
| 738 } | 738 } |
| OLD | NEW |