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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // This function should only be called if the colorType is suppo
rted by jpeg | 365 // This function should only be called if the colorType is suppo
rted by jpeg |
366 SkASSERT(false); | 366 SkASSERT(false); |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 if (JCS_RGB == fDecoderMgr->dinfo()->out_color_space) { | 370 if (JCS_RGB == fDecoderMgr->dinfo()->out_color_space) { |
371 srcConfig = SkSwizzler::kRGB; | 371 srcConfig = SkSwizzler::kRGB; |
372 } | 372 } |
373 | 373 |
374 fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, opti
ons)); | 374 fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, opti
ons)); |
| 375 SkASSERT(fSwizzler); |
375 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); | 376 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); |
376 fSrcRow = fStorage.get(); | 377 fSrcRow = fStorage.get(); |
377 } | 378 } |
378 | 379 |
379 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { | 380 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { |
380 if (!createIfNecessary || fSwizzler) { | 381 if (!createIfNecessary || fSwizzler) { |
381 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); | 382 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); |
382 return fSwizzler; | 383 return fSwizzler; |
383 } | 384 } |
384 | 385 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 666 |
666 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 667 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
667 if (linesRead < remainingRows) { | 668 if (linesRead < remainingRows) { |
668 // FIXME: Handle incomplete YUV decodes without signalling an error. | 669 // FIXME: Handle incomplete YUV decodes without signalling an error. |
669 return kInvalidInput; | 670 return kInvalidInput; |
670 } | 671 } |
671 } | 672 } |
672 | 673 |
673 return kSuccess; | 674 return kSuccess; |
674 } | 675 } |
OLD | NEW |