From 4944243acb0f5ccac65c062ab5f5cfee91e250ef Mon Sep 17 00:00:00 2001 From: Geoffray Levasseur Date: Tue, 3 Nov 2026 16:01:54 +0100 Subject: [PATCH] new function --- widget/include/Cevo/CevoScreenTools.h | 5 +++++ widget/src/CevoScreenTools.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/widget/include/Cevo/CevoScreenTools.h b/widget/include/Cevo/CevoScreenTools.h index 7309423..10f2ae3 100644 --- a/widget/include/Cevo/CevoScreenTools.h +++ b/widget/include/Cevo/CevoScreenTools.h @@ -142,6 +142,11 @@ void bitmapReplaceColor(Dpi::Bitmap &dst, int x, int y, int width, int height, Q // A soft radial glow (GlowRange=8 px) painted around a (width,height) // rectangle at (x0,y0) within dst, tinted by cl. void glowFrame(Dpi::Bitmap &dst, int x0, int y0, int width, int height, QColor cl); +// ScreenTools.pas's shared `DrawBuffer` scratch bitmap (resized on demand +// by drawBufferEnsureSize()) - used by dialogs that need an off-screen +// compositing surface for a one-off effect. +extern Dpi::Bitmap drawBuffer; +void drawBufferEnsureSize(int width, int height); // Draws a masked sprite (AND then OR, via an internal scratch buffer since // Qt's QPainter has no raster-op compositing against the live canvas). diff --git a/widget/src/CevoScreenTools.cpp b/widget/src/CevoScreenTools.cpp index 6205c40..69479c7 100644 --- a/widget/src/CevoScreenTools.cpp +++ b/widget/src/CevoScreenTools.cpp @@ -47,6 +47,17 @@ GraphicSet *Templates = nullptr; Dpi::Bitmap *Colors = nullptr; Dpi::Bitmap *bigImp = nullptr; Dpi::Bitmap paper; +Dpi::Bitmap drawBuffer; + +void drawBufferEnsureSize(int width, int height) +{ + if (drawBuffer.width() >= width && drawBuffer.height() >= height) + return; + drawBuffer.setSize(std::max(drawBuffer.width(), width), std::max(drawBuffer.height(), height)); + drawBuffer.canvas().begin(); + drawBuffer.canvas().fillRect(QRect(0, 0, drawBuffer.width(), drawBuffer.height())); + drawBuffer.canvas().end(); +} QColor colorFromDelphi(int value) {