Changeset 61910 in webkit
- Timestamp:
- Jun 25, 2010 3:47:09 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r61900 r61910 1 2010-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 1 11 2010-06-25 Alpha Lam <hclam@chromium.org> 2 12 -
trunk/LayoutTests/fast/canvas/webgl/gl-get-calls-expected.txt
r61046 r61910 27 27 PASS context.getParameter(context.BLEND_SRC_RGB) is 1 28 28 PASS context.getParameter(context.COLOR_CLEAR_VALUE) is [0, 0, 0, 0] 29 PASS context.getParameter(context.COLOR_WRITEMASK) is [ 1, 1, 1, 1]29 PASS context.getParameter(context.COLOR_WRITEMASK) is [true, true, true, true] 30 30 PASS context.getParameter(context.CULL_FACE) is false 31 31 PASS context.getParameter(context.CULL_FACE_MODE) is context.BACK -
trunk/LayoutTests/fast/canvas/webgl/gl-get-calls.html
r61046 r61910 52 52 shouldBe('context.getParameter(context.BLEND_SRC_RGB)', '1'); 53 53 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]'); 55 55 shouldBe('context.getParameter(context.CULL_FACE)', 'false'); 56 56 shouldBe('context.getParameter(context.CULL_FACE_MODE)', 'context.BACK'); -
trunk/WebCore/ChangeLog
r61908 r61910 1 2010-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 1 22 2010-06-25 Evan Stade <estade@chromium.org> 2 23 -
trunk/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
r61027 r61910 56 56 #include "WebGLRenderingContext.h" 57 57 #include <runtime/Error.h> 58 #include <runtime/JSArray.h> 58 59 #include <wtf/FastMalloc.h> 59 60 #include <wtf/OwnFastMallocPtr.h> … … 73 74 case WebGLGetInfo::kTypeBool: 74 75 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 } 75 83 case WebGLGetInfo::kTypeFloat: 76 84 return jsNumber(exec, info.getFloat()); -
trunk/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
r60902 r61910 111 111 case WebGLGetInfo::kTypeBool: 112 112 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 } 113 120 case WebGLGetInfo::kTypeFloat: 114 121 return v8::Number::New(info.getFloat()); -
trunk/WebCore/html/canvas/WebGLGetInfo.cpp
r60902 r61910 47 47 } 48 48 49 WebGLGetInfo::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 49 59 WebGLGetInfo::WebGLGetInfo(float value) 50 60 : m_type(kTypeFloat) … … 139 149 } 140 150 151 const Vector<bool>& WebGLGetInfo::getBoolArray() const 152 { 153 ASSERT(getType() == kTypeBoolArray); 154 return m_boolArray; 155 } 156 141 157 float WebGLGetInfo::getFloat() const 142 158 { -
trunk/WebCore/html/canvas/WebGLGetInfo.h
r60902 r61910 54 54 enum Type { 55 55 kTypeBool, 56 kTypeBoolArray, 56 57 kTypeFloat, 57 58 kTypeLong, … … 71 72 72 73 WebGLGetInfo(bool value); 74 WebGLGetInfo(const bool* value, int size); 73 75 WebGLGetInfo(float value); 74 76 WebGLGetInfo(long value); … … 93 95 94 96 bool getBool() const; 97 const Vector<bool>& getBoolArray() const; 95 98 float getFloat() const; 96 99 long getLong() const; … … 111 114 Type m_type; 112 115 bool m_bool; 116 Vector<bool> m_boolArray; 113 117 float m_float; 114 118 long m_long; -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r61715 r61910 1163 1163 return getWebGLFloatArrayParameter(pname); 1164 1164 case GraphicsContext3D::COLOR_WRITEMASK: 1165 return get WebGLUnsignedByteArrayParameter(pname);1165 return getBooleanArrayParameter(pname); 1166 1166 case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS: 1167 1167 // Defined as null in the spec … … 3149 3149 } 3150 3150 3151 WebGLGetInfo 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 3151 3165 WebGLGetInfo WebGLRenderingContext::getFloatParameter(unsigned long pname) 3152 3166 { … … 3213 3227 } 3214 3228 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));3230 3229 } 3231 3230 -
trunk/WebCore/html/canvas/WebGLRenderingContext.h
r61406 r61910 390 390 // Helpers for getParameter and others 391 391 WebGLGetInfo getBooleanParameter(unsigned long pname); 392 WebGLGetInfo getBooleanArrayParameter(unsigned long pname); 392 393 WebGLGetInfo getFloatParameter(unsigned long pname); 393 394 WebGLGetInfo getIntParameter(unsigned long pname); … … 396 397 WebGLGetInfo getWebGLFloatArrayParameter(unsigned long pname); 397 398 WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname); 398 WebGLGetInfo getWebGLUnsignedByteArrayParameter(unsigned long pname);399 399 400 400 void texImage2DBase(unsigned target, unsigned level, unsigned internalformat,
Note: See TracChangeset
for help on using the changeset viewer.