| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 2 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 #include "ImageDecoder.h" | 23 #include "ImageDecoder.h" |
| 24 | 24 |
| 25 #include "BMPImageDecoder.h" | 25 #include "BMPImageDecoder.h" |
| 26 #include "GIFImageDecoder.h" | 26 #include "GIFImageDecoder.h" |
| 27 #include "ICOImageDecoder.h" | 27 #include "ICOImageDecoder.h" |
| 28 #if PLATFORM(QT) | |
| 29 #include "ImageDecoderQt.h" | |
| 30 #endif | |
| 31 #if !PLATFORM(QT) || USE(LIBJPEG) | |
| 32 #include "JPEGImageDecoder.h" | 28 #include "JPEGImageDecoder.h" |
| 33 #endif | |
| 34 #include "PNGImageDecoder.h" | 29 #include "PNGImageDecoder.h" |
| 35 #include "PlatformMemoryInstrumentation.h" | 30 #include "PlatformMemoryInstrumentation.h" |
| 36 #include "SharedBuffer.h" | 31 #include "SharedBuffer.h" |
| 37 #if USE(WEBP) | 32 #if USE(WEBP) |
| 38 #include "WEBPImageDecoder.h" | 33 #include "WEBPImageDecoder.h" |
| 39 #endif | 34 #endif |
| 40 | 35 |
| 41 #include <algorithm> | 36 #include <algorithm> |
| 42 #include <cmath> | 37 #include <cmath> |
| 43 #include <wtf/MemoryInstrumentationVector.h> | 38 #include <wtf/MemoryInstrumentationVector.h> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 { | 101 { |
| 107 static const unsigned lengthOfLongestSignature = 14; // To wit: "RIFF????WEB
PVP" | 102 static const unsigned lengthOfLongestSignature = 14; // To wit: "RIFF????WEB
PVP" |
| 108 char contents[lengthOfLongestSignature]; | 103 char contents[lengthOfLongestSignature]; |
| 109 unsigned length = copyFromSharedBuffer(contents, lengthOfLongestSignature, d
ata, 0); | 104 unsigned length = copyFromSharedBuffer(contents, lengthOfLongestSignature, d
ata, 0); |
| 110 if (length < lengthOfLongestSignature) | 105 if (length < lengthOfLongestSignature) |
| 111 return nullptr; | 106 return nullptr; |
| 112 | 107 |
| 113 if (matchesGIFSignature(contents)) | 108 if (matchesGIFSignature(contents)) |
| 114 return adoptPtr(new GIFImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); | 109 return adoptPtr(new GIFImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); |
| 115 | 110 |
| 116 #if !PLATFORM(QT) || (PLATFORM(QT) && USE(LIBPNG)) | |
| 117 if (matchesPNGSignature(contents)) | 111 if (matchesPNGSignature(contents)) |
| 118 return adoptPtr(new PNGImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); | 112 return adoptPtr(new PNGImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); |
| 119 | 113 |
| 120 if (matchesICOSignature(contents) || matchesCURSignature(contents)) | 114 if (matchesICOSignature(contents) || matchesCURSignature(contents)) |
| 121 return adoptPtr(new ICOImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); | 115 return adoptPtr(new ICOImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); |
| 122 #endif | |
| 123 | 116 |
| 124 #if !PLATFORM(QT) || (PLATFORM(QT) && USE(LIBJPEG)) | |
| 125 if (matchesJPEGSignature(contents)) | 117 if (matchesJPEGSignature(contents)) |
| 126 return adoptPtr(new JPEGImageDecoder(alphaOption, gammaAndColorProfileOp
tion)); | 118 return adoptPtr(new JPEGImageDecoder(alphaOption, gammaAndColorProfileOp
tion)); |
| 127 #endif | |
| 128 | 119 |
| 129 #if USE(WEBP) | 120 #if USE(WEBP) |
| 130 if (matchesWebPSignature(contents)) | 121 if (matchesWebPSignature(contents)) |
| 131 return adoptPtr(new WEBPImageDecoder(alphaOption, gammaAndColorProfileOp
tion)); | 122 return adoptPtr(new WEBPImageDecoder(alphaOption, gammaAndColorProfileOp
tion)); |
| 132 #endif | 123 #endif |
| 133 | 124 |
| 134 if (matchesBMPSignature(contents)) | 125 if (matchesBMPSignature(contents)) |
| 135 return adoptPtr(new BMPImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); | 126 return adoptPtr(new BMPImageDecoder(alphaOption, gammaAndColorProfileOpt
ion)); |
| 136 | 127 |
| 137 #if PLATFORM(QT) | |
| 138 return adoptPtr(new ImageDecoderQt(alphaOption, gammaAndColorProfileOption))
; | |
| 139 #endif | |
| 140 return nullptr; | 128 return nullptr; |
| 141 } | 129 } |
| 142 | 130 |
| 143 #if !USE(SKIA) | 131 #if !USE(SKIA) |
| 144 | 132 |
| 145 ImageFrame::ImageFrame() | 133 ImageFrame::ImageFrame() |
| 146 : m_hasAlpha(false) | 134 : m_hasAlpha(false) |
| 147 , m_status(FrameEmpty) | 135 , m_status(FrameEmpty) |
| 148 , m_duration(0) | 136 , m_duration(0) |
| 149 , m_disposalMethod(DisposeNotSpecified) | 137 , m_disposalMethod(DisposeNotSpecified) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 { | 329 { |
| 342 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); | 330 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); |
| 343 info.addMember(m_data, "data"); | 331 info.addMember(m_data, "data"); |
| 344 info.addMember(m_frameBufferCache, "frameBufferCache"); | 332 info.addMember(m_frameBufferCache, "frameBufferCache"); |
| 345 info.addMember(m_colorProfile, "colorProfile"); | 333 info.addMember(m_colorProfile, "colorProfile"); |
| 346 info.addMember(m_scaledColumns, "scaledColumns"); | 334 info.addMember(m_scaledColumns, "scaledColumns"); |
| 347 info.addMember(m_scaledRows, "scaledRows"); | 335 info.addMember(m_scaledRows, "scaledRows"); |
| 348 } | 336 } |
| 349 | 337 |
| 350 } | 338 } |
| OLD | NEW |