| var shape_pool = (function () { |
| function create() { |
| return new ShapePath(); |
| } |
| |
| function release(shapePath) { |
| var len = shapePath._length, i; |
| for (i = 0; i < len; i += 1) { |
| point_pool.release(shapePath.v[i]); |
| point_pool.release(shapePath.i[i]); |
| point_pool.release(shapePath.o[i]); |
| shapePath.v[i] = null; |
| shapePath.i[i] = null; |
| shapePath.o[i] = null; |
| } |
| shapePath._length = 0; |
| shapePath.c = false; |
| } |
| |
| function clone(shape) { |
| var cloned = factory.newElement(); |
| var i, len = shape._length === undefined ? shape.v.length : shape._length; |
| cloned.setLength(len); |
| cloned.c = shape.c; |
| var pt; |
| |
| for (i = 0; i < len; i += 1) { |
| cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i); |
| } |
| return cloned; |
| } |
| |
| var factory = pool_factory(4, create, release); |
| factory.clone = clone; |
| |
| return factory; |
| }()); |