Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> | 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> |
| 4 * Copyright (C) 2008, Google Inc. All rights reserved. | 4 * Copyright (C) 2008, Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 ImageSource::~ImageSource() | 40 ImageSource::~ImageSource() |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 size_t ImageSource::clearCacheExceptFrame(size_t clearExceptFrame) | 44 size_t ImageSource::clearCacheExceptFrame(size_t clearExceptFrame) |
| 45 { | 45 { |
| 46 return m_decoder ? m_decoder->clearCacheExceptFrame(clearExceptFrame) : 0; | 46 return m_decoder ? m_decoder->clearCacheExceptFrame(clearExceptFrame) : 0; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool ImageSource::hasData() const | |
| 50 { | |
| 51 return m_decoder ? m_decoder->hasData() : false; | |
| 52 } | |
| 53 | |
| 54 PassRefPtr<SharedBuffer> ImageSource::data() | |
| 55 { | |
| 56 return m_decoder->data(); | |
|
scroggo_chromium
2016/06/20 19:00:43
Shouldn't you check to make sure m_decoder is not
hajimehoshi
2016/06/22 09:42:30
Done.
| |
| 57 } | |
| 58 | |
| 49 void ImageSource::setData(SharedBuffer& data, bool allDataReceived) | 59 void ImageSource::setData(SharedBuffer& data, bool allDataReceived) |
| 50 { | 60 { |
| 51 // Create a decoder by sniffing the encoded data. If insufficient data bytes are available to | 61 // Create a decoder by sniffing the encoded data. If insufficient data bytes are available to |
| 52 // determine the encoded image type, no decoder is created. | 62 // determine the encoded image type, no decoder is created. |
| 53 if (!m_decoder) | 63 if (!m_decoder) |
| 54 m_decoder = DeferredImageDecoder::create(data, ImageDecoder::AlphaPremul tiplied, ImageDecoder::GammaAndColorProfileApplied); | 64 m_decoder = DeferredImageDecoder::create(data, ImageDecoder::AlphaPremul tiplied, ImageDecoder::GammaAndColorProfileApplied); |
| 55 | 65 |
| 56 if (m_decoder) | 66 if (m_decoder) |
| 57 m_decoder->setData(data, allDataReceived); | 67 m_decoder->setData(data, allDataReceived); |
| 58 } | 68 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 { | 151 { |
| 142 return m_decoder && m_decoder->frameIsCompleteAtIndex(index); | 152 return m_decoder && m_decoder->frameIsCompleteAtIndex(index); |
| 143 } | 153 } |
| 144 | 154 |
| 145 size_t ImageSource::frameBytesAtIndex(size_t index) const | 155 size_t ImageSource::frameBytesAtIndex(size_t index) const |
| 146 { | 156 { |
| 147 return m_decoder ? m_decoder->frameBytesAtIndex(index) : 0; | 157 return m_decoder ? m_decoder->frameBytesAtIndex(index) : 0; |
| 148 } | 158 } |
| 149 | 159 |
| 150 } // namespace blink | 160 } // namespace blink |
| OLD | NEW |