OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
8 * | 8 * |
9 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 9 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
10 * | 10 * |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_EXT_BGRA; } | 68 inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_EXT_BGRA; } |
69 #endif | 69 #endif |
70 inline bool turboSwizzled(J_COLOR_SPACE colorSpace) { return colorSpace == JCS_E
XT_RGBA || colorSpace == JCS_EXT_BGRA; } | 70 inline bool turboSwizzled(J_COLOR_SPACE colorSpace) { return colorSpace == JCS_E
XT_RGBA || colorSpace == JCS_EXT_BGRA; } |
71 inline bool colorSpaceHasAlpha(J_COLOR_SPACE colorSpace) { return turboSwizzled(
colorSpace); } | 71 inline bool colorSpaceHasAlpha(J_COLOR_SPACE colorSpace) { return turboSwizzled(
colorSpace); } |
72 #else | 72 #else |
73 inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_RGB; } | 73 inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_RGB; } |
74 inline bool colorSpaceHasAlpha(J_COLOR_SPACE) { return false; } | 74 inline bool colorSpaceHasAlpha(J_COLOR_SPACE) { return false; } |
75 #endif | 75 #endif |
76 | 76 |
77 #if USE(LOW_QUALITY_IMAGE_NO_JPEG_DITHERING) | 77 #if USE(LOW_QUALITY_IMAGE_NO_JPEG_DITHERING) |
78 inline J_DCT_METHOD dctMethod() { return JDCT_IFAST; } | |
79 inline J_DITHER_MODE ditherMode() { return JDITHER_NONE; } | 78 inline J_DITHER_MODE ditherMode() { return JDITHER_NONE; } |
80 #else | 79 #else |
81 inline J_DCT_METHOD dctMethod() { return JDCT_ISLOW; } | |
82 inline J_DITHER_MODE ditherMode() { return JDITHER_FS; } | 80 inline J_DITHER_MODE ditherMode() { return JDITHER_FS; } |
83 #endif | 81 #endif |
84 | 82 |
| 83 // We always use JDCT_ISLOW, since JDCT_IFAST can introduce artifacts. |
| 84 inline J_DCT_METHOD dctMethod() { return JDCT_ISLOW; } |
| 85 |
85 #if USE(LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING) | 86 #if USE(LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING) |
86 inline bool doFancyUpsampling() { return false; } | 87 inline bool doFancyUpsampling() { return false; } |
87 #else | 88 #else |
88 inline bool doFancyUpsampling() { return true; } | 89 inline bool doFancyUpsampling() { return true; } |
89 #endif | 90 #endif |
90 | 91 |
91 namespace { | 92 namespace { |
92 | 93 |
93 const int exifMarker = JPEG_APP0 + 1; | 94 const int exifMarker = JPEG_APP0 + 1; |
94 | 95 |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 // has failed. | 799 // has failed. |
799 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 800 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
800 setFailed(); | 801 setFailed(); |
801 // If we're done decoding the image, we don't need the JPEGImageReader | 802 // If we're done decoding the image, we don't need the JPEGImageReader |
802 // anymore. (If we failed, |m_reader| has already been cleared.) | 803 // anymore. (If we failed, |m_reader| has already been cleared.) |
803 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() ==
ImageFrame::FrameComplete)) | 804 else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() ==
ImageFrame::FrameComplete)) |
804 m_reader.clear(); | 805 m_reader.clear(); |
805 } | 806 } |
806 | 807 |
807 } | 808 } |
OLD | NEW |