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

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

Issue 2749703002: Refactor ImageFrame::setSizeAndColorSpace() (Closed)
Patch Set: Forgot to update the call sites 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
122 // are written. Must only be called once. The specified color space may 122 // are written. The specified color space may be nullptr if and only if
123 // be nullptr if and only if color correct rendering is enabled. Returns 123 // color correct rendering is enabled. Returns whether allocation succeeded.
124 // whether allocation succeeded. 124 bool allocateBackingStore(int newWidth, int newHeight, sk_sp<SkColorSpace>);
Noel Gordon 2017/03/15 13:42:51 Better, and re-reading the comment here for this A
cblume 2017/03/16 02:29:25 I think allocatePixelData() is a much better name.
Noel Gordon 2017/03/16 11:34:04 I'm good with this part of the change: allocatePix
cblume 2017/03/17 05:35:14 Done.
125 bool setSizeAndColorSpace(int newWidth, int newHeight, sk_sp<SkColorSpace>);
126 125
127 bool hasAlpha() const; 126 bool hasAlpha() const;
128 const IntRect& originalFrameRect() const { return m_originalFrameRect; } 127 const IntRect& originalFrameRect() const { return m_originalFrameRect; }
129 Status getStatus() const { return m_status; } 128 Status getStatus() const { return m_status; }
130 unsigned duration() const { return m_duration; } 129 unsigned duration() const { return m_duration; }
131 DisposalMethod getDisposalMethod() const { return m_disposalMethod; } 130 DisposalMethod getDisposalMethod() const { return m_disposalMethod; }
132 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; } 131 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; }
133 bool premultiplyAlpha() const { return m_premultiplyAlpha; } 132 bool premultiplyAlpha() const { return m_premultiplyAlpha; }
134 SkBitmap::Allocator* allocator() const { return m_allocator; } 133 SkBitmap::Allocator* allocator() const { return m_allocator; }
135 134
(...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. 291 // The frame that must be decoded before this frame can be decoded.
293 // WTF::kNotFound if this frame doesn't require any previous frame. 292 // WTF::kNotFound if this frame doesn't require any previous frame.
294 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never 293 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never
295 // be read for image formats that do not have multiple frames. 294 // be read for image formats that do not have multiple frames.
296 size_t m_requiredPreviousFrameIndex; 295 size_t m_requiredPreviousFrameIndex;
297 }; 296 };
298 297
299 } // namespace blink 298 } // namespace blink
300 299
301 #endif 300 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698