diff options
| author | Neil <nyamatongwe@gmail.com> | 2021-03-19 15:04:38 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2021-03-19 15:04:38 +1100 |
| commit | dd9ae27be2d1b983638337f24685e6458360dfa3 (patch) | |
| tree | 3b26625721b6704669c5a6d58d8a1199ad195afe /gtk | |
| parent | 4b553e8fce75afd0ad0df2e752edafe739db44dc (diff) | |
| download | scintilla-mirror-dd9ae27be2d1b983638337f24685e6458360dfa3.tar.gz | |
Implement PopClip to allow local clipping.
Diffstat (limited to 'gtk')
| -rwxr-xr-x | gtk/PlatGTK.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 33a0b8917..3b19df3ba 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -136,6 +136,7 @@ class SurfaceImpl : public Surface { Converter conv; int characterSet; void SetConverter(int characterSet_); + void CairoRectangle(PRectangle rc); public: SurfaceImpl() noexcept; // Deleted so SurfaceImpl objects can not be copied. @@ -186,6 +187,7 @@ public: XYPOSITION AverageCharWidth(const Font *font_) override; void SetClip(PRectangle rc) override; + void PopClip() override; void FlushCachedState() override; void SetUnicodeMode(bool unicodeMode_) override; @@ -257,6 +259,10 @@ void SurfaceImpl::SetConverter(int characterSet_) { } } +void SurfaceImpl::CairoRectangle(PRectangle rc) { + cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); +} + SurfaceImpl::SurfaceImpl() noexcept : et(singleByte), context(nullptr), psurf(nullptr), @@ -950,10 +956,16 @@ XYPOSITION SurfaceImpl::AverageCharWidth(const Font *font_) { void SurfaceImpl::SetClip(PRectangle rc) { PLATFORM_ASSERT(context); - cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); + cairo_save(context); + CairoRectangle(rc); cairo_clip(context); } +void SurfaceImpl::PopClip() { + PLATFORM_ASSERT(context); + cairo_restore(context); +} + void SurfaceImpl::FlushCachedState() {} void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) { |
