From 7214ada78f570f7897d33446e280086640666a14 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Wed, 13 Jun 2012 13:31:34 -0700 Subject: fix bug #1704 where small paths/strokes with large stroke width caused a flip of the gradient colors --- assets/canvas-runtime.js | 4 +++- js/lib/geom/brush-stroke.js | 1 + js/lib/geom/sub-path.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) 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, { if (ipColor.gradientMode){ var position, gradient, cs, inset; //vars used in gradient calculations inset = Math.ceil( lw ) - 0.5; - + inset=0; + if(ipColor.gradientMode === "radial") { var ww = w - 2*lw, hh = h - 2*lw; 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, { if (ipColor.gradientMode){ var position, gradient, cs, inset; //vars used in gradient calculations inset = Math.ceil( lw ) - 0.5; + inset=0; if(ipColor.gradientMode === "radial") { 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 if (ipColor.gradientMode){ var position, gradient, cs, inset; //vars used in gradient calculations inset = Math.ceil( lw ) - 0.5; + inset = 0; if(ipColor.gradientMode === "radial") { 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 if (ipColor.gradientMode){ var position, gradient, cs, inset; //vars used in gradient calculations inset = Math.ceil( lw ) - 0.5; + inset=0; if(ipColor.gradientMode === "radial") { var ww = w - 2*lw, hh = h - 2*lw; -- cgit v1.2.3