| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 num -= 1; | 468 num -= 1; |
| 469 calc_output_dimensions(&dinfo, num, denom); | 469 calc_output_dimensions(&dinfo, num, denom); |
| 470 } | 470 } |
| 471 | 471 |
| 472 fDecoderMgr->dinfo()->scale_num = num; | 472 fDecoderMgr->dinfo()->scale_num = num; |
| 473 fDecoderMgr->dinfo()->scale_denom = denom; | 473 fDecoderMgr->dinfo()->scale_denom = denom; |
| 474 return true; | 474 return true; |
| 475 } | 475 } |
| 476 | 476 |
| 477 static bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageInfo& src
Info) { | 477 static bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageInfo& src
Info) { |
| 478 // FIXME (msarett): | |
| 479 // Do a better check for color space equality. | |
| 480 return (kRGBA_F16_SkColorType == dstInfo.colorType()) || | 478 return (kRGBA_F16_SkColorType == dstInfo.colorType()) || |
| 481 (dstInfo.colorSpace() && (dstInfo.colorSpace() != srcInfo.colorSpace(
))); | 479 (dstInfo.colorSpace() && !SkColorSpace::Equals(srcInfo.colorSpace(), |
| 480 dstInfo.colorSpace()))
; |
| 482 } | 481 } |
| 483 | 482 |
| 484 int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes
, int count) { | 483 int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes
, int count) { |
| 485 // Set the jump location for libjpeg-turbo errors | 484 // Set the jump location for libjpeg-turbo errors |
| 486 if (setjmp(fDecoderMgr->getJmpBuf())) { | 485 if (setjmp(fDecoderMgr->getJmpBuf())) { |
| 487 return 0; | 486 return 0; |
| 488 } | 487 } |
| 489 | 488 |
| 490 // When fSwizzleSrcRow is non-null, it means that we need to swizzle. In th
is case, | 489 // When fSwizzleSrcRow is non-null, it means that we need to swizzle. In th
is case, |
| 491 // we will always decode into fSwizzlerSrcRow before swizzling into the next
buffer. | 490 // we will always decode into fSwizzlerSrcRow before swizzling into the next
buffer. |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 992 |
| 994 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 993 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
| 995 if (linesRead < remainingRows) { | 994 if (linesRead < remainingRows) { |
| 996 // FIXME: Handle incomplete YUV decodes without signalling an error. | 995 // FIXME: Handle incomplete YUV decodes without signalling an error. |
| 997 return kInvalidInput; | 996 return kInvalidInput; |
| 998 } | 997 } |
| 999 } | 998 } |
| 1000 | 999 |
| 1001 return kSuccess; | 1000 return kSuccess; |
| 1002 } | 1001 } |
| OLD | NEW |