| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 // Packs the contents of the given Image which is passed in |pixels| into th
e passed Vector | 187 // Packs the contents of the given Image which is passed in |pixels| into th
e passed Vector |
| 188 // according to the given format and type, and obeying the flipY and AlphaOp
flags. | 188 // according to the given format and type, and obeying the flipY and AlphaOp
flags. |
| 189 // Returns true upon success. | 189 // Returns true upon success. |
| 190 static bool packImageData(Image*, const void* pixels, GLenum format, GLenum
type, bool flipY, AlphaOp, DataFormat sourceFormat, unsigned width, unsigned hei
ght, unsigned sourceUnpackAlignment, Vector<uint8_t>& data); | 190 static bool packImageData(Image*, const void* pixels, GLenum format, GLenum
type, bool flipY, AlphaOp, DataFormat sourceFormat, unsigned width, unsigned hei
ght, unsigned sourceUnpackAlignment, Vector<uint8_t>& data); |
| 191 | 191 |
| 192 // Extracts the contents of the given ImageData into the passed Vector, | 192 // Extracts the contents of the given ImageData into the passed Vector, |
| 193 // packing the pixel data according to the given format and type, | 193 // packing the pixel data according to the given format and type, |
| 194 // and obeying the flipY and premultiplyAlpha flags. Returns true | 194 // and obeying the flipY and premultiplyAlpha flags. Returns true |
| 195 // upon success. | 195 // upon success. |
| 196 static bool extractImageData(const uint8_t*, const IntSize&, GLenum format,
GLenum type, bool flipY, bool premultiplyAlpha, Vector<uint8_t>& data); | 196 static bool extractImageData(const uint8_t*, DataFormat sourceDataFormat, co
nst IntSize&, GLenum format, GLenum type, bool flipY, bool premultiplyAlpha, Vec
tor<uint8_t>& data); |
| 197 | 197 |
| 198 // Helper function which extracts the user-supplied texture | 198 // Helper function which extracts the user-supplied texture |
| 199 // data, applying the flipY and premultiplyAlpha parameters. | 199 // data, applying the flipY and premultiplyAlpha parameters. |
| 200 // If the data is not tightly packed according to the passed | 200 // If the data is not tightly packed according to the passed |
| 201 // unpackAlignment, the output data will be tightly packed. | 201 // unpackAlignment, the output data will be tightly packed. |
| 202 // Returns true if successful, false if any error occurred. | 202 // Returns true if successful, false if any error occurred. |
| 203 static bool extractTextureData(unsigned width, unsigned height, GLenum forma
t, GLenum type, unsigned unpackAlignment, bool flipY, bool premultiplyAlpha, con
st void* pixels, Vector<uint8_t>& data); | 203 static bool extractTextureData(unsigned width, unsigned height, GLenum forma
t, GLenum type, unsigned unpackAlignment, bool flipY, bool premultiplyAlpha, con
st void* pixels, Vector<uint8_t>& data); |
| 204 | 204 |
| 205 // End GraphicsContext3DImagePacking.cpp functions | 205 // End GraphicsContext3DImagePacking.cpp functions |
| 206 | 206 |
| 207 private: | 207 private: |
| 208 // Helper for packImageData/extractImageData/extractTextureData which implem
ent packing of pixel | 208 // Helper for packImageData/extractImageData/extractTextureData which implem
ent packing of pixel |
| 209 // data into the specified OpenGL destination format and type. | 209 // data into the specified OpenGL destination format and type. |
| 210 // A sourceUnpackAlignment of zero indicates that the source | 210 // A sourceUnpackAlignment of zero indicates that the source |
| 211 // data is tightly packed. Non-zero values may take a slow path. | 211 // data is tightly packed. Non-zero values may take a slow path. |
| 212 // Destination data will have no gaps between rows. | 212 // Destination data will have no gaps between rows. |
| 213 // Implemented in GraphicsContext3DImagePacking.cpp | 213 // Implemented in GraphicsContext3DImagePacking.cpp |
| 214 static bool packPixels(const uint8_t* sourceData, DataFormat sourceDataForma
t, unsigned width, unsigned height, unsigned sourceUnpackAlignment, unsigned des
tinationFormat, unsigned destinationType, AlphaOp, void* destinationData, bool f
lipY); | 214 static bool packPixels(const uint8_t* sourceData, DataFormat sourceDataForma
t, unsigned width, unsigned height, unsigned sourceUnpackAlignment, unsigned des
tinationFormat, unsigned destinationType, AlphaOp, void* destinationData, bool f
lipY); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| 218 | 218 |
| 219 #endif // WebGLImageConversion_h | 219 #endif // WebGLImageConversion_h |
| OLD | NEW |