| 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 "SkJpegCodec.h" | 9 #include "SkJpegCodec.h" |
| 10 #include "SkJpegDecoderMgr.h" | 10 #include "SkJpegDecoderMgr.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // current platform | 239 // current platform |
| 240 #if defined(SK_PMCOLOR_IS_RGBA) | 240 #if defined(SK_PMCOLOR_IS_RGBA) |
| 241 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA; | 241 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA; |
| 242 #else | 242 #else |
| 243 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_BGRA; | 243 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_BGRA; |
| 244 #endif | 244 #endif |
| 245 } | 245 } |
| 246 return true; | 246 return true; |
| 247 case kRGB_565_SkColorType: | 247 case kRGB_565_SkColorType: |
| 248 if (isCMYK) { | 248 if (isCMYK) { |
| 249 // FIXME (msarett): We need to support 565 here. It's not hard
to do, considering |
| 250 // we already convert CMYK to RGBA, I just need to do it. I thi
nk it might be |
| 251 // best to do this in SkSwizzler and also move convert_CMYK_to_R
GBA into SkSwizzler. |
| 249 return false; | 252 return false; |
| 250 } else { | 253 } else { |
| 254 fDecoderMgr->dinfo()->dither_mode = JDITHER_NONE; |
| 251 fDecoderMgr->dinfo()->out_color_space = JCS_RGB565; | 255 fDecoderMgr->dinfo()->out_color_space = JCS_RGB565; |
| 252 } | 256 } |
| 253 return true; | 257 return true; |
| 254 case kGray_8_SkColorType: | 258 case kGray_8_SkColorType: |
| 255 if (isCMYK) { | 259 if (isCMYK) { |
| 256 return false; | 260 return false; |
| 257 } else { | 261 } else { |
| 258 // We will enable decodes to gray even if the image is color bec
ause this is | 262 // We will enable decodes to gray even if the image is color bec
ause this is |
| 259 // much faster than decoding to color and then converting | 263 // much faster than decoding to color and then converting |
| 260 fDecoderMgr->dinfo()->out_color_space = JCS_GRAYSCALE; | 264 fDecoderMgr->dinfo()->out_color_space = JCS_GRAYSCALE; |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 SkAutoTDelete<SkJpegCodec> codec(static_cast<SkJpegCodec*>(SkJpegCodec::NewF
romStream(stream))); | 577 SkAutoTDelete<SkJpegCodec> codec(static_cast<SkJpegCodec*>(SkJpegCodec::NewF
romStream(stream))); |
| 574 if (!codec) { | 578 if (!codec) { |
| 575 return nullptr; | 579 return nullptr; |
| 576 } | 580 } |
| 577 | 581 |
| 578 const SkImageInfo& srcInfo = codec->getInfo(); | 582 const SkImageInfo& srcInfo = codec->getInfo(); |
| 579 | 583 |
| 580 // Return the new scanline decoder | 584 // Return the new scanline decoder |
| 581 return new SkJpegScanlineDecoder(srcInfo, codec.detach()); | 585 return new SkJpegScanlineDecoder(srcInfo, codec.detach()); |
| 582 } | 586 } |
| OLD | NEW |