From dd9ae27be2d1b983638337f24685e6458360dfa3 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 19 Mar 2021 15:04:38 +1100 Subject: Implement PopClip to allow local clipping. --- qt/ScintillaEditBase/PlatQt.cpp | 8 +++++++- qt/ScintillaEditBase/PlatQt.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'qt') diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 1b8f75c02..ce6f0313b 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -470,7 +470,7 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, { SetClip(rc); DrawTextNoClip(rc, font, ybase, text, fore, back); - GetPainter()->setClipping(false); + PopClip(); } void SurfaceImpl::DrawTextTransparent(PRectangle rc, @@ -489,9 +489,15 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, void SurfaceImpl::SetClip(PRectangle rc) { + GetPainter()->save(); GetPainter()->setClipRect(QRectFFromPRect(rc)); } +void SurfaceImpl::PopClip() +{ + GetPainter()->restore(); +} + void SurfaceImpl::MeasureWidths(const Font *font, std::string_view text, XYPOSITION *positions) diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h index 7b43e0b02..4069898ff 100644 --- a/qt/ScintillaEditBase/PlatQt.h +++ b/qt/ScintillaEditBase/PlatQt.h @@ -133,6 +133,7 @@ public: XYPOSITION AverageCharWidth(const Font *font) override; void SetClip(PRectangle rc) override; + void PopClip() override; void FlushCachedState() override; void SetUnicodeMode(bool unicodeMode_) override; -- cgit v1.2.3