Bug 812890 - spot light filters do not process limiting cone angle properly. r=cam
authorRobert Longson <longsonr@gmail.com>
Mon, 10 Dec 2012 12:14:25 +0000
changeset 124587 cfccbaf87671adf1be8442cdded6ca79c4bb4d68
parent 124586 64dabdd4df4a93e1ac4a84bd6fecfa6da84107b8
child 124588 36ac5361823644b6c993658323f32ba6c3003469
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscam
bugs812890
milestone20.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 812890 - spot light filters do not process limiting cone angle properly. r=cam
content/svg/content/src/nsSVGFilters.cpp
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -5118,18 +5118,18 @@ nsSVGFELightingElement::Filter(nsSVGFilt
 
       if (spotLight) {
         float S[3];
         S[0] = pointsAt[0] - lightPos[0];
         S[1] = pointsAt[1] - lightPos[1];
         S[2] = pointsAt[2] - lightPos[2];
         NORMALIZE(S);
         float dot = -DOT(L, S);
-        if (dot < cosConeAngle) dot = 0;
         float tmp = pow(dot, specularExponent);
+        if (dot < cosConeAngle) tmp = 0;
         color = NS_RGB(uint8_t(NS_GET_R(lightColor) * tmp),
                        uint8_t(NS_GET_G(lightColor) * tmp),
                        uint8_t(NS_GET_B(lightColor) * tmp));
       } else {
         color = lightColor;
       }
 
       LightPixel(N, L, color, targetData + index);
@@ -5978,17 +5978,17 @@ nsSVGFEDisplacementMapElement::Filter(ns
   int32_t width = instance->GetSurfaceWidth();
   int32_t height = instance->GetSurfaceHeight();
 
   uint8_t* sourceData = aSources[0]->mImage->Data();
   uint8_t* displacementData = aSources[1]->mImage->Data();
   uint8_t* targetData = aTarget->mImage->Data();
   uint32_t stride = aTarget->mImage->Stride();
 
-  static uint8_t dummyData[4] = { 0, 0, 0, 0 };
+  static const uint8_t dummyData[4] = { 0, 0, 0, 0 };
 
   static const uint16_t channelMap[5] = {
                              0,
                              GFX_ARGB32_OFFSET_R,
                              GFX_ARGB32_OFFSET_G,
                              GFX_ARGB32_OFFSET_B,
                              GFX_ARGB32_OFFSET_A };
   uint16_t xChannel = channelMap[mEnumAttributes[CHANNEL_X].GetAnimValue()];
@@ -6005,17 +6005,17 @@ nsSVGFEDisplacementMapElement::Filter(ns
         NSToIntFloor(scaleOver255 * displacementData[targIndex + xChannel] +
                 scaleAdjustment);
       int32_t sourceY = y +
         NSToIntFloor(scaleOver255 * displacementData[targIndex + yChannel] +
                 scaleAdjustment);
 
       bool outOfBounds = sourceX < 0 || sourceX >= width ||
                          sourceY < 0 || sourceY >= height;
-      uint8_t* data;
+      const uint8_t* data;
       int32_t multiplier;
       if (outOfBounds) {
         data = dummyData;
         multiplier = 0;
       } else {
         data = sourceData;
         multiplier = 1;
       }