surface: hallazgo 5 — renderWithColorReplace aplica sub_palette_

Coherencia con render() y renderWithVerticalFade(): el píxel no
sustituido pasa por sub_palette_ en vez de copiarse crudo. Hoy es
no-op (las surfaces que usan color replace no hacen fadeSubPalette)
pero cierra la divergencia de API y previene regresiones futuras.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-18 11:58:46 +02:00
parent 1f5b1ad1ab
commit 6a12294a36

View File

@@ -415,11 +415,11 @@ void Surface::renderWithColorReplace(int x, int y, Uint8 source_color, Uint8 tar
continue; // Saltar píxeles fuera del rango del destino
}
// Copia el píxel si no es transparente
// Copia el píxel si no es transparente; aplica sub_palette_ como el resto de render*
Uint8 color = surface_data_->data.get()[static_cast<size_t>(src_x + (src_y * surface_data_->width))];
if (color != static_cast<Uint8>(transparent_color_)) {
surface_data->data[dest_x + (dest_y * surface_data->width)] =
(color == source_color) ? target_color : color;
(color == source_color) ? target_color : sub_palette_[color];
}
}
}