| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileSize)) | 165 else if (!ImageDecoder::inputDeviceColorProfile(profileData, profileSize)) |
| 166 ignoreProfile = true; | 166 ignoreProfile = true; |
| 167 | 167 |
| 168 if (!ignoreProfile) | 168 if (!ignoreProfile) |
| 169 createColorTransform(profileData, profileSize); | 169 createColorTransform(profileData, profileSize); |
| 170 | 170 |
| 171 WebPDemuxReleaseChunkIterator(&chunkIterator); | 171 WebPDemuxReleaseChunkIterator(&chunkIterator); |
| 172 WebPDemuxDelete(demuxer); | 172 WebPDemuxDelete(demuxer); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void WEBPImageDecoder::applyColorProfile(const uint8_t* data, size_t size, Image
Frame& buffer) | 175 void WEBPImageDecoder::applyColorProfile(const uint8_t* data, size_t dataSize, I
mageFrame& buffer) |
| 176 { | 176 { |
| 177 int width; | 177 int width; |
| 178 int decodedHeight; | 178 int decodedHeight; |
| 179 if (!WebPIDecGetRGB(m_decoder, &decodedHeight, &width, 0, 0)) | 179 if (!WebPIDecGetRGB(m_decoder, &decodedHeight, &width, 0, 0)) |
| 180 return; // See also https://bugs.webkit.org/show_bug.cgi?id=74062 | 180 return; // See also https://bugs.webkit.org/show_bug.cgi?id=74062 |
| 181 if (decodedHeight <= 0) | 181 if (decodedHeight <= 0) |
| 182 return; | 182 return; |
| 183 | 183 |
| 184 if (!m_haveReadProfile) { | 184 if (!m_haveReadProfile) { |
| 185 readColorProfile(data, size); | 185 readColorProfile(data, dataSize); |
| 186 m_haveReadProfile = true; | 186 m_haveReadProfile = true; |
| 187 } | 187 } |
| 188 | 188 |
| 189 ASSERT(width == scaledSize().width()); | 189 ASSERT(width == size().width()); |
| 190 ASSERT(decodedHeight <= scaledSize().height()); | 190 ASSERT(decodedHeight <= size().height()); |
| 191 | 191 |
| 192 for (int y = m_decodedHeight; y < decodedHeight; ++y) { | 192 for (int y = m_decodedHeight; y < decodedHeight; ++y) { |
| 193 uint8_t* row = reinterpret_cast<uint8_t*>(buffer.getAddr(0, y)); | 193 uint8_t* row = reinterpret_cast<uint8_t*>(buffer.getAddr(0, y)); |
| 194 if (qcms_transform* transform = colorTransform()) | 194 if (qcms_transform* transform = colorTransform()) |
| 195 qcms_transform_data_type(transform, row, row, width, QCMS_OUTPUT_RGB
X); | 195 qcms_transform_data_type(transform, row, row, width, QCMS_OUTPUT_RGB
X); |
| 196 uint8_t* pixel = row; | 196 uint8_t* pixel = row; |
| 197 for (int x = 0; x < width; ++x, pixel += 4) | 197 for (int x = 0; x < width; ++x, pixel += 4) |
| 198 buffer.setRGBA(x, y, pixel[0], pixel[1], pixel[2], pixel[3]); | 198 buffer.setRGBA(x, y, pixel[0], pixel[1], pixel[2], pixel[3]); |
| 199 } | 199 } |
| 200 | 200 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile()) | 292 if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile()) |
| 293 applyColorProfile(dataBytes, dataSize, buffer); | 293 applyColorProfile(dataBytes, dataSize, buffer); |
| 294 return false; | 294 return false; |
| 295 default: | 295 default: |
| 296 clear(); | 296 clear(); |
| 297 return setFailed(); | 297 return setFailed(); |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace WebCore | 301 } // namespace WebCore |
| OLD | NEW |