[vlc-commits] macosx/image view: improve border appearance

Felix Paul Kühne git at videolan.org
Wed May 29 15:38:46 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed May 29 14:14:11 2019 +0200| [519ed8454479bf4a90bbf2c4fb5aa8326f5a6905] | committer: Felix Paul Kühne

macosx/image view: improve border appearance

This introduces a 1pt border to avoid bleeding and a 5° corner radius to smoothen the appearance

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=519ed8454479bf4a90bbf2c4fb5aa8326f5a6905
---

 modules/gui/macosx/views/VLCImageView.m | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/gui/macosx/views/VLCImageView.m b/modules/gui/macosx/views/VLCImageView.m
index e3bd78698a..c0015df9d5 100644
--- a/modules/gui/macosx/views/VLCImageView.m
+++ b/modules/gui/macosx/views/VLCImageView.m
@@ -21,6 +21,8 @@
  *****************************************************************************/
 
 #import "VLCImageView.h"
+#import "extensions/NSColor+VLCAdditions.h"
+#import "extensions/NSView+VLCAdditions.h"
 
 @implementation VLCImageView
 
@@ -47,6 +49,15 @@
     self.layer = [[CALayer alloc] init];
     self.contentGravity = VLCImageViewContentGravityResizeAspectFill;
     self.wantsLayer = YES;
+    self.layer.cornerRadius = 5.;
+    self.layer.masksToBounds = YES;
+    self.layer.borderWidth = 1.;
+    [self setupBorderColor];
+}
+
+- (void)setupBorderColor
+{
+    self.layer.borderColor = self.shouldShowDarkAppearance ? [NSColor VLClibrarySeparatorDarkColor].CGColor : [NSColor VLClibrarySeparatorLightColor].CGColor;
 }
 
 - (void)setImage:(NSImage *)image
@@ -105,4 +116,9 @@
     }
 }
 
+- (void)viewDidChangeEffectiveAppearance
+{
+    [self setupBorderColor];
+}
+
 @end



More information about the vlc-commits mailing list