diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index dafe4ba..c518279 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -372,10 +372,10 @@ var recPoints = []; recPoints.push(x, y + radius); - recPoints = recPoints.concat(this.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height)); - recPoints = recPoints.concat(this.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius)); - recPoints = recPoints.concat(this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y)); - recPoints = recPoints.concat(this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius)); + this.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height, recPoints); + this.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius, recPoints); + this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints); + this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius, recPoints); if (graphicsData.fill) { @@ -435,11 +435,11 @@ * @param cpY {number} Control point y * @param toX {number} Destination point x * @param toY {number} Destination point y + * @param [out] {number[]} The output array to add points into. If not passed, a new array is created. * @return {number[]} an array of points */ -GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY) +GraphicsRenderer.prototype.quadraticBezierCurve = function (fromX, fromY, cpX, cpY, toX, toY, out) { - var xa, ya, xb, @@ -447,7 +447,7 @@ x, y, n = 20, - points = []; + points = out || []; function getPt(n1 , n2, perc) { var diff = n2 - n1; @@ -471,6 +471,7 @@ points.push(x, y); } + return points; }; @@ -836,7 +837,7 @@ * Builds a polygon to draw * * @private - * @param graphicsData {Graphics} The graphics object containing all the necessary properties + * @param graphicsData {WebGLGraphicsData} The graphics object containing all the necessary properties * @param webGLData {object} an object containing all the webGL-specific information to create this shape */ GraphicsRenderer.prototype.buildPoly = function (graphicsData, webGLData)