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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 // ImageFrameGenerator has the latest known alpha state. There will | 110 // ImageFrameGenerator has the latest known alpha state. There will |
111 // be a performance boost if this frame is opaque. | 111 // be a performance boost if this frame is opaque. |
112 m_lazyDecodedFrames[index]->setHasAlpha(m_frameGenerator->hasAlpha(index )); | 112 m_lazyDecodedFrames[index]->setHasAlpha(m_frameGenerator->hasAlpha(index )); |
113 return m_lazyDecodedFrames[index].get(); | 113 return m_lazyDecodedFrames[index].get(); |
114 } | 114 } |
115 if (m_actualDecoder) | 115 if (m_actualDecoder) |
116 return m_actualDecoder->frameBufferAtIndex(index); | 116 return m_actualDecoder->frameBufferAtIndex(index); |
117 return 0; | 117 return 0; |
118 } | 118 } |
119 | 119 |
120 void DeferredImageDecoder::setData(SharedBuffer* data, bool allDataReceived) | 120 void DeferredImageDecoder::setData(SharedBuffer& data, bool allDataReceived) |
121 { | 121 { |
122 if (m_actualDecoder) { | 122 if (m_actualDecoder) { |
123 const bool firstData = !m_data && data; | 123 const bool firstData = !m_data; |
124 const bool moreData = data && data->size() > m_lastDataSize; | 124 const bool moreData = data.size() > m_lastDataSize; |
125 m_dataChanged = firstData || moreData; | 125 m_dataChanged = firstData || moreData; |
126 m_data = data; | 126 m_data = RefPtr<SharedBuffer>(data); |
127 m_lastDataSize = data->size(); | 127 m_lastDataSize = data.size(); |
Inactive
2014/04/20 13:16:51
There was no null check here.
| |
128 m_allDataReceived = allDataReceived; | 128 m_allDataReceived = allDataReceived; |
129 m_actualDecoder->setData(data, allDataReceived); | 129 m_actualDecoder->setData(&data, allDataReceived); |
130 prepareLazyDecodedFrames(); | 130 prepareLazyDecodedFrames(); |
131 } | 131 } |
132 | 132 |
133 if (m_frameGenerator) | 133 if (m_frameGenerator) |
134 m_frameGenerator->setData(data, allDataReceived); | 134 m_frameGenerator->setData(&data, allDataReceived); |
135 } | 135 } |
136 | 136 |
137 bool DeferredImageDecoder::isSizeAvailable() | 137 bool DeferredImageDecoder::isSizeAvailable() |
138 { | 138 { |
139 // m_actualDecoder is 0 only if image decoding is deferred and that | 139 // m_actualDecoder is 0 only if image decoding is deferred and that |
140 // means image header decoded successfully and size is available. | 140 // means image header decoded successfully and size is available. |
141 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; | 141 return m_actualDecoder ? m_actualDecoder->isSizeAvailable() : true; |
142 } | 142 } |
143 | 143 |
144 IntSize DeferredImageDecoder::size() const | 144 IntSize DeferredImageDecoder::size() const |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 return bitmap; | 326 return bitmap; |
327 } | 327 } |
328 | 328 |
329 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const | 329 bool DeferredImageDecoder::hotSpot(IntPoint& hotSpot) const |
330 { | 330 { |
331 // TODO: Implement. | 331 // TODO: Implement. |
332 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; | 332 return m_actualDecoder ? m_actualDecoder->hotSpot(hotSpot) : false; |
333 } | 333 } |
334 | 334 |
335 } // namespace WebCore | 335 } // namespace WebCore |
OLD | NEW |