| OLD | NEW |
| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 static bool packImageData(Image*, | 212 static bool packImageData(Image*, |
| 213 const void* pixels, | 213 const void* pixels, |
| 214 GLenum format, | 214 GLenum format, |
| 215 GLenum type, | 215 GLenum type, |
| 216 bool flipY, | 216 bool flipY, |
| 217 AlphaOp, | 217 AlphaOp, |
| 218 DataFormat sourceFormat, | 218 DataFormat sourceFormat, |
| 219 unsigned sourceImageWidth, | 219 unsigned sourceImageWidth, |
| 220 unsigned sourceImageHeight, | 220 unsigned sourceImageHeight, |
| 221 const IntRect& sourceImageSubRectangle, | 221 const IntRect& sourceImageSubRectangle, |
| 222 int depth, |
| 222 unsigned sourceUnpackAlignment, | 223 unsigned sourceUnpackAlignment, |
| 224 int unpackImageHeight, |
| 223 Vector<uint8_t>& data); | 225 Vector<uint8_t>& data); |
| 224 | 226 |
| 225 // Extracts the contents of the given ImageData into the passed Vector, | 227 // Extracts the contents of the given ImageData into the passed Vector, |
| 226 // packing the pixel data according to the given format and type, | 228 // packing the pixel data according to the given format and type, |
| 227 // and obeying the flipY and premultiplyAlpha flags. Returns true | 229 // and obeying the flipY and premultiplyAlpha flags. Returns true |
| 228 // upon success. | 230 // upon success. |
| 229 static bool extractImageData(const uint8_t*, | 231 static bool extractImageData(const uint8_t* imageData, |
| 230 DataFormat sourceDataFormat, | 232 DataFormat sourceDataFormat, |
| 231 const IntSize&, | 233 const IntSize& imageDataSize, |
| 232 const IntRect&, | 234 const IntRect& sourceImageSubRectangle, |
| 235 int depth, |
| 236 int unpackImageHeight, |
| 233 GLenum format, | 237 GLenum format, |
| 234 GLenum type, | 238 GLenum type, |
| 235 bool flipY, | 239 bool flipY, |
| 236 bool premultiplyAlpha, | 240 bool premultiplyAlpha, |
| 237 Vector<uint8_t>& data); | 241 Vector<uint8_t>& data); |
| 238 | 242 |
| 239 // Helper function which extracts the user-supplied texture | 243 // Helper function which extracts the user-supplied texture |
| 240 // data, applying the flipY and premultiplyAlpha parameters. | 244 // data, applying the flipY and premultiplyAlpha parameters. |
| 241 // If the data is not tightly packed according to the passed | 245 // If the data is not tightly packed according to the passed |
| 242 // unpackAlignment, the output data will be tightly packed. | 246 // unpackAlignment, the output data will be tightly packed. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 259 // implement packing of pixel data into the specified OpenGL destination | 263 // implement packing of pixel data into the specified OpenGL destination |
| 260 // format and type. A sourceUnpackAlignment of zero indicates that the source | 264 // format and type. A sourceUnpackAlignment of zero indicates that the source |
| 261 // data is tightly packed. Non-zero values may take a slow path. Destination | 265 // data is tightly packed. Non-zero values may take a slow path. Destination |
| 262 // data will have no gaps between rows. Implemented in | 266 // data will have no gaps between rows. Implemented in |
| 263 // GraphicsContext3DImagePacking.cpp. | 267 // GraphicsContext3DImagePacking.cpp. |
| 264 static bool packPixels(const uint8_t* sourceData, | 268 static bool packPixels(const uint8_t* sourceData, |
| 265 DataFormat sourceDataFormat, | 269 DataFormat sourceDataFormat, |
| 266 unsigned sourceDataWidth, | 270 unsigned sourceDataWidth, |
| 267 unsigned sourceDataHeight, | 271 unsigned sourceDataHeight, |
| 268 const IntRect& sourceDataSubRectangle, | 272 const IntRect& sourceDataSubRectangle, |
| 273 int depth, |
| 269 unsigned sourceUnpackAlignment, | 274 unsigned sourceUnpackAlignment, |
| 275 int unpackImageHeight, |
| 270 unsigned destinationFormat, | 276 unsigned destinationFormat, |
| 271 unsigned destinationType, | 277 unsigned destinationType, |
| 272 AlphaOp, | 278 AlphaOp, |
| 273 void* destinationData, | 279 void* destinationData, |
| 274 bool flipY); | 280 bool flipY); |
| 275 static void unpackPixels(const uint16_t* sourceData, | 281 static void unpackPixels(const uint16_t* sourceData, |
| 276 DataFormat sourceDataFormat, | 282 DataFormat sourceDataFormat, |
| 277 unsigned pixelsPerRow, | 283 unsigned pixelsPerRow, |
| 278 uint8_t* destinationData); | 284 uint8_t* destinationData); |
| 279 static void packPixels(const uint8_t* sourceData, | 285 static void packPixels(const uint8_t* sourceData, |
| 280 DataFormat sourceDataFormat, | 286 DataFormat sourceDataFormat, |
| 281 unsigned pixelsPerRow, | 287 unsigned pixelsPerRow, |
| 282 uint8_t* destinationData); | 288 uint8_t* destinationData); |
| 283 }; | 289 }; |
| 284 | 290 |
| 285 } // namespace blink | 291 } // namespace blink |
| 286 | 292 |
| 287 #endif // WebGLImageConversion_h | 293 #endif // WebGLImageConversion_h |
| OLD | NEW |