| 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) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 SkBitmap::Allocator* allocator() const { return m_allocator; } | 135 SkBitmap::Allocator* allocator() const { return m_allocator; } |
| 136 | 136 |
| 137 // Returns the bitmap that is the output of decoding. | 137 // Returns the bitmap that is the output of decoding. |
| 138 const SkBitmap& bitmap() const { return m_bitmap; } | 138 const SkBitmap& bitmap() const { return m_bitmap; } |
| 139 | 139 |
| 140 // Create SkImage from bitmap() and return it. This should be called only | 140 // Create SkImage from bitmap() and return it. This should be called only |
| 141 // if frame is complete. The bitmap is set immutable before creating | 141 // if frame is complete. The bitmap is set immutable before creating |
| 142 // SkImage to avoid copying bitmap in SkImage::MakeFromBitmap(m_bitmap). | 142 // SkImage to avoid copying bitmap in SkImage::MakeFromBitmap(m_bitmap). |
| 143 sk_sp<SkImage> finalizePixelsAndGetImage(); | 143 sk_sp<SkImage> finalizePixelsAndGetImage(); |
| 144 | 144 |
| 145 // Returns true if the pixels changed, but the bitmap has not yet been notifie
d. | 145 // Returns true if the pixels changed, but the bitmap has not yet been |
| 146 // notified. |
| 146 bool pixelsChanged() const { return m_pixelsChanged; } | 147 bool pixelsChanged() const { return m_pixelsChanged; } |
| 147 size_t requiredPreviousFrameIndex() const { | 148 size_t requiredPreviousFrameIndex() const { |
| 148 return m_requiredPreviousFrameIndex; | 149 return m_requiredPreviousFrameIndex; |
| 149 } | 150 } |
| 150 void setHasAlpha(bool alpha); | 151 void setHasAlpha(bool alpha); |
| 151 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } | 152 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } |
| 152 void setStatus(Status); | 153 void setStatus(Status); |
| 153 void setDuration(unsigned duration) { m_duration = duration; } | 154 void setDuration(unsigned duration) { m_duration = duration; } |
| 154 void setDisposalMethod(DisposalMethod disposalMethod) { | 155 void setDisposalMethod(DisposalMethod disposalMethod) { |
| 155 m_disposalMethod = disposalMethod; | 156 m_disposalMethod = disposalMethod; |
| 156 } | 157 } |
| 157 void setAlphaBlendSource(AlphaBlendSource alphaBlendSource) { | 158 void setAlphaBlendSource(AlphaBlendSource alphaBlendSource) { |
| 158 m_alphaBlendSource = alphaBlendSource; | 159 m_alphaBlendSource = alphaBlendSource; |
| 159 } | 160 } |
| 160 void setPremultiplyAlpha(bool premultiplyAlpha) { | 161 void setPremultiplyAlpha(bool premultiplyAlpha) { |
| 161 m_premultiplyAlpha = premultiplyAlpha; | 162 m_premultiplyAlpha = premultiplyAlpha; |
| 162 } | 163 } |
| 163 void setMemoryAllocator(SkBitmap::Allocator* allocator) { | 164 void setMemoryAllocator(SkBitmap::Allocator* allocator) { |
| 164 m_allocator = allocator; | 165 m_allocator = allocator; |
| 165 } | 166 } |
| 166 // The pixelsChanged flag needs to be set when the raw pixel data was directly
modified | 167 // The pixelsChanged flag needs to be set when the raw pixel data was directly |
| 167 // (e.g. through a pointer or setRGBA). The flag is usually set after a batch
of changes was made. | 168 // modified (e.g. through a pointer or setRGBA). The flag is usually set after |
| 169 // a batch of changes was made. |
| 168 void setPixelsChanged(bool pixelsChanged) { m_pixelsChanged = pixelsChanged; } | 170 void setPixelsChanged(bool pixelsChanged) { m_pixelsChanged = pixelsChanged; } |
| 169 void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { | 171 void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { |
| 170 m_requiredPreviousFrameIndex = previousFrameIndex; | 172 m_requiredPreviousFrameIndex = previousFrameIndex; |
| 171 } | 173 } |
| 172 | 174 |
| 173 inline PixelData* getAddr(int x, int y) { return m_bitmap.getAddr32(x, y); } | 175 inline PixelData* getAddr(int x, int y) { return m_bitmap.getAddr32(x, y); } |
| 174 | 176 |
| 175 inline void setRGBA(int x, | 177 inline void setRGBA(int x, |
| 176 int y, | 178 int y, |
| 177 unsigned r, | 179 unsigned r, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // The frame that must be decoded before this frame can be decoded. | 250 // The frame that must be decoded before this frame can be decoded. |
| 249 // WTF::kNotFound if this frame doesn't require any previous frame. | 251 // WTF::kNotFound if this frame doesn't require any previous frame. |
| 250 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never | 252 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never |
| 251 // be read for image formats that do not have multiple frames. | 253 // be read for image formats that do not have multiple frames. |
| 252 size_t m_requiredPreviousFrameIndex; | 254 size_t m_requiredPreviousFrameIndex; |
| 253 }; | 255 }; |
| 254 | 256 |
| 255 } // namespace blink | 257 } // namespace blink |
| 256 | 258 |
| 257 #endif | 259 #endif |
| OLD | NEW |