summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0f915e1)
raw | patch | inline | side by side (parent: 0f915e1)
author | jaspervdg <jaspervdg@users.sourceforge.net> | |
Wed, 1 Apr 2009 19:00:07 +0000 (19:00 +0000) | ||
committer | jaspervdg <jaspervdg@users.sourceforge.net> | |
Wed, 1 Apr 2009 19:00:07 +0000 (19:00 +0000) |
src/sp-gradient.cpp | patch | blob | history |
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 3abb91690c9f08512c59f6348ee60cd7d64d661a..09c2bd65f2164650af927f5e44222f93fee0f9e6 100644 (file)
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
gint o1 = (gint) floor(gr->vector.stops[i + 1].offset * (NCOLORS - 0.001));
if (o1 > o0) {
for (int j = o0; j < o1 + 1; j++) {
- gr->color[4 * j + 0] = r0 + DIV_ROUND((j-o0)*(r1-r0),(o1-o0));
- gr->color[4 * j + 1] = g0 + DIV_ROUND((j-o0)*(g1-g0),(o1-o0));
- gr->color[4 * j + 2] = b0 + DIV_ROUND((j-o0)*(b1-b0),(o1-o0));
- gr->color[4 * j + 3] = a0 + DIV_ROUND((j-o0)*(a1-a0),(o1-o0));
+ gr->color[4 * j + 0] = r0 + ((j-o0)*(r1-r0) + (o1-o0)/2)/(o1-o0);
+ gr->color[4 * j + 1] = g0 + ((j-o0)*(g1-g0) + (o1-o0)/2)/(o1-o0);
+ gr->color[4 * j + 2] = b0 + ((j-o0)*(b1-b0) + (o1-o0)/2)/(o1-o0);
+ gr->color[4 * j + 3] = a0 + ((j-o0)*(a1-a0) + (o1-o0)/2)/(o1-o0);
}
}
}