check unpremul scale directly against infinity

There are non-zero values of a that make infinite 1.0f/a.
Let's just check for the real thing we care about, that
scale is finite.

Bug: skia:7123

Change-Id: If97574c9f3f2f0b73c749d0bea9aa19e6114f4d1
Reviewed-on: https://skia-review.googlesource.com/58460
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-10-11 13:05:24 -04:00 committed by Skia Commit-Bot
parent 587afc9df0
commit a65f2f001e
3 changed files with 9251 additions and 9208 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -572,7 +572,8 @@ STAGE(premul_dst, Ctx::None) {
db = db * da;
}
STAGE(unpremul, Ctx::None) {
auto scale = if_then_else(a == 0, 0, 1.0f / a);
float inf = bit_cast<float>(0x7f800000);
auto scale = if_then_else(1.0f/a < inf, 1.0f/a, 0);
r *= scale;
g *= scale;
b *= scale;