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

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

Issue 2749703002: Refactor ImageFrame::setSizeAndColorSpace() (Closed)
Patch Set: Moving to another CR the separation of zeroing pixel data from setting alpha Created 3 years, 9 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 DCHECK_LT(startX, width()); 111 DCHECK_LT(startX, width());
112 DCHECK_LE(endX, width()); 112 DCHECK_LE(endX, width());
113 DCHECK_LT(startY, height()); 113 DCHECK_LT(startY, height());
114 DCHECK_LE(endY, height()); 114 DCHECK_LE(endY, height());
115 const int rowBytes = (endX - startX) * sizeof(PixelData); 115 const int rowBytes = (endX - startX) * sizeof(PixelData);
116 const PixelData* const startAddr = getAddr(startX, startY); 116 const PixelData* const startAddr = getAddr(startX, startY);
117 for (int destY = startY + 1; destY < endY; ++destY) 117 for (int destY = startY + 1; destY < endY; ++destY)
118 memcpy(getAddr(startX, destY), startAddr, rowBytes); 118 memcpy(getAddr(startX, destY), startAddr, rowBytes);
119 } 119 }
120 120
121 // Allocates space for the pixel data. Must be called before any pixels 121 // Allocates space for the pixel data. Must be called before any pixels are
122 // are written. Must only be called once. The specified color space may 122 // written, and should only be called once. The specified color space may be
123 // be nullptr if and only if color correct rendering is enabled. Returns 123 // null if and only if color correct rendering is enabled. Returns true if the
124 // whether allocation succeeded. 124 // allocation succeeded.
125 bool setSizeAndColorSpace(int newWidth, int newHeight, sk_sp<SkColorSpace>); 125 bool allocatePixelData(int newWidth, int newHeight, sk_sp<SkColorSpace>);
126 126
127 bool hasAlpha() const; 127 bool hasAlpha() const;
128 const IntRect& originalFrameRect() const { return m_originalFrameRect; } 128 const IntRect& originalFrameRect() const { return m_originalFrameRect; }
129 Status getStatus() const { return m_status; } 129 Status getStatus() const { return m_status; }
130 unsigned duration() const { return m_duration; } 130 unsigned duration() const { return m_duration; }
131 DisposalMethod getDisposalMethod() const { return m_disposalMethod; } 131 DisposalMethod getDisposalMethod() const { return m_disposalMethod; }
132 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; } 132 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; }
133 bool premultiplyAlpha() const { return m_premultiplyAlpha; } 133 bool premultiplyAlpha() const { return m_premultiplyAlpha; }
134 SkBitmap::Allocator* allocator() const { return m_allocator; } 134 SkBitmap::Allocator* allocator() const { return m_allocator; }
135 135
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // The frame that must be decoded before this frame can be decoded. 292 // The frame that must be decoded before this frame can be decoded.
293 // WTF::kNotFound if this frame doesn't require any previous frame. 293 // WTF::kNotFound if this frame doesn't require any previous frame.
294 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never 294 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never
295 // be read for image formats that do not have multiple frames. 295 // be read for image formats that do not have multiple frames.
296 size_t m_requiredPreviousFrameIndex; 296 size_t m_requiredPreviousFrameIndex;
297 }; 297 };
298 298
299 } // namespace blink 299 } // namespace blink
300 300
301 #endif 301 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698