2011-03-15 John Bauman <jbauman@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 03:26:48 +0000 (03:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 03:26:48 +0000 (03:26 +0000)
commitebf71b0f578438ec46896d776adc5dca625ff1cc
tree646963ce2b19f85f8bf1410c71ef4c67be1c687a
parentb201b70bc92fdc963cac81aa7f0f8daf0295f695
2011-03-15  John Bauman  <jbauman@chromium.org>

        Reviewed by Kenneth Russell.

        Non-premultiplied-alpha canvas attribute is ignore for toDataURL, drawImage, texImage2D
        https://bugs.webkit.org/show_bug.cgi?id=56238

        Add new test from webgl conformance test.

        * fast/canvas/webgl/premultiplyalpha-test-expected.txt: Added.
        * fast/canvas/webgl/premultiplyalpha-test.html: Added.
        * fast/canvas/webgl/resources/webgl-test-utils.js: Update to fix fillTexture
        (WebGLTestUtils):
        * platform/chromium/test_expectations.txt:
        * platform/mac-wk2/Skipped:
2011-03-15  John Bauman  <jbauman@chromium.org>

        Reviewed by Kenneth Russell.

        Non-premultiplied-alpha canvas attribute is ignore for toDataURL, drawImage, texImage2D
        https://bugs.webkit.org/show_bug.cgi?id=56238

       Attempt to get an ImageData (non-premultiplied) from a WebGL canvas
       instead of getting an ImageBuffer, so there's a chance the data can be
       passed straight through to the consumer with no premultiplication
       necessary. Fixes Chromium and Safari.

        Test: fast/canvas/webgl/premultiplyalpha-test.html

        * html/HTMLCanvasElement.cpp:
        (WebCore::HTMLCanvasElement::toDataURL):
        (WebCore::HTMLCanvasElement::getImageData):
        * html/HTMLCanvasElement.h:
        * html/canvas/WebGLRenderingContext.cpp:
        (WebCore::WebGLRenderingContext::paintRenderingResultsToImageData):
        (WebCore::WebGLRenderingContext::texImage2D):
        (WebCore::WebGLRenderingContext::texSubImage2D):
        * html/canvas/WebGLRenderingContext.h:
        * platform/graphics/GraphicsContext3D.h:
        * platform/graphics/ImageBuffer.h:
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::CGImageToDataURL):
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageDataToDataURL):
        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
        (WebCore::GraphicsContext3D::validateAttributes):
        (WebCore::GraphicsContext3D::readRenderingResults):
        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
        (WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
        * platform/graphics/qt/GraphicsContext3DQt.cpp:
        (WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
        * platform/graphics/skia/ImageBufferSkia.cpp:
        (WebCore::ImageToDataURL):
        (WebCore::ImageBuffer::toDataURL):
        (WebCore::ImageDataToDataURL):
        * platform/image-encoders/skia/JPEGImageEncoder.cpp:
        (WebCore::preMultipliedBGRAtoRGB):
        (WebCore::RGBAtoRGB):
        (WebCore::encodePixels):
        (WebCore::JPEGImageEncoder::encode):
        * platform/image-encoders/skia/JPEGImageEncoder.h:
        * platform/image-encoders/skia/PNGImageEncoder.cpp:
        (WebCore::preMultipliedBGRAtoRGBA):
        (WebCore::encodePixels):
        (WebCore::PNGImageEncoder::encode):
        * platform/image-encoders/skia/PNGImageEncoder.h:
2011-03-15  John Bauman  <jbauman@chromium.org>

        Reviewed by Kenneth Russell.

        Non-premultiplied-alpha canvas attribute is ignore for toDataURL, drawImage, texImage2D
        https://bugs.webkit.org/show_bug.cgi?id=56238

        Add support for reading a webgl context into an ImageData.

        * src/GraphicsContext3DChromium.cpp:
        (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas):
        (WebCore::GraphicsContext3DInternal::paintRenderingResultsToImageData):
        * src/GraphicsContext3DInternal.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/premultiplyalpha-test-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/premultiplyalpha-test.html [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/resources/webgl-test-utils.js
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/mac-wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.h
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp
Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.h
Source/WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp
Source/WebCore/platform/image-encoders/skia/PNGImageEncoder.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
Source/WebKit/chromium/src/GraphicsContext3DInternal.h