Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageFrame.h

Issue 1880993003: Use RefPtr for SkBitmap::Allocator in ImageDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharedBufferInterface6
Patch Set: Rebase to ToT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // succeeded. 113 // succeeded.
114 bool setSize(int newWidth, int newHeight); 114 bool setSize(int newWidth, int newHeight);
115 115
116 bool hasAlpha() const; 116 bool hasAlpha() const;
117 const IntRect& originalFrameRect() const { return m_originalFrameRect; } 117 const IntRect& originalFrameRect() const { return m_originalFrameRect; }
118 Status getStatus() const { return m_status; } 118 Status getStatus() const { return m_status; }
119 unsigned duration() const { return m_duration; } 119 unsigned duration() const { return m_duration; }
120 DisposalMethod getDisposalMethod() const { return m_disposalMethod; } 120 DisposalMethod getDisposalMethod() const { return m_disposalMethod; }
121 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; } 121 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; }
122 bool premultiplyAlpha() const { return m_premultiplyAlpha; } 122 bool premultiplyAlpha() const { return m_premultiplyAlpha; }
123 SkBitmap::Allocator* allocator() const { return m_allocator; }
124 const SkBitmap& bitmap() const { return m_bitmap; } 123 const SkBitmap& bitmap() const { return m_bitmap; }
125 // Returns true if the pixels changed, but the bitmap has not yet been notif ied. 124 // Returns true if the pixels changed, but the bitmap has not yet been notif ied.
126 bool pixelsChanged() const { return m_pixelsChanged; } 125 bool pixelsChanged() const { return m_pixelsChanged; }
127 size_t requiredPreviousFrameIndex() const { return m_requiredPreviousFrameIn dex; } 126 size_t requiredPreviousFrameIndex() const { return m_requiredPreviousFrameIn dex; }
128 void setHasAlpha(bool alpha); 127 void setHasAlpha(bool alpha);
129 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } 128 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; }
130 void setStatus(Status); 129 void setStatus(Status);
131 void setDuration(unsigned duration) { m_duration = duration; } 130 void setDuration(unsigned duration) { m_duration = duration; }
132 void setDisposalMethod(DisposalMethod disposalMethod) { m_disposalMethod = d isposalMethod; } 131 void setDisposalMethod(DisposalMethod disposalMethod) { m_disposalMethod = d isposalMethod; }
133 void setAlphaBlendSource(AlphaBlendSource alphaBlendSource) { m_alphaBlendSo urce = alphaBlendSource; } 132 void setAlphaBlendSource(AlphaBlendSource alphaBlendSource) { m_alphaBlendSo urce = alphaBlendSource; }
134 void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premu ltiplyAlpha; } 133 void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premu ltiplyAlpha; }
135 void setMemoryAllocator(SkBitmap::Allocator* allocator) { m_allocator = allo cator; } 134 void setMemoryAllocator(PassRefPtr<SkBitmap::Allocator> allocator) { m_alloc ator = allocator; }
136 // The pixelsChanged flag needs to be set when the raw pixel data was direct ly modified 135 // The pixelsChanged flag needs to be set when the raw pixel data was direct ly modified
137 // (e.g. through a pointer or setRGBA). The flag is usually set after a batc h of changes was made. 136 // (e.g. through a pointer or setRGBA). The flag is usually set after a batc h of changes was made.
138 void setPixelsChanged(bool pixelsChanged) { m_pixelsChanged = pixelsChanged; } 137 void setPixelsChanged(bool pixelsChanged) { m_pixelsChanged = pixelsChanged; }
139 void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { m_requiredPr eviousFrameIndex = previousFrameIndex; } 138 void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { m_requiredPr eviousFrameIndex = previousFrameIndex; }
140 139
141 inline PixelData* getAddr(int x, int y) 140 inline PixelData* getAddr(int x, int y)
142 { 141 {
143 return m_bitmap.getAddr32(x, y); 142 return m_bitmap.getAddr32(x, y);
144 } 143 }
145 144
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 189 }
191 190
192 int height() const 191 int height() const
193 { 192 {
194 return m_bitmap.height(); 193 return m_bitmap.height();
195 } 194 }
196 195
197 SkAlphaType computeAlphaType() const; 196 SkAlphaType computeAlphaType() const;
198 197
199 SkBitmap m_bitmap; 198 SkBitmap m_bitmap;
200 SkBitmap::Allocator* m_allocator; 199 RefPtr<SkBitmap::Allocator> m_allocator;
201 bool m_hasAlpha; 200 bool m_hasAlpha;
202 // This will always just be the entire buffer except for GIF or WebP 201 // This will always just be the entire buffer except for GIF or WebP
203 // frames whose original rect was smaller than the overall image size. 202 // frames whose original rect was smaller than the overall image size.
204 IntRect m_originalFrameRect; 203 IntRect m_originalFrameRect;
205 Status m_status; 204 Status m_status;
206 unsigned m_duration; 205 unsigned m_duration;
207 DisposalMethod m_disposalMethod; 206 DisposalMethod m_disposalMethod;
208 AlphaBlendSource m_alphaBlendSource; 207 AlphaBlendSource m_alphaBlendSource;
209 bool m_premultiplyAlpha; 208 bool m_premultiplyAlpha;
210 // True if the pixels changed, but the bitmap has not yet been notified. 209 // True if the pixels changed, but the bitmap has not yet been notified.
211 bool m_pixelsChanged; 210 bool m_pixelsChanged;
212 211
213 // The frame that must be decoded before this frame can be decoded. 212 // The frame that must be decoded before this frame can be decoded.
214 // WTF::kNotFound if this frame doesn't require any previous frame. 213 // WTF::kNotFound if this frame doesn't require any previous frame.
215 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never 214 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never
216 // be read for image formats that do not have multiple frames. 215 // be read for image formats that do not have multiple frames.
217 size_t m_requiredPreviousFrameIndex; 216 size_t m_requiredPreviousFrameIndex;
218 }; 217 };
219 218
220 } // namespace blink 219 } // namespace blink
221 220
222 #endif 221 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698