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 /win32 | |
| parent | 4b553e8fce75afd0ad0df2e752edafe739db44dc (diff) | |
| download | scintilla-mirror-dd9ae27be2d1b983638337f24685e6458360dfa3.tar.gz | |
Implement PopClip to allow local clipping.
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/PlatWin.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 014c09793..18cf7bca7 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -513,6 +513,7 @@ public: XYPOSITION AverageCharWidth(const Font *font_) override; void SetClip(PRectangle rc) override; + void PopClip() override; void FlushCachedState() override; void SetUnicodeMode(bool unicodeMode_) override; @@ -1091,10 +1092,15 @@ XYPOSITION SurfaceGDI::AverageCharWidth(const Font *font_) { } void SurfaceGDI::SetClip(PRectangle rc) { + ::SaveDC(hdc); ::IntersectClipRect(hdc, static_cast<int>(rc.left), static_cast<int>(rc.top), static_cast<int>(rc.right), static_cast<int>(rc.bottom)); } +void SurfaceGDI::PopClip() { + ::RestoreDC(hdc, -1); +} + void SurfaceGDI::FlushCachedState() { pen = {}; brush = {}; @@ -1207,6 +1213,7 @@ public: XYPOSITION AverageCharWidth(const Font *font_) override; void SetClip(PRectangle rc) override; + void PopClip() override; void FlushCachedState() override; void SetUnicodeMode(bool unicodeMode_) override; @@ -2250,6 +2257,14 @@ void SurfaceD2D::SetClip(PRectangle rc) { } } +void SurfaceD2D::PopClip() { + if (pRenderTarget) { + PLATFORM_ASSERT(clipsActive > 0); + pRenderTarget->PopAxisAlignedClip(); + clipsActive--; + } +} + void SurfaceD2D::FlushCachedState() { } |
