Bug 697168 - Removes WebGL overloads for untyped ArrayBuffers where disallowed - r=bjacob

This commit is contained in:
Jeff Gilbert 2011-10-31 16:55:00 -07:00
Родитель a924fd547c
Коммит ff27c8a903
3 изменённых файлов: 8 добавлений и 75 удалений

Просмотреть файл

@ -259,10 +259,7 @@ nsIDOMWebGLRenderingContext_ReadPixels(JSContext *cx, uintN argc, jsval *vp)
!JSVAL_IS_PRIMITIVE(argv[6])) !JSVAL_IS_PRIMITIVE(argv[6]))
{ {
JSObject *argv6 = JSVAL_TO_OBJECT(argv[6]); JSObject *argv6 = JSVAL_TO_OBJECT(argv[6]);
if (js_IsArrayBuffer(argv6)) { if (js_IsTypedArray(argv6)) {
rv = self->ReadPixels_buf(argv0, argv1, argv2, argv3,
argv4, argv5, js::ArrayBuffer::getArrayBuffer(argv6));
} else if (js_IsTypedArray(argv6)) {
rv = self->ReadPixels_array(argv0, argv1, argv2, argv3, rv = self->ReadPixels_array(argv0, argv1, argv2, argv3,
argv4, argv5, argv4, argv5,
js::TypedArray::getTypedArray(argv6)); js::TypedArray::getTypedArray(argv6));
@ -380,15 +377,11 @@ nsIDOMWebGLRenderingContext_TexImage2D(JSContext *cx, uintN argc, jsval *vp)
JSObject *argv8 = JSVAL_TO_OBJECT(argv[8]); JSObject *argv8 = JSVAL_TO_OBJECT(argv[8]);
// then try to grab either a js::ArrayBuffer, js::TypedArray, or null // then try to grab either a js::TypedArray, or null
if (argv8 == nsnull) { if (argv8 == nsnull) {
rv = self->TexImage2D_buf(argv0, argv1, argv2, argv3, rv = self->TexImage2D_array(argv0, argv1, argv2, argv3,
argv4, argv5, argv6, argv7, argv4, argv5, argv6, argv7,
nsnull); nsnull);
} else if (js_IsArrayBuffer(argv8)) {
rv = self->TexImage2D_buf(argv0, argv1, argv2, argv3,
argv4, argv5, argv6, argv7,
js::ArrayBuffer::getArrayBuffer(argv8));
} else if (js_IsTypedArray(argv8)) { } else if (js_IsTypedArray(argv8)) {
rv = self->TexImage2D_array(argv0, argv1, argv2, argv3, rv = self->TexImage2D_array(argv0, argv1, argv2, argv3,
argv4, argv5, argv6, argv7, argv4, argv5, argv6, argv7,
@ -503,12 +496,8 @@ nsIDOMWebGLRenderingContext_TexSubImage2D(JSContext *cx, uintN argc, jsval *vp)
GET_UINT32_ARG(argv7, 7); GET_UINT32_ARG(argv7, 7);
JSObject *argv8 = JSVAL_TO_OBJECT(argv[8]); JSObject *argv8 = JSVAL_TO_OBJECT(argv[8]);
// try to grab either a js::ArrayBuffer or js::TypedArray // try to grab a js::TypedArray
if (js_IsArrayBuffer(argv8)) { if (js_IsTypedArray(argv8)) {
rv = self->TexSubImage2D_buf(argv0, argv1, argv2, argv3,
argv4, argv5, argv6, argv7,
js::ArrayBuffer::getArrayBuffer(argv8));
} else if (js_IsTypedArray(argv8)) {
rv = self->TexSubImage2D_array(argv0, argv1, argv2, argv3, rv = self->TexSubImage2D_array(argv0, argv1, argv2, argv3,
argv4, argv5, argv6, argv7, argv4, argv5, argv6, argv7,
js::TypedArray::getTypedArray(argv8)); js::TypedArray::getTypedArray(argv8));

Просмотреть файл

@ -3532,18 +3532,6 @@ WebGLContext::ReadPixels_array(WebGLint x, WebGLint y, WebGLsizei width, WebGLsi
pixels ? JS_GetTypedArrayByteLength(pixels) : 0); pixels ? JS_GetTypedArrayByteLength(pixels) : 0);
} }
NS_IMETHODIMP
WebGLContext::ReadPixels_buf(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
WebGLenum format, WebGLenum type, JSObject *pixels)
{
if (mContextLost)
return NS_OK;
return ReadPixels_base(x, y, width, height, format, type,
pixels ? JS_GetArrayBufferData(pixels) : 0,
pixels ? JS_GetArrayBufferByteLength(pixels) : 0);
}
NS_IMETHODIMP NS_IMETHODIMP
WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, WebGLsizei width, WebGLsizei height) WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, WebGLsizei width, WebGLsizei height)
{ {
@ -4910,22 +4898,6 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
WebGLContext::TexImage2D_buf(WebGLenum target, WebGLint level, WebGLenum internalformat,
WebGLsizei width, WebGLsizei height, WebGLint border,
WebGLenum format, WebGLenum type,
JSObject *pixels)
{
if (mContextLost)
return NS_OK;
return TexImage2D_base(target, level, internalformat, width, height, 0, border, format, type,
pixels ? JS_GetArrayBufferData(pixels) : 0,
pixels ? JS_GetArrayBufferByteLength(pixels) : 0,
-1,
WebGLTexelFormat::Auto, false);
}
NS_IMETHODIMP NS_IMETHODIMP
WebGLContext::TexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat, WebGLContext::TexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat,
WebGLsizei width, WebGLsizei height, WebGLint border, WebGLsizei width, WebGLsizei height, WebGLint border,
@ -4938,7 +4910,7 @@ WebGLContext::TexImage2D_array(WebGLenum target, WebGLint level, WebGLenum inter
return TexImage2D_base(target, level, internalformat, width, height, 0, border, format, type, return TexImage2D_base(target, level, internalformat, width, height, 0, border, format, type,
pixels ? JS_GetTypedArrayData(pixels) : 0, pixels ? JS_GetTypedArrayData(pixels) : 0,
pixels ? JS_GetTypedArrayByteLength(pixels) : 0, pixels ? JS_GetTypedArrayByteLength(pixels) : 0,
(int) JS_GetTypedArrayType(pixels), pixels ? (int)JS_GetTypedArrayType(pixels) : -1,
WebGLTexelFormat::Auto, false); WebGLTexelFormat::Auto, false);
} }
@ -5106,26 +5078,6 @@ WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
WebGLContext::TexSubImage2D_buf(WebGLenum target, WebGLint level,
WebGLint xoffset, WebGLint yoffset,
WebGLsizei width, WebGLsizei height,
WebGLenum format, WebGLenum type,
JSObject *pixels)
{
if (mContextLost)
return NS_OK;
if (!pixels)
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
return TexSubImage2D_base(target, level, xoffset, yoffset,
width, height, 0, format, type,
JS_GetArrayBufferData(pixels), JS_GetArrayBufferByteLength(pixels),
-1,
WebGLTexelFormat::Auto, false);
}
NS_IMETHODIMP NS_IMETHODIMP
WebGLContext::TexSubImage2D_array(WebGLenum target, WebGLint level, WebGLContext::TexSubImage2D_array(WebGLenum target, WebGLint level,
WebGLint xoffset, WebGLint yoffset, WebGLint xoffset, WebGLint yoffset,

Просмотреть файл

@ -735,8 +735,6 @@ interface nsIDOMWebGLRenderingContext : nsISupports
void readPixels([optional] in long dummy); void readPixels([optional] in long dummy);
[noscript] void readPixels_array(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height, [noscript] void readPixels_array(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height,
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels); in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
[noscript] void readPixels_buf(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height,
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
//void glReleaseShaderCompiler(); //void glReleaseShaderCompiler();
@ -755,9 +753,6 @@ interface nsIDOMWebGLRenderingContext : nsISupports
void stencilOpSeparate(in WebGLenum face, in WebGLenum fail, in WebGLenum zfail, in WebGLenum zpass); void stencilOpSeparate(in WebGLenum face, in WebGLenum fail, in WebGLenum zfail, in WebGLenum zpass);
void texImage2D([optional] in long dummy); void texImage2D([optional] in long dummy);
[noscript] void texImage2D_buf(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
in WebGLsizei width, in WebGLsizei height,
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
[noscript] void texImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat, [noscript] void texImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
in WebGLsizei width, in WebGLsizei height, in WebGLsizei width, in WebGLsizei height,
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels); in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
@ -770,9 +765,6 @@ interface nsIDOMWebGLRenderingContext : nsISupports
in WebGLenum format, in WebGLenum type, in nsIDOMElement element); in WebGLenum format, in WebGLenum type, in nsIDOMElement element);
void texSubImage2D([optional] in long dummy); void texSubImage2D([optional] in long dummy);
[noscript] void texSubImage2D_buf(in WebGLenum target, in WebGLint level,
in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
[noscript] void texSubImage2D_array(in WebGLenum target, in WebGLint level, [noscript] void texSubImage2D_array(in WebGLenum target, in WebGLint level,
in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height, in WebGLint xoffset, in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels); in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);