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 330780 61f5cb9b36df99327afc958e6a34b0c8ac876e48
parent 330779 c0503b9ac96a6f83d94c1e9b922d6e783586a51c
child 330781 c74b25c022b7318115a6e0c85d264d0b2808a4a2
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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);