{"ScriptPreparationCode":"var img = new Image();\r\nimg.decoding = \u0027sync\u0027;\r\n\r\nvar imageBitmap;\r\nvar imageBitmapResized;\r\nvar doneLoading = false;\r\nlet canvas = document.createElement(\u0027canvas\u0027);\r\n\r\ncanvas.width = 640;\r\ncanvas.height = 480;\r\nlet canvas2 = document.createElement(\u0027canvas\u0027);\r\nlet offscreen = canvas2.transferControlToOffscreen();\r\noffscreen.width = 640;\r\noffscreen.height = 480;\r\n\r\nvar ctx = canvas.getContext(\u00272d\u0027);\r\nvar ctx2 = offscreen.getContext(\u00272d\u0027);\r\n\r\nimg.addEventListener(\u0027load\u0027, function() {\r\n var tempCanv = document.createElement(\u0022canvas\u0022);\r\n var tempCtx = tempCanv.getContext(\u00272d\u0027);\r\n tempCanv.width = img.width/2;\r\n tempCanv.height = img.height/2;\r\n tempCtx.drawImage(img,0,0,tempCanv.width,tempCanv.height);\r\n \r\n Promise.all([\r\n createImageBitmap(img)\r\n ]).then(function(images) {\r\n imageBitmap = images[0];\r\n doneLoading = true;\r\n}, false);\r\n \r\n Promise.all([\r\n\r\n createImageBitmap(tempCanv)\r\n\r\n ]).then(function(images) {\r\n imageBitmapResized = images[0];\r\n doneLoading = true;\r\n}, false);\r\n \r\n});\r\n\r\nimg.src = \u0027https://media.discordapp.net/attachments/447410261289205781/574359442913492992/unknown.png\u0027;","TestCases":[{"Name":"Image","Code":"if (doneLoading)\r\nctx.drawImage(img,0,0);","IsDeferred":false},{"Name":"ImageBitmap/Offscreen","Code":"if (doneLoading)\r\nctx.drawImage(imageBitmap,0,0);","IsDeferred":false},{"Name":"ImageBitmap/Offscreen Resized","Code":"if (doneLoading)\r\nctx.drawImage(imageBitmapResized,0,0);","IsDeferred":false}]}