Make use of new Segment#getHandleIn/OutIfSet() where we can.

This commit is contained in:
Jürg Lehni 2011-03-06 11:04:41 +00:00
parent b98abeb416
commit 7bea7e36de

View file

@ -95,14 +95,10 @@ var Path = this.Path = PathItem.extend({
// points for largely improved performance, as no calls to // points for largely improved performance, as no calls to
// Point.read() and Point constructors are necessary. // Point.read() and Point constructors are necessary.
var point = segment._point, var point = segment._point,
handleIn = segment._handleIn, handleIn = segment.getHandleInIfSet(),
handleOut = segment._handleOut, handleOut = segment.getHandleOutIfSet(),
x = point.x, x = point.x,
y = point.y; y = point.y;
if (handleIn.isZero())
handleIn = null;
if (handleOut.isZero())
handleOut = null;
coords[0] = x; coords[0] = x;
coords[1] = y; coords[1] = y;
var index = 2; var index = 2;
@ -370,7 +366,8 @@ var Path = this.Path = PathItem.extend({
point = segment._point, point = segment._point,
x = point.x, x = point.x,
y = point.y, y = point.y,
handleIn = segment._handleIn; handleIn = segment._handleIn,
handleOut = segment._handleOut;
if (i == 0) { if (i == 0) {
ctx.moveTo(x, y); ctx.moveTo(x, y);
} else { } else {
@ -384,7 +381,6 @@ var Path = this.Path = PathItem.extend({
); );
} }
} }
handleOut = segment._handleOut;
outX = handleOut.x + x; outX = handleOut.x + x;
outY = handleOut.y + y; outY = handleOut.y + y;
} }