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); | |
358 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); | 357 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); |
359 fSrcRow = fStorage.get(); | 358 fSrcRow = fStorage.get(); |
360 } | 359 } |
361 | 360 |
362 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { | 361 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { |
363 if (!createIfNecessary || fSwizzler) { | 362 if (!createIfNecessary || fSwizzler) { |
364 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); | 363 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); |
365 return fSwizzler; | 364 return fSwizzler; |
366 } | 365 } |
367 | 366 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 646 |
648 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 647 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
649 if (linesRead < remainingRows) { | 648 if (linesRead < remainingRows) { |
650 // FIXME: Handle incomplete YUV decodes without signalling an error. | 649 // FIXME: Handle incomplete YUV decodes without signalling an error. |
651 return kInvalidInput; | 650 return kInvalidInput; |
652 } | 651 } |
653 } | 652 } |
654 | 653 |
655 return kSuccess; | 654 return kSuccess; |
656 } | 655 } |
OLD | NEW |