| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 return true; | 193 return true; |
| 194 } | 194 } |
| 195 #endif | 195 #endif |
| 196 | 196 |
| 197 // This guy exists just to aid in debugging, as it allows debuggers to just | 197 // This guy exists just to aid in debugging, as it allows debuggers to just |
| 198 // set a break-point in one place to see all error exists. | 198 // set a break-point in one place to see all error exists. |
| 199 static bool return_false(const jpeg_decompress_struct& cinfo, | 199 static bool return_false(const jpeg_decompress_struct& cinfo, |
| 200 const SkBitmap& bm, const char msg[]) { | 200 const SkBitmap& bm, const char msg[]) { |
| 201 #ifdef SK_DEBUG | 201 #ifdef SK_DEBUG |
| 202 SkDebugf("libjpeg error %d <%s> from %s [%d %d]", cinfo.err->msg_code, | 202 SkDebugf("libjpeg error %d <%s> from %s [%d %d]\n", cinfo.err->msg_code, |
| 203 cinfo.err->jpeg_message_table[cinfo.err->msg_code], msg, | 203 cinfo.err->jpeg_message_table[cinfo.err->msg_code], msg, |
| 204 bm.width(), bm.height()); | 204 bm.width(), bm.height()); |
| 205 #endif | 205 #endif |
| 206 return false; // must always return false | 206 return false; // must always return false |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Convert a scanline of CMYK samples to RGBX in place. Note that this | 209 // Convert a scanline of CMYK samples to RGBX in place. Note that this |
| 210 // method moves the "scanline" pointer in its processing | 210 // method moves the "scanline" pointer in its processing |
| 211 static void convert_CMYK_to_RGB(uint8_t* scanline, unsigned int width) { | 211 static void convert_CMYK_to_RGB(uint8_t* scanline, unsigned int width) { |
| 212 // At this point we've received CMYK pixels from libjpeg. We | 212 // At this point we've received CMYK pixels from libjpeg. We |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1033 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
| 1034 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 1034 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 | 1037 |
| 1038 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory); | 1038 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory); |
| 1039 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_jpeg
); | 1039 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_jpeg
); |
| 1040 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact
ory); | 1040 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact
ory); |
| OLD | NEW |