Use rounding to 8888 in lighting filters, raster path.

when converting float -> 8-bit BGRA in lighting filters, use rounding
rather than floor(). This makes the GPU and raster paths match more
closely (as tested by Blink test
feDiffuseLighting-linearrgb-lighting-color.svg).

Will affect the LSB of lighting, imagefiltersscaled GMs.

R=junov@chromium.org
BUG=skia:

Review URL: https://codereview.chromium.org/205073002

git-svn-id: http://skia.googlecode.com/svn/trunk@13863 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/expectations/gm/ignored-tests.txt b/expectations/gm/ignored-tests.txt
index d9db6bc..d63d980 100644
--- a/expectations/gm/ignored-tests.txt
+++ b/expectations/gm/ignored-tests.txt
@@ -51,3 +51,8 @@
 # This change removes an API that this GM was testing. If/when it lands and sticks,
 # I will likely just delete the GM.
 canvas-layer-state
+
+# senorblanco: https://codereview.chromium.org/205073002/
+# This patch changes the LSB of raster lighting results, and will be rebaselined.
+imagefiltersscaled
+lighting
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 54bb1c8..09ceef0 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -64,9 +64,9 @@
         colorScale = SkScalarClampMax(colorScale, SK_Scalar1);
         SkPoint3 color(lightColor * colorScale);
         return SkPackARGB32(255,
-                            SkClampMax(SkScalarFloorToInt(color.fX), 255),
-                            SkClampMax(SkScalarFloorToInt(color.fY), 255),
-                            SkClampMax(SkScalarFloorToInt(color.fZ), 255));
+                            SkClampMax(SkScalarRoundToInt(color.fX), 255),
+                            SkClampMax(SkScalarRoundToInt(color.fY), 255),
+                            SkClampMax(SkScalarRoundToInt(color.fZ), 255));
     }
 private:
     SkScalar fKD;
@@ -84,10 +84,10 @@
             SkScalarPow(normal.dot(halfDir), fShininess));
         colorScale = SkScalarClampMax(colorScale, SK_Scalar1);
         SkPoint3 color(lightColor * colorScale);
-        return SkPackARGB32(SkClampMax(SkScalarFloorToInt(color.maxComponent()), 255),
-                            SkClampMax(SkScalarFloorToInt(color.fX), 255),
-                            SkClampMax(SkScalarFloorToInt(color.fY), 255),
-                            SkClampMax(SkScalarFloorToInt(color.fZ), 255));
+        return SkPackARGB32(SkClampMax(SkScalarRoundToInt(color.maxComponent()), 255),
+                            SkClampMax(SkScalarRoundToInt(color.fX), 255),
+                            SkClampMax(SkScalarRoundToInt(color.fY), 255),
+                            SkClampMax(SkScalarRoundToInt(color.fZ), 255));
     }
 private:
     SkScalar fKS;