aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt
diff options
context:
space:
mode:
Diffstat (limited to 'qt')
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp15
-rw-r--r--qt/ScintillaEditBase/PlatQt.h17
2 files changed, 25 insertions, 7 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index 6503d9c19..d61abf7b2 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -157,6 +157,16 @@ SurfaceImpl::SurfaceImpl()
: device(nullptr), painter(nullptr), deviceOwned(false), painterOwned(false), x(0), y(0),
codecName(nullptr), codec(nullptr)
{}
+
+SurfaceImpl::SurfaceImpl(int width, int height, SurfaceMode mode_)
+{
+ if (width < 1) width = 1;
+ if (height < 1) height = 1;
+ deviceOwned = true;
+ device = new QPixmap(width, height);
+ mode = mode_;
+}
+
SurfaceImpl::~SurfaceImpl()
{
Clear();
@@ -203,6 +213,11 @@ void SurfaceImpl::InitPixMap(int width,
mode = psurfOther->mode;
}
+std::unique_ptr<Surface> SurfaceImpl::AllocatePixMap(int width, int height)
+{
+ return std::make_unique<SurfaceImpl>(width, height, mode);
+}
+
void SurfaceImpl::SetMode(SurfaceMode mode_)
{
mode = mode_;
diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h
index 8f4d2c51d..1fc476129 100644
--- a/qt/ScintillaEditBase/PlatQt.h
+++ b/qt/ScintillaEditBase/PlatQt.h
@@ -73,25 +73,28 @@ constexpr PRectangle RectangleInset(PRectangle rc, XYPOSITION delta) noexcept {
class SurfaceImpl : public Surface {
private:
- QPaintDevice *device;
- QPainter *painter;
- bool deviceOwned;
- bool painterOwned;
- float x, y;
+ QPaintDevice *device = nullptr;
+ QPainter *painter = nullptr;
+ bool deviceOwned = false;
+ bool painterOwned = false;
+ float x = 0;
+ float y = 0;
SurfaceMode mode;
- const char *codecName;
- QTextCodec *codec;
+ const char *codecName = nullptr;
+ QTextCodec *codec = nullptr;
void Clear();
public:
SurfaceImpl();
+ SurfaceImpl(int width, int height, SurfaceMode mode_);
virtual ~SurfaceImpl();
void Init(WindowID wid) override;
void Init(SurfaceID sid, WindowID wid) override;
void InitPixMap(int width, int height,
Surface *surface, WindowID wid) override;
+ std::unique_ptr<Surface> AllocatePixMap(int width, int height) override;
void SetMode(SurfaceMode mode) override;