fix resize bug

This commit is contained in:
Geoffray Levasseur committed 2026-11-04 15:06:43 +01:00
1 parent e5f109327c
commit 988acdbab8
2 files changed
+6

No files matched your search

+3
View File
@@ -304,6 +304,7 @@ Bitmap::Bitmap(int width, int height)
void Bitmap::setSize(int width, int height)
{
m_canvas.end(); // the painter must not outlive the image it paints on
QImage resized(width, height, QImage::Format_ARGB32);
resized.fill(Qt::transparent);
m_image = resized;
@@ -318,6 +319,7 @@ void Bitmap::setTransparentColor(const QColor &value)
void Bitmap::loadFromFile(const QString &fileName)
{
m_canvas.end();
m_image.load(fileName);
m_image = m_image.convertToFormat(QImage::Format_ARGB32);
m_canvas.setDevice(&m_image);
@@ -330,6 +332,7 @@ void Bitmap::saveToFile(const QString &fileName) const
void Bitmap::assign(const Bitmap &source)
{
m_canvas.end();
m_image = source.m_image;
m_transparent = source.m_transparent;
m_transparentColor = source.m_transparentColor;