mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Revert "Drop it "
This reverts commit cc66e7e7c843e295f999b23b7fa8258c2ec9dbea.
This commit is contained in:
parent
958a09b280
commit
3ba7c18288
@ -152,6 +152,27 @@ 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);
|
||||||
@ -171,6 +192,29 @@ 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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user