Report position in color errors

This commit is contained in:
ISSOtm
2022-05-20 20:13:46 +02:00
committed by Eldred Habert
parent caaf7a8444
commit 832e0ec972

View File

@@ -333,18 +333,19 @@ public:
uint32_t css = color.toCSS(); uint32_t css = color.toCSS();
if (std::find(indeterminates.begin(), indeterminates.end(), css) if (std::find(indeterminates.begin(), indeterminates.end(), css)
== indeterminates.end()) { == indeterminates.end()) {
error( error("Color #%08x is neither transparent (alpha < %u) nor opaque (alpha >= "
"Color #%08x is neither transparent (alpha < %u) nor opaque (alpha >= %u)", "%u) [first seen at x: %" PRIu32 ", y: %" PRIu32 "]",
css, Rgba::transparency_threshold, Rgba::opacity_threshold); css, Rgba::transparency_threshold, Rgba::opacity_threshold, x, y);
indeterminates.push_back(css); indeterminates.push_back(css);
} }
} else if (Rgba const *other = colors.registerColor(color); other) { } else if (Rgba const *other = colors.registerColor(color); other) {
std::tuple conflicting{color.toCSS(), other->toCSS()}; std::tuple conflicting{color.toCSS(), other->toCSS()};
// Do not report combinations twice // Do not report combinations twice
if (std::find(conflicts.begin(), conflicts.end(), conflicting) == conflicts.end()) { if (std::find(conflicts.begin(), conflicts.end(), conflicting) == conflicts.end()) {
warning("Fusing colors #%08x and #%08x into Game Boy color $%04x", warning("Fusing colors #%08x and #%08x into Game Boy color $%04x [first seen "
std::get<0>(conflicting), std::get<1>(conflicting), "at x: %" PRIu32 ", y: %" PRIu32 "]",
color.cgbColor()); // TODO: indicate position std::get<0>(conflicting), std::get<1>(conflicting), color.cgbColor(), x,
y);
// Do not report this combination again // Do not report this combination again
conflicts.emplace_back(conflicting); conflicts.emplace_back(conflicting);
} }