diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-20 12:53:27 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-20 12:53:27 +1100 |
commit | 921df6efca5b385790a2806f8b8844becb36e773 (patch) | |
tree | d84a6c8801e83a972485c052559ab9997e8073d2 /qt/ScintillaEditBase/PlatQt.cpp | |
parent | 2813306346e4087679915c2b30f1be4949f0228a (diff) | |
download | scintilla-mirror-921df6efca5b385790a2806f8b8844becb36e773.tar.gz |
Add AllocatePixMap method on Surface to create a pixmap surface.
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 15 |
1 files changed, 15 insertions, 0 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_; |