[vlc-commits] macosx: add vlc_safeDrawInBezierPath
Marvin Scholz
git at videolan.org
Wed Jun 3 16:51:21 CEST 2020
vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Jun 3 16:09:57 2020 +0200| [ca17a12643409621bc58510a73274b6e2999a3d0] | committer: Marvin Scholz
macosx: add vlc_safeDrawInBezierPath
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=ca17a12643409621bc58510a73274b6e2999a3d0
---
modules/gui/macosx/NSGradient+VLCAdditions.h | 8 +++++++-
modules/gui/macosx/NSGradient+VLCAdditions.m | 8 ++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/modules/gui/macosx/NSGradient+VLCAdditions.h b/modules/gui/macosx/NSGradient+VLCAdditions.h
index 1a1a9d14d5..8185a207a0 100644
--- a/modules/gui/macosx/NSGradient+VLCAdditions.h
+++ b/modules/gui/macosx/NSGradient+VLCAdditions.h
@@ -27,7 +27,13 @@
/* Safe alternative to drawInBezierPath:angle: which will throw an
* exception when trying to draw into an empty NSBezierPath.
*/
-- (void)vlc_safeDrawInBezierPath:(NSBezierPath *)path
+- (void)vlc_safeDrawInBezierPath:(NSBezierPath *)path
angle:(CGFloat)angle;
+/* Safe alternative to drawInBezierPath:relativeCenterPosition: which
+ * will throw an exception when trying to draw into an empty NSBezierPath.
+ */
+- (void)vlc_safeDrawInBezierPath:(NSBezierPath *)path
+ relativeCenterPosition:(NSPoint)relativeCenterPosition;
+
@end
diff --git a/modules/gui/macosx/NSGradient+VLCAdditions.m b/modules/gui/macosx/NSGradient+VLCAdditions.m
index 4f06e88ca6..6e92ef0324 100644
--- a/modules/gui/macosx/NSGradient+VLCAdditions.m
+++ b/modules/gui/macosx/NSGradient+VLCAdditions.m
@@ -32,4 +32,12 @@
[self drawInBezierPath:path angle:angle];
}
+- (void)vlc_safeDrawInBezierPath:(NSBezierPath *)path
+ relativeCenterPosition:(NSPoint)relativeCenterPosition
+{
+ if ([path isEmpty])
+ return;
+ [self drawInBezierPath:path relativeCenterPosition:relativeCenterPosition];
+}
+
@end
More information about the vlc-commits
mailing list