OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return false; | 174 return false; |
175 } | 175 } |
176 | 176 |
177 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( | 177 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( |
178 data, true, ImageDecoder::AlphaPremultiplied, m_decoderColorBehavior); | 178 data, true, ImageDecoder::AlphaPremultiplied, m_decoderColorBehavior); |
179 // getYUVComponentSizes was already called and was successful, so | 179 // getYUVComponentSizes was already called and was successful, so |
180 // ImageDecoder::create must succeed. | 180 // ImageDecoder::create must succeed. |
181 ASSERT(decoder); | 181 ASSERT(decoder); |
182 | 182 |
183 std::unique_ptr<ImagePlanes> imagePlanes = | 183 std::unique_ptr<ImagePlanes> imagePlanes = |
184 makeUnique<ImagePlanes>(planes, rowBytes); | 184 WTF::makeUnique<ImagePlanes>(planes, rowBytes); |
185 decoder->setImagePlanes(std::move(imagePlanes)); | 185 decoder->setImagePlanes(std::move(imagePlanes)); |
186 | 186 |
187 ASSERT(decoder->canDecodeToYUV()); | 187 ASSERT(decoder->canDecodeToYUV()); |
188 | 188 |
189 if (decoder->decodeToYUV()) { | 189 if (decoder->decodeToYUV()) { |
190 setHasAlpha(0, false); // YUV is always opaque | 190 setHasAlpha(0, false); // YUV is always opaque |
191 return true; | 191 return true; |
192 } | 192 } |
193 | 193 |
194 ASSERT(decoder->failed()); | 194 ASSERT(decoder->failed()); |
(...skipping 23 matching lines...) Expand all Loading... |
218 decode(data, allDataReceived, index, &decoder, &fullSizeImage, allocator); | 218 decode(data, allDataReceived, index, &decoder, &fullSizeImage, allocator); |
219 | 219 |
220 if (!decoder) | 220 if (!decoder) |
221 return SkBitmap(); | 221 return SkBitmap(); |
222 | 222 |
223 // If we are not resuming decoding that means the decoder is freshly | 223 // If we are not resuming decoding that means the decoder is freshly |
224 // created and we have ownership. If we are resuming decoding then | 224 // created and we have ownership. If we are resuming decoding then |
225 // the decoder is owned by ImageDecodingStore. | 225 // the decoder is owned by ImageDecodingStore. |
226 std::unique_ptr<ImageDecoder> decoderContainer; | 226 std::unique_ptr<ImageDecoder> decoderContainer; |
227 if (!resumeDecoding) | 227 if (!resumeDecoding) |
228 decoderContainer = wrapUnique(decoder); | 228 decoderContainer = WTF::wrapUnique(decoder); |
229 | 229 |
230 if (fullSizeImage.isNull()) { | 230 if (fullSizeImage.isNull()) { |
231 // If decoding has failed, we can save work in the future by | 231 // If decoding has failed, we can save work in the future by |
232 // ignoring further requests to decode the image. | 232 // ignoring further requests to decode the image. |
233 m_decodeFailed = decoder->failed(); | 233 m_decodeFailed = decoder->failed(); |
234 if (resumeDecoding) | 234 if (resumeDecoding) |
235 ImageDecodingStore::instance().unlockDecoder(this, decoder); | 235 ImageDecodingStore::instance().unlockDecoder(this, decoder); |
236 return SkBitmap(); | 236 return SkBitmap(); |
237 } | 237 } |
238 | 238 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 if (m_yuvDecodingFailed) | 365 if (m_yuvDecodingFailed) |
366 return false; | 366 return false; |
367 | 367 |
368 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( | 368 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::create( |
369 data, true, ImageDecoder::AlphaPremultiplied, m_decoderColorBehavior); | 369 data, true, ImageDecoder::AlphaPremultiplied, m_decoderColorBehavior); |
370 if (!decoder) | 370 if (!decoder) |
371 return false; | 371 return false; |
372 | 372 |
373 // Setting a dummy ImagePlanes object signals to the decoder that we want to | 373 // Setting a dummy ImagePlanes object signals to the decoder that we want to |
374 // do YUV decoding. | 374 // do YUV decoding. |
375 std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); | 375 std::unique_ptr<ImagePlanes> dummyImagePlanes = |
| 376 WTF::wrapUnique(new ImagePlanes); |
376 decoder->setImagePlanes(std::move(dummyImagePlanes)); | 377 decoder->setImagePlanes(std::move(dummyImagePlanes)); |
377 | 378 |
378 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, | 379 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, |
379 sizeInfo->fWidthBytes); | 380 sizeInfo->fWidthBytes); |
380 } | 381 } |
381 | 382 |
382 } // namespace blink | 383 } // namespace blink |
OLD | NEW |