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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h

Issue 2391943002: Rewrap comments to 80 columns in platform/graphics/{compositing,cpu,gpu,skia}/. (Closed)
Patch Set: One space Created 4 years, 2 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WebGLImageConversion_h 5 #ifndef WebGLImageConversion_h
6 #define WebGLImageConversion_h 6 #define WebGLImageConversion_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/graphics/Image.h" 9 #include "platform/graphics/Image.h"
10 #include "platform/graphics/skia/ImagePixelLocker.h" 10 #include "platform/graphics/skia/ImagePixelLocker.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 unsigned imageWidth() { return m_imageWidth; } 143 unsigned imageWidth() { return m_imageWidth; }
144 unsigned imageHeight() { return m_imageHeight; } 144 unsigned imageHeight() { return m_imageHeight; }
145 DataFormat imageSourceFormat() { return m_imageSourceFormat; } 145 DataFormat imageSourceFormat() { return m_imageSourceFormat; }
146 AlphaOp imageAlphaOp() { return m_alphaOp; } 146 AlphaOp imageAlphaOp() { return m_alphaOp; }
147 unsigned imageSourceUnpackAlignment() { 147 unsigned imageSourceUnpackAlignment() {
148 return m_imageSourceUnpackAlignment; 148 return m_imageSourceUnpackAlignment;
149 } 149 }
150 150
151 private: 151 private:
152 // Extract the image and keeps track of its status, such as width, height, S ource Alignment, 152 // Extracts the image and keeps track of its status, such as width, height,
153 // format and AlphaOp etc. This needs to lock the resources or relevant data if needed. 153 // Source Alignment, format, AlphaOp, etc. This needs to lock the resources
154 // or relevant data if needed.
154 void extractImage(bool premultiplyAlpha, bool ignoreGammaAndColorProfile); 155 void extractImage(bool premultiplyAlpha, bool ignoreGammaAndColorProfile);
155 156
156 Image* m_image; 157 Image* m_image;
157 Optional<ImagePixelLocker> m_imagePixelLocker; 158 Optional<ImagePixelLocker> m_imagePixelLocker;
158 ImageHtmlDomSource m_imageHtmlDomSource; 159 ImageHtmlDomSource m_imageHtmlDomSource;
159 unsigned m_imageWidth; 160 unsigned m_imageWidth;
160 unsigned m_imageHeight; 161 unsigned m_imageHeight;
161 DataFormat m_imageSourceFormat; 162 DataFormat m_imageSourceFormat;
162 AlphaOp m_alphaOp; 163 AlphaOp m_alphaOp;
163 unsigned m_imageSourceUnpackAlignment; 164 unsigned m_imageSourceUnpackAlignment;
(...skipping 20 matching lines...) Expand all
184 static GLenum computeImageSizeInBytes(GLenum format, 185 static GLenum computeImageSizeInBytes(GLenum format,
185 GLenum type, 186 GLenum type,
186 GLsizei width, 187 GLsizei width,
187 GLsizei height, 188 GLsizei height,
188 GLsizei depth, 189 GLsizei depth,
189 const PixelStoreParams&, 190 const PixelStoreParams&,
190 unsigned* imageSizeInBytes, 191 unsigned* imageSizeInBytes,
191 unsigned* paddingInBytes, 192 unsigned* paddingInBytes,
192 unsigned* skipSizeInBytes); 193 unsigned* skipSizeInBytes);
193 194
194 // Check if the format is one of the formats from the ImageData or DOM element s. 195 // Check if the format is one of the formats from the ImageData or DOM
195 // The formats from ImageData is always RGBA8. 196 // elements. The format from ImageData is always RGBA8. The formats from DOM
196 // The formats from DOM elements vary with Graphics ports. It can only be RGBA 8 or BGRA8. 197 // elements vary with Graphics ports, but can only be RGBA8 or BGRA8.
197 static ALWAYS_INLINE bool srcFormatComeFromDOMElementOrImageData( 198 static ALWAYS_INLINE bool srcFormatComeFromDOMElementOrImageData(
198 DataFormat SrcFormat) { 199 DataFormat SrcFormat) {
199 return SrcFormat == DataFormatBGRA8 || SrcFormat == DataFormatRGBA8; 200 return SrcFormat == DataFormatBGRA8 || SrcFormat == DataFormatRGBA8;
200 } 201 }
201 202
202 // The input can be either format or internalformat. 203 // The input can be either format or internalformat.
203 static unsigned getChannelBitsByFormat(GLenum); 204 static unsigned getChannelBitsByFormat(GLenum);
204 205
205 // The Following functions are implemented in GraphicsContext3DImagePacking.cp p 206 // The Following functions are implemented in
207 // GraphicsContext3DImagePacking.cpp.
206 208
207 // Packs the contents of the given Image which is passed in |pixels| into the passed Vector 209 // Packs the contents of the given Image, which is passed in |pixels|, into
208 // according to the given format and type, and obeying the flipY and AlphaOp f lags. 210 // the passed Vector according to the given format and type, and obeying the
209 // Returns true upon success. 211 // flipY and AlphaOp flags. Returns true upon success.
210 static bool packImageData(Image*, 212 static bool packImageData(Image*,
211 const void* pixels, 213 const void* pixels,
212 GLenum format, 214 GLenum format,
213 GLenum type, 215 GLenum type,
214 bool flipY, 216 bool flipY,
215 AlphaOp, 217 AlphaOp,
216 DataFormat sourceFormat, 218 DataFormat sourceFormat,
217 unsigned width, 219 unsigned width,
218 unsigned height, 220 unsigned height,
219 unsigned sourceUnpackAlignment, 221 unsigned sourceUnpackAlignment,
(...skipping 24 matching lines...) Expand all
244 unsigned unpackAlignment, 246 unsigned unpackAlignment,
245 bool flipY, 247 bool flipY,
246 bool premultiplyAlpha, 248 bool premultiplyAlpha,
247 const void* pixels, 249 const void* pixels,
248 Vector<uint8_t>& data); 250 Vector<uint8_t>& data);
249 251
250 // End GraphicsContext3DImagePacking.cpp functions 252 // End GraphicsContext3DImagePacking.cpp functions
251 253
252 private: 254 private:
253 friend class WebGLImageConversionTest; 255 friend class WebGLImageConversionTest;
254 // Helper for packImageData/extractImageData/extractTextureData which implemen t packing of pixel 256 // Helper for packImageData/extractImageData/extractTextureData, which
255 // data into the specified OpenGL destination format and type. 257 // implement packing of pixel data into the specified OpenGL destination
256 // A sourceUnpackAlignment of zero indicates that the source 258 // format and type. A sourceUnpackAlignment of zero indicates that the source
257 // data is tightly packed. Non-zero values may take a slow path. 259 // data is tightly packed. Non-zero values may take a slow path. Destination
258 // Destination data will have no gaps between rows. 260 // data will have no gaps between rows. Implemented in
259 // Implemented in GraphicsContext3DImagePacking.cpp 261 // GraphicsContext3DImagePacking.cpp.
260 static bool packPixels(const uint8_t* sourceData, 262 static bool packPixels(const uint8_t* sourceData,
261 DataFormat sourceDataFormat, 263 DataFormat sourceDataFormat,
262 unsigned width, 264 unsigned width,
263 unsigned height, 265 unsigned height,
264 unsigned sourceUnpackAlignment, 266 unsigned sourceUnpackAlignment,
265 unsigned destinationFormat, 267 unsigned destinationFormat,
266 unsigned destinationType, 268 unsigned destinationType,
267 AlphaOp, 269 AlphaOp,
268 void* destinationData, 270 void* destinationData,
269 bool flipY); 271 bool flipY);
270 static void unpackPixels(const uint16_t* sourceData, 272 static void unpackPixels(const uint16_t* sourceData,
271 DataFormat sourceDataFormat, 273 DataFormat sourceDataFormat,
272 unsigned pixelsPerRow, 274 unsigned pixelsPerRow,
273 uint8_t* destinationData); 275 uint8_t* destinationData);
274 static void packPixels(const uint8_t* sourceData, 276 static void packPixels(const uint8_t* sourceData,
275 DataFormat sourceDataFormat, 277 DataFormat sourceDataFormat,
276 unsigned pixelsPerRow, 278 unsigned pixelsPerRow,
277 uint8_t* destinationData); 279 uint8_t* destinationData);
278 }; 280 };
279 281
280 } // namespace blink 282 } // namespace blink
281 283
282 #endif // WebGLImageConversion_h 284 #endif // WebGLImageConversion_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698