Merge pull request #589 from DaMatrix/palette-optimization

palette does not always start with zero...
This commit is contained in:
Steven Smith 2020-10-17 18:56:39 -07:00 committed by GitHub
commit 8270ec65e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -10,7 +10,7 @@ public class ListPalette implements Palette {
private final int maxId;
private final int[] data;
private int nextId = 1;
private int nextId = 0;
public ListPalette(int bitsPerEntry) {
this.maxId = (1 << bitsPerEntry) - 1;

View file

@ -13,13 +13,12 @@ public class MapPalette implements Palette {
private final int[] idToState;
private final IntObjectMap<Integer> stateToId = new IntObjectHashMap<>();
private int nextId = 1;
private int nextId = 0;
public MapPalette(int bitsPerEntry) {
this.maxId = (1 << bitsPerEntry) - 1;
this.idToState = new int[this.maxId + 1];
this.stateToId.put(0, (Integer) 0);
}
@Override