Bug 1279997 - Improve the check of alpha premult in TexOrSubImage. r=jgilbert
authorEthan Lin <ethlin@mozilla.com>
Mon, 18 Jul 2016 19:37:00 +0200
changeset 389626 61f5cb9b36df99327afc958e6a34b0c8ac876e48
parent 389625 c0503b9ac96a6f83d94c1e9b922d6e783586a51c
child 389627 c74b25c022b7318115a6e0c85d264d0b2808a4a2
push id23471
push userbmo:tchiovoloni@mozilla.com
push dateTue, 19 Jul 2016 18:52:45 +0000
reviewersjgilbert
bugs1279997
milestone50.0a1
Bug 1279997 - Improve the check of alpha premult in TexOrSubImage. r=jgilbert
dom/canvas/TexUnpackBlob.cpp
--- a/dom/canvas/TexUnpackBlob.cpp
+++ b/dom/canvas/TexUnpackBlob.cpp
@@ -15,22 +15,22 @@
 #include "WebGLContext.h"
 #include "WebGLTexelConversions.h"
 #include "WebGLTexture.h"
 
 namespace mozilla {
 namespace webgl {
 
 static bool
-UnpackFormatHasAlpha(GLenum unpackFormat)
+UnpackFormatHasColorAndAlpha(GLenum unpackFormat)
 {
     switch (unpackFormat) {
-    case LOCAL_GL_ALPHA:
     case LOCAL_GL_LUMINANCE_ALPHA:
     case LOCAL_GL_RGBA:
+    case LOCAL_GL_SRGB_ALPHA:
         return true;
 
     default:
         return false;
     }
 }
 
 static WebGLTexelFormat
@@ -211,17 +211,17 @@ TexUnpackBlob::ConvertIfNeeded(WebGLCont
         return false;
     }
 
     //////
 
     const auto dstFormat = FormatForPackingInfo(pi);
 
     bool premultMatches = (mIsSrcPremult == isDstPremult);
-    if (!UnpackFormatHasAlpha(dstDUI->unpackFormat)) {
+    if (!UnpackFormatHasColorAndAlpha(dstDUI->unpackFormat)) {
         premultMatches = true;
     }
 
     const bool needsPixelConversion = (srcFormat != dstFormat || !premultMatches);
     const bool originsMatch = (srcOrigin == dstOrigin);
 
     MOZ_ASSERT_IF(!needsPixelConversion, srcBPP == dstBPP);