Bug 1170455 - Part 1: Reformat GetVertexAttrib function. r=jgilbert
authorDan Glastonbury <dglastonbury@mozilla.com>
Mon, 20 Jul 2015 12:55:38 +1000
changeset 254023 ce1426e69a5cfeec7f61aaadef817b8ffa2eebe2
parent 254022 5141f9fd3b4e0c8047fa19a30e7f36c0f399ae9d
child 254024 f03847cf62c27dad282e7b80559c2cd3422bef80
push id62627
push userdglastonbury@mozilla.com
push dateWed, 22 Jul 2015 02:04:59 +0000
treeherdermozilla-inbound@bef0545626b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1170455
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1170455 - Part 1: Reformat GetVertexAttrib function. r=jgilbert
dom/canvas/WebGLContextVertices.cpp
--- a/dom/canvas/WebGLContextVertices.cpp
+++ b/dom/canvas/WebGLContextVertices.cpp
@@ -254,52 +254,40 @@ WebGLContext::GetVertexAttrib(JSContext*
         return JS::NullValue();
 
     MOZ_ASSERT(mBoundVertexArray);
     mBoundVertexArray->EnsureAttrib(index);
 
     MakeContextCurrent();
 
     switch (pname) {
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
-        {
-            return WebGLObjectAsJSValue(cx, mBoundVertexArray->mAttribs[index].buf.get(), rv);
-        }
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+        return WebGLObjectAsJSValue(cx, mBoundVertexArray->mAttribs[index].buf.get(), rv);
+
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+        return JS::Int32Value(mBoundVertexArray->mAttribs[index].stride);
 
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE:
-        {
-            return JS::Int32Value(mBoundVertexArray->mAttribs[index].stride);
-        }
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE:
+        if (!mBoundVertexArray->mAttribs[index].enabled)
+            return JS::Int32Value(4);
 
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE:
-        {
-            if (!mBoundVertexArray->mAttribs[index].enabled)
-                return JS::Int32Value(4);
-
-            return JS::Int32Value(mBoundVertexArray->mAttribs[index].size);
-        }
+        return JS::Int32Value(mBoundVertexArray->mAttribs[index].size);
 
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE:
-        {
-            if (!mBoundVertexArray->mAttribs[index].enabled)
-                return JS::NumberValue(uint32_t(LOCAL_GL_FLOAT));
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE:
+        if (!mBoundVertexArray->mAttribs[index].enabled)
+            return JS::NumberValue(uint32_t(LOCAL_GL_FLOAT));
 
-            return JS::NumberValue(uint32_t(mBoundVertexArray->mAttribs[index].type));
-        }
+        return JS::NumberValue(uint32_t(mBoundVertexArray->mAttribs[index].type));
 
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
-        {
-            if (IsExtensionEnabled(WebGLExtensionID::ANGLE_instanced_arrays))
-            {
-                return JS::Int32Value(mBoundVertexArray->mAttribs[index].divisor);
-            }
-            break;
-        }
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+        if (IsExtensionEnabled(WebGLExtensionID::ANGLE_instanced_arrays))
+            return JS::Int32Value(mBoundVertexArray->mAttribs[index].divisor);
+        break;
 
-        case LOCAL_GL_CURRENT_VERTEX_ATTRIB:
+    case LOCAL_GL_CURRENT_VERTEX_ATTRIB:
         {
             GLfloat vec[4] = {0, 0, 0, 1};
             if (index) {
                 gl->fGetVertexAttribfv(index, LOCAL_GL_CURRENT_VERTEX_ATTRIB, &vec[0]);
             } else {
                 vec[0] = mVertexAttrib0Vector[0];
                 vec[1] = mVertexAttrib0Vector[1];
                 vec[2] = mVertexAttrib0Vector[2];
@@ -307,28 +295,24 @@ WebGLContext::GetVertexAttrib(JSContext*
             }
             JSObject* obj = dom::Float32Array::Create(cx, this, 4, vec);
             if (!obj) {
                 rv.Throw(NS_ERROR_OUT_OF_MEMORY);
             }
             return JS::ObjectOrNullValue(obj);
         }
 
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED:
-        {
-            return JS::BooleanValue(mBoundVertexArray->mAttribs[index].enabled);
-        }
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+        return JS::BooleanValue(mBoundVertexArray->mAttribs[index].enabled);
 
-        case LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
-        {
-            return JS::BooleanValue(mBoundVertexArray->mAttribs[index].normalized);
-        }
+    case LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+        return JS::BooleanValue(mBoundVertexArray->mAttribs[index].normalized);
 
-        default:
-            break;
+    default:
+        break;
     }
 
     ErrorInvalidEnumInfo("getVertexAttrib: parameter", pname);
     return JS::NullValue();
 }
 
 WebGLsizeiptr
 WebGLContext::GetVertexAttribOffset(GLuint index, GLenum pname)