Chromium Code Reviews| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 233 |
| 234 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied); | 234 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageDecoder::Alp haPremultiplied, ImageDecoder::GammaAndColorProfileApplied); |
| 235 if (!decoder) | 235 if (!decoder) |
| 236 return false; | 236 return false; |
| 237 | 237 |
| 238 decoder->setData(data, allDataReceived); | 238 decoder->setData(data, allDataReceived); |
| 239 | 239 |
| 240 OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes) ); | 240 OwnPtr<ImagePlanes> imagePlanes = adoptPtr(new ImagePlanes(planes, rowBytes) ); |
| 241 decoder->setImagePlanes(imagePlanes.release()); | 241 decoder->setImagePlanes(imagePlanes.release()); |
| 242 | 242 |
| 243 ASSERT(decoder->canDecodeToYUV()); | 243 ASSERT(decoder->canDecodeToYUV()); |
|
Justin Novosad
2016/03/24 14:13:57
Does this assert hit?
xidachen
2016/03/24 14:40:24
This condition is always true, so it doesn't hit t
| |
| 244 | 244 |
| 245 if (decoder->decodeToYUV()) { | 245 if (decoder->decodeToYUV()) { |
| 246 setHasAlpha(0, false); // YUV is always opaque | 246 setHasAlpha(0, false); // YUV is always opaque |
| 247 return true; | 247 return true; |
| 248 } | 248 } |
| 249 | 249 |
| 250 ASSERT(decoder->failed()); | 250 ASSERT(decoder->failed()); |
|
Justin Novosad
2016/03/24 14:13:57
Does this assert fire when you try to repro the bu
xidachen
2016/03/24 14:40:24
The example loads and calls drawImage() on 25 imag
| |
| 251 m_decodeFailed = true; | |
| 252 return false; | 251 return false; |
|
Justin Novosad
2016/03/24 14:13:57
Can you explain why the decode flow reaches this p
Noel Gordon
2016/03/25 08:16:46
Concur with these questions.
https://codereview.c
| |
| 253 } | 252 } |
| 254 | 253 |
| 255 SkBitmap ImageFrameGenerator::tryToResumeDecode(size_t index, const SkISize& sca ledSize) | 254 SkBitmap ImageFrameGenerator::tryToResumeDecode(size_t index, const SkISize& sca ledSize) |
| 256 { | 255 { |
| 257 TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index ", static_cast<int>(index)); | 256 TRACE_EVENT1("blink", "ImageFrameGenerator::tryToResumeDecode", "frame index ", static_cast<int>(index)); |
| 258 | 257 |
| 259 ImageDecoder* decoder = 0; | 258 ImageDecoder* decoder = 0; |
| 260 const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder); | 259 const bool resumeDecoding = ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder); |
| 261 ASSERT(!resumeDecoding || decoder); | 260 ASSERT(!resumeDecoding || decoder); |
| 262 | 261 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 | 408 |
| 410 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. | 409 // Setting a dummy ImagePlanes object signals to the decoder that we want to do YUV decoding. |
| 411 decoder->setData(data, allDataReceived); | 410 decoder->setData(data, allDataReceived); |
| 412 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 411 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
| 413 decoder->setImagePlanes(dummyImagePlanes.release()); | 412 decoder->setImagePlanes(dummyImagePlanes.release()); |
| 414 | 413 |
| 415 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW idthBytes); | 414 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW idthBytes); |
| 416 } | 415 } |
| 417 | 416 |
| 418 } // namespace blink | 417 } // namespace blink |
| OLD | NEW |