aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPushkar Joshi2012-06-13 13:31:34 -0700
committerPushkar Joshi2012-06-13 13:31:34 -0700
commit7214ada78f570f7897d33446e280086640666a14 (patch)
treeffa665e862e3d11196cf1b852a5f54ed2ac8478a
parent877cb0294fa9a91b6926239d476eac2e6b1c6506 (diff)
downloadninja-7214ada78f570f7897d33446e280086640666a14.tar.gz
fix bug #1704 where small paths/strokes with large stroke width caused a flip of the gradient colors
-rw-r--r--assets/canvas-runtime.js4
-rwxr-xr-xjs/lib/geom/brush-stroke.js1
-rwxr-xr-xjs/lib/geom/sub-path.js1
3 files changed, 5 insertions, 1 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index feb35187..6268f0bb 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -1969,7 +1969,8 @@ NinjaCvsRt.RuntimeSubPath = Object.create(NinjaCvsRt.RuntimeGeomObj, {
1969 if (ipColor.gradientMode){ 1969 if (ipColor.gradientMode){
1970 var position, gradient, cs, inset; //vars used in gradient calculations 1970 var position, gradient, cs, inset; //vars used in gradient calculations
1971 inset = Math.ceil( lw ) - 0.5; 1971 inset = Math.ceil( lw ) - 0.5;
1972 1972 inset=0;
1973
1973 if(ipColor.gradientMode === "radial") { 1974 if(ipColor.gradientMode === "radial") {
1974 var ww = w - 2*lw, hh = h - 2*lw; 1975 var ww = w - 2*lw, hh = h - 2*lw;
1975 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2); 1976 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2);
@@ -2181,6 +2182,7 @@ NinjaCvsRt.RuntimeBrushStroke = Object.create(NinjaCvsRt.RuntimeGeomObj, {
2181 if (ipColor.gradientMode){ 2182 if (ipColor.gradientMode){
2182 var position, gradient, cs, inset; //vars used in gradient calculations 2183 var position, gradient, cs, inset; //vars used in gradient calculations
2183 inset = Math.ceil( lw ) - 0.5; 2184 inset = Math.ceil( lw ) - 0.5;
2185 inset=0;
2184 2186
2185 if(ipColor.gradientMode === "radial") { 2187 if(ipColor.gradientMode === "radial") {
2186 var ww = w - 2*lw, hh = h - 2*lw; 2188 var ww = w - 2*lw, hh = h - 2*lw;
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index b69139b6..c9224fde 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -665,6 +665,7 @@ BrushStroke.prototype.buildColor = function(ctx, //the 2D rendering con
665 if (ipColor.gradientMode){ 665 if (ipColor.gradientMode){
666 var position, gradient, cs, inset; //vars used in gradient calculations 666 var position, gradient, cs, inset; //vars used in gradient calculations
667 inset = Math.ceil( lw ) - 0.5; 667 inset = Math.ceil( lw ) - 0.5;
668 inset = 0;
668 669
669 if(ipColor.gradientMode === "radial") { 670 if(ipColor.gradientMode === "radial") {
670 var ww = w - 2*lw, hh = h - 2*lw; 671 var ww = w - 2*lw, hh = h - 2*lw;
diff --git a/js/lib/geom/sub-path.js b/js/lib/geom/sub-path.js
index ba277197..9b72f6b7 100755
--- a/js/lib/geom/sub-path.js
+++ b/js/lib/geom/sub-path.js
@@ -87,6 +87,7 @@ GLSubpath.prototype.buildColor = function(ctx, //the 2D rendering conte
87 if (ipColor.gradientMode){ 87 if (ipColor.gradientMode){
88 var position, gradient, cs, inset; //vars used in gradient calculations 88 var position, gradient, cs, inset; //vars used in gradient calculations
89 inset = Math.ceil( lw ) - 0.5; 89 inset = Math.ceil( lw ) - 0.5;
90 inset=0;
90 91
91 if(ipColor.gradientMode === "radial") { 92 if(ipColor.gradientMode === "radial") {
92 var ww = w - 2*lw, hh = h - 2*lw; 93 var ww = w - 2*lw, hh = h - 2*lw;