mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Support CanvasProvider.get(width, height) arguments.
This commit is contained in:
parent
9600fdb512
commit
51150cb20d
3 changed files with 4 additions and 3 deletions
|
@ -62,7 +62,7 @@ var Color = this.Color = Base.extend(new function() {
|
|||
// Use a canvas to draw to with the given name and then retrieve rgb
|
||||
// values from. Build a cache for all the used colors.
|
||||
if (!colorContext) {
|
||||
var canvas = CanvasProvider.get(Size.create(1, 1));
|
||||
var canvas = CanvasProvider.get(1, 1);
|
||||
colorContext = canvas.getContext('2d');
|
||||
colorContext.globalCompositeOperation = 'copy';
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{
|
|||
if (!this.support) {
|
||||
// Set up paper.support, as an object containing properties that
|
||||
// describe the support of various features.
|
||||
var canvas = CanvasProvider.get(Size.create(1, 1)),
|
||||
var canvas = CanvasProvider.get(1, 1),
|
||||
ctx = canvas.getContext('2d');
|
||||
PaperScope.prototype.support = {
|
||||
nativeDash: 'setLineDash' in ctx || 'mozDash' in ctx
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
var CanvasProvider = {
|
||||
canvases: [],
|
||||
|
||||
get: function(size) {
|
||||
get: function(width, height) {
|
||||
var size = arguments.length == 2 ? Size.create(width, height) : width;
|
||||
if (this.canvases.length) {
|
||||
var canvas = this.canvases.pop();
|
||||
// If they are not the same size, we don't need to clear them
|
||||
|
|
Loading…
Reference in a new issue