ui/draw.hpp: one place for the pixel loops of fill and copy
67 file-local helpers (fill/rect/copy/copy_region/... in 39 screens) now call draw::fill, draw::copy_clipped or draw::copy_unclipped. Only the loops moved: every screen keeps its own wrapper with its bounds check and error text, so the contracts are unchanged. Eight helpers with special behaviour stay as they are (bank, season promotion, toto, tax animation, ...). Verified: 9 headless careers and the scripted UI walk (German and English data, 38 screens, about 5,460 steps each) give the same fingerprints as before. ctest: 209 of 211; other_games_ui_tests and ui_preparation_tests fail the same way without this change. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
901f3dec1c
commit
fb3c2fe757
40 files changed
+171
-206
No files matched your search
+2
-2
@@ -20,6 +20,7 @@
|
||||
#include "game/messages.hpp"
|
||||
#include "game/state.hpp"
|
||||
#include "ui/setup.hpp"
|
||||
#include "ui/draw.hpp"
|
||||
|
||||
namespace bmh::ui {
|
||||
namespace {
|
||||
@@ -31,8 +32,7 @@ std::string money(int64_t value) {
|
||||
return result;
|
||||
}
|
||||
void rect(Image& image, int x, int y, int w, int h, uint8_t color) {
|
||||
for (int yy = std::max(0, y); yy < std::min(image.height, y + h); ++yy)
|
||||
for (int xx = std::max(0, x); xx < std::min(image.width, x + w); ++xx) image.at(xx, yy) = color;
|
||||
draw::fill(image, x, y, w, h, color);
|
||||
}
|
||||
void line(Image& image, int x0, int y0, int x1, int y1, uint8_t color) {
|
||||
int dx = std::abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
|
||||
|
||||
Reference in new issue
Block a user