Fixed visualization of G-code lines in G-code viewer (3D view).

Improved speed of parsing external G-code.
This commit is contained in:
Vojtech Bubnik 2021-09-21 15:30:37 +02:00
parent 116fd0526b
commit ac7674b85a
7 changed files with 163 additions and 73 deletions

View file

@ -255,6 +255,19 @@ template<typename T> struct IsTriviallyCopyable { static constexpr bool value =
template<typename T> struct IsTriviallyCopyable : public std::is_trivially_copyable<T> {};
#endif
// A very lightweight ROII wrapper around C FILE.
// The old C file API is much faster than C++ streams, thus they are recommended for processing large / huge files.
struct FilePtr {
FilePtr(FILE *f) : f(f) {}
~FilePtr() { this->close(); }
void close() {
if (this->f) {
::fclose(this->f);
this->f = nullptr;
}
}
FILE* f = nullptr;
};
class ScopeGuard
{