aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
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);
}