|
|
@ -247,11 +247,6 @@ Canvas.prototype.toDataURL = function(a1, a2, a3){ |
|
|
|
// ['image/jpeg', qual, fn] -> ['image/jpeg', {quality: qual}, fn]
|
|
|
|
// ['image/jpeg', undefined, fn] -> ['image/jpeg', null, fn]
|
|
|
|
|
|
|
|
if (this.width === 0 || this.height === 0) { |
|
|
|
// Per spec, if the bitmap has no pixels, return this string:
|
|
|
|
return "data:,"; |
|
|
|
} |
|
|
|
|
|
|
|
var type = 'image/png'; |
|
|
|
var opts = {}; |
|
|
|
var fn; |
|
|
@ -280,6 +275,17 @@ Canvas.prototype.toDataURL = function(a1, a2, a3){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.width === 0 || this.height === 0) { |
|
|
|
// Per spec, if the bitmap has no pixels, return this string:
|
|
|
|
var str = "data:,"; |
|
|
|
if (fn) { |
|
|
|
setTimeout(function() { |
|
|
|
fn(null, str); |
|
|
|
}); |
|
|
|
} |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
if ('image/png' === type) { |
|
|
|
if (fn) { |
|
|
|
this.toBuffer(function(err, buf){ |
|
|
|