I preload Images, but DOM target reloads images when they need to be shown :S

I preload all my images with https://github.com/tiagolr/assetsmanager. Unfortunately, with the openfl DOM target, each image is re-downloaded when shown on screen. Things work fine for the canvas and swf targets.

See the code from openfl below. Within if(bla == null), only gets called once per image. I think I need to do some hocus-pocus within bitmap.__image (ImageElement).

Any ideas?

Here is where the images get re-loaded:

package openfl._internal.renderer.dom;

#if (js && html5)
if (bitmap.__canvas != null) {

		renderSession.element.removeChild (bitmap.__canvas);
		bitmap.__canvas = null;
	if (bitmap.__image == null) {
		bitmap.__image = cast Browser.document.createElement ("img");
		bitmap.__image.src = bitmap.bitmapData.image.buffer.__srcImage.src;
		DOMRenderer.initializeElement (bitmap, bitmap.__image, renderSession);
	DOMRenderer.applyStyle (bitmap, renderSession, true, true, true);

package js.html;

extern class ImageElement extends Element
var alt : String;
var src : String;
var srcset : String;
var crossOrigin : String;
var useMap : String;
var isMap : Bool;
var width : Int;
var height : Int;
var naturalWidth(default,null) : Int;
var naturalHeight(default,null) : Int;
var complete(default,null) : Bool;
var name : String;
var align : String;
var hspace : Int;
var vspace : Int;
var longDesc : String;
var border : String;
var sizes : String;
var currentSrc(default,null) : String;
var lowsrc : String;
var x(default,null) : Int;
var y(default,null) : Int;


Totally crazy bananas, but piping the preloaded image through the below function prevents the second (unnecessary) reload.


private function scale_bm_data(scale:Float, orig_bm_data:BitmapData):BitmapData {

	var matrix:Matrix = new Matrix();
	matrix.scale(scale, scale);

	var scaled:BitmapData = new BitmapData(Std.int(orig_bm_data.width * scale), Std.int(orig_bm_data.height * scale), true, 0x000000);
	scaled.draw(orig_bm_data, matrix, null, null, null, true);
	return scaled;