Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Unified Diff: src/core/SkXfermode.cpp

Issue 101623007: Fixed more issues (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/effects/SkDisplacementMapEffect.cpp » ('j') | src/effects/SkDisplacementMapEffect.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermode.cpp
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 8cb79c2dbd29f3682450f4392bb5ff04347ca9cf..51e384e6f70b4c391511aa0253c8063d5cb3ad64 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -468,16 +468,17 @@ static inline void clipColor(int* r, int* g, int* b, int a) {
int L = Lum(*r, *g, *b);
int n = minimum(*r, *g, *b);
int x = maximum(*r, *g, *b);
- if(n < 0) {
- *r = L + SkMulDiv(*r - L, L, L - n);
- *g = L + SkMulDiv(*g - L, L, L - n);
- *b = L + SkMulDiv(*b - L, L, L - n);
+ if((n < 0) && (n = L - n)) { // Store denom in 'n' and make sure it's non zero
Stephen White 2013/12/09 21:16:12 Mike (or Florin? not sure who wrote this) should p
reed1 2013/12/09 21:20:49 I don't know who wrote this. For readability, I'd
fmalita_google_do_not_use 2013/12/09 21:29:12 FWIW, this was added by Rik (https://chromiumcoder
+ *r = L + SkMulDiv(*r - L, L, n);
+ *g = L + SkMulDiv(*g - L, L, n);
+ *b = L + SkMulDiv(*b - L, L, n);
}
- if (x > a) {
- *r = L + SkMulDiv(*r - L, a - L, x - L);
- *g = L + SkMulDiv(*g - L, a - L, x - L);
- *b = L + SkMulDiv(*b - L, a - L, x - L);
+ if ((x > a) && (x = x - L)) { // Store denom in 'x' and make sure it's non zero
+ n = a - L; // Store numer in 'n'
+ *r = L + SkMulDiv(*r - L, n, x);
+ *g = L + SkMulDiv(*g - L, n, x);
+ *b = L + SkMulDiv(*b - L, n, x);
}
}
« no previous file with comments | « no previous file | src/effects/SkDisplacementMapEffect.cpp » ('j') | src/effects/SkDisplacementMapEffect.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698