aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jumper/SkJumper_stages.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-16 12:03:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-16 21:10:14 +0000
commit7e68bc93ffaa394bd94a6954e2a8318a825067c6 (patch)
tree34e3898f3c119c5d562b423269adb14b60d99635 /src/jumper/SkJumper_stages.cpp
parent0eb4ecb88532494e32521bdcc60aa98c25089923 (diff)
clamp to premul in dither
Dither can bump color values above alpha (duh), or below zero (duh), so clamp back to premul after dithering. BUG=skia:6644,skia:6643 Change-Id: Ida107e866380e06130af0d01467117bca929ba44 Reviewed-on: https://skia-review.googlesource.com/17070 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/jumper/SkJumper_stages.cpp')
-rw-r--r--src/jumper/SkJumper_stages.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/jumper/SkJumper_stages.cpp b/src/jumper/SkJumper_stages.cpp
index a486403239..aa161e9c94 100644
--- a/src/jumper/SkJumper_stages.cpp
+++ b/src/jumper/SkJumper_stages.cpp
@@ -320,6 +320,10 @@ STAGE(dither) {
r += c->rate*dither;
g += c->rate*dither;
b += c->rate*dither;
+
+ r = max(0, min(r, a));
+ g = max(0, min(g, a));
+ b = max(0, min(b, a));
}
// load 4 floats from memory, and splat them into r,g,b,a