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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 case kRGB_565_SkColorType: | 347 case kRGB_565_SkColorType: |
348 srcConfig = SkSwizzler::kNoOp16; | 348 srcConfig = SkSwizzler::kNoOp16; |
349 break; | 349 break; |
350 default: | 350 default: |
351 // This function should only be called if the colorType is suppo
rted by jpeg | 351 // This function should only be called if the colorType is suppo
rted by jpeg |
352 SkASSERT(false); | 352 SkASSERT(false); |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, opti
ons)); | 356 fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, opti
ons)); |
| 357 SkASSERT(fSwizzler); |
357 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); | 358 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); |
358 fSrcRow = fStorage.get(); | 359 fSrcRow = fStorage.get(); |
359 } | 360 } |
360 | 361 |
361 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { | 362 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { |
362 if (!createIfNecessary || fSwizzler) { | 363 if (!createIfNecessary || fSwizzler) { |
363 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); | 364 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); |
364 return fSwizzler; | 365 return fSwizzler; |
365 } | 366 } |
366 | 367 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 647 |
647 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 648 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
648 if (linesRead < remainingRows) { | 649 if (linesRead < remainingRows) { |
649 // FIXME: Handle incomplete YUV decodes without signalling an error. | 650 // FIXME: Handle incomplete YUV decodes without signalling an error. |
650 return kInvalidInput; | 651 return kInvalidInput; |
651 } | 652 } |
652 } | 653 } |
653 | 654 |
654 return kSuccess; | 655 return kSuccess; |
655 } | 656 } |
OLD | NEW |