mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
fix image converter bug
This commit is contained in:
parent
54340358bc
commit
26090499e7
|
@ -432,8 +432,8 @@ fn palette_tile_data(
|
||||||
|
|
||||||
let mut tile_data = Vec::new();
|
let mut tile_data = Vec::new();
|
||||||
|
|
||||||
for image in images {
|
for (image_idx, image) in images.iter().enumerate() {
|
||||||
add_image_to_tile_data(&mut tile_data, image, optimiser, 0)
|
add_image_to_tile_data(&mut tile_data, image, optimiser, image_idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
let tile_data = collapse_to_4bpp(&tile_data);
|
let tile_data = collapse_to_4bpp(&tile_data);
|
||||||
|
|
|
@ -138,17 +138,7 @@ impl Palette16Optimiser {
|
||||||
while !unsatisfied_palettes.is_empty() {
|
while !unsatisfied_palettes.is_empty() {
|
||||||
let palette = self.find_maximal_palette_for(&unsatisfied_palettes);
|
let palette = self.find_maximal_palette_for(&unsatisfied_palettes);
|
||||||
|
|
||||||
for test_palette in unsatisfied_palettes.clone() {
|
unsatisfied_palettes.retain(|test_palette| !test_palette.is_satisfied_by(&palette));
|
||||||
if test_palette.is_satisfied_by(&palette) {
|
|
||||||
unsatisfied_palettes.remove(&test_palette);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i, overall_palette) in self.palettes.iter().enumerate() {
|
|
||||||
if overall_palette.is_satisfied_by(&palette) {
|
|
||||||
assignments[i] = optimised_palettes.len();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
optimised_palettes.push(palette);
|
optimised_palettes.push(palette);
|
||||||
|
|
||||||
|
@ -157,6 +147,13 @@ impl Palette16Optimiser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i, overall_palette) in self.palettes.iter().enumerate() {
|
||||||
|
assignments[i] = optimised_palettes
|
||||||
|
.iter()
|
||||||
|
.position(|palette| overall_palette.is_satisfied_by(palette))
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
Palette16OptimisationResults {
|
Palette16OptimisationResults {
|
||||||
optimised_palettes,
|
optimised_palettes,
|
||||||
assignments,
|
assignments,
|
||||||
|
|
Loading…
Reference in a new issue