Revision: 15153
          http://sourceforge.net/p/skim-app/code/15153
Author:   hofman
Date:     2025-05-04 14:52:54 +0000 (Sun, 04 May 2025)
Log Message:
-----------
Move scale calculation to inline function

Modified Paths:
--------------
    trunk/SKImageToolTipWindow.m

Modified: trunk/SKImageToolTipWindow.m
===================================================================
--- trunk/SKImageToolTipWindow.m        2025-05-04 14:42:44 UTC (rev 15152)
+++ trunk/SKImageToolTipWindow.m        2025-05-04 14:52:54 UTC (rev 15153)
@@ -164,6 +164,17 @@
     [[self class] cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(showDelayed) object:nil];
 }
 
+static inline CGFloat toolTipScale(CGFloat scale) {
+    NSNumber *usedScaleNumber = [[NSUserDefaults standardUserDefaults] 
objectForKey:SKToolTipScaleKey];
+    CGFloat usedScale = [usedScaleNumber 
respondsToSelector:@selector(doubleValue)] ? [usedScaleNumber doubleValue] : 
DEFAULT_SCALE;
+    if (usedScale > 0.0)
+        return usedScale;
+    else if (usedScale < 0.0)
+        return fmin(scale, -usedScale);
+    else
+        return scale;
+}
+
 - (void)showForImageContext:(id <SKImageToolTipContext>)aContext 
scale:(CGFloat)aScale atPoint:(NSPoint)aPoint {
     point = aPoint;
     
@@ -178,13 +189,8 @@
         
         dispatch_async([[self class] imageQueue], ^{
             
-            NSNumber *usedScaleNumber = [[NSUserDefaults standardUserDefaults] 
objectForKey:SKToolTipScaleKey];
-            CGFloat usedScale = [usedScaleNumber 
respondsToSelector:@selector(doubleValue)] ? [usedScaleNumber doubleValue] : 
DEFAULT_SCALE;
-            if (usedScale <= 0.0)
-                usedScale = usedScale < 0.0 ? fmin(aScale, -usedScale) : 
aScale;
+            NSImage *anImage = [aContext 
toolTipImageWithScale:toolTipScale(aScale) backingScale:backingScale];
             
-            NSImage *anImage = [aContext toolTipImageWithScale:usedScale 
backingScale:backingScale];
-            
             dispatch_async(dispatch_get_main_queue(), ^{
                 
                 // check if another image is enerated or we are fading out

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to