|
@ -1,10 +1,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
// Try loading
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
var o3 = true; |
|
|
|
|
|
canvasFactory = require('./node-o3-canvas/lib/o3-canvas') |
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
var o3 = false; |
|
|
|
|
|
canvasFactory = function(){}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Module dependencies. |
|
|
* Module dependencies. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
var Canvas = require('../lib/canvas') |
|
|
var Canvas = require('../lib/canvas') |
|
|
, canvasFactory = require('./node-o3-canvas/lib/o3-canvas') |
|
|
|
|
|
, canvas = new Canvas(200, 200) |
|
|
, canvas = new Canvas(200, 200) |
|
|
, largeCanvas = new Canvas(1000, 1000) |
|
|
, largeCanvas = new Canvas(1000, 1000) |
|
|
, ctx = canvas.getContext('2d') |
|
|
, ctx = canvas.getContext('2d') |
|
@ -117,6 +126,7 @@ bm('moveTo() / arc() / stroke()', function(){ |
|
|
// node-o3-canvas
|
|
|
// node-o3-canvas
|
|
|
console.log('\n node-o3-canvas\n'); |
|
|
console.log('\n node-o3-canvas\n'); |
|
|
|
|
|
|
|
|
|
|
|
if (o3) { |
|
|
bm('lineTo()', function(){ |
|
|
bm('lineTo()', function(){ |
|
|
o3ctx.lineTo(0, 50); |
|
|
o3ctx.lineTo(0, 50); |
|
|
}); |
|
|
}); |
|
@ -164,5 +174,8 @@ bm('moveTo() / arc() / stroke()', function(){ |
|
|
o3ctx.arc(90,65,5,0,Math.PI*2,true); // Right eye
|
|
|
o3ctx.arc(90,65,5,0,Math.PI*2,true); // Right eye
|
|
|
o3ctx.stroke(); |
|
|
o3ctx.stroke(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('cannot load'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
console.log(); |
|
|
console.log(); |
|
|