Bug 1133160 - Matrix filters should have 20 elements. r=mstange
authorMilan Sreckovic <milan@mozilla.com>
Wed, 18 Feb 2015 18:11:54 -0500
changeset 229936 3615c8ae27ad4ea47ccae77a74c5145cc5bd7265
parent 229935 c649b0112e6d3abcf1de013fce37adde06b07b55
child 229937 9d623faf8c8b065dc0c18256e51a23daf75e8321
push id55843
push userryanvm@gmail.com
push dateFri, 20 Feb 2015 00:52:59 +0000
treeherdermozilla-inbound@3615c8ae27ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1133160
milestone38.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 1133160 - Matrix filters should have 20 elements. r=mstange
gfx/src/FilterSupport.cpp
--- a/gfx/src/FilterSupport.cpp
+++ b/gfx/src/FilterSupport.cpp
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FilterSupport.h"
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Filters.h"
+#include "mozilla/gfx/Logging.h"
 #include "mozilla/PodOperations.h"
 
 #include "gfxContext.h"
 #include "gfxPattern.h"
 #include "gfxPlatform.h"
 #include "gfx2DGlue.h"
 
 #include "nsMargin.h"
@@ -394,18 +395,19 @@ ComputeColorMatrix(uint32_t aColorMatrix
   static const float hueRotateR = 0.143f;
   static const float hueRotateG = 0.140f;
   static const float hueRotateB = 0.283f;
 
   switch (aColorMatrixType) {
 
     case SVG_FECOLORMATRIX_TYPE_MATRIX:
     {
-      if (aValues.Length() != 20)
+      if (aValues.Length() != 20) {
         return NS_ERROR_FAILURE;
+      }
 
       PodCopy(aOutMatrix, aValues.Elements(), 20);
       break;
     }
 
     case SVG_FECOLORMATRIX_TYPE_SATURATE:
     {
       if (aValues.Length() != 1)
@@ -1474,17 +1476,17 @@ FilterSupport::PostFilterExtentsForPrimi
       }
       return ThebesIntRect(aDescription.PrimitiveSubregion());
     }
 
     case PrimitiveType::ColorMatrix:
     {
       if (atts.GetUint(eColorMatrixType) == (uint32_t)SVG_FECOLORMATRIX_TYPE_MATRIX) {
         const nsTArray<float>& values = atts.GetFloats(eColorMatrixValues);
-        if (values[19] > 0.0f) {
+        if (values.Length() == 20 && values[19] > 0.0f) {
           return ThebesIntRect(aDescription.PrimitiveSubregion());
         }
       }
       return aInputExtents[0];
     }
 
     case PrimitiveType::ComponentTransfer:
     {