Skip to content

Commit 6010689

Browse files
committed
Built.
1 parent 29a7275 commit 6010689

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

imagediff.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! imagediff.js 1.0.1
1+
/*! imagediff.js 1.0.2
22
* (c) 2011 Carl Sutherland, Humble Software Development
33
* imagediff.js is freely distributable under the MIT license.
44
* Thanks to Jacob Thornton for the node/amd integration bits.
@@ -29,9 +29,11 @@
2929
imagediff, jasmine;
3030

3131
// Creation
32-
function getCanvas () {
32+
function getCanvas (width, height) {
3333
var
3434
canvas = document.createElement('canvas');
35+
if (width) canvas.width = width;
36+
if (height) canvas.height = height;
3537
return canvas;
3638
}
3739
function getImageData (width, height) {
@@ -108,6 +110,15 @@
108110
width = canvas.width;
109111
return context.getImageData(0, 0, width, height);
110112
}
113+
function toCanvas (object) {
114+
var
115+
data = toImageData(object),
116+
canvas = getCanvas(data.width, data.height),
117+
context = canvas.getContext('2d');
118+
119+
context.putImageData(data, 0, 0);
120+
return canvas;
121+
}
111122

112123

113124
// ImageData Equality Operators
@@ -262,8 +273,8 @@
262273
context = canvas.getContext('2d');
263274
context.putImageData(diff, 0, 0);
264275

265-
a.appendChild(this.actual);
266-
b.appendChild(expected);
276+
a.appendChild(toCanvas(this.actual));
277+
b.appendChild(toCanvas(expected));
267278
c.appendChild(canvas);
268279

269280
div.appendChild(a);

imagediff.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)