| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // Packs the contents of the given Image, which is passed in |pixels|, into | 209 // Packs the contents of the given Image, which is passed in |pixels|, into |
| 210 // the passed Vector according to the given format and type, and obeying the | 210 // the passed Vector according to the given format and type, and obeying the |
| 211 // flipY and AlphaOp flags. Returns true upon success. | 211 // flipY and AlphaOp flags. Returns true upon success. |
| 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 width, | 219 unsigned sourceImageWidth, |
| 220 unsigned height, | 220 unsigned sourceImageHeight, |
| 221 const IntRect& sourceImageSubRectangle, |
| 221 unsigned sourceUnpackAlignment, | 222 unsigned sourceUnpackAlignment, |
| 222 Vector<uint8_t>& data); | 223 Vector<uint8_t>& data); |
| 223 | 224 |
| 224 // Extracts the contents of the given ImageData into the passed Vector, | 225 // Extracts the contents of the given ImageData into the passed Vector, |
| 225 // packing the pixel data according to the given format and type, | 226 // packing the pixel data according to the given format and type, |
| 226 // and obeying the flipY and premultiplyAlpha flags. Returns true | 227 // and obeying the flipY and premultiplyAlpha flags. Returns true |
| 227 // upon success. | 228 // upon success. |
| 228 static bool extractImageData(const uint8_t*, | 229 static bool extractImageData(const uint8_t*, |
| 229 DataFormat sourceDataFormat, | 230 DataFormat sourceDataFormat, |
| 230 const IntSize&, | 231 const IntSize&, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 254 private: | 255 private: |
| 255 friend class WebGLImageConversionTest; | 256 friend class WebGLImageConversionTest; |
| 256 // Helper for packImageData/extractImageData/extractTextureData, which | 257 // Helper for packImageData/extractImageData/extractTextureData, which |
| 257 // implement packing of pixel data into the specified OpenGL destination | 258 // implement packing of pixel data into the specified OpenGL destination |
| 258 // format and type. A sourceUnpackAlignment of zero indicates that the source | 259 // format and type. A sourceUnpackAlignment of zero indicates that the source |
| 259 // data is tightly packed. Non-zero values may take a slow path. Destination | 260 // data is tightly packed. Non-zero values may take a slow path. Destination |
| 260 // data will have no gaps between rows. Implemented in | 261 // data will have no gaps between rows. Implemented in |
| 261 // GraphicsContext3DImagePacking.cpp. | 262 // GraphicsContext3DImagePacking.cpp. |
| 262 static bool packPixels(const uint8_t* sourceData, | 263 static bool packPixels(const uint8_t* sourceData, |
| 263 DataFormat sourceDataFormat, | 264 DataFormat sourceDataFormat, |
| 264 unsigned width, | 265 unsigned sourceDataWidth, |
| 265 unsigned height, | 266 unsigned sourceDataHeight, |
| 267 const IntRect& sourceDataSubRectangle, |
| 266 unsigned sourceUnpackAlignment, | 268 unsigned sourceUnpackAlignment, |
| 267 unsigned destinationFormat, | 269 unsigned destinationFormat, |
| 268 unsigned destinationType, | 270 unsigned destinationType, |
| 269 AlphaOp, | 271 AlphaOp, |
| 270 void* destinationData, | 272 void* destinationData, |
| 271 bool flipY); | 273 bool flipY); |
| 272 static void unpackPixels(const uint16_t* sourceData, | 274 static void unpackPixels(const uint16_t* sourceData, |
| 273 DataFormat sourceDataFormat, | 275 DataFormat sourceDataFormat, |
| 274 unsigned pixelsPerRow, | 276 unsigned pixelsPerRow, |
| 275 uint8_t* destinationData); | 277 uint8_t* destinationData); |
| 276 static void packPixels(const uint8_t* sourceData, | 278 static void packPixels(const uint8_t* sourceData, |
| 277 DataFormat sourceDataFormat, | 279 DataFormat sourceDataFormat, |
| 278 unsigned pixelsPerRow, | 280 unsigned pixelsPerRow, |
| 279 uint8_t* destinationData); | 281 uint8_t* destinationData); |
| 280 }; | 282 }; |
| 281 | 283 |
| 282 } // namespace blink | 284 } // namespace blink |
| 283 | 285 |
| 284 #endif // WebGLImageConversion_h | 286 #endif // WebGLImageConversion_h |
| OLD | NEW |