annoying housekeeping

This commit is contained in:
scawful
2024-02-01 00:13:34 -05:00
parent 9b30316b9a
commit d7b75fd7f6
7 changed files with 17 additions and 16 deletions

View File

@@ -329,7 +329,7 @@ void Bitmap::ApplyPalette(const SnesPalette &palette) {
palette_ = palette;
SDL_UnlockSurface(surface_.get());
for (int i = 0; i < palette.size(); ++i) {
if (palette.GetColor(i).IsTransparent()) {
if (palette.GetColor(i).is_transparent()) {
surface_->format->palette->colors[i].r = 0;
surface_->format->palette->colors[i].g = 0;
surface_->format->palette->colors[i].b = 0;
@@ -350,7 +350,7 @@ void Bitmap::ApplyPaletteFromPaletteGroup(const SnesPalette &palette,
palette_ = palette.sub_palette(start_index, start_index + 8);
SDL_UnlockSurface(surface_.get());
for (int i = 0; i < palette_.size(); ++i) {
if (palette_.GetColor(i).IsTransparent()) {
if (palette_.GetColor(i).is_transparent()) {
surface_->format->palette->colors[i].r = 0;
surface_->format->palette->colors[i].g = 0;
surface_->format->palette->colors[i].b = 0;

View File

@@ -56,10 +56,6 @@ class SnesColor {
snes_ = ConvertRGBtoSNES(color);
modified = true;
}
snes_color rom_color() const { return rom_color_; }
uint16_t snes() const { return snes_; }
void set_snes(uint16_t val) {
snes_ = val;
snes_color col = ConvertSNEStoRGB(val);
@@ -67,10 +63,12 @@ class SnesColor {
modified = true;
}
bool IsModified() const { return modified; }
bool IsTransparent() const { return transparent; }
void SetTransparent(bool t) { transparent = t; }
void SetModified(bool m) { modified = m; }
snes_color rom_color() const { return rom_color_; }
uint16_t snes() const { return snes_; }
bool is_modified() const { return modified; }
bool is_transparent() const { return transparent; }
void set_transparent(bool t) { transparent = t; }
void set_modified(bool m) { modified = m; }
private:
ImVec4 rgb_;

View File

@@ -152,7 +152,7 @@ SnesPalette ReadPaletteFromRom(int offset, int num_colors, const uchar* rom) {
new_color.blue = ((color >> 10) & 0x1F) * 8;
colors[color_offset].set_snes(ConvertRGBtoSNES(new_color));
if (color_offset == 0) {
colors[color_offset].SetTransparent(true);
colors[color_offset].set_transparent(true);
}
color_offset++;
offset += 2;

View File

@@ -104,7 +104,7 @@ class SnesPalette {
throw std::out_of_range("SNESPalette: Index out of bounds");
}
colors[i].set_rgb(color);
colors[i].SetModified(true);
colors[i].set_modified(true);
}
SnesPalette sub_palette(int start, int end) const {