Skip to content

Commit 51150cb

Browse files
committed
Support CanvasProvider.get(width, height) arguments.
1 parent 9600fdb commit 51150cb

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/color/Color.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var Color = this.Color = Base.extend(new function() {
6262
// Use a canvas to draw to with the given name and then retrieve rgb
6363
// values from. Build a cache for all the used colors.
6464
if (!colorContext) {
65-
var canvas = CanvasProvider.get(Size.create(1, 1));
65+
var canvas = CanvasProvider.get(1, 1);
6666
colorContext = canvas.getContext('2d');
6767
colorContext.globalCompositeOperation = 'copy';
6868
}

src/core/PaperScope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
6262
if (!this.support) {
6363
// Set up paper.support, as an object containing properties that
6464
// describe the support of various features.
65-
var canvas = CanvasProvider.get(Size.create(1, 1)),
65+
var canvas = CanvasProvider.get(1, 1),
6666
ctx = canvas.getContext('2d');
6767
PaperScope.prototype.support = {
6868
nativeDash: 'setLineDash' in ctx || 'mozDash' in ctx

src/util/CanvasProvider.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
var CanvasProvider = {
1616
canvases: [],
1717

18-
get: function(size) {
18+
get: function(width, height) {
19+
var size = arguments.length == 2 ? Size.create(width, height) : width;
1920
if (this.canvases.length) {
2021
var canvas = this.canvases.pop();
2122
// If they are not the same size, we don't need to clear them

0 commit comments

Comments
 (0)