aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-29 11:50:41 -0800
committerPushkar Joshi2012-02-29 11:50:41 -0800
commit271a8f2b29d87d12c81d03e3f1e2c05b816a138d (patch)
treed55dc0c615335dd156cfbe70a50f7da4951f448b
parent46fb52be241dced940d46629c809a09c86ed4438 (diff)
downloadninja-271a8f2b29d87d12c81d03e3f1e2c05b816a138d.tar.gz
prevent extremely long path rendering (temporary fix)
-rwxr-xr-xjs/helper-classes/RDGE/GLBrushStroke.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/GLBrushStroke.js b/js/helper-classes/RDGE/GLBrushStroke.js
index 07a4a039..5d773c2d 100755
--- a/js/helper-classes/RDGE/GLBrushStroke.js
+++ b/js/helper-classes/RDGE/GLBrushStroke.js
@@ -38,6 +38,9 @@ function GLBrushStroke() {
38 //smaller value means more samples for the path 38 //smaller value means more samples for the path
39 this._WETNESS_FACTOR = 0.25; 39 this._WETNESS_FACTOR = 0.25;
40 40
41 //prevent extremely long paths that can take a long time to render
42 this._MAX_ALLOWED_SAMPLES = 500;
43
41 //drawing context 44 //drawing context
42 this._world = null; 45 this._world = null;
43 46
@@ -159,6 +162,12 @@ function GLBrushStroke() {
159 prevPt=pt; 162 prevPt=pt;
160 //update numPoints to match the new length 163 //update numPoints to match the new length
161 numPoints = this._Points.length; 164 numPoints = this._Points.length;
165
166 //end this function if the numPoints has gone above the max. size specified
167 if (numPoints> this._MAX_ALLOWED_SAMPLES){
168 console.log("leaving the resampling because numPoints is greater than limit:"+this._MAX_ALLOWED_SAMPLES);
169 break;
170 }
162 } 171 }
163 } 172 }
164 173