From 271a8f2b29d87d12c81d03e3f1e2c05b816a138d Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Wed, 29 Feb 2012 11:50:41 -0800 Subject: prevent extremely long path rendering (temporary fix) --- js/helper-classes/RDGE/GLBrushStroke.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js') 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() { //smaller value means more samples for the path this._WETNESS_FACTOR = 0.25; + //prevent extremely long paths that can take a long time to render + this._MAX_ALLOWED_SAMPLES = 500; + //drawing context this._world = null; @@ -159,6 +162,12 @@ function GLBrushStroke() { prevPt=pt; //update numPoints to match the new length numPoints = this._Points.length; + + //end this function if the numPoints has gone above the max. size specified + if (numPoints> this._MAX_ALLOWED_SAMPLES){ + console.log("leaving the resampling because numPoints is greater than limit:"+this._MAX_ALLOWED_SAMPLES); + break; + } } } -- cgit v1.2.3