Skip to content

Commit

Permalink
Better flush logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Oct 22, 2024
1 parent abc78fe commit d2cfc0e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/SvgStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,19 @@ class SvgStreamFile : public SvgStream {
if (!always_valid) {
return;
}

stream_ << "</g>\n</svg>";
#ifdef _WIN32
stream_.seekp(-12, std::ios_base::cur);
int offset = -12;
#else
stream_.seekp(-11, std::ios_base::cur);
int offset = -11;
#endif

if (is_clipping()) {
// We don't do newline here just to avoid having to deal with windows
stream_ << "</g>";
offset -= 4;
}
stream_ << "</g>\n</svg>";
stream_.seekp(offset, std::ios_base::cur);
}

void finish(bool close) {
Expand Down

0 comments on commit d2cfc0e

Please sign in to comment.