1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-28 11:00:34 +00:00

svg:: make smaller SVG files by not including things out of the region

This commit is contained in:
Zeno Rogue 2023-03-16 14:47:04 +01:00
parent e0e1182d97
commit c862a94e46
2 changed files with 14 additions and 0 deletions

View File

@ -2652,6 +2652,10 @@ int readRuleArgs() {
rulegen::flags ^= Flag(argi());
}
else if(argis("-origin-id")) {
shift(); origin_id = argi();
}
else if(argis("-ruledflags")) {
shift();
rulegen::rdebug_flags = argi();

View File

@ -29,6 +29,8 @@ EX always_false in;
#endif
EX bool in = false;
EX bool remove_out = true;
ld cta(color_t col) {
// col >>= 24;
@ -155,6 +157,14 @@ EX always_false in;
if(invisible(col) && invisible(outline)) return;
if(polyi < 2) return;
if(remove_out) {
int minx = polyx[0], miny = polyy[0];
int maxx = minx, maxy = miny;
for(int i=0; i<polyi; i++) if(polyx[i] < minx) minx = polyx[i]; else if(polyx[i] > maxx) maxx = polyx[i];
for(int i=0; i<polyi; i++) if(polyy[i] < miny) miny = polyy[i]; else if(polyy[i] > maxy) maxy = polyy[i];
if(maxx < 0 || maxy < 0 || minx > vid.xres || miny > vid.yres) return;
}
startstring();
for(int i=0; i<polyi; i++) {
if(i == 0)