Store images as data when in a web worker.

More work may need to be done to transfer an image from a worker to the main thread, but this will at least prevent crashes.
This commit is contained in:
Joseph Cloutier
2024-05-27 12:10:00 -04:00
parent 2dad602c0d
commit 166ac06e3e

View File

@@ -32,10 +32,11 @@ import lime.utils.UInt8Array;
#if !display
import lime._internal.backend.html5.HTML5HTTPRequest;
#end
import js.html.CanvasElement;
import js.html.ImageElement;
import js.html.Image as JSImage;
import js.Browser;
import js.html.CanvasElement;
import js.html.Image as JSImage;
import js.html.ImageElement;
import lime._internal.backend.html5.HTML5Thread;
#elseif flash
import flash.display.Bitmap;
import flash.display.BitmapData;
@@ -230,6 +231,13 @@ class Image
{
#if (js && html5)
type = CANVAS;
#if lime_threads
if (HTML5Thread.current().isWorker())
{
type = DATA;
}
#end
#elseif flash
type = FLASH;
#else