mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11: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();
|
||||
|
||||
for image in images {
|
||||
add_image_to_tile_data(&mut tile_data, image, optimiser, 0)
|
||||
for (image_idx, image) in images.iter().enumerate() {
|
||||
add_image_to_tile_data(&mut tile_data, image, optimiser, image_idx)
|
||||
}
|
||||
|
||||
let tile_data = collapse_to_4bpp(&tile_data);
|
||||
|
|
|
@ -138,17 +138,7 @@ impl Palette16Optimiser {
|
|||
while !unsatisfied_palettes.is_empty() {
|
||||
let palette = self.find_maximal_palette_for(&unsatisfied_palettes);
|
||||
|
||||
for test_palette in unsatisfied_palettes.clone() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
unsatisfied_palettes.retain(|test_palette| !test_palette.is_satisfied_by(&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 {
|
||||
optimised_palettes,
|
||||
assignments,
|
||||
|
|
Loading…
Reference in a new issue