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

@@ -1,5 +1,8 @@
#include "app/core/platform/clipboard.h"
#include <cstdint>
#include <vector>
void CopyImageToClipboard(const std::vector<uint8_t>& data) {}
void GetImageFromClipboard(std::vector<uint8_t>& data, int& width,
int& height) {}

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 {

View File

@@ -483,9 +483,9 @@ void ROM::SavePalette(int index, const std::string& group_name,
for (size_t j = 0; j < palette.size(); ++j) {
gfx::SnesColor color = palette[j];
// If the color is modified, save the color to the ROM
if (color.IsModified()) {
if (color.is_modified()) {
WriteColor(gfx::GetPaletteAddress(group_name, index, j), color);
color.SetModified(false); // Reset the modified flag after saving
color.set_modified(false); // Reset the modified flag after saving
}
}
}
@@ -514,7 +514,7 @@ absl::Status ROM::UpdatePaletteColor(const std::string& groupName,
if (colorIndex < palette_groups_[groupName][paletteIndex].size()) {
// Update the color value in the palette
palette_groups_[groupName][paletteIndex][colorIndex] = newColor;
palette_groups_[groupName][paletteIndex][colorIndex].SetModified(true);
palette_groups_[groupName][paletteIndex][colorIndex].set_modified(true);
} else {
return absl::AbortedError(
"Error: Invalid color index in UpdatePaletteColor.");

View File

@@ -341,7 +341,7 @@ void SetColorsPalette(ROM& rom, int index, gfx::SnesPalette& current,
current.Create(new_palette);
for (int i = 0; i < 256; i++) {
current[(i / 16) * 16].SetTransparent(true);
current[(i / 16) * 16].set_transparent(true);
}
}
} // namespace palette_internal