Changeset 71185 in webkit


Ignore:
Timestamp:
Nov 2, 2010 4:25:00 PM (13 years ago)
Author:
zmo@google.com
Message:

2010-11-01 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
https://bugs.webkit.org/show_bug.cgi?id=48674

Test: fast/canvas/webgl/webgl-specific.html

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::blendFunc): (WebCore::WebGLRenderingContext::blendFuncSeparate):
  • html/canvas/WebGLRenderingContext.h: (WebCore::WebGLRenderingContext::validateBlendFuncFactors): Helper function to do the checking.

2010-11-01 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
https://bugs.webkit.org/show_bug.cgi?id=48674

  • fast/canvas/webgl/webgl-specific-expected.txt: Added.
  • fast/canvas/webgl/webgl-specific.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r71184 r71185  
     12010-11-01  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
     6        https://bugs.webkit.org/show_bug.cgi?id=48674
     7
     8        * fast/canvas/webgl/webgl-specific-expected.txt: Added.
     9        * fast/canvas/webgl/webgl-specific.html: Added.
     10
    1112010-11-02  Dmitry Titov  <dimich@chromium.org>
    212
  • trunk/WebCore/ChangeLog

    r71182 r71185  
     12010-11-01  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
     6        https://bugs.webkit.org/show_bug.cgi?id=48674
     7
     8        Test: fast/canvas/webgl/webgl-specific.html
     9
     10        * html/canvas/WebGLRenderingContext.cpp:
     11        (WebCore::WebGLRenderingContext::blendFunc):
     12        (WebCore::WebGLRenderingContext::blendFuncSeparate):
     13        * html/canvas/WebGLRenderingContext.h:
     14        (WebCore::WebGLRenderingContext::validateBlendFuncFactors): Helper function to do the checking.
     15
    1162010-11-02  Simon Fraser  <simon.fraser@apple.com>
    217
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r71164 r71185  
    354354void WebGLRenderingContext::blendFunc(unsigned long sfactor, unsigned long dfactor)
    355355{
     356    if (!validateBlendFuncFactors(sfactor, dfactor))
     357        return;
    356358    m_context->blendFunc(sfactor, dfactor);
    357359    cleanupAfterGraphicsCall(false);
     
    360362void WebGLRenderingContext::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha)
    361363{
     364    if (!validateBlendFuncFactors(srcRGB, dstRGB))
     365        return;
    362366    m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    363367    cleanupAfterGraphicsCall(false);
     
    33943398}
    33953399
     3400bool WebGLRenderingContext::validateBlendFuncFactors(unsigned long src, unsigned long dst)
     3401{
     3402    if (((src == GraphicsContext3D::CONSTANT_COLOR || src == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
     3403         && (dst == GraphicsContext3D::CONSTANT_ALPHA || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))
     3404        || ((dst == GraphicsContext3D::CONSTANT_COLOR || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
     3405            && (src == GraphicsContext3D::CONSTANT_ALPHA || src == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))) {
     3406        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     3407        return false;
     3408    }
     3409    return true;
     3410}
     3411
    33963412bool WebGLRenderingContext::validateCapability(unsigned long cap)
    33973413{
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r70661 r71185  
    496496    bool validateBlendEquation(unsigned long);
    497497
     498    // Helper function to validate blend func factors.
     499    bool validateBlendFuncFactors(unsigned long src, unsigned long dst);
     500
    498501    // Helper function to validate a GL capability.
    499502    bool validateCapability(unsigned long);
Note: See TracChangeset for help on using the changeset viewer.