Commit 7fd85b3f authored by Ms2ger's avatar Ms2ger
Browse files

Bug 722154 - Part c: Remove custom quickstubs for compressedTexImage2D and...

Bug 722154 - Part c: Remove custom quickstubs for compressedTexImage2D and compressedTexSubImage2D; r=bjacob
parent 79d282af
Loading
Loading
Loading
Loading
+0 −101
Original line number Diff line number Diff line
@@ -77,107 +77,6 @@ helper_isFloat32Array(JSObject *obj) {
    return js::GetObjectClass(obj) == &js::TypedArray::fastClasses[js::TypedArray::TYPE_FLOAT32];
}

/*
 * CompressedTexImage2D takes:
 *    CompressedTexImage2D(uint, int, uint, int, int, int, ArrayBufferView)
 */
static JSBool
nsIDOMWebGLRenderingContext_CompressedTexImage2D(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);

    GET_UINT32_ARG(argv0, 0);
    GET_INT32_ARG(argv1, 1);
    GET_UINT32_ARG(argv2, 2);
    GET_INT32_ARG(argv3, 3);
    GET_INT32_ARG(argv4, 4);
    GET_INT32_ARG(argv5, 5);

    if (!JSVAL_IS_PRIMITIVE(argv[6])) {
        JSObject* argv6 = JSVAL_TO_OBJECT(argv[6]);
        if (js_IsTypedArray(argv6)) {
            rv = self->CompressedTexImage2D_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;
    }

    *vp = JSVAL_VOID;
    return JS_TRUE;
}

/*
 * CompressedTexSubImage2D takes:
 *    CompressedTexSubImage2D(uint, int, int, int, int, int, uint, ArrayBufferView)
 */
static JSBool
nsIDOMWebGLRenderingContext_CompressedTexSubImage2D(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 < 8)
        return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);

    jsval *argv = JS_ARGV(cx, vp);

    GET_UINT32_ARG(argv0, 0);
    GET_INT32_ARG(argv1, 1);
    GET_INT32_ARG(argv2, 2);
    GET_INT32_ARG(argv3, 3);
    GET_INT32_ARG(argv4, 4);
    GET_INT32_ARG(argv5, 5);
    GET_UINT32_ARG(argv6, 6);

    if (!JSVAL_IS_PRIMITIVE(argv[7])) {
        JSObject* argv7 = JSVAL_TO_OBJECT(argv[7]);
        if (js_IsTypedArray(argv7)) {
            rv = self->CompressedTexSubImage2D_array(argv0, argv1, argv2, argv3, argv4, argv5,
                                                     argv6, js::TypedArray::getTypedArray(argv7));
        } else {
            xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 7);
            return JS_FALSE;
        }
    } else {
        xpc_qsThrow(cx, NS_ERROR_FAILURE);
        return JS_FALSE;
    }

    *vp = JSVAL_VOID;
    return JS_TRUE;
}

/*
 * ReadPixels takes:
 *    ReadPixels(int, int, int, int, uint, uint, ArrayBufferView)
+18 −23
Original line number Diff line number Diff line
@@ -4567,20 +4567,17 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
}

NS_IMETHODIMP
WebGLContext::CompressedTexImage2D(PRInt32)
WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum internalformat,
                                   WebGLsizei width, WebGLsizei height, WebGLint border,
                                   const JS::Value& pixels)
{
    NS_RUNTIMEABORT("CompressedTexImage2D(PRInt32) should never be called");

    if (!pixels.isObject() || !js_IsTypedArray(&pixels.toObject())) {
        return NS_ERROR_FAILURE;
    }

NS_IMETHODIMP
WebGLContext::CompressedTexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat,
                                         WebGLsizei width, WebGLsizei height, WebGLint border,
                                         JSObject *pixels)
{
    if (!IsContextStable())
    if (!IsContextStable()) {
        return NS_OK;
    }

    WebGLTexture *tex = activeBoundTextureForTarget(target);
    if (!tex)
@@ -4590,24 +4587,22 @@ WebGLContext::CompressedTexImage2D_array(WebGLenum target, WebGLint level, WebGL
}

NS_IMETHODIMP
WebGLContext::CompressedTexSubImage2D(PRInt32)
WebGLContext::CompressedTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset,
                                      WebGLint yoffset, WebGLsizei width, WebGLsizei height,
                                      WebGLenum format, const JS::Value& pixels)
{
    NS_RUNTIMEABORT("CompressedTexSubImage2D(PRInt32) should never be called");

    if (!pixels.isObject() || !js_IsTypedArray(&pixels.toObject())) {
        return NS_ERROR_FAILURE;
    }

NS_IMETHODIMP
WebGLContext::CompressedTexSubImage2D_array(WebGLenum target, WebGLint level, WebGLint xoffset,
                                            WebGLint yoffset, WebGLsizei width, WebGLsizei height,
                                            WebGLenum format, JSObject *pixels)
{
    if (!IsContextStable())
    if (!IsContextStable()) {
        return NS_OK;
    }

    WebGLTexture *tex = activeBoundTextureForTarget(target);
    if (!tex)
    if (!tex) {
        return ErrorInvalidOperation("compressedTexSubImage2D: no texture is bound to this target");
    }

    return ErrorInvalidEnum("compressedTexSubImage2D: compressed textures are not supported");
}
+7 −9
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
  const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
};

[scriptable, builtinclass, uuid(cabad79d-222c-40d1-a746-4942278c0bba)]
[scriptable, builtinclass, uuid(6db28d5b-f230-4d81-a457-b82c5369fc11)]
interface nsIDOMWebGLRenderingContext : nsISupports
{
  //
@@ -634,15 +634,13 @@ interface nsIDOMWebGLRenderingContext : nsISupports
  void colorMask(in WebGLboolean red, in WebGLboolean green, in WebGLboolean blue, in WebGLboolean alpha);
  void compileShader([optional] in nsIWebGLShader shader);

  void compressedTexImage2D([optional] in long dummy);
  [noscript] void compressedTexImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
  void compressedTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
                            in WebGLsizei width, in WebGLsizei height, in WebGLint border,
                                             in WebGLJSObjectPtr pixels);
                            in jsval pixels);

  void compressedTexSubImage2D([optional] in long dummy);
  [noscript] void compressedTexSubImage2D_array(in WebGLenum target, in WebGLint level, in WebGLint xoffset,
  void compressedTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset,
                               in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
                                                in WebGLenum format, in WebGLJSObjectPtr pixels);
                               in WebGLenum format, in jsval pixels);

  void copyTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat, 
                      in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height, in WebGLint border);
+0 −2
Original line number Diff line number Diff line
@@ -981,8 +981,6 @@ customMethodCalls = {
    'nsIDOMWebGLRenderingContext_ReadPixels': CUSTOM_QS,
    'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
    'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
    'nsIDOMWebGLRenderingContext_CompressedTexImage2D': CUSTOM_QS,
    'nsIDOMWebGLRenderingContext_CompressedTexSubImage2D': CUSTOM_QS,
    'nsIDOMWebGLRenderingContext_Uniform1iv': CUSTOM_QS_TN,
    'nsIDOMWebGLRenderingContext_Uniform2iv': CUSTOM_QS_TN,
    'nsIDOMWebGLRenderingContext_Uniform3iv': CUSTOM_QS_TN,