Bug 972682 - make UploadImageDataToTexture not pass uninitialized parameters to glTexImage2D - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 20 Feb 2014 08:05:34 -0500
changeset 170024 3159065d1ceec2054a1451328226ecec650ee088
parent 170023 88950b3366602a1ed2d4024265e49d7ac8238ded
child 170025 f0412d2e262c6d149b5ce95a02dc9c37f16387c6
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjgilbert
bugs972682
milestone30.0a1
Bug 972682 - make UploadImageDataToTexture not pass uninitialized parameters to glTexImage2D - r=jgilbert
gfx/gl/GLUploadHelpers.cpp
--- a/gfx/gl/GLUploadHelpers.cpp
+++ b/gfx/gl/GLUploadHelpers.cpp
@@ -417,21 +417,21 @@ UploadImageDataToTexture(GLContext* gl,
 
     nsIntRegion paintRegion;
     if (!textureInited) {
         paintRegion = nsIntRegion(aDstRegion.GetBounds());
     } else {
         paintRegion = aDstRegion;
     }
 
-    GLenum format;
-    GLenum internalFormat;
-    GLenum type;
+    GLenum format = 0;
+    GLenum internalFormat = 0;
+    GLenum type = 0;
     int32_t pixelSize = BytesPerPixel(aFormat);
-    SurfaceFormat surfaceFormat;
+    SurfaceFormat surfaceFormat = gfx::SurfaceFormat::UNKNOWN;
 
     MOZ_ASSERT(gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA ||
                gl->GetPreferredARGB32Format() == LOCAL_GL_RGBA);
     switch (aFormat) {
         case SurfaceFormat::B8G8R8A8:
             if (gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA) {
               format = LOCAL_GL_BGRA;
               surfaceFormat = SurfaceFormat::R8G8B8A8;
@@ -465,19 +465,16 @@ UploadImageDataToTexture(GLContext* gl,
         case SurfaceFormat::A8:
             internalFormat = format = LOCAL_GL_LUMINANCE;
             type = LOCAL_GL_UNSIGNED_BYTE;
             // We don't have a specific luminance shader
             surfaceFormat = SurfaceFormat::A8;
             break;
         default:
             NS_ASSERTION(false, "Unhandled image surface format!");
-            format = 0;
-            type = 0;
-            surfaceFormat = SurfaceFormat::UNKNOWN;
     }
 
     nsIntRegionRectIterator iter(paintRegion);
     const nsIntRect *iterRect;
 
     // Top left point of the region's bounding rectangle.
     nsIntPoint topLeft = paintRegion.GetBounds().TopLeft();