Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
56a6ef98 by Claudio Cambra at 2022-06-24T17:13:37+00:00
macosx: Only set VLCImageView images when necessary

This prevents constant flashing of the placeholder image

Signed-off-by: Claudio Cambra <claudio.cam...@gmail.com>

- - - - -


1 changed file:

- modules/gui/macosx/views/VLCImageView.m


Changes:

=====================================
modules/gui/macosx/views/VLCImageView.m
=====================================
@@ -24,6 +24,12 @@
 #import "extensions/NSColor+VLCAdditions.h"
 #import "extensions/NSView+VLCAdditions.h"
 
+@interface VLCImageView()
+{
+    NSURL *_currentArtworkURL;
+}
+@end
+
 @implementation VLCImageView
 
 - (instancetype)initWithFrame:(NSRect)frameRect
@@ -145,7 +151,13 @@
 
 - (void)setImageURL:(NSURL * _Nonnull)artworkURL placeholderImage:(NSImage * 
_Nullable)image
 {
+    if([_currentArtworkURL isEqual:artworkURL]) {
+        return;
+    }
+
+    _currentArtworkURL = artworkURL;
     [self setImage:image];
+
     
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 
0), ^{
         NSImage *downloadedImage = [[NSImage alloc] 
initWithContentsOfURL:artworkURL];
         dispatch_async(dispatch_get_main_queue(), ^{



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/56a6ef98be450d93ec44f25212f65c6a583746e2

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/56a6ef98be450d93ec44f25212f65c6a583746e2
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to