[Bf-blender-cvs] [60ad4a761ac] master: UI: Improved macOS Application Icon Progress Bar
Yevgeny Makarov
noreply at git.blender.org
Fri Nov 6 17:55:13 CET 2020
Commit: 60ad4a761ace5fffb2379b8437c26249e194ad26
Author: Yevgeny Makarov
Date: Fri Nov 6 08:28:58 2020 -0800
Branches: master
https://developer.blender.org/rB60ad4a761ace5fffb2379b8437c26249e194ad26
UI: Improved macOS Application Icon Progress Bar
Nicer appearance for the progress bar that is drawn over the application icon during long processes on macOS.
Differential Revision: https://developer.blender.org/D9398
Reviewed by Brecht Van Lommel
===================================================================
M intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index ebc08fb411c..360fe73b648 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -869,28 +869,26 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
NSImage *dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128, 128)];
[dockIcon lockFocus];
- NSRect progressBox = {{4, 4}, {120, 16}};
[[NSImage imageNamed:@"NSApplicationIcon"] drawAtPoint:NSZeroPoint
fromRect:NSZeroRect
operation:NSCompositingOperationSourceOver
fraction:1.0];
- // Track & Outline
- [[NSColor blackColor] setFill];
- NSRectFill(progressBox);
+ NSRect progressRect = {{8, 8}, {112, 14}};
+ NSBezierPath *progressPath;
- [[NSColor whiteColor] set];
- NSFrameRect(progressBox);
+ /* Draw white track. */
+ [[[NSColor whiteColor] colorWithAlphaComponent: 0.6] setFill];
+ progressPath = [NSBezierPath bezierPathWithRoundedRect:progressRect xRadius:7 yRadius:7];
+ [progressPath fill];
- // Progress fill
- progressBox = NSInsetRect(progressBox, 1, 1);
-
- progressBox.size.width = progressBox.size.width * progress;
- NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor darkGrayColor]
- endingColor:[NSColor lightGrayColor]];
- [gradient drawInRect:progressBox angle:90];
- [gradient release];
+ /* Black progress fill. */
+ [[[NSColor blackColor] colorWithAlphaComponent: 0.7] setFill];
+ progressRect = NSInsetRect(progressRect, 2, 2);
+ progressRect.size.width *= progress;
+ progressPath = [NSBezierPath bezierPathWithRoundedRect:progressRect xRadius:5 yRadius:5];
+ [progressPath fill];
[dockIcon unlockFocus];
More information about the Bf-blender-cvs
mailing list