Refactor bitmap palette management across various components to streamline palette setting and improve error handling; remove unnecessary status checks and enhance consistency in palette application methods.

This commit is contained in:
scawful
2025-04-17 21:49:47 -04:00
parent eeab477e72
commit 44e13cf4bb
17 changed files with 253 additions and 316 deletions

View File

@@ -142,17 +142,14 @@ void DungeonObjectRenderer::UpdateObjectBitmap() {
bitmap_.Create(256, 256, 8, tilemap_);
}
absl::Status DungeonObjectRenderer::SetPalette(const gfx::SnesPalette& palette,
size_t transparent_index) {
void DungeonObjectRenderer::SetPalette(const gfx::SnesPalette& palette,
size_t transparent_index) {
// Apply the palette to the bitmap
RETURN_IF_ERROR(
bitmap_.SetPaletteWithTransparent(palette, transparent_index));
bitmap_.SetPaletteWithTransparent(palette, transparent_index);
// Store the palette in the VRAM structure for future reference
vram_.palettes.clear();
vram_.palettes.push_back(palette);
return absl::OkStatus();
}
} // namespace zelda3

View File

@@ -65,9 +65,8 @@ class DungeonObjectRenderer : public SharedRom {
*
* @param palette The palette to use for the object
* @param transparent_index Index of the transparent color (default: 0)
* @return absl::Status Success or error status
*/
absl::Status SetPalette(const gfx::SnesPalette& palette, size_t transparent_index = 0);
void SetPalette(const gfx::SnesPalette& palette, size_t transparent_index = 0);
/**
* @brief Gets the rendered bitmap