aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-19 15:04:38 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-19 15:04:38 +1100
commitdd9ae27be2d1b983638337f24685e6458360dfa3 (patch)
tree3b26625721b6704669c5a6d58d8a1199ad195afe /cocoa
parent4b553e8fce75afd0ad0df2e752edafe739db44dc (diff)
downloadscintilla-mirror-dd9ae27be2d1b983638337f24685e6458360dfa3.tar.gz
Implement PopClip to allow local clipping.
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.h1
-rw-r--r--cocoa/PlatCocoa.mm5
2 files changed, 6 insertions, 0 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index 870b61aa3..8f959014b 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -118,6 +118,7 @@ public:
XYPOSITION AverageCharWidth(const Font *font_) override;
void SetClip(PRectangle rc) override;
+ void PopClip() override;
void FlushCachedState() override;
void SetUnicodeMode(bool unicodeMode_) override;
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index b662c25e6..f5f69608e 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1270,9 +1270,14 @@ XYPOSITION SurfaceImpl::AverageCharWidth(const Font *font_) {
}
void SurfaceImpl::SetClip(PRectangle rc) {
+ CGContextSaveGState(gc);
CGContextClipToRect(gc, PRectangleToCGRect(rc));
}
+void SurfaceImpl::PopClip() {
+ CGContextRestoreGState(gc);
+}
+
void SurfaceImpl::FlushCachedState() {
CGContextSynchronize(gc);
}