Revert "tried optimization thing but it didnt worked lol"

This reverts commit e51b618baa.
This commit is contained in:
Yoshman29
2022-12-03 23:24:45 +01:00
parent e51b618baa
commit b1a7b28c14
6 changed files with 5 additions and 71 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
export/
latest/windows/obj/
latest/windows/haxe/
.vscode/
**.png.bin
.vscode/
+1 -1
View File
@@ -1 +1 @@
1369
1354
+1 -1
View File
@@ -20,7 +20,7 @@ class CharacterEditor extends MusicBeatState {
public override function create() {
super.create();
add(new Stage("stage"));
add(new Stage("default"));
character = new Character(770, 100, characterName, true);
characterName = character.curCharacter;
+2 -19
View File
@@ -1,7 +1,5 @@
package funkin.mods;
import funkin.options.Options;
import lime.graphics.ImageBuffer;
import lime.utils.Log;
import lime.utils.AssetLibrary;
import lime.utils.Assets as LimeAssets;
@@ -98,23 +96,8 @@ class ModsFolderLibrary extends AssetLibrary implements ModsAssetLibrary {
var path = getAssetPath();
editedTimes[id] = FileSystem.stat(path).mtime.getTime();
var buffer:ImageBuffer = null;
var image:Image;
if (Options.enablePngBins) {
if (PngBinHandler.exists(path)) {
buffer = PngBinHandler.loadBinPng(path);
@:privateAccess
image = new Image(buffer);
} else {
@:privateAccess
image = Image.fromFile(path);
PngBinHandler.saveBinPng(image.buffer, path);
}
} else {
@:privateAccess
image = Image.fromFile(path);
}
return image;
var e = Image.fromFile(path);
return e;
}
}
-47
View File
@@ -1,47 +0,0 @@
package funkin.mods;
import sys.FileSystem;
import lime.utils.UInt8Array;
import lime.graphics.ImageBuffer;
import openfl.utils.ByteArray;
import openfl.utils.Assets;
import sys.io.File;
class PngBinHandler {
public static function loadBinPng(path:String) {
#if sys
var bytes = File.getBytes('$path.bin');
var width:Int = bytes.getInt32(0);
var height:Int = bytes.getInt32(4);
var bitsPerPixel:Int = bytes.getUInt16(8);
var pixelFormat:Int = bytes.getUInt16(10);
var imageBuffer = new ImageBuffer(UInt8Array.fromBytes(bytes, 12), width, height, bitsPerPixel, pixelFormat);
return imageBuffer;
#else
return null;
#end
}
public static function saveBinPng(buffer:ImageBuffer, path:String) {
#if sys
var array = new ByteArrayData(buffer.data.length + 12);
array.writeInt(buffer.width);
array.writeInt(buffer.height);
array.writeShort(buffer.bitsPerPixel);
array.writeShort(buffer.format);
array.writeBytes(buffer.data.toBytes());
File.saveBytes('$path.bin', array);
#end
}
public static function exists(path:String) {
#if sys
return FileSystem.exists('$path.bin');
#else
return false;
#end
}
}
-1
View File
@@ -21,7 +21,6 @@ class Options
public static var fpsCounter:Bool = true;
public static var autoPause:Bool = true;
public static var antialiasing:Bool = true;
public static var enablePngBins:Bool = true; // optimization feature kinda which takes space on your computer!
public static var volume:Float = 1;
/**