Changeset 61910 in webkit


Ignore:
Timestamp:
Jun 25, 2010 3:47:09 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-06-25 Zhenyao Mo <zmo@google.com>

Reviewed by Dimitri Glazkov.

getParameter(COLOR_WRITEMASK) needs to return Array
https://bugs.webkit.org/show_bug.cgi?id=40437

  • fast/canvas/webgl/gl-get-calls-expected.txt: getParameter(COLOR_WRITEMASK) returns bool array.
  • fast/canvas/webgl/gl-get-calls.html: Ditto.

2010-06-25 Zhenyao Mo <zmo@google.com>

Reviewed by Dimitri Glazkov.

getParameter(COLOR_WRITEMASK) needs to return Array
https://bugs.webkit.org/show_bug.cgi?id=40437

  • bindings/js/JSWebGLRenderingContextCustom.cpp: Handling bool array. (WebCore::toJS):
  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: Handling bool array. (WebCore::toV8Object):
  • html/canvas/WebGLGetInfo.cpp: Handling bool array. (WebCore::WebGLGetInfo::WebGLGetInfo): (WebCore::WebGLGetInfo::getBoolArray):
  • html/canvas/WebGLGetInfo.h: Handling bool array. (WebCore::WebGLGetInfo::):
  • html/canvas/WebGLRenderingContext.cpp: Handling bool array. (WebCore::WebGLRenderingContext::getParameter): (WebCore::WebGLRenderingContext::getBooleanArrayParameter):
  • html/canvas/WebGLRenderingContext.h: Handling bool array.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61900 r61910  
     12010-06-25  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        getParameter(COLOR_WRITEMASK) needs to return Array
     6        https://bugs.webkit.org/show_bug.cgi?id=40437
     7
     8        * fast/canvas/webgl/gl-get-calls-expected.txt: getParameter(COLOR_WRITEMASK) returns bool array.
     9        * fast/canvas/webgl/gl-get-calls.html: Ditto.
     10
    1112010-06-25  Alpha Lam  <hclam@chromium.org>
    212
  • trunk/LayoutTests/fast/canvas/webgl/gl-get-calls-expected.txt

    r61046 r61910  
    2727PASS context.getParameter(context.BLEND_SRC_RGB) is 1
    2828PASS context.getParameter(context.COLOR_CLEAR_VALUE) is [0, 0, 0, 0]
    29 PASS context.getParameter(context.COLOR_WRITEMASK) is [1, 1, 1, 1]
     29PASS context.getParameter(context.COLOR_WRITEMASK) is [true, true, true, true]
    3030PASS context.getParameter(context.CULL_FACE) is false
    3131PASS context.getParameter(context.CULL_FACE_MODE) is context.BACK
  • trunk/LayoutTests/fast/canvas/webgl/gl-get-calls.html

    r61046 r61910  
    5252    shouldBe('context.getParameter(context.BLEND_SRC_RGB)', '1');
    5353    shouldBe('context.getParameter(context.COLOR_CLEAR_VALUE)', '[0, 0, 0, 0]');
    54     shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[1, 1, 1, 1]');
     54    shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[true, true, true, true]');
    5555    shouldBe('context.getParameter(context.CULL_FACE)', 'false');
    5656    shouldBe('context.getParameter(context.CULL_FACE_MODE)', 'context.BACK');
  • trunk/WebCore/ChangeLog

    r61908 r61910  
     12010-06-25  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        getParameter(COLOR_WRITEMASK) needs to return Array
     6        https://bugs.webkit.org/show_bug.cgi?id=40437
     7
     8        * bindings/js/JSWebGLRenderingContextCustom.cpp: Handling bool array.
     9        (WebCore::toJS):
     10        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: Handling bool array.
     11        (WebCore::toV8Object):
     12        * html/canvas/WebGLGetInfo.cpp: Handling bool array.
     13        (WebCore::WebGLGetInfo::WebGLGetInfo):
     14        (WebCore::WebGLGetInfo::getBoolArray):
     15        * html/canvas/WebGLGetInfo.h: Handling bool array.
     16        (WebCore::WebGLGetInfo::):
     17        * html/canvas/WebGLRenderingContext.cpp: Handling bool array.
     18        (WebCore::WebGLRenderingContext::getParameter):
     19        (WebCore::WebGLRenderingContext::getBooleanArrayParameter):
     20        * html/canvas/WebGLRenderingContext.h: Handling bool array.
     21
    1222010-06-25  Evan Stade  <estade@chromium.org>
    223
  • trunk/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp

    r61027 r61910  
    5656#include "WebGLRenderingContext.h"
    5757#include <runtime/Error.h>
     58#include <runtime/JSArray.h>
    5859#include <wtf/FastMalloc.h>
    5960#include <wtf/OwnFastMallocPtr.h>
     
    7374    case WebGLGetInfo::kTypeBool:
    7475        return jsBoolean(info.getBool());
     76    case WebGLGetInfo::kTypeBoolArray: {
     77        MarkedArgumentBuffer list;
     78        const Vector<bool>& value = info.getBoolArray();
     79        for (size_t ii = 0; ii < value.size(); ++ii)
     80            list.append(jsBoolean(value[ii]));
     81        return constructArray(exec, list);
     82    }
    7583    case WebGLGetInfo::kTypeFloat:
    7684        return jsNumber(exec, info.getFloat());
  • trunk/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r60902 r61910  
    111111    case WebGLGetInfo::kTypeBool:
    112112        return v8::Boolean::New(info.getBool());
     113    case WebGLGetInfo::kTypeBoolArray: {
     114        const Vector<bool>& value = info.getBoolArray();
     115        v8::Local<v8::Array> array = v8::Array::New(value.size());
     116        for (size_t ii = 0; ii < value.size(); ++ii)
     117            array->Set(v8::Integer::New(ii), v8::Boolean::New(value[ii]));
     118        return array;
     119    }
    113120    case WebGLGetInfo::kTypeFloat:
    114121        return v8::Number::New(info.getFloat());
  • trunk/WebCore/html/canvas/WebGLGetInfo.cpp

    r60902 r61910  
    4747}
    4848
     49WebGLGetInfo::WebGLGetInfo(const bool* value, int size)
     50    : m_type(kTypeBoolArray)
     51{
     52    if (!value || size <=0)
     53        return;
     54    m_boolArray.resize(size);
     55    for (int ii = 0; ii < size; ++ii)
     56        m_boolArray[ii] = value[ii];
     57}
     58
    4959WebGLGetInfo::WebGLGetInfo(float value)
    5060    : m_type(kTypeFloat)
     
    139149}
    140150
     151const Vector<bool>& WebGLGetInfo::getBoolArray() const
     152{
     153    ASSERT(getType() == kTypeBoolArray);
     154    return m_boolArray;
     155}
     156
    141157float WebGLGetInfo::getFloat() const
    142158{
  • trunk/WebCore/html/canvas/WebGLGetInfo.h

    r60902 r61910  
    5454    enum Type {
    5555        kTypeBool,
     56        kTypeBoolArray,
    5657        kTypeFloat,
    5758        kTypeLong,
     
    7172
    7273    WebGLGetInfo(bool value);
     74    WebGLGetInfo(const bool* value, int size);
    7375    WebGLGetInfo(float value);
    7476    WebGLGetInfo(long value);
     
    9395
    9496    bool getBool() const;
     97    const Vector<bool>& getBoolArray() const;
    9598    float getFloat() const;
    9699    long getLong() const;
     
    111114    Type m_type;
    112115    bool m_bool;
     116    Vector<bool> m_boolArray;
    113117    float m_float;
    114118    long m_long;
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r61715 r61910  
    11631163        return getWebGLFloatArrayParameter(pname);
    11641164    case GraphicsContext3D::COLOR_WRITEMASK:
    1165         return getWebGLUnsignedByteArrayParameter(pname);
     1165        return getBooleanArrayParameter(pname);
    11661166    case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS:
    11671167        // Defined as null in the spec
     
    31493149}
    31503150
     3151WebGLGetInfo WebGLRenderingContext::getBooleanArrayParameter(unsigned long pname)
     3152{
     3153    if (pname != GraphicsContext3D::COLOR_WRITEMASK) {
     3154        notImplemented();
     3155        return WebGLGetInfo(0, 0);
     3156    }
     3157    unsigned char value[4] = {0};
     3158    m_context->getBooleanv(pname, value);
     3159    bool boolValue[4];
     3160    for (int ii = 0; ii < 4; ++ii)
     3161        boolValue[ii] = static_cast<bool>(value[ii]);
     3162    return WebGLGetInfo(boolValue, 4);
     3163}
     3164
    31513165WebGLGetInfo WebGLRenderingContext::getFloatParameter(unsigned long pname)
    31523166{
     
    32133227    }
    32143228    return WebGLGetInfo(Int32Array::create(value, length));
    3215 }
    3216 
    3217 WebGLGetInfo WebGLRenderingContext::getWebGLUnsignedByteArrayParameter(unsigned long pname)
    3218 {
    3219     unsigned char value[4] = {0};
    3220     m_context->getBooleanv(pname, value);
    3221     unsigned length = 0;
    3222     switch (pname) {
    3223     case GraphicsContext3D::COLOR_WRITEMASK:
    3224         length = 4;
    3225         break;
    3226     default:
    3227         notImplemented();
    3228     }
    3229     return WebGLGetInfo(Uint8Array::create(value, length));
    32303229}
    32313230
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r61406 r61910  
    390390        // Helpers for getParameter and others
    391391        WebGLGetInfo getBooleanParameter(unsigned long pname);
     392        WebGLGetInfo getBooleanArrayParameter(unsigned long pname);
    392393        WebGLGetInfo getFloatParameter(unsigned long pname);
    393394        WebGLGetInfo getIntParameter(unsigned long pname);
     
    396397        WebGLGetInfo getWebGLFloatArrayParameter(unsigned long pname);
    397398        WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname);
    398         WebGLGetInfo getWebGLUnsignedByteArrayParameter(unsigned long pname);
    399399
    400400        void texImage2DBase(unsigned target, unsigned level, unsigned internalformat,
Note: See TracChangeset for help on using the changeset viewer.