@@ -164,18 +164,13 @@ Browser has to support `OffscreenCanvas` and `bitmaprenderer` context.
164164importScripts (' bundle.js' );
165165
166166const createCanvas = (width , height ) => {
167- const canvas = new OffscreenCanvas (width, height);
168- canvas .width = width;
169- canvas .height = height;
170- return canvas;
167+ return new OffscreenCanvas (width, height);
171168};
172169
173170const createCanvasFromData = (data ) => {
174171 const image = new Image ();
175172 image .src = ' data:image/jpeg;base64,' + agPsd .byteArrayToBase64 (data);
176173 const canvas = new OffscreenCanvas (image .width , image .height );
177- canvas .width = image .width ;
178- canvas .height = image .height ;
179174 canvas .getContext (' 2d' ).drawImage (image, 0 , 0 );
180175 return canvas;
181176};
@@ -227,18 +222,13 @@ xhr.send();
227222importScripts (' bundle.js' );
228223
229224const createCanvas = (width , height ) => {
230- const canvas = new OffscreenCanvas (width, height);
231- canvas .width = width;
232- canvas .height = height;
233- return canvas;
225+ return OffscreenCanvas (width, height);
234226};
235227
236228const createCanvasFromData = (data ) => {
237229 const image = new Image ();
238230 image .src = ' data:image/jpeg;base64,' + agPsd .byteArrayToBase64 (data);
239231 const canvas = new OffscreenCanvas (image .width , image .height );
240- canvas .width = image .width ;
241- canvas .height = image .height ;
242232 canvas .getContext (' 2d' ).drawImage (image, 0 , 0 );
243233 return canvas;
244234};
0 commit comments