OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 if (buffer->getStatus() != ImageFrame::FrameEmpty) | 351 if (buffer->getStatus() != ImageFrame::FrameEmpty) |
352 return true; | 352 return true; |
353 | 353 |
354 size_t requiredPreviousFrameIndex = buffer->requiredPreviousFrameIndex(); | 354 size_t requiredPreviousFrameIndex = buffer->requiredPreviousFrameIndex(); |
355 if (requiredPreviousFrameIndex == kNotFound) { | 355 if (requiredPreviousFrameIndex == kNotFound) { |
356 // This frame doesn't rely on any previous data. | 356 // This frame doesn't rely on any previous data. |
357 if (!buffer->setSizeAndColorSpace(size().width(), size().height(), | 357 if (!buffer->setSizeAndColorSpace(size().width(), size().height(), |
358 colorSpaceForSkImages())) { | 358 colorSpaceForSkImages())) { |
359 return setFailed(); | 359 return setFailed(); |
360 } | 360 } |
| 361 buffer->zeroFillPixelData(); |
361 } else { | 362 } else { |
362 ImageFrame* const prevBuffer = | 363 ImageFrame* const prevBuffer = |
363 &m_frameBufferCache[requiredPreviousFrameIndex]; | 364 &m_frameBufferCache[requiredPreviousFrameIndex]; |
364 DCHECK(prevBuffer->getStatus() == ImageFrame::FrameComplete); | 365 DCHECK(prevBuffer->getStatus() == ImageFrame::FrameComplete); |
365 | 366 |
366 // We try to reuse |prevBuffer| as starting state to avoid copying. | 367 // We try to reuse |prevBuffer| as starting state to avoid copying. |
367 // If canReusePreviousFrameBuffer returns false, we must copy the data since | 368 // If canReusePreviousFrameBuffer returns false, we must copy the data since |
368 // |prevBuffer| is necessary to decode this or later frames. In that case, | 369 // |prevBuffer| is necessary to decode this or later frames. In that case, |
369 // copy the data instead. | 370 // copy the data instead. |
370 if ((!canReusePreviousFrameBuffer(frameIndex) || | 371 if ((!canReusePreviousFrameBuffer(frameIndex) || |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { | 547 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { |
547 if (!m_colorBehavior.isTag()) | 548 if (!m_colorBehavior.isTag()) |
548 return nullptr; | 549 return nullptr; |
549 | 550 |
550 if (m_embeddedColorSpace) | 551 if (m_embeddedColorSpace) |
551 return m_embeddedColorSpace; | 552 return m_embeddedColorSpace; |
552 return SkColorSpace::MakeSRGB(); | 553 return SkColorSpace::MakeSRGB(); |
553 } | 554 } |
554 | 555 |
555 } // namespace blink | 556 } // namespace blink |
OLD | NEW |