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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 size_t ImageSource::frameCount() const | 108 size_t ImageSource::frameCount() const |
109 { | 109 { |
110 return m_decoder ? m_decoder->frameCount() : 0; | 110 return m_decoder ? m_decoder->frameCount() : 0; |
111 } | 111 } |
112 | 112 |
113 PassRefPtr<NativeImageSkia> ImageSource::createFrameAtIndex(size_t index) | 113 PassRefPtr<NativeImageSkia> ImageSource::createFrameAtIndex(size_t index) |
114 { | 114 { |
115 if (!m_decoder) | 115 if (!m_decoder) |
116 return 0; | 116 return nullptr; |
117 | 117 |
118 ImageFrame* buffer = m_decoder->frameBufferAtIndex(index); | 118 ImageFrame* buffer = m_decoder->frameBufferAtIndex(index); |
119 if (!buffer || buffer->status() == ImageFrame::FrameEmpty) | 119 if (!buffer || buffer->status() == ImageFrame::FrameEmpty) |
120 return 0; | 120 return nullptr; |
121 | 121 |
122 // Zero-height images can cause problems for some ports. If we have an | 122 // Zero-height images can cause problems for some ports. If we have an |
123 // empty image dimension, just bail. | 123 // empty image dimension, just bail. |
124 if (size().isEmpty()) | 124 if (size().isEmpty()) |
125 return 0; | 125 return nullptr; |
126 | 126 |
127 // Return the buffer contents as a native image. For some ports, the data | 127 // Return the buffer contents as a native image. For some ports, the data |
128 // is already in a native container, and this just increments its refcount. | 128 // is already in a native container, and this just increments its refcount. |
129 return buffer->asNewNativeImage(); | 129 return buffer->asNewNativeImage(); |
130 } | 130 } |
131 | 131 |
132 float ImageSource::frameDurationAtIndex(size_t index) const | 132 float ImageSource::frameDurationAtIndex(size_t index) const |
133 { | 133 { |
134 if (!m_decoder) | 134 if (!m_decoder) |
135 return 0; | 135 return 0; |
(...skipping 24 matching lines...) Expand all Loading... |
160 } | 160 } |
161 | 161 |
162 unsigned ImageSource::frameBytesAtIndex(size_t index) const | 162 unsigned ImageSource::frameBytesAtIndex(size_t index) const |
163 { | 163 { |
164 if (!m_decoder) | 164 if (!m_decoder) |
165 return 0; | 165 return 0; |
166 return m_decoder->frameBytesAtIndex(index); | 166 return m_decoder->frameBytesAtIndex(index); |
167 } | 167 } |
168 | 168 |
169 } | 169 } |
OLD | NEW |