mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Remove reference to CanvasProvider in test methods
This commit is contained in:
parent
2e75467fb4
commit
337538b21a
1 changed files with 8 additions and 4 deletions
|
@ -176,11 +176,13 @@ var compareImageData = function(imageData1, imageData2, tolerance, diffDetail) {
|
|||
* @return {HTMLImageElement}
|
||||
*/
|
||||
function image(imageData) {
|
||||
var canvas = CanvasProvider.getCanvas(imageData.width, imageData.height);
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = imageData.width;
|
||||
canvas.height = imageData.height;
|
||||
canvas.getContext('2d').putImageData(imageData, 0, 0);
|
||||
var image = new Image();
|
||||
image.src = canvas.toDataURL();
|
||||
CanvasProvider.release(canvas);
|
||||
canvas.remove();
|
||||
return image;
|
||||
}
|
||||
|
||||
|
@ -339,12 +341,14 @@ var compareItem = function(actual, expected, message, options, properties) {
|
|||
*/
|
||||
var compareCanvas = function(width, height, expectedCallback, actualCallback) {
|
||||
function getImageData(width, height, callback) {
|
||||
var canvas = CanvasProvider.getCanvas(width, height);
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
var project = new Project(canvas);
|
||||
callback();
|
||||
project.view.update();
|
||||
var imageData = canvas.getContext('2d').getImageData(0, 0, width, height);
|
||||
CanvasProvider.release(canvas);
|
||||
canvas.remove();
|
||||
project.remove();
|
||||
return imageData;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue