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

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

Issue 2326473005: Use sk_sp<SkBitmap::Allocator> instead of raw pointers or WTF::RefPtr<T>. (Closed)
Patch Set: Created 4 years, 3 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // succeeded. 117 // succeeded.
118 bool setSizeAndColorProfile(int newWidth, int newHeight, const ICCProfile& n ewIccProfile); 118 bool setSizeAndColorProfile(int newWidth, int newHeight, const ICCProfile& n ewIccProfile);
119 119
120 bool hasAlpha() const; 120 bool hasAlpha() const;
121 const IntRect& originalFrameRect() const { return m_originalFrameRect; } 121 const IntRect& originalFrameRect() const { return m_originalFrameRect; }
122 Status getStatus() const { return m_status; } 122 Status getStatus() const { return m_status; }
123 unsigned duration() const { return m_duration; } 123 unsigned duration() const { return m_duration; }
124 DisposalMethod getDisposalMethod() const { return m_disposalMethod; } 124 DisposalMethod getDisposalMethod() const { return m_disposalMethod; }
125 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; } 125 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; }
126 bool premultiplyAlpha() const { return m_premultiplyAlpha; } 126 bool premultiplyAlpha() const { return m_premultiplyAlpha; }
127 SkBitmap::Allocator* allocator() const { return m_allocator; } 127 const sk_sp<SkBitmap::Allocator>& allocator() const { return m_allocator; }
scroggo_chromium 2016/09/13 14:54:42 We went back and forth on how to handle this insid
Łukasz Anforowicz 2016/09/13 18:17:31 I've reverted this part of the change and just foc
128 const SkBitmap& bitmap() const { return m_bitmap; } 128 const SkBitmap& bitmap() const { return m_bitmap; }
129 // Returns true if the pixels changed, but the bitmap has not yet been notif ied. 129 // Returns true if the pixels changed, but the bitmap has not yet been notif ied.
130 bool pixelsChanged() const { return m_pixelsChanged; } 130 bool pixelsChanged() const { return m_pixelsChanged; }
131 size_t requiredPreviousFrameIndex() const { return m_requiredPreviousFrameIn dex; } 131 size_t requiredPreviousFrameIndex() const { return m_requiredPreviousFrameIn dex; }
132 void setHasAlpha(bool alpha); 132 void setHasAlpha(bool alpha);
133 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; } 133 void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; }
134 void setStatus(Status); 134 void setStatus(Status);
135 void setDuration(unsigned duration) { m_duration = duration; } 135 void setDuration(unsigned duration) { m_duration = duration; }
136 void setDisposalMethod(DisposalMethod disposalMethod) { m_disposalMethod = d isposalMethod; } 136 void setDisposalMethod(DisposalMethod disposalMethod) { m_disposalMethod = d isposalMethod; }
137 void setAlphaBlendSource(AlphaBlendSource alphaBlendSource) { m_alphaBlendSo urce = alphaBlendSource; } 137 void setAlphaBlendSource(AlphaBlendSource alphaBlendSource) { m_alphaBlendSo urce = alphaBlendSource; }
138 void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premu ltiplyAlpha; } 138 void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premu ltiplyAlpha; }
139 void setMemoryAllocator(SkBitmap::Allocator* allocator) { m_allocator = allo cator; } 139 void setMemoryAllocator(sk_sp<SkBitmap::Allocator> allocator) { m_allocator = allocator; }
scroggo_chromium 2016/09/13 14:54:42 Don't you want to std::move |allocator|?
Łukasz Anforowicz 2016/09/13 18:17:31 Ooops - yes, std::move would be appropriate here.
140 // The pixelsChanged flag needs to be set when the raw pixel data was direct ly modified 140 // The pixelsChanged flag needs to be set when the raw pixel data was direct ly modified
141 // (e.g. through a pointer or setRGBA). The flag is usually set after a batc h of changes was made. 141 // (e.g. through a pointer or setRGBA). The flag is usually set after a batc h of changes was made.
142 void setPixelsChanged(bool pixelsChanged) { m_pixelsChanged = pixelsChanged; } 142 void setPixelsChanged(bool pixelsChanged) { m_pixelsChanged = pixelsChanged; }
143 void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { m_requiredPr eviousFrameIndex = previousFrameIndex; } 143 void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { m_requiredPr eviousFrameIndex = previousFrameIndex; }
144 144
145 inline PixelData* getAddr(int x, int y) 145 inline PixelData* getAddr(int x, int y)
146 { 146 {
147 return m_bitmap.getAddr32(x, y); 147 return m_bitmap.getAddr32(x, y);
148 } 148 }
149 149
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 int height() const 196 int height() const
197 { 197 {
198 return m_bitmap.height(); 198 return m_bitmap.height();
199 } 199 }
200 200
201 SkAlphaType computeAlphaType() const; 201 SkAlphaType computeAlphaType() const;
202 202
203 SkBitmap m_bitmap; 203 SkBitmap m_bitmap;
204 SkBitmap::Allocator* m_allocator; 204 sk_sp<SkBitmap::Allocator> m_allocator;
205 bool m_hasAlpha; 205 bool m_hasAlpha;
206 // This will always just be the entire buffer except for GIF or WebP 206 // This will always just be the entire buffer except for GIF or WebP
207 // frames whose original rect was smaller than the overall image size. 207 // frames whose original rect was smaller than the overall image size.
208 IntRect m_originalFrameRect; 208 IntRect m_originalFrameRect;
209 Status m_status; 209 Status m_status;
210 unsigned m_duration; 210 unsigned m_duration;
211 DisposalMethod m_disposalMethod; 211 DisposalMethod m_disposalMethod;
212 AlphaBlendSource m_alphaBlendSource; 212 AlphaBlendSource m_alphaBlendSource;
213 bool m_premultiplyAlpha; 213 bool m_premultiplyAlpha;
214 // True if the pixels changed, but the bitmap has not yet been notified. 214 // True if the pixels changed, but the bitmap has not yet been notified.
215 bool m_pixelsChanged; 215 bool m_pixelsChanged;
216 216
217 // The frame that must be decoded before this frame can be decoded. 217 // The frame that must be decoded before this frame can be decoded.
218 // WTF::kNotFound if this frame doesn't require any previous frame. 218 // WTF::kNotFound if this frame doesn't require any previous frame.
219 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never 219 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never
220 // be read for image formats that do not have multiple frames. 220 // be read for image formats that do not have multiple frames.
221 size_t m_requiredPreviousFrameIndex; 221 size_t m_requiredPreviousFrameIndex;
222 }; 222 };
223 223
224 } // namespace blink 224 } // namespace blink
225 225
226 #endif 226 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698