mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Use the faster Point/Size.create() constructors across the basic classes for higher performance.
This commit is contained in:
parent
dca26949ff
commit
9a9cb91f72
2 changed files with 12 additions and 12 deletions
|
@ -327,7 +327,7 @@ var Matrix = Base.extend({
|
||||||
var point = Point.read(arguments);
|
var point = Point.read(arguments);
|
||||||
if (point) {
|
if (point) {
|
||||||
var x = point.x, y = point.y;
|
var x = point.x, y = point.y;
|
||||||
return new Point(
|
return Point.create(
|
||||||
x * this._m00 + y * this._m01 + this._m02,
|
x * this._m00 + y * this._m01 + this._m02,
|
||||||
x * this._m10 + y * this._m11 + this._m12
|
x * this._m10 + y * this._m11 + this._m12
|
||||||
);
|
);
|
||||||
|
|
|
@ -54,7 +54,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
return new Point(this.x, this.y);
|
return Point.create(this.x, this.y);
|
||||||
},
|
},
|
||||||
|
|
||||||
setPoint: function() {
|
setPoint: function() {
|
||||||
|
@ -64,7 +64,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getSize: function() {
|
getSize: function() {
|
||||||
return new Size(this.width, this.height);
|
return Size.create(this.width, this.height);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize: function() {
|
setSize: function() {
|
||||||
|
@ -125,7 +125,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getCenter: function() {
|
getCenter: function() {
|
||||||
return new Point(this.x + this.width * 0.5, this.y + this.height * 0.5);
|
return Point.create(this.x + this.width * 0.5, this.y + this.height * 0.5);
|
||||||
},
|
},
|
||||||
|
|
||||||
setCenter: function() {
|
setCenter: function() {
|
||||||
|
@ -135,7 +135,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopLeft: function() {
|
getTopLeft: function() {
|
||||||
return new Point(this.left, this.top);
|
return Point.create(this.left, this.top);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTopLeft: function() {
|
setTopLeft: function() {
|
||||||
|
@ -145,7 +145,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopRight: function() {
|
getTopRight: function() {
|
||||||
return new Point(this.right, this.top);
|
return Point.create(this.right, this.top);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTopRight: function() {
|
setTopRight: function() {
|
||||||
|
@ -155,7 +155,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getBottomLeft: function() {
|
getBottomLeft: function() {
|
||||||
return new Point(this.left, this.bottom);
|
return Point.create(this.left, this.bottom);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBottomLeft: function() {
|
setBottomLeft: function() {
|
||||||
|
@ -165,7 +165,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getBottomRight: function() {
|
getBottomRight: function() {
|
||||||
return new Point(this.right, this.bottom);
|
return Point.create(this.right, this.bottom);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBottomRight: function() {
|
setBottomRight: function() {
|
||||||
|
@ -175,7 +175,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getLeftCenter: function() {
|
getLeftCenter: function() {
|
||||||
return new Point(this.left, this.centerY);
|
return Point.create(this.left, this.centerY);
|
||||||
},
|
},
|
||||||
|
|
||||||
setLeftCenter: function() {
|
setLeftCenter: function() {
|
||||||
|
@ -185,7 +185,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopCenter: function() {
|
getTopCenter: function() {
|
||||||
return new Point(this.centerX, this.top);
|
return Point.create(this.centerX, this.top);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTopCenter: function() {
|
setTopCenter: function() {
|
||||||
|
@ -195,7 +195,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getRightCenter: function() {
|
getRightCenter: function() {
|
||||||
return new Point(this.right, this.centerY);
|
return Point.create(this.right, this.centerY);
|
||||||
},
|
},
|
||||||
|
|
||||||
setRightCenter: function() {
|
setRightCenter: function() {
|
||||||
|
@ -205,7 +205,7 @@ var Rectangle = Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getBottomCenter: function() {
|
getBottomCenter: function() {
|
||||||
return new Point(this.centerX, this.bottom);
|
return Point.create(this.centerX, this.bottom);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBottomCenter: function() {
|
setBottomCenter: function() {
|
||||||
|
|
Loading…
Reference in a new issue