File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 44 * @author szimek / https://github.com/szimek/
55 */
66
7+ var _canvas ;
8+
79var ImageUtils = {
810
911 getDataURL : function ( image ) {
@@ -20,11 +22,12 @@ var ImageUtils = {
2022
2123 } else {
2224
23- canvas = document . createElementNS ( 'http://www.w3.org/1999/xhtml' , 'canvas' ) ;
24- canvas . width = image . width ;
25- canvas . height = image . height ;
25+ if ( _canvas === undefined ) _canvas = document . createElementNS ( 'http://www.w3.org/1999/xhtml' , 'canvas' ) ;
26+
27+ _canvas . width = image . width ;
28+ _canvas . height = image . height ;
2629
27- var context = canvas . getContext ( '2d' ) ;
30+ var context = _canvas . getContext ( '2d' ) ;
2831
2932 if ( image instanceof ImageData ) {
3033
@@ -36,6 +39,8 @@ var ImageUtils = {
3639
3740 }
3841
42+ canvas = _canvas ;
43+
3944 }
4045
4146 if ( canvas . width > 2048 || canvas . height > 2048 ) {
You can’t perform that action at this time.
0 commit comments