work around leftshift for negative values

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1774963002

Review URL: https://codereview.chromium.org/1774963002
This commit is contained in:
reed 2016-03-08 09:02:24 -08:00 committed by Commit bot
parent c41fd9251d
commit aa5e1ae06b

View File

@ -326,8 +326,9 @@ static inline int SkFDot6UpShift(SkFDot6 x, int upShift) {
*/ */
static SkFDot6 cubic_delta_from_line(SkFDot6 a, SkFDot6 b, SkFDot6 c, SkFDot6 d) static SkFDot6 cubic_delta_from_line(SkFDot6 a, SkFDot6 b, SkFDot6 c, SkFDot6 d)
{ {
SkFDot6 oneThird = ((a << 3) - ((b << 4) - b) + 6*c + d) * 19 >> 9; // since our parameters may be negative, we don't use << to avoid ASAN warnings
SkFDot6 twoThird = (a + 6*b - ((c << 4) - c) + (d << 3)) * 19 >> 9; SkFDot6 oneThird = (a*8 - b*15 + 6*c + d) * 19 >> 9;
SkFDot6 twoThird = (a + 6*b - c*15 + d*8) * 19 >> 9;
return SkMax32(SkAbs32(oneThird), SkAbs32(twoThird)); return SkMax32(SkAbs32(oneThird), SkAbs32(twoThird));
} }