don't generate gradient on invisible elements

This commit is contained in:
Andy Edinborough 2012-12-28 16:52:48 -06:00
parent 7f1cbc70a8
commit 7e38df782c

View File

@ -321,6 +321,10 @@
}; };
_html2canvas.Generate.Gradient = function(src, bounds) { _html2canvas.Generate.Gradient = function(src, bounds) {
if(bounds.width === 0 || bounds.height === 0) {
return;
}
var canvas = document.createElement('canvas'), var canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'), ctx = canvas.getContext('2d'),
gradient, grad, i, len, img; gradient, grad, i, len, img;