vlc | branch: master | Marvin Scholz <[email protected]> | Wed Jun 3 15:45:48 2020 +0200| [6c1786b6e0ff677ec7bff9de47f506443d889765] | committer: Marvin Scholz
macosx: use vlc_safeDrawInBezierPath:angle: > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c1786b6e0ff677ec7bff9de47f506443d889765 --- modules/gui/macosx/views/VLCBottomBarView.m | 16 +++++++--------- modules/gui/macosx/views/VLCSliderCell.m | 5 ++--- modules/gui/macosx/views/VLCVolumeSliderCell.m | 19 +++++++------------ 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/modules/gui/macosx/views/VLCBottomBarView.m b/modules/gui/macosx/views/VLCBottomBarView.m index 47e44444b0..601e1efc85 100644 --- a/modules/gui/macosx/views/VLCBottomBarView.m +++ b/modules/gui/macosx/views/VLCBottomBarView.m @@ -24,6 +24,7 @@ #import "VLCBottomBarView.h" #import "extensions/NSView+VLCAdditions.h" +#import "extensions/NSGradient+VLCAdditions.h" @interface VLCBottomBarView () { NSBezierPath *_rectanglePath; @@ -126,15 +127,12 @@ [[NSColor clearColor] setFill]; NSRectFill(barRect); - // Drawing a gradient into an empty bezier path will cause an exception, prevent that - if (![_rectanglePath isEmpty]) { - if (_isDark) { - [_darkGradient drawInBezierPath:_rectanglePath angle:270.0]; - [_darkStroke setStroke]; - } else { - [_lightGradient drawInBezierPath:_rectanglePath angle:270.0]; - [_lightStroke setStroke]; - } + if (_isDark) { + [_darkGradient vlc_safeDrawInBezierPath:_rectanglePath angle:270.0]; + [_darkStroke setStroke]; + } else { + [_lightGradient vlc_safeDrawInBezierPath:_rectanglePath angle:270.0]; + [_lightStroke setStroke]; } [_separatorPath stroke]; diff --git a/modules/gui/macosx/views/VLCSliderCell.m b/modules/gui/macosx/views/VLCSliderCell.m index 50160f86e0..caa0e59e59 100644 --- a/modules/gui/macosx/views/VLCSliderCell.m +++ b/modules/gui/macosx/views/VLCSliderCell.m @@ -22,6 +22,7 @@ #import "VLCSliderCell.h" +#import "extensions/NSGradient+VLCAdditions.h" #import "main/CompatibilityFixes.h" @interface VLCSliderCell () { @@ -224,9 +225,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt // Empty Track Drawing NSBezierPath* emptyTrackPath = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:3 yRadius:3]; - // Drawing a gradient into an empty bezier path will cause an exception, prevent that - if (![emptyTrackPath isEmpty]) - [_trackGradient drawInBezierPath:emptyTrackPath angle:-90]; + [_trackGradient vlc_safeDrawInBezierPath:emptyTrackPath angle:-90]; if (_isKnobHidden) { [_trackStrokeColor setStroke]; diff --git a/modules/gui/macosx/views/VLCVolumeSliderCell.m b/modules/gui/macosx/views/VLCVolumeSliderCell.m index e42dd17fd8..a392db51b3 100644 --- a/modules/gui/macosx/views/VLCVolumeSliderCell.m +++ b/modules/gui/macosx/views/VLCVolumeSliderCell.m @@ -22,6 +22,7 @@ #import "VLCVolumeSliderCell.h" +#import "extensions/NSGradient+VLCAdditions.h" #import "main/CompatibilityFixes.h" @interface VLCVolumeSliderCell () { @@ -142,16 +143,14 @@ // Draw knob NSBezierPath* knobPath = [NSBezierPath bezierPathWithOvalInRect:NSInsetRect(knobRect, 1.0, 1.0)]; if (self.isHighlighted) { - // Drawing a gradient into an empty bezier path will cause an exception, prevent that - if (_knobGradient && ![knobPath isEmpty]) { - [_knobGradient drawInBezierPath:knobPath angle:_knobGradientAngleHighlighted]; + if (_knobGradient) { + [_knobGradient vlc_safeDrawInBezierPath:knobPath angle:_knobGradientAngleHighlighted]; } else { [_activeKnobFillColor setFill]; } } else { - // Drawing a gradient into an empty bezier path will cause an exception, prevent that - if (_knobGradient && ![knobPath isEmpty]) { - [_knobGradient drawInBezierPath:knobPath angle:_knobGradientAngle]; + if (_knobGradient) { + [_knobGradient vlc_safeDrawInBezierPath:knobPath angle:_knobGradientAngle]; } else { [_knobFillColor setFill]; } @@ -200,14 +199,10 @@ [emptyTrackPath fill]; // Filled part drawing - // Drawing a gradient into an empty bezier path will cause an exception, prevent that - if (![leadingTrackPath isEmpty]) - [_trackGradient drawInBezierPath:leadingTrackPath angle:-90]; + [_trackGradient vlc_safeDrawInBezierPath:leadingTrackPath angle:-90]; } else { // Empty part drawing - // Drawing a gradient into an empty bezier path will cause an exception, prevent that - if (![emptyTrackPath isEmpty]) - [_trackGradient drawInBezierPath:emptyTrackPath angle:-90]; + [_trackGradient vlc_safeDrawInBezierPath:emptyTrackPath angle:-90]; // Filled part drawing [_filledTrackColor setFill]; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
