From c3fdd3050d9d423ce2ba703e31246c3ceb83f296 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 13 Oct 2015 13:53:24 -0400 Subject: [PATCH] Implemented clipping on OS X. --- darwin/draw.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/darwin/draw.m b/darwin/draw.m index b0a1a8c4..79b21a8e 100644 --- a/darwin/draw.m +++ b/darwin/draw.m @@ -403,6 +403,21 @@ void uiDrawTransform(uiDrawContext *c, uiDrawMatrix *m) CGContextConcatCTM(c->c, cm); } +void uiDrawClip(uiDrawContext *c, uiDrawPath *path) +{ + if (!path->ended) + complain("path not ended in uiDrawClip()"); + CGContextAddPath(c->c, (CGPathRef) (path->path)); + switch (path->fillMode) { + case uiDrawFillModeWinding: + CGContextClip(c->c); + break; + case uiDrawFillModeAlternate: + CGContextEOClip(c->c); + break; + } +} + // TODO figure out what besides transforms these save/restore on all platforms void uiDrawSave(uiDrawContext *c) {