diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-02-27 12:46:52 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-02-27 12:46:52 +0300 |
commit | 3c39e1a618f3cfcc0a1b37d0f0f5492ef9ab1ea4 (patch) | |
tree | 2052e3447d3baaf39004ec18035581159a1bad5c /src/slic3r/GUI/GLTexture.cpp | |
parent | 6066f7b7c5fa01d74ce62dfbb95fdbb5e00398a6 (diff) |
Attempt to fix rendering of printbed svg textures on Mac
Diffstat (limited to 'src/slic3r/GUI/GLTexture.cpp')
-rw-r--r-- | src/slic3r/GUI/GLTexture.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index e7e20b27e..436a37e1c 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -20,6 +20,8 @@ #include "nanosvg/nanosvgrast.h" #endif // ENABLE_TEXTURES_FROM_SVG +#include "libslic3r/Utils.hpp" + namespace Slic3r { namespace GUI { @@ -357,6 +359,27 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns nsvgDeleteRasterizer(rast); nsvgDelete(image); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if 1 + // debug output + wxImage output(m_width, m_height); + output.InitAlpha(); + + for (int h = 0; h < m_height; ++h) + { + int px_h = h * m_width; + for (int w = 0; w < m_width; ++w) + { + int offset = (px_h + w) * 4; + output.SetRGB(w, h, data.data()[offset + 0], data.data()[offset + 1], data.data()[offset + 2]); + output.SetAlpha(w, h, data.data()[offset + 3]); + } + } + + output.SaveFile(resources_dir() + "/icons/test_svg_import.png", wxBITMAP_TYPE_PNG); +#endif // 0 +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + return true; } #endif // ENABLE_TEXTURES_FROM_SVG |