mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
svg:: make smaller SVG files by not including things out of the region
This commit is contained in:
parent
e0e1182d97
commit
c862a94e46
@ -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();
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user