diff --git a/src/item/Item.js b/src/item/Item.js index f68c2788..030b62ab 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1897,7 +1897,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ : rectangle.height / bounds.height, delta = rectangle.getCenter().subtract(bounds.getCenter()), newBounds = new Rectangle(new Point(), - new Size(bounds.width * scale, bounds.height * scale)); + Size.create(bounds.width * scale, bounds.height * scale)); newBounds.setCenter(rectangle.getCenter()); this.setBounds(newBounds); }, @@ -1940,9 +1940,9 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ // If the item has a blendMode or is defining an opacity, draw it on // a temporary canvas first and composite the canvas afterwards. // Paths with an opacity < 1 that both define a fillColor - // and strokeColor also need to be drawn on a temporary canvas first, - // since otherwise their stroke is drawn half transparent over their - // fill. + // and strokeColor also need to be drawn on a temporary canvas + // first, since otherwise their stroke is drawn half transparent + // over their fill. if (item._blendMode !== 'normal' || item._opacity < 1 && !(item._segments && (!item.getFillColor() @@ -1953,7 +1953,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ // Floor the offset and ceil the size, so we don't cut off any // antialiased pixels when drawing onto the temporary canvas. var itemOffset = bounds.getTopLeft().floor(), - size = bounds.getSize().ceil().add(new Size(1, 1)); + size = bounds.getSize().ceil().add(Size.create(1, 1)); tempCanvas = CanvasProvider.getCanvas(size); // Save the parent context, so we can draw onto it later parentCtx = ctx; diff --git a/src/item/Raster.js b/src/item/Raster.js index 67e08043..8702c891 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -120,7 +120,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ orig = new Point(0, 0).transform(matrix), u = new Point(1, 0).transform(matrix).subtract(orig), v = new Point(0, 1).transform(matrix).subtract(orig); - return new Size( + return Size.create( 72 / u.getLength(), 72 / v.getLength() ); @@ -160,7 +160,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ if (this._canvas) CanvasProvider.returnCanvas(this._canvas); this._canvas = canvas; - this._size = new Size(canvas.width, canvas.height); + this._size = Size.create(canvas.width, canvas.height); this._image = null; this._context = null; this._changed(Change.GEOMETRY); @@ -182,9 +182,9 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ CanvasProvider.returnCanvas(this._canvas); this._image = image; /*#*/ if (options.browser) { - this._size = new Size(image.naturalWidth, image.naturalHeight); + this._size = Size.create(image.naturalWidth, image.naturalHeight); /*#*/ } else if (options.server) { - this._size = new Size(image.width, image.height); + this._size = Size.create(image.width, image.height); /*#*/ } // options.server this._canvas = null; this._context = null; @@ -252,7 +252,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ var ctx = Raster._sampleContext; if (!ctx) { ctx = Raster._sampleContext = CanvasProvider.getCanvas( - new Size(sampleSize)).getContext('2d'); + sampleSize.clone()).getContext('2d'); } else { // Clear the sample canvas: ctx.clearRect(0, 0, sampleSize, sampleSize); diff --git a/src/ui/CanvasView.js b/src/ui/CanvasView.js index 9eae86a6..c83277e1 100644 --- a/src/ui/CanvasView.js +++ b/src/ui/CanvasView.js @@ -32,7 +32,7 @@ var CanvasView = View.extend(/** @lends CanvasView# */{ // 2nd argument onwards could be view size, otherwise use default: var size = Size.read(arguments, 1); if (size.isZero()) - size = new Size(1024, 768); + size = Size.create(1024, 768); canvas = CanvasProvider.getCanvas(size); } this._context = canvas.getContext('2d');