mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-30 15:39:54 +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();
|
||||
|
@ -30,6 +30,8 @@ EX always_false in;
|
||||
|
||||
EX bool in = false;
|
||||
|
||||
EX bool remove_out = true;
|
||||
|
||||
ld cta(color_t col) {
|
||||
// col >>= 24;
|
||||
col &= 0xFF;
|
||||
@ -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