Attempt to fix rendering of printbed svg textures on Mac

This commit is contained in:
Enrico Turri 2019-02-27 10:46:52 +01:00
parent 6066f7b7c5
commit 3c39e1a618
2 changed files with 31 additions and 2 deletions

View file

@ -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