зеркало из https://github.com/mozilla/pjs.git
Bug 722154 - Part d: Remove custom quickstub for readPixels; r=bjacob
This commit is contained in:
Родитель
0dd907c250
Коммит
43e858d60c
|
@ -77,64 +77,6 @@ helper_isFloat32Array(JSObject *obj) {
|
|||
return js::GetObjectClass(obj) == &js::TypedArray::fastClasses[js::TypedArray::TYPE_FLOAT32];
|
||||
}
|
||||
|
||||
/*
|
||||
* ReadPixels takes:
|
||||
* ReadPixels(int, int, int, int, uint, uint, ArrayBufferView)
|
||||
*/
|
||||
static JSBool
|
||||
nsIDOMWebGLRenderingContext_ReadPixels(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsIDOMWebGLRenderingContext *self;
|
||||
xpc_qsSelfRef selfref;
|
||||
JS::AutoValueRooter tvr(cx);
|
||||
if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
|
||||
return JS_FALSE;
|
||||
|
||||
if (argc < 7)
|
||||
return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
|
||||
|
||||
jsval *argv = JS_ARGV(cx, vp);
|
||||
|
||||
// arguments common to all cases
|
||||
GET_INT32_ARG(argv0, 0);
|
||||
GET_INT32_ARG(argv1, 1);
|
||||
GET_INT32_ARG(argv2, 2);
|
||||
GET_INT32_ARG(argv3, 3);
|
||||
GET_UINT32_ARG(argv4, 4);
|
||||
GET_UINT32_ARG(argv5, 5);
|
||||
|
||||
if (argc == 7 &&
|
||||
!JSVAL_IS_PRIMITIVE(argv[6]))
|
||||
{
|
||||
JSObject *argv6 = JSVAL_TO_OBJECT(argv[6]);
|
||||
if (js_IsTypedArray(argv6)) {
|
||||
rv = self->ReadPixels_array(argv0, argv1, argv2, argv3,
|
||||
argv4, argv5,
|
||||
js::TypedArray::getTypedArray(argv6));
|
||||
} else {
|
||||
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 6);
|
||||
return JS_FALSE;
|
||||
}
|
||||
} else {
|
||||
xpc_qsThrow(cx, NS_ERROR_FAILURE);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return xpc_qsThrowMethodFailed(cx, rv, vp);
|
||||
|
||||
*vp = JSVAL_VOID;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
class CallTexImage2D
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -811,8 +811,6 @@ protected:
|
|||
void *pixels, PRUint32 byteLength,
|
||||
int jsArrayType,
|
||||
int srcFormat, bool srcPremultiplied);
|
||||
nsresult ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type, JSObject* pixels);
|
||||
nsresult TexParameter_base(WebGLenum target, WebGLenum pname,
|
||||
WebGLint *intParamPtr, WebGLfloat *floatParamPtr);
|
||||
|
||||
|
|
|
@ -3333,18 +3333,19 @@ WebGLContext::PixelStorei(WebGLenum pname, WebGLint param)
|
|||
GL_SAME_METHOD_2(PolygonOffset, PolygonOffset, WebGLfloat, WebGLfloat)
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::ReadPixels(PRInt32)
|
||||
WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type, const JS::Value& pixelsVal)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
if (!pixelsVal.isObject() || !js_IsTypedArray(&pixelsVal.toObject())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSObject& pixels = pixelsVal.toObject();
|
||||
|
||||
if (!IsContextStable()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type, JSObject* pixels)
|
||||
{
|
||||
if (HTMLCanvasElement()->IsWriteOnly() && !nsContentUtils::IsCallerTrustedForRead()) {
|
||||
LogMessageIfVerbose("ReadPixels: Not allowed");
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
@ -3353,16 +3354,13 @@ WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsiz
|
|||
if (width < 0 || height < 0)
|
||||
return ErrorInvalidValue("ReadPixels: negative size passed");
|
||||
|
||||
if (!pixels)
|
||||
return ErrorInvalidValue("ReadPixels: null array passed");
|
||||
|
||||
const WebGLRectangleObject *framebufferRect = FramebufferRectangleObject();
|
||||
WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
|
||||
WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
|
||||
|
||||
void* data = JS_GetTypedArrayData(pixels);
|
||||
PRUint32 dataByteLen = JS_GetTypedArrayByteLength(pixels);
|
||||
int dataType = JS_GetTypedArrayType(pixels);
|
||||
void* data = JS_GetTypedArrayData(&pixels);
|
||||
PRUint32 dataByteLen = JS_GetTypedArrayByteLength(&pixels);
|
||||
int dataType = JS_GetTypedArrayType(&pixels);
|
||||
|
||||
PRUint32 channels = 0;
|
||||
|
||||
|
@ -3561,16 +3559,6 @@ WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsiz
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::ReadPixels_array(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type, JSObject *pixels)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
return ReadPixels_base(x, y, width, height, format, type, pixels);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, WebGLsizei width, WebGLsizei height)
|
||||
{
|
||||
|
|
|
@ -177,7 +177,7 @@ interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
|
|||
const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(6db28d5b-f230-4d81-a457-b82c5369fc11)]
|
||||
[scriptable, builtinclass, uuid(aae55fc4-b650-4178-920a-c985b720d9bb)]
|
||||
interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
{
|
||||
//
|
||||
|
@ -749,9 +749,8 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
|||
void pixelStorei(in WebGLenum pname, in WebGLint param);
|
||||
void polygonOffset(in WebGLfloat factor, in WebGLfloat units);
|
||||
|
||||
void readPixels([optional] in long dummy);
|
||||
[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);
|
||||
void readPixels(in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height,
|
||||
in WebGLenum format, in WebGLenum type, in jsval pixels);
|
||||
|
||||
//void glReleaseShaderCompiler();
|
||||
|
||||
|
|
|
@ -978,7 +978,6 @@ customMethodCalls = {
|
|||
'unwrapThisFailureFatal' : False
|
||||
},
|
||||
# WebGL
|
||||
'nsIDOMWebGLRenderingContext_ReadPixels': CUSTOM_QS,
|
||||
'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
|
||||
'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
|
||||
'nsIDOMWebGLRenderingContext_Uniform1iv': CUSTOM_QS_TN,
|
||||
|
|
Загрузка…
Ссылка в новой задаче