Remove srcOffset and dstOffset parameters from Matrix#_transformCoordinates().

This commit is contained in:
Jürg Lehni 2014-05-08 13:54:05 +01:00
parent ea2c653eb7
commit 8560a71312
3 changed files with 10 additions and 13 deletions

View file

@ -435,19 +435,16 @@ var Matrix = Base.extend(/** @lends Matrix# */{
* @function * @function
* @param {Number[]} src the array containing the source points * @param {Number[]} src the array containing the source points
* as x, y value pairs * as x, y value pairs
* @param {Number} srcOffset the offset to the first point to be transformed
* @param {Number[]} dst the array into which to store the transformed * @param {Number[]} dst the array into which to store the transformed
* point pairs * point pairs
* @param {Number} dstOffset the offset of the location of the first
* transformed point in the destination array
* @param {Number} count the number of points to tranform * @param {Number} count the number of points to tranform
* @return {Number[]} the dst array, containing the transformed coordinates. * @return {Number[]} the dst array, containing the transformed coordinates.
*/ */
transform: function(/* point | */ src, srcOffset, dst, dstOffset, count) { transform: function(/* point | */ src, dst, count) {
return arguments.length < 5 return arguments.length < 3
// TODO: Check for rectangle and use _tranformBounds? // TODO: Check for rectangle and use _tranformBounds?
? this._transformPoint(Point.read(arguments)) ? this._transformPoint(Point.read(arguments))
: this._transformCoordinates(src, srcOffset, dst, dstOffset, count); : this._transformCoordinates(src, dst, count);
}, },
/** /**
@ -466,10 +463,10 @@ var Matrix = Base.extend(/** @lends Matrix# */{
); );
}, },
_transformCoordinates: function(src, srcOffset, dst, dstOffset, count) { _transformCoordinates: function(src, dst, count) {
var i = srcOffset, var i = 0,
j = dstOffset, j = 0,
max = i + 2 * count; max = 2 * count;
while (i < max) { while (i < max) {
var x = src[i++], var x = src[i++],
y = src[i++]; y = src[i++];
@ -485,7 +482,7 @@ var Matrix = Base.extend(/** @lends Matrix# */{
x2 = x1 + rect.width, x2 = x1 + rect.width,
y2 = y1 + rect.height, y2 = y1 + rect.height,
coords = [ x1, y1, x2, y1, x2, y2, x1, y2 ]; coords = [ x1, y1, x2, y1, x2, y2, x1, y2 ];
return this._transformCoordinates(coords, 0, coords, 0, 4); return this._transformCoordinates(coords, coords, 4);
}, },
/** /**

View file

@ -481,7 +481,7 @@ statics: {
p2._x, p2._y p2._x, p2._y
]; ];
if (matrix) if (matrix)
matrix._transformCoordinates(values, 0, values, 0, 6); matrix._transformCoordinates(values, values, 6);
return values; return values;
}, },

View file

@ -525,7 +525,7 @@ var Segment = Base.extend(/** @lends Segment# */{
// If no matrix was previded, this was just called to get the coords and // If no matrix was previded, this was just called to get the coords and
// we are done now. // we are done now.
if (matrix) { if (matrix) {
matrix._transformCoordinates(coords, 0, coords, 0, i / 2); matrix._transformCoordinates(coords, coords, i / 2);
x = coords[0]; x = coords[0];
y = coords[1]; y = coords[1];
if (change) { if (change) {