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
This commit is contained in:
senorblanco@chromium.org 2014-03-19 19:44:41 +00:00
parent 8e13a159f3
commit b9c95978c6
2 changed files with 12 additions and 7 deletions

View File

@ -51,3 +51,8 @@ rrect_clip_aa
# 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

View File

@ -64,9 +64,9 @@ public:
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 @@ public:
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;