mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00

1. fix the thumbnail white issue in some random case 2. fix the thumbnail not update issue under preview panel 3. fix the previous panel's toolpath not clear issue while switch panel under preview 4. fix the toolpath not clear issue while switch from 3d to preview in some corner case Change-Id: I158eba35e3b5d8a1e77f19ee9f86801e6a6dbd86
32 lines
624 B
C++
32 lines
624 B
C++
#include "ThumbnailData.hpp"
|
|
|
|
namespace Slic3r {
|
|
|
|
void ThumbnailData::set(unsigned int w, unsigned int h)
|
|
{
|
|
if ((w == 0) || (h == 0))
|
|
return;
|
|
|
|
if ((width != w) || (height != h))
|
|
{
|
|
width = w;
|
|
height = h;
|
|
// defaults to white texture
|
|
pixels.clear();
|
|
pixels = std::vector<unsigned char>(width * height * 4, 255);
|
|
}
|
|
}
|
|
|
|
void ThumbnailData::reset()
|
|
{
|
|
width = 0;
|
|
height = 0;
|
|
pixels.clear();
|
|
}
|
|
|
|
bool ThumbnailData::is_valid() const
|
|
{
|
|
return (width != 0) && (height != 0) && ((unsigned int)pixels.size() == 4 * width * height);
|
|
}
|
|
|
|
} // namespace Slic3r
|