Browse Source

use full async decoding for flash

ncannasse 8 years ago
parent
commit
77a7dc66c9
2 changed files with 6 additions and 2 deletions
  1. 3 1
      hxd/fmt/pak/FileSystem.hx
  2. 3 1
      hxd/fs/LocalFileSystem.hx

+ 3 - 1
hxd/fmt/pak/FileSystem.hx

@@ -141,7 +141,9 @@ private class PakEntry extends FileEntry {
 			onLoaded(new hxd.fs.LoadedBitmap(content.bitmapData));
 			loader.unload();
 		});
-		loader.loadBytes(openedBytes.getData());
+		var ctx = new flash.system.LoaderContext();
+		ctx.imageDecodingPolicy = ON_LOAD;
+		loader.loadBytes(openedBytes.getData(), ctx);
 		openedBytes = null;
 		#else
 		super.loadBitmap(onLoaded);

+ 3 - 1
hxd/fs/LocalFileSystem.hx

@@ -223,7 +223,9 @@ private class LocalEntry extends FileEntry {
 			onLoaded(new hxd.fs.LoadedBitmap(content.bitmapData));
 			loader.unload();
 		});
-		loader.load(new flash.net.URLRequest(file.url));
+		var ctx = new flash.system.LoaderContext();
+		ctx.imageDecodingPolicy = ON_LOAD;
+		loader.load(new flash.net.URLRequest(file.url), ctx);
 		#else
 		var bmp = new hxd.res.Image(this).toBitmap();
 		onLoaded(new hxd.fs.LoadedBitmap(bmp));