diff --git a/widget/src/CevoScreenTools.cpp b/widget/src/CevoScreenTools.cpp index 55b1b8c..947ccf3 100644 --- a/widget/src/CevoScreenTools.cpp +++ b/widget/src/CevoScreenTools.cpp @@ -339,7 +339,10 @@ void glowFrame(Dpi::Bitmap &dst, int x0, int y0, int width, int height, QColor c void sprite(Dpi::Canvas &canvas, GraphicSet &graphicSet, int xDst, int yDst, int width, int height, int xGr, int yGr) { + // dst = (dst AND mask) OR data: start from what is already on the canvas (when it is image backed). Dpi::Bitmap scratch(width, height); + scratch.canvas().copyRect(QRect(0, 0, width, height), canvas, QRect(xDst, yDst, width, height)); + scratch.canvas().end(); bitBltBitmap(scratch, 0, 0, width, height, graphicSet.mask, xGr, yGr, RasterOp::And); bitBltBitmap(scratch, 0, 0, width, height, graphicSet.data, xGr, yGr, RasterOp::Paint); canvas.draw(xDst, yDst, scratch.image()); diff --git a/widget/src/DpiGraphics.cpp b/widget/src/DpiGraphics.cpp index f79b745..1da1531 100644 --- a/widget/src/DpiGraphics.cpp +++ b/widget/src/DpiGraphics.cpp @@ -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;