This commit is contained in:
cyberpwn 2021-09-22 08:55:45 -04:00
parent 7f58e0413c
commit cc66e7e7c8

View File

@ -152,27 +152,6 @@ public interface MatterSlice<T> extends Hunk<T>, PaletteType<T> {
default void write(DataOutputStream dos) throws IOException { default void write(DataOutputStream dos) throws IOException {
dos.writeUTF(getType().getCanonicalName()); dos.writeUTF(getType().getCanonicalName());
if(IrisSettings.get().getPerformance().isUseExperimentalMantleMemoryCompression() && (this instanceof PaletteOrHunk f && f.isPalette()))
{
PalettedContainer<T> c = f.palette();
List<T> palette = new ArrayList<>();
long[] data = c.write(palette);
Varint.writeUnsignedVarInt(palette.size(), dos);
for(T i : palette)
{
writeNode(i, dos);
}
Varint.writeUnsignedVarInt(data.length, dos);
for(long i : data)
{
dos.writeLong(i);
}
return;
}
int w = getWidth(); int w = getWidth();
int h = getHeight(); int h = getHeight();
MatterPalette<T> palette = new MatterPalette<T>(this); MatterPalette<T> palette = new MatterPalette<T>(this);
@ -192,29 +171,6 @@ public interface MatterSlice<T> extends Hunk<T>, PaletteType<T> {
} }
default void read(DataInputStream din) throws IOException { default void read(DataInputStream din) throws IOException {
if(IrisSettings.get().getPerformance().isUseExperimentalMantleMemoryCompression() && (this instanceof PaletteOrHunk f && f.isPalette()))
{
PalettedContainer<T> c = new PalettedContainer<>();
List<T> palette = new ArrayList<>();
int ps = Varint.readUnsignedVarInt(din);
for(int i = 0; i < ps; i++)
{
palette.add(readNode(din));
}
int ds = Varint.readUnsignedVarInt(din);
long[] data = new long[ds];
for(int i = 0; i < ds; i++)
{
data[i] = din.readLong();
}
c.read(palette, data);
return;
}
int w = getWidth(); int w = getWidth();
int h = getHeight(); int h = getHeight();
MatterPalette<T> palette = new MatterPalette<T>(this, din); MatterPalette<T> palette = new MatterPalette<T>(this, din);