Bug 1313541 - ClearBuffer style fixes. - r=ethlin, a=gchang
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Thu, 13 Oct 2016 16:25:11 -0700
changeset 356588 4c980dc86a395c7534164c5d359b60c3d15e95c6
parent 356587 a001d6e786d202d277bae6bac28ffdf9f2e8d7b3
child 356589 1d2c29c98b70637b57b62744d53e87f289b7149c
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethlin, gchang
bugs1313541
milestone51.0a2
Bug 1313541 - ClearBuffer style fixes. - r=ethlin, a=gchang MozReview-Commit-ID: CZbWDAepxlX
dom/canvas/WebGL2ContextMRTs.cpp
--- a/dom/canvas/WebGL2ContextMRTs.cpp
+++ b/dom/canvas/WebGL2ContextMRTs.cpp
@@ -5,53 +5,56 @@
 
 #include "WebGL2Context.h"
 
 #include "GLContext.h"
 #include "WebGLFramebuffer.h"
 
 namespace mozilla {
 
-bool WebGL2Context::ValidateClearBuffer(const char* info, GLenum buffer, GLint drawbuffer, size_t elemCount)
+bool
+WebGL2Context::ValidateClearBuffer(const char* info, GLenum buffer, GLint drawbuffer,
+                                   size_t elemCount)
 {
-    size_t requiredElements = -1;
-    GLint maxDrawbuffer = -1;
+    size_t requiredElements;
+    GLint maxDrawbuffer;
     switch (buffer) {
-      case LOCAL_GL_COLOR:
-      case LOCAL_GL_FRONT:
-      case LOCAL_GL_BACK:
-      case LOCAL_GL_LEFT:
-      case LOCAL_GL_RIGHT:
-      case LOCAL_GL_FRONT_AND_BACK:
+    case LOCAL_GL_COLOR:
+    case LOCAL_GL_FRONT:
+    case LOCAL_GL_BACK:
+    case LOCAL_GL_LEFT:
+    case LOCAL_GL_RIGHT:
+    case LOCAL_GL_FRONT_AND_BACK:
           requiredElements = 4;
           maxDrawbuffer = mGLMaxDrawBuffers - 1;
           break;
 
-      case LOCAL_GL_DEPTH:
-      case LOCAL_GL_STENCIL:
+    case LOCAL_GL_DEPTH:
+    case LOCAL_GL_STENCIL:
           requiredElements = 1;
           maxDrawbuffer = 0;
           break;
 
-      default:
+    default:
           ErrorInvalidEnumInfo(info, buffer);
           return false;
     }
 
     if (drawbuffer < 0 || drawbuffer > maxDrawbuffer) {
         ErrorInvalidValue("%s: invalid drawbuffer %d. This buffer only supports drawbuffer values between 0 and %d",
                           info, drawbuffer, maxDrawbuffer);
         return false;
     }
 
     if (elemCount < requiredElements) {
         ErrorInvalidValue("%s: Not enough elements. Require %u. Given %u.",
                           info, requiredElements, elemCount);
         return false;
     }
+
     return true;
 }
 
 // Common base functionality. These a good candidates to be moved into WebGLContextUnchecked.cpp
 void
 WebGL2Context::ClearBufferiv_base(GLenum buffer, GLint drawbuffer, const GLint* value)
 {
     const char funcName[] = "clearBufferiv";