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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 fDecoderMgr.reset(decoderMgr); | 324 fDecoderMgr.reset(decoderMgr); |
325 return true; | 325 return true; |
326 } | 326 } |
327 | 327 |
328 /* | 328 /* |
329 * Checks if the conversion between the input image and the requested output | 329 * Checks if the conversion between the input image and the requested output |
330 * image has been implemented | 330 * image has been implemented |
331 * Sets the output color space | 331 * Sets the output color space |
332 */ | 332 */ |
333 bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) { | 333 bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) { |
334 const SkImageInfo& src = this->getInfo(); | |
335 | |
336 // Ensure that the profile type is unchanged | |
337 if (dst.profileType() != src.profileType()) { | |
338 return false; | |
339 } | |
340 | |
341 if (kUnknown_SkAlphaType == dst.alphaType()) { | 334 if (kUnknown_SkAlphaType == dst.alphaType()) { |
342 return false; | 335 return false; |
343 } | 336 } |
344 | 337 |
345 if (kOpaque_SkAlphaType != dst.alphaType()) { | 338 if (kOpaque_SkAlphaType != dst.alphaType()) { |
346 SkCodecPrintf("Warning: an opaque image should be decoded as opaque " | 339 SkCodecPrintf("Warning: an opaque image should be decoded as opaque " |
347 "- it is being decoded as non-opaque, which will draw slow
er\n"); | 340 "- it is being decoded as non-opaque, which will draw slow
er\n"); |
348 } | 341 } |
349 | 342 |
350 // Check if we will decode to CMYK because a conversion to RGBA is not suppo
rted | 343 // Check if we will decode to CMYK because a conversion to RGBA is not suppo
rted |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 889 |
897 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 890 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
898 if (linesRead < remainingRows) { | 891 if (linesRead < remainingRows) { |
899 // FIXME: Handle incomplete YUV decodes without signalling an error. | 892 // FIXME: Handle incomplete YUV decodes without signalling an error. |
900 return kInvalidInput; | 893 return kInvalidInput; |
901 } | 894 } |
902 } | 895 } |
903 | 896 |
904 return kSuccess; | 897 return kSuccess; |
905 } | 898 } |
OLD | NEW |