зеркало из https://github.com/mozilla/gecko-dev.git
Bug 664249 - API fixes for inlined TypedArray properties. r=mrbkap
--HG-- extra : rebase_source : 1bcd524f639b1e79dbb461c737b6abdbc62ba606
This commit is contained in:
Родитель
a33512d7ec
Коммит
7ecfdf8e09
|
@ -187,13 +187,13 @@ CreateImageData(JSContext* cx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
js::TypedArray* tdest = js::TypedArray::fromJSObject(darray);
|
JSObject *tdest = js::TypedArray::getTypedArray(darray);
|
||||||
|
|
||||||
// make the call
|
// make the call
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
self->GetImageData_explicit(x, y, w, h,
|
self->GetImageData_explicit(x, y, w, h,
|
||||||
static_cast<PRUint8*>(tdest->data),
|
static_cast<PRUint8*>(JS_GetTypedArrayData(tdest)),
|
||||||
tdest->byteLength);
|
JS_GetTypedArrayByteLength(tdest));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
||||||
}
|
}
|
||||||
|
@ -416,11 +416,11 @@ nsIDOMCanvasRenderingContext2D_PutImageData(JSContext *cx, uintN argc, jsval *vp
|
||||||
|
|
||||||
js::AutoValueRooter tsrc_tvr(cx);
|
js::AutoValueRooter tsrc_tvr(cx);
|
||||||
|
|
||||||
js::TypedArray *tsrc = NULL;
|
JSObject *tsrc = NULL;
|
||||||
if (darray->getClass() == &js::TypedArray::fastClasses[js::TypedArray::TYPE_UINT8] ||
|
if (darray->getClass() == &js::TypedArray::fastClasses[js::TypedArray::TYPE_UINT8] ||
|
||||||
darray->getClass() == &js::TypedArray::fastClasses[js::TypedArray::TYPE_UINT8_CLAMPED])
|
darray->getClass() == &js::TypedArray::fastClasses[js::TypedArray::TYPE_UINT8_CLAMPED])
|
||||||
{
|
{
|
||||||
tsrc = js::TypedArray::fromJSObject(darray);
|
tsrc = js::TypedArray::getTypedArray(darray);
|
||||||
} else if (JS_IsArrayObject(cx, darray) || js_IsTypedArray(darray)) {
|
} else if (JS_IsArrayObject(cx, darray) || js_IsTypedArray(darray)) {
|
||||||
// ugh, this isn't a uint8 typed array, someone made their own object; convert it to a typed array
|
// ugh, this isn't a uint8 typed array, someone made their own object; convert it to a typed array
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_UINT8, darray);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_UINT8, darray);
|
||||||
|
@ -428,14 +428,14 @@ nsIDOMCanvasRenderingContext2D_PutImageData(JSContext *cx, uintN argc, jsval *vp
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
*tsrc_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*tsrc_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
tsrc = js::TypedArray::fromJSObject(nobj);
|
tsrc = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
// yeah, no.
|
// yeah, no.
|
||||||
return xpc_qsThrow(cx, NS_ERROR_DOM_TYPE_MISMATCH_ERR);
|
return xpc_qsThrow(cx, NS_ERROR_DOM_TYPE_MISMATCH_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the call
|
// make the call
|
||||||
rv = self->PutImageData_explicit(x, y, w, h, (PRUint8*) tsrc->data, tsrc->byteLength, hasDirtyRect, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
|
rv = self->PutImageData_explicit(x, y, w, h, (PRUint8*) JS_GetTypedArrayData(tsrc), JS_GetTypedArrayByteLength(tsrc), hasDirtyRect, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ nsIDOMWebGLRenderingContext_BufferData(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsval *argv = JS_ARGV(cx, vp);
|
jsval *argv = JS_ARGV(cx, vp);
|
||||||
|
|
||||||
int32 target;
|
int32 target;
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
JSObject *wb = 0;
|
JSObject *wb = 0;
|
||||||
int32 size;
|
int32 size;
|
||||||
int32 usage;
|
int32 usage;
|
||||||
|
@ -120,7 +120,7 @@ nsIDOMWebGLRenderingContext_BufferData(JSContext *cx, uintN argc, jsval *vp)
|
||||||
if (js_IsArrayBuffer(arg2)) {
|
if (js_IsArrayBuffer(arg2)) {
|
||||||
wb = js::ArrayBuffer::getArrayBuffer(arg2);
|
wb = js::ArrayBuffer::getArrayBuffer(arg2);
|
||||||
} else if (js_IsTypedArray(arg2)) {
|
} else if (js_IsTypedArray(arg2)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg2);
|
wa = js::TypedArray::getTypedArray(arg2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ nsIDOMWebGLRenderingContext_BufferSubData(JSContext *cx, uintN argc, jsval *vp)
|
||||||
|
|
||||||
int32 target;
|
int32 target;
|
||||||
int32 offset;
|
int32 offset;
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
JSObject *wb = 0;
|
JSObject *wb = 0;
|
||||||
|
|
||||||
if (!JS_ValueToECMAInt32(cx, argv[0], &target))
|
if (!JS_ValueToECMAInt32(cx, argv[0], &target))
|
||||||
|
@ -195,7 +195,7 @@ nsIDOMWebGLRenderingContext_BufferSubData(JSContext *cx, uintN argc, jsval *vp)
|
||||||
if (js_IsArrayBuffer(arg3)) {
|
if (js_IsArrayBuffer(arg3)) {
|
||||||
wb = js::ArrayBuffer::getArrayBuffer(arg3);
|
wb = js::ArrayBuffer::getArrayBuffer(arg3);
|
||||||
} else if (js_IsTypedArray(arg3)) {
|
} else if (js_IsTypedArray(arg3)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg3);
|
wa = js::TypedArray::getTypedArray(arg3);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -265,7 +265,7 @@ nsIDOMWebGLRenderingContext_ReadPixels(JSContext *cx, uintN argc, jsval *vp)
|
||||||
} else if (js_IsTypedArray(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::fromJSObject(argv6));
|
js::TypedArray::getTypedArray(argv6));
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 6);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 6);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -365,7 +365,7 @@ nsIDOMWebGLRenderingContext_TexImage2D(JSContext *cx, uintN argc, jsval *vp)
|
||||||
}
|
}
|
||||||
rv = self->TexImage2D_imageData(argv0, argv1, argv2,
|
rv = self->TexImage2D_imageData(argv0, argv1, argv2,
|
||||||
int_width, int_height, 0,
|
int_width, int_height, 0,
|
||||||
argv3, argv4, js::TypedArray::fromJSObject(obj_data));
|
argv3, argv4, js::TypedArray::getTypedArray(obj_data));
|
||||||
}
|
}
|
||||||
} else if (argc > 8 &&
|
} else if (argc > 8 &&
|
||||||
JSVAL_IS_OBJECT(argv[8])) // here, we allow null !
|
JSVAL_IS_OBJECT(argv[8])) // here, we allow null !
|
||||||
|
@ -392,7 +392,7 @@ nsIDOMWebGLRenderingContext_TexImage2D(JSContext *cx, uintN argc, jsval *vp)
|
||||||
} 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,
|
||||||
js::TypedArray::fromJSObject(argv8));
|
js::TypedArray::getTypedArray(argv8));
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -491,7 +491,7 @@ nsIDOMWebGLRenderingContext_TexSubImage2D(JSContext *cx, uintN argc, jsval *vp)
|
||||||
rv = self->TexSubImage2D_imageData(argv0, argv1, argv2, argv3,
|
rv = self->TexSubImage2D_imageData(argv0, argv1, argv2, argv3,
|
||||||
int_width, int_height,
|
int_width, int_height,
|
||||||
argv4, argv5,
|
argv4, argv5,
|
||||||
js::TypedArray::fromJSObject(obj_data));
|
js::TypedArray::getTypedArray(obj_data));
|
||||||
}
|
}
|
||||||
} else if (argc > 8 &&
|
} else if (argc > 8 &&
|
||||||
!JSVAL_IS_PRIMITIVE(argv[8]))
|
!JSVAL_IS_PRIMITIVE(argv[8]))
|
||||||
|
@ -511,7 +511,7 @@ nsIDOMWebGLRenderingContext_TexSubImage2D(JSContext *cx, uintN argc, jsval *vp)
|
||||||
} else if (js_IsTypedArray(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::fromJSObject(argv8));
|
js::TypedArray::getTypedArray(argv8));
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 8);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -567,10 +567,10 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(JSContext *cx, uintN argc, jsval
|
||||||
|
|
||||||
js::AutoValueRooter obj_tvr(cx);
|
js::AutoValueRooter obj_tvr(cx);
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isInt32Array(arg1)) {
|
if (helper_isInt32Array(arg1)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg1);
|
wa = js::TypedArray::getTypedArray(arg1);
|
||||||
} else if (JS_IsArrayObject(cx, arg1)) {
|
} else if (JS_IsArrayObject(cx, arg1)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_INT32, arg1);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_INT32, arg1);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -579,7 +579,7 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_iv(JSContext *cx, uintN argc, jsval
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -641,10 +641,10 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(JSContext *cx, uintN argc, jsval
|
||||||
|
|
||||||
js::AutoValueRooter obj_tvr(cx);
|
js::AutoValueRooter obj_tvr(cx);
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isFloat32Array(arg1)) {
|
if (helper_isFloat32Array(arg1)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg1);
|
wa = js::TypedArray::getTypedArray(arg1);
|
||||||
} else if (JS_IsArrayObject(cx, arg1)) {
|
} else if (JS_IsArrayObject(cx, arg1)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg1);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg1);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -653,7 +653,7 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_fv(JSContext *cx, uintN argc, jsval
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -717,10 +717,10 @@ helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv(JSContext *cx, uintN argc,
|
||||||
|
|
||||||
js::AutoValueRooter obj_tvr(cx);
|
js::AutoValueRooter obj_tvr(cx);
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isFloat32Array(arg2)) {
|
if (helper_isFloat32Array(arg2)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg2);
|
wa = js::TypedArray::getTypedArray(arg2);
|
||||||
} else if (JS_IsArrayObject(cx, arg2)) {
|
} else if (JS_IsArrayObject(cx, arg2)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg2);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg2);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -729,7 +729,7 @@ helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv(JSContext *cx, uintN argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 2);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -782,10 +782,10 @@ helper_nsIDOMWebGLRenderingContext_VertexAttrib_x_fv(JSContext *cx, uintN argc,
|
||||||
|
|
||||||
js::AutoValueRooter obj_tvr(cx);
|
js::AutoValueRooter obj_tvr(cx);
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isFloat32Array(arg1)) {
|
if (helper_isFloat32Array(arg1)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg1);
|
wa = js::TypedArray::getTypedArray(arg1);
|
||||||
} else if (JS_IsArrayObject(cx, arg1)) {
|
} else if (JS_IsArrayObject(cx, arg1)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg1);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg1);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -794,7 +794,7 @@ helper_nsIDOMWebGLRenderingContext_VertexAttrib_x_fv(JSContext *cx, uintN argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 1);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -944,10 +944,10 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_iv_tn(JSContext *cx, JSObject *obj,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isInt32Array(arg)) {
|
if (helper_isInt32Array(arg)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg);
|
wa = js::TypedArray::getTypedArray(arg);
|
||||||
} else if (JS_IsArrayObject(cx, arg)) {
|
} else if (JS_IsArrayObject(cx, arg)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_INT32, arg);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_INT32, arg);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -957,7 +957,7 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_iv_tn(JSContext *cx, JSObject *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowMethodFailedWithDetails(cx, NS_ERROR_FAILURE, "nsIDOMWebGLRenderingContext", "uniformNiv");
|
xpc_qsThrowMethodFailedWithDetails(cx, NS_ERROR_FAILURE, "nsIDOMWebGLRenderingContext", "uniformNiv");
|
||||||
js_SetTraceableNativeFailed(cx);
|
js_SetTraceableNativeFailed(cx);
|
||||||
|
@ -1015,10 +1015,10 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_fv_tn(JSContext *cx, JSObject *obj,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isFloat32Array(arg)) {
|
if (helper_isFloat32Array(arg)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg);
|
wa = js::TypedArray::getTypedArray(arg);
|
||||||
} else if (JS_IsArrayObject(cx, arg)) {
|
} else if (JS_IsArrayObject(cx, arg)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -1028,7 +1028,7 @@ helper_nsIDOMWebGLRenderingContext_Uniform_x_fv_tn(JSContext *cx, JSObject *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowMethodFailedWithDetails(cx, NS_ERROR_FAILURE, "nsIDOMWebGLRenderingContext", "uniformNfv");
|
xpc_qsThrowMethodFailedWithDetails(cx, NS_ERROR_FAILURE, "nsIDOMWebGLRenderingContext", "uniformNfv");
|
||||||
js_SetTraceableNativeFailed(cx);
|
js_SetTraceableNativeFailed(cx);
|
||||||
|
@ -1088,10 +1088,10 @@ helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv_tn(JSContext *cx, JSObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
js::TypedArray *wa = 0;
|
JSObject *wa = 0;
|
||||||
|
|
||||||
if (helper_isFloat32Array(arg)) {
|
if (helper_isFloat32Array(arg)) {
|
||||||
wa = js::TypedArray::fromJSObject(arg);
|
wa = js::TypedArray::getTypedArray(arg);
|
||||||
} else if (JS_IsArrayObject(cx, arg)) {
|
} else if (JS_IsArrayObject(cx, arg)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg);
|
JSObject *nobj = js_CreateTypedArrayWithArray(cx, js::TypedArray::TYPE_FLOAT32, arg);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
|
@ -1101,7 +1101,7 @@ helper_nsIDOMWebGLRenderingContext_UniformMatrix_x_fv_tn(JSContext *cx, JSObject
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*obj_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
wa = js::TypedArray::fromJSObject(nobj);
|
wa = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
xpc_qsThrowMethodFailedWithDetails(cx, NS_ERROR_FAILURE, "nsIDOMWebGLRenderingContext", "uniformMatrixNfv");
|
xpc_qsThrowMethodFailedWithDetails(cx, NS_ERROR_FAILURE, "nsIDOMWebGLRenderingContext", "uniformMatrixNfv");
|
||||||
js_SetTraceableNativeFailed(cx);
|
js_SetTraceableNativeFailed(cx);
|
||||||
|
|
|
@ -487,7 +487,7 @@ WebGLContext::BufferData_buf(WebGLenum target, JSObject *wb, WebGLenum usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebGLContext::BufferData_array(WebGLenum target, js::TypedArray *wa, WebGLenum usage)
|
WebGLContext::BufferData_array(WebGLenum target, JSObject *wa, WebGLenum usage)
|
||||||
{
|
{
|
||||||
WebGLBuffer *boundBuffer = NULL;
|
WebGLBuffer *boundBuffer = NULL;
|
||||||
|
|
||||||
|
@ -508,17 +508,17 @@ WebGLContext::BufferData_array(WebGLenum target, js::TypedArray *wa, WebGLenum u
|
||||||
MakeContextCurrent();
|
MakeContextCurrent();
|
||||||
|
|
||||||
GLenum error = CheckedBufferData(target,
|
GLenum error = CheckedBufferData(target,
|
||||||
wa->byteLength,
|
JS_GetTypedArrayByteLength(wa),
|
||||||
wa->data,
|
JS_GetTypedArrayData(wa),
|
||||||
usage);
|
usage);
|
||||||
if (error) {
|
if (error) {
|
||||||
LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
|
LogMessageIfVerbose("bufferData generated error %s", ErrorName(error));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
boundBuffer->SetByteLength(wa->byteLength);
|
boundBuffer->SetByteLength(JS_GetTypedArrayByteLength(wa));
|
||||||
boundBuffer->InvalidateCachedMaxElements();
|
boundBuffer->InvalidateCachedMaxElements();
|
||||||
if (!boundBuffer->CopyDataIfElementArray(wa->data))
|
if (!boundBuffer->CopyDataIfElementArray(JS_GetTypedArrayData(wa)))
|
||||||
return ErrorOutOfMemory("bufferData: out of memory");
|
return ErrorOutOfMemory("bufferData: out of memory");
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -574,7 +574,7 @@ WebGLContext::BufferSubData_buf(GLenum target, WebGLsizei byteOffset, JSObject *
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, js::TypedArray *wa)
|
WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, JSObject *wa)
|
||||||
{
|
{
|
||||||
WebGLBuffer *boundBuffer = NULL;
|
WebGLBuffer *boundBuffer = NULL;
|
||||||
|
|
||||||
|
@ -592,20 +592,20 @@ WebGLContext::BufferSubData_array(WebGLenum target, WebGLsizei byteOffset, js::T
|
||||||
if (!boundBuffer)
|
if (!boundBuffer)
|
||||||
return ErrorInvalidOperation("BufferData: no buffer bound!");
|
return ErrorInvalidOperation("BufferData: no buffer bound!");
|
||||||
|
|
||||||
CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + wa->byteLength;
|
CheckedUint32 checked_neededByteLength = CheckedUint32(byteOffset) + JS_GetTypedArrayByteLength(wa);
|
||||||
if (!checked_neededByteLength.valid())
|
if (!checked_neededByteLength.valid())
|
||||||
return ErrorInvalidOperation("bufferSubData: integer overflow computing the needed byte length");
|
return ErrorInvalidOperation("bufferSubData: integer overflow computing the needed byte length");
|
||||||
|
|
||||||
if (checked_neededByteLength.value() > boundBuffer->ByteLength())
|
if (checked_neededByteLength.value() > boundBuffer->ByteLength())
|
||||||
return ErrorInvalidOperation("BufferSubData: not enough data -- operation requires %d bytes, but buffer only has %d bytes",
|
return ErrorInvalidOperation("BufferSubData: not enough data -- operation requires %d bytes, but buffer only has %d bytes",
|
||||||
byteOffset, wa->byteLength, boundBuffer->ByteLength());
|
byteOffset, JS_GetTypedArrayByteLength(wa), boundBuffer->ByteLength());
|
||||||
|
|
||||||
MakeContextCurrent();
|
MakeContextCurrent();
|
||||||
|
|
||||||
boundBuffer->CopySubDataIfElementArray(byteOffset, wa->byteLength, wa->data);
|
boundBuffer->CopySubDataIfElementArray(byteOffset, JS_GetTypedArrayByteLength(wa), JS_GetTypedArrayData(wa));
|
||||||
boundBuffer->InvalidateCachedMaxElements();
|
boundBuffer->InvalidateCachedMaxElements();
|
||||||
|
|
||||||
gl->fBufferSubData(target, byteOffset, wa->byteLength, wa->data);
|
gl->fBufferSubData(target, byteOffset, JS_GetTypedArrayByteLength(wa), JS_GetTypedArrayData(wa));
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -3140,11 +3140,11 @@ WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsiz
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebGLContext::ReadPixels_array(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
WebGLContext::ReadPixels_array(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||||
WebGLenum format, WebGLenum type, js::TypedArray *pixels)
|
WebGLenum format, WebGLenum type, JSObject *pixels)
|
||||||
{
|
{
|
||||||
return ReadPixels_base(x, y, width, height, format, type,
|
return ReadPixels_base(x, y, width, height, format, type,
|
||||||
pixels ? pixels->data : 0,
|
pixels ? JS_GetTypedArrayData(pixels) : 0,
|
||||||
pixels ? pixels->byteLength : 0);
|
pixels ? JS_GetTypedArrayByteLength(pixels) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -3661,15 +3661,15 @@ WebGLContext::name(PRInt32) { \
|
||||||
return NS_ERROR_NOT_IMPLEMENTED; \
|
return NS_ERROR_NOT_IMPLEMENTED; \
|
||||||
} \
|
} \
|
||||||
NS_IMETHODIMP \
|
NS_IMETHODIMP \
|
||||||
WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, js::TypedArray *wa) \
|
WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, JSObject *wa) \
|
||||||
{ \
|
{ \
|
||||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||||
if (!wa || wa->type != js::TypedArray::arrayType) \
|
if (!wa || JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) \
|
||||||
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
||||||
if (wa->length == 0 || wa->length % cnt != 0) \
|
if (JS_GetTypedArrayLength(wa) == 0 || JS_GetTypedArrayLength(wa) % cnt != 0)\
|
||||||
return ErrorInvalidValue(#name ": array must be > 0 elements and have a length multiple of %d", cnt); \
|
return ErrorInvalidValue(#name ": array must be > 0 elements and have a length multiple of %d", cnt); \
|
||||||
MakeContextCurrent(); \
|
MakeContextCurrent(); \
|
||||||
gl->f##name(location, wa->length / cnt, (ptrType *)wa->data); \
|
gl->f##name(location, JS_GetTypedArrayLength(wa) / cnt, (ptrType *)JS_GetTypedArrayData(wa)); \
|
||||||
return NS_OK; \
|
return NS_OK; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3679,17 +3679,17 @@ WebGLContext::name(PRInt32) { \
|
||||||
return NS_ERROR_NOT_IMPLEMENTED; \
|
return NS_ERROR_NOT_IMPLEMENTED; \
|
||||||
} \
|
} \
|
||||||
NS_IMETHODIMP \
|
NS_IMETHODIMP \
|
||||||
WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, WebGLboolean transpose, js::TypedArray *wa) \
|
WebGLContext::name##_array(nsIWebGLUniformLocation *ploc, WebGLboolean transpose, JSObject *wa) \
|
||||||
{ \
|
{ \
|
||||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||||
if (!wa || wa->type != js::TypedArray::arrayType) \
|
if (!wa || JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) \
|
||||||
return ErrorInvalidValue(#name ": array must be " #arrayType); \
|
return ErrorInvalidValue(#name ": array must be " #arrayType); \
|
||||||
if (wa->length == 0 || wa->length % (dim*dim) != 0) \
|
if (JS_GetTypedArrayLength(wa) == 0 || JS_GetTypedArrayLength(wa) % (dim*dim) != 0) \
|
||||||
return ErrorInvalidValue(#name ": array length must be >0 and multiple of %d", dim*dim); \
|
return ErrorInvalidValue(#name ": array length must be >0 and multiple of %d", dim*dim); \
|
||||||
if (transpose) \
|
if (transpose) \
|
||||||
return ErrorInvalidValue(#name ": transpose must be FALSE as per the OpenGL ES 2.0 spec"); \
|
return ErrorInvalidValue(#name ": transpose must be FALSE as per the OpenGL ES 2.0 spec"); \
|
||||||
MakeContextCurrent(); \
|
MakeContextCurrent(); \
|
||||||
gl->f##name(location, wa->length / (dim*dim), transpose, (ptrType *)wa->data); \
|
gl->f##name(location, JS_GetTypedArrayLength(wa) / (dim*dim), transpose, (ptrType *)JS_GetTypedArrayData(wa)); \
|
||||||
return NS_OK; \
|
return NS_OK; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3824,14 +3824,14 @@ WebGLContext::name(PRInt32) { \
|
||||||
return NS_ERROR_NOT_IMPLEMENTED; \
|
return NS_ERROR_NOT_IMPLEMENTED; \
|
||||||
} \
|
} \
|
||||||
NS_IMETHODIMP \
|
NS_IMETHODIMP \
|
||||||
WebGLContext::name##_array(WebGLuint idx, js::TypedArray *wa) \
|
WebGLContext::name##_array(WebGLuint idx, JSObject *wa) \
|
||||||
{ \
|
{ \
|
||||||
if (!wa || wa->type != js::TypedArray::arrayType) \
|
if (!wa || JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) \
|
||||||
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
||||||
if (wa->length < cnt) \
|
if (JS_GetTypedArrayLength(wa) < cnt) \
|
||||||
return ErrorInvalidOperation(#name ": array must be >= %d elements", cnt); \
|
return ErrorInvalidOperation(#name ": array must be >= %d elements", cnt); \
|
||||||
MakeContextCurrent(); \
|
MakeContextCurrent(); \
|
||||||
ptrType *ptr = (ptrType *)wa->data; \
|
ptrType *ptr = (ptrType *)JS_GetTypedArrayData(wa); \
|
||||||
if (idx) { \
|
if (idx) { \
|
||||||
gl->f##name(idx, ptr); \
|
gl->f##name(idx, ptr); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -4428,12 +4428,12 @@ 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,
|
||||||
WebGLenum format, WebGLenum type,
|
WebGLenum format, WebGLenum type,
|
||||||
js::TypedArray *pixels)
|
JSObject *pixels)
|
||||||
{
|
{
|
||||||
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 ? pixels->data : 0,
|
pixels ? JS_GetTypedArrayData(pixels) : 0,
|
||||||
pixels ? pixels->byteLength : 0,
|
pixels ? JS_GetTypedArrayByteLength(pixels) : 0,
|
||||||
(int) pixels->type,
|
(int) JS_GetTypedArrayType(pixels),
|
||||||
WebGLTexelFormat::Auto, PR_FALSE);
|
WebGLTexelFormat::Auto, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4441,11 +4441,11 @@ NS_IMETHODIMP
|
||||||
WebGLContext::TexImage2D_imageData(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
WebGLContext::TexImage2D_imageData(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||||
WebGLsizei width, WebGLsizei height, WebGLint border,
|
WebGLsizei width, WebGLsizei height, WebGLint border,
|
||||||
WebGLenum format, WebGLenum type,
|
WebGLenum format, WebGLenum type,
|
||||||
js::TypedArray *pixels)
|
JSObject *pixels)
|
||||||
{
|
{
|
||||||
return TexImage2D_base(target, level, internalformat, width, height, 4*width, border, format, type,
|
return TexImage2D_base(target, level, internalformat, width, height, 4*width, border, format, type,
|
||||||
pixels ? pixels->data : 0,
|
pixels ? JS_GetTypedArrayData(pixels) : 0,
|
||||||
pixels ? pixels->byteLength : 0,
|
pixels ? JS_GetTypedArrayByteLength(pixels) : 0,
|
||||||
-1,
|
-1,
|
||||||
WebGLTexelFormat::RGBA8, PR_FALSE);
|
WebGLTexelFormat::RGBA8, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -4612,15 +4612,15 @@ WebGLContext::TexSubImage2D_array(WebGLenum target, WebGLint level,
|
||||||
WebGLint xoffset, WebGLint yoffset,
|
WebGLint xoffset, WebGLint yoffset,
|
||||||
WebGLsizei width, WebGLsizei height,
|
WebGLsizei width, WebGLsizei height,
|
||||||
WebGLenum format, WebGLenum type,
|
WebGLenum format, WebGLenum type,
|
||||||
js::TypedArray *pixels)
|
JSObject *pixels)
|
||||||
{
|
{
|
||||||
if (!pixels)
|
if (!pixels)
|
||||||
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
|
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
|
||||||
|
|
||||||
return TexSubImage2D_base(target, level, xoffset, yoffset,
|
return TexSubImage2D_base(target, level, xoffset, yoffset,
|
||||||
width, height, 0, format, type,
|
width, height, 0, format, type,
|
||||||
pixels->data, pixels->byteLength,
|
JS_GetTypedArrayData(pixels), JS_GetTypedArrayByteLength(pixels),
|
||||||
pixels->type,
|
JS_GetTypedArrayType(pixels),
|
||||||
WebGLTexelFormat::Auto, PR_FALSE);
|
WebGLTexelFormat::Auto, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4629,14 +4629,14 @@ WebGLContext::TexSubImage2D_imageData(WebGLenum target, WebGLint level,
|
||||||
WebGLint xoffset, WebGLint yoffset,
|
WebGLint xoffset, WebGLint yoffset,
|
||||||
WebGLsizei width, WebGLsizei height,
|
WebGLsizei width, WebGLsizei height,
|
||||||
WebGLenum format, WebGLenum type,
|
WebGLenum format, WebGLenum type,
|
||||||
js::TypedArray *pixels)
|
JSObject *pixels)
|
||||||
{
|
{
|
||||||
if (!pixels)
|
if (!pixels)
|
||||||
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
|
return ErrorInvalidValue("TexSubImage2D: pixels must not be null!");
|
||||||
|
|
||||||
return TexSubImage2D_base(target, level, xoffset, yoffset,
|
return TexSubImage2D_base(target, level, xoffset, yoffset,
|
||||||
width, height, 4*width, format, type,
|
width, height, 4*width, format, type,
|
||||||
pixels->data, pixels->byteLength,
|
JS_GetTypedArrayData(pixels), JS_GetTypedArrayByteLength(pixels),
|
||||||
-1,
|
-1,
|
||||||
WebGLTexelFormat::RGBA8, PR_FALSE);
|
WebGLTexelFormat::RGBA8, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,8 @@ nsDOMNotifyAudioAvailableEvent::GetFrameBuffer(JSContext* aCx, jsval* aResult)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
js::TypedArray *tdest = js::TypedArray::fromJSObject(mCachedArray);
|
JSObject *tdest = js::TypedArray::getTypedArray(mCachedArray);
|
||||||
memcpy(tdest->data, mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
|
memcpy(JS_GetTypedArrayData(tdest), mFrameBuffer.get(), mFrameBufferLength * sizeof(float));
|
||||||
|
|
||||||
*aResult = OBJECT_TO_JSVAL(mCachedArray);
|
*aResult = OBJECT_TO_JSVAL(mCachedArray);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -197,24 +197,24 @@ nsHTMLAudioElement::MozWriteAudio(const jsval &aData, JSContext *aCx, PRUint32 *
|
||||||
|
|
||||||
JSObject *darray = JSVAL_TO_OBJECT(aData);
|
JSObject *darray = JSVAL_TO_OBJECT(aData);
|
||||||
js::AutoValueRooter tsrc_tvr(aCx);
|
js::AutoValueRooter tsrc_tvr(aCx);
|
||||||
js::TypedArray *tsrc = NULL;
|
JSObject *tsrc = NULL;
|
||||||
|
|
||||||
// Allow either Float32Array or plain JS Array
|
// Allow either Float32Array or plain JS Array
|
||||||
if (darray->getClass() == &js::TypedArray::fastClasses[js::TypedArray::TYPE_FLOAT32])
|
if (darray->getClass() == &js::TypedArray::fastClasses[js::TypedArray::TYPE_FLOAT32])
|
||||||
{
|
{
|
||||||
tsrc = js::TypedArray::fromJSObject(darray);
|
tsrc = js::TypedArray::getTypedArray(darray);
|
||||||
} else if (JS_IsArrayObject(aCx, darray)) {
|
} else if (JS_IsArrayObject(aCx, darray)) {
|
||||||
JSObject *nobj = js_CreateTypedArrayWithArray(aCx, js::TypedArray::TYPE_FLOAT32, darray);
|
JSObject *nobj = js_CreateTypedArrayWithArray(aCx, js::TypedArray::TYPE_FLOAT32, darray);
|
||||||
if (!nobj) {
|
if (!nobj) {
|
||||||
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
||||||
}
|
}
|
||||||
*tsrc_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
*tsrc_tvr.jsval_addr() = OBJECT_TO_JSVAL(nobj);
|
||||||
tsrc = js::TypedArray::fromJSObject(nobj);
|
tsrc = js::TypedArray::getTypedArray(nobj);
|
||||||
} else {
|
} else {
|
||||||
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32 dataLength = tsrc->length;
|
PRUint32 dataLength = JS_GetTypedArrayLength(tsrc);
|
||||||
|
|
||||||
// Make sure that we are going to write the correct amount of data based
|
// Make sure that we are going to write the correct amount of data based
|
||||||
// on number of channels.
|
// on number of channels.
|
||||||
|
@ -225,7 +225,7 @@ nsHTMLAudioElement::MozWriteAudio(const jsval &aData, JSContext *aCx, PRUint32 *
|
||||||
// Don't write more than can be written without blocking.
|
// Don't write more than can be written without blocking.
|
||||||
PRUint32 writeLen = NS_MIN(mAudioStream->Available(), dataLength);
|
PRUint32 writeLen = NS_MIN(mAudioStream->Available(), dataLength);
|
||||||
|
|
||||||
nsresult rv = mAudioStream->Write(tsrc->data, writeLen, PR_TRUE);
|
nsresult rv = mAudioStream->Write(JS_GetTypedArrayData(tsrc), writeLen, PR_TRUE);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,14 +68,13 @@ struct TypedArray;
|
||||||
#undef NO_ERROR
|
#undef NO_ERROR
|
||||||
%}
|
%}
|
||||||
|
|
||||||
[ptr] native WebGLArrayPtr (js::TypedArray);
|
|
||||||
[ptr] native WebGLJSObjectPtr (JSObject);
|
[ptr] native WebGLJSObjectPtr (JSObject);
|
||||||
|
|
||||||
//
|
//
|
||||||
// OpenGL object wrappers
|
// OpenGL object wrappers
|
||||||
//
|
//
|
||||||
|
|
||||||
[scriptable, uuid(3b43762a-8305-11de-98ab-000c29206271)]
|
[scriptable, uuid(0df9f4ed-f5ff-4e51-a6ff-2bd9785a7639)]
|
||||||
interface nsIWebGLTexture : nsISupports
|
interface nsIWebGLTexture : nsISupports
|
||||||
{
|
{
|
||||||
[noscript] attribute WebGLuint name;
|
[noscript] attribute WebGLuint name;
|
||||||
|
@ -588,12 +587,12 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
void bufferData([optional] in long dummy);
|
void bufferData([optional] in long dummy);
|
||||||
[noscript] void bufferData_size(in WebGLenum target, in WebGLsizei size, in WebGLenum usage);
|
[noscript] void bufferData_size(in WebGLenum target, in WebGLsizei size, in WebGLenum usage);
|
||||||
[noscript] void bufferData_buf(in WebGLenum target, in WebGLJSObjectPtr data, in WebGLenum usage);
|
[noscript] void bufferData_buf(in WebGLenum target, in WebGLJSObjectPtr data, in WebGLenum usage);
|
||||||
[noscript] void bufferData_array(in WebGLenum target, in WebGLArrayPtr data, in WebGLenum usage);
|
[noscript] void bufferData_array(in WebGLenum target, in WebGLJSObjectPtr data, in WebGLenum usage);
|
||||||
[noscript] void bufferData_null();
|
[noscript] void bufferData_null();
|
||||||
|
|
||||||
void bufferSubData([optional] in long dummy);
|
void bufferSubData([optional] in long dummy);
|
||||||
[noscript] void bufferSubData_buf(in WebGLenum target, in long offset, in WebGLJSObjectPtr data);
|
[noscript] void bufferSubData_buf(in WebGLenum target, in long offset, in WebGLJSObjectPtr data);
|
||||||
[noscript] void bufferSubData_array(in WebGLenum target, in long offset, in WebGLArrayPtr data);
|
[noscript] void bufferSubData_array(in WebGLenum target, in long offset, in WebGLJSObjectPtr data);
|
||||||
[noscript] void bufferSubData_null();
|
[noscript] void bufferSubData_null();
|
||||||
|
|
||||||
WebGLenum checkFramebufferStatus(in WebGLenum target);
|
WebGLenum checkFramebufferStatus(in WebGLenum target);
|
||||||
|
@ -714,7 +713,7 @@ 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 WebGLArrayPtr 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,
|
[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);
|
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||||
|
|
||||||
|
@ -740,10 +739,10 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
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 WebGLArrayPtr pixels);
|
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||||
[noscript] void texImage2D_imageData(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
[noscript] void texImage2D_imageData(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 WebGLArrayPtr pixels);
|
in WebGLint border, in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||||
|
|
||||||
// HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
|
// HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
|
||||||
[noscript] void texImage2D_dom(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
[noscript] void texImage2D_dom(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||||
|
@ -755,10 +754,10 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
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 WebGLArrayPtr pixels);
|
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||||
[noscript] void texSubImage2D_imageData(in WebGLenum target, in WebGLint level,
|
[noscript] void texSubImage2D_imageData(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 WebGLArrayPtr pixels);
|
in WebGLenum format, in WebGLenum type, in WebGLJSObjectPtr pixels);
|
||||||
// HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
|
// HTMLImageElement, HTMLCanvasElement, HTMLVideoElement
|
||||||
[noscript] void texSubImage2D_dom(in WebGLenum target, in WebGLint level,
|
[noscript] void texSubImage2D_dom(in WebGLenum target, in WebGLint level,
|
||||||
in WebGLint xoffset, in WebGLint yoffset, in WebGLenum format, in WebGLenum type,
|
in WebGLint xoffset, in WebGLint yoffset, in WebGLenum format, in WebGLenum type,
|
||||||
|
@ -788,23 +787,23 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
void uniform4fv([optional] in long dummy);
|
void uniform4fv([optional] in long dummy);
|
||||||
void uniform4iv([optional] in long dummy);
|
void uniform4iv([optional] in long dummy);
|
||||||
|
|
||||||
[noscript] void uniform1fv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform1fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform1iv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform1iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform2fv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform2fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform2iv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform2iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform3fv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform3fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform3iv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform3iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform4fv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform4fv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
[noscript] void uniform4iv_array (in nsIWebGLUniformLocation location, in WebGLArrayPtr v);
|
[noscript] void uniform4iv_array (in nsIWebGLUniformLocation location, in WebGLJSObjectPtr v);
|
||||||
|
|
||||||
// Modified. These are modified by replacing 'count' and 'value' with a WebGLArrayPtr
|
// Modified. These are modified by replacing 'count' and 'value' with a WebGLJSObjectPtr
|
||||||
void uniformMatrix2fv([optional] in long dummy);
|
void uniformMatrix2fv([optional] in long dummy);
|
||||||
void uniformMatrix3fv([optional] in long dummy);
|
void uniformMatrix3fv([optional] in long dummy);
|
||||||
void uniformMatrix4fv([optional] in long dummy);
|
void uniformMatrix4fv([optional] in long dummy);
|
||||||
|
|
||||||
[noscript] void uniformMatrix2fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLArrayPtr value);
|
[noscript] void uniformMatrix2fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLJSObjectPtr value);
|
||||||
[noscript] void uniformMatrix3fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLArrayPtr value);
|
[noscript] void uniformMatrix3fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLJSObjectPtr value);
|
||||||
[noscript] void uniformMatrix4fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLArrayPtr value);
|
[noscript] void uniformMatrix4fv_array (in nsIWebGLUniformLocation location, in WebGLboolean transpose, in WebGLJSObjectPtr value);
|
||||||
|
|
||||||
// Added API using top entry from the passed nsIWebGLMatrixStack
|
// Added API using top entry from the passed nsIWebGLMatrixStack
|
||||||
//ZZ void glUniformMatrix(in WebGLint location, in WebGLboolean transpose, in nsIWebGLMatrixStack value);
|
//ZZ void glUniformMatrix(in WebGLint location, in WebGLboolean transpose, in nsIWebGLMatrixStack value);
|
||||||
|
@ -812,7 +811,7 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
void useProgram(in nsIWebGLProgram program);
|
void useProgram(in nsIWebGLProgram program);
|
||||||
void validateProgram(in nsIWebGLProgram program);
|
void validateProgram(in nsIWebGLProgram program);
|
||||||
|
|
||||||
// Modified: All the glVertexAttrib*v forms below are modified by replacing 'values' with a WebGLArrayPtr
|
// Modified: All the glVertexAttrib*v forms below are modified by replacing 'values' with a WebGLJSObjectPtr
|
||||||
void vertexAttrib1f(in WebGLuint indx, in WebGLfloat x);
|
void vertexAttrib1f(in WebGLuint indx, in WebGLfloat x);
|
||||||
void vertexAttrib2f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y);
|
void vertexAttrib2f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y);
|
||||||
void vertexAttrib3f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z);
|
void vertexAttrib3f(in WebGLuint indx, in WebGLfloat x, in WebGLfloat y, in WebGLfloat z);
|
||||||
|
@ -823,10 +822,10 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
void vertexAttrib3fv([optional] in long dummy);
|
void vertexAttrib3fv([optional] in long dummy);
|
||||||
void vertexAttrib4fv([optional] in long dummy);
|
void vertexAttrib4fv([optional] in long dummy);
|
||||||
|
|
||||||
[noscript] void vertexAttrib1fv_array(in WebGLuint indx, in WebGLArrayPtr values);
|
[noscript] void vertexAttrib1fv_array(in WebGLuint indx, in WebGLJSObjectPtr values);
|
||||||
[noscript] void vertexAttrib2fv_array(in WebGLuint indx, in WebGLArrayPtr values);
|
[noscript] void vertexAttrib2fv_array(in WebGLuint indx, in WebGLJSObjectPtr values);
|
||||||
[noscript] void vertexAttrib3fv_array(in WebGLuint indx, in WebGLArrayPtr values);
|
[noscript] void vertexAttrib3fv_array(in WebGLuint indx, in WebGLJSObjectPtr values);
|
||||||
[noscript] void vertexAttrib4fv_array(in WebGLuint indx, in WebGLArrayPtr values);
|
[noscript] void vertexAttrib4fv_array(in WebGLuint indx, in WebGLJSObjectPtr values);
|
||||||
|
|
||||||
// size is number of elements per attrib; offset, stride are in bytes
|
// size is number of elements per attrib; offset, stride are in bytes
|
||||||
void vertexAttribPointer(in WebGLuint idx, in WebGLint size, in WebGLenum type, in WebGLboolean normalized, in WebGLsizei stride, in WebGLsizeiptr offset);
|
void vertexAttribPointer(in WebGLuint idx, in WebGLint size, in WebGLenum type, in WebGLboolean normalized, in WebGLsizei stride, in WebGLsizeiptr offset);
|
||||||
|
|
|
@ -1956,3 +1956,39 @@ js_CreateTypedArrayWithBuffer(JSContext *cx, jsint atype, JSObject *bufArg,
|
||||||
AutoArrayRooter tvr(cx, JS_ARRAY_LENGTH(vals), vals);
|
AutoArrayRooter tvr(cx, JS_ARRAY_LENGTH(vals), vals);
|
||||||
return TypedArrayConstruct(cx, atype, argc, &vals[0]);
|
return TypedArrayConstruct(cx, atype, argc, &vals[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSUint32
|
||||||
|
JS_GetTypedArrayLength(JSObject *obj)
|
||||||
|
{
|
||||||
|
return obj->getSlot(TypedArray::FIELD_LENGTH).toInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSUint32
|
||||||
|
JS_GetTypedArrayByteOffset(JSObject *obj)
|
||||||
|
{
|
||||||
|
return obj->getSlot(TypedArray::FIELD_BYTEOFFSET).toInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSUint32
|
||||||
|
JS_GetTypedArrayByteLength(JSObject *obj)
|
||||||
|
{
|
||||||
|
return obj->getSlot(TypedArray::FIELD_BYTELENGTH).toInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSUint32
|
||||||
|
JS_GetTypedArrayType(JSObject *obj)
|
||||||
|
{
|
||||||
|
return obj->getSlot(TypedArray::FIELD_TYPE).toInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSObject *
|
||||||
|
JS_GetTypedArrayBuffer(JSObject *obj)
|
||||||
|
{
|
||||||
|
return (JSObject *) obj->getSlot(TypedArray::FIELD_BUFFER).toPrivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
JS_GetTypedArrayData(JSObject *obj)
|
||||||
|
{
|
||||||
|
return TypedArray::getDataOffset(obj);
|
||||||
|
}
|
||||||
|
|
|
@ -260,4 +260,22 @@ JS_GetArrayBufferByteLength(JSObject *obj);
|
||||||
JS_FRIEND_API(uint8 *)
|
JS_FRIEND_API(uint8 *)
|
||||||
JS_GetArrayBufferData(JSObject *obj);
|
JS_GetArrayBufferData(JSObject *obj);
|
||||||
|
|
||||||
|
JS_FRIEND_API(JSUint32)
|
||||||
|
JS_GetTypedArrayLength(JSObject *obj);
|
||||||
|
|
||||||
|
JS_FRIEND_API(JSUint32)
|
||||||
|
JS_GetTypedArrayByteOffset(JSObject *obj);
|
||||||
|
|
||||||
|
JS_FRIEND_API(JSUint32)
|
||||||
|
JS_GetTypedArrayByteLength(JSObject *obj);
|
||||||
|
|
||||||
|
JS_FRIEND_API(JSUint32)
|
||||||
|
JS_GetTypedArrayType(JSObject *obj);
|
||||||
|
|
||||||
|
JS_FRIEND_API(JSObject *)
|
||||||
|
JS_GetTypedArrayBuffer(JSObject *obj);
|
||||||
|
|
||||||
|
JS_FRIEND_API(void *)
|
||||||
|
JS_GetTypedArrayData(JSObject *obj);
|
||||||
|
|
||||||
#endif /* jstypedarray_h */
|
#endif /* jstypedarray_h */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче