Changeset 55283 in webkit
- Timestamp:
- Feb 26, 2010 7:48:59 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55282 r55283 1 2010-02-26 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by David Levin. 4 5 texImage2D and texSubImage2D taking ImageData ignore flipY and premultiplyAlpha 6 https://bugs.webkit.org/show_bug.cgi?id=34459 7 8 * fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data-expected.txt: Added. 9 * fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html: Added. 10 1 11 2010-02-26 Zhenyao Mo <zmo@google.com> 2 12 -
trunk/WebCore/ChangeLog
r55282 r55283 1 2010-02-26 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by David Levin. 4 5 texImage2D and texSubImage2D taking ImageData ignore flipY and premultiplyAlpha 6 https://bugs.webkit.org/show_bug.cgi?id=34459 7 8 Test: fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html 9 10 * html/canvas/WebGLRenderingContext.cpp: 11 (WebCore::WebGLRenderingContext::texImage2D): Apply flipY and premultiplyAlpha to the texture data. 12 (WebCore::WebGLRenderingContext::texSubImage2D): Ditto. 13 * platform/graphics/GraphicsContext3D.cpp: 14 (WebCore::GraphicsContext3D::extractImageData): Extract data from ImageData, applying flipY and premultiplyAlpha. 15 * platform/graphics/GraphicsContext3D.h: Add function extractImageData declaration. 16 1 17 2010-02-26 Zhenyao Mo <zmo@google.com> 2 18 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r55282 r55283 1636 1636 { 1637 1637 // FIXME: For now we ignore any errors returned 1638 // FIXME: Need a form of this call that can take both a pixel buffer and flipY and premultiplyAlpha flags1639 UNUSED_PARAM(flipY);1640 UNUSED_PARAM(premultiplyAlpha);1641 1638 ec = 0; 1642 m_context->texImage2D(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels->data()->data()->data()); 1643 //RLP: m_context->texImage2D(target, level, pixels, flipY, premultiplyAlpha); 1639 Vector<uint8_t> data; 1640 m_context->extractImageData(pixels, flipY, premultiplyAlpha, data); 1641 m_context->texImage2D(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data()); 1644 1642 cleanupAfterGraphicsCall(false); 1645 1643 } … … 1726 1724 { 1727 1725 // FIXME: For now we ignore any errors returned 1728 UNUSED_PARAM(flipY);1729 UNUSED_PARAM(premultiplyAlpha);1730 1726 ec = 0; 1731 m_context->texSubImage2D(target, level, xoffset, yoffset, pixels->width(), pixels->height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels->data()->data()->data()); 1732 //RLP: m_context->texSubImage2D(target, level, xoffset, yoffset, pixels, flipY, premultiplyAlpha); 1727 Vector<uint8_t> data; 1728 m_context->extractImageData(pixels, flipY, premultiplyAlpha, data); 1729 m_context->texSubImage2D(target, level, xoffset, yoffset, pixels->width(), pixels->height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, data.data()); 1733 1730 cleanupAfterGraphicsCall(false); 1734 1731 } -
trunk/WebCore/platform/graphics/GraphicsContext3D.cpp
r54907 r55283 32 32 33 33 #include "Image.h" 34 #include "ImageData.h" 34 35 35 36 namespace WebCore { … … 55 56 alphaOp); 56 57 *internalFormat = (hasAlphaChannel ? RGBA : RGB); 58 return true; 59 } 60 61 bool GraphicsContext3D::extractImageData(ImageData* imageData, 62 bool flipY, 63 bool premultiplyAlpha, 64 Vector<uint8_t>& data) 65 { 66 if (!imageData) 67 return false; 68 int width = imageData->width(); 69 int height = imageData->height(); 70 int dataBytes = width * height * 4; 71 data.resize(dataBytes); 72 uint8_t* dst = data.data(); 73 uint8_t* src = imageData->data()->data()->data(); 74 memcpy(dst, src, dataBytes); 75 processImageData(dst, 76 width, 77 height, 78 flipY, 79 premultiplyAlpha ? kAlphaDoPremultiply : kAlphaDoNothing); 57 80 return true; 58 81 } -
trunk/WebCore/platform/graphics/GraphicsContext3D.h
r55235 r55283 73 73 class WebGLTexture; 74 74 class Image; 75 class ImageData; 75 76 76 77 struct ActiveInfo { … … 446 447 unsigned int* internalFormat); 447 448 449 // Extracts the contents of the given ImageData into the passed 450 // Vector, obeying the flipY and premultiplyAlpha flags. 451 // Returns true upon success. 452 bool extractImageData(ImageData*, 453 bool flipY, 454 bool premultiplyAlpha, 455 Vector<uint8_t>& data); 456 448 457 // Processes the given image data in preparation for uploading 449 458 // via texImage2D or texSubImage2D. The input data must be in
Note: See TracChangeset
for help on using the changeset viewer.