Revision: 16408
          http://sourceforge.net/p/skim-app/code/16408
Author:   hofman
Date:     2026-09-01 16:43:55 +0000 (Tue, 01 Sep 2026)
Log Message:
-----------
combine calculations in one line

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

Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m     2026-09-01 16:10:56 UTC (rev 16407)
+++ trunk/NSGraphics_SKExtensions.m     2026-09-01 16:43:55 UTC (rev 16408)
@@ -191,18 +191,12 @@
 static inline CGFloat sRGBFromGamma16(CGFloat c) { return c <= 0.0031308 ? 
12.92 * pow(c, 1.6) : 1.055 * pow(c, 2.0/3.0) - 0.055; }
 
 static CGFloat invertedColorsFilterFactor() {
-    static CGFloat backgroundWhite = -2.0;
-    if (backgroundWhite < -1.0) {
+    static CGFloat backgroundWhite = -1.0;
+    if (backgroundWhite < 0.0) {
         NSNumber *bgw = [[NSUserDefaults standardUserDefaults] 
objectForKey:SKInvertedColorsBackgroundWhiteKey];
-        if (bgw == nil) {
-            backgroundWhite = -1.0;
-        } else {
-            backgroundWhite = fmax(0.0, fmin(1.0, [bgw  doubleValue]));
-            // map from sRGB to gamma=1.6 colorspace
-            backgroundWhite = sRGBToGamma16(backgroundWhite);
-        }
+        backgroundWhite = bgw ? sRGBToGamma16(fmax(0.0, fmin(1.0, [bgw  
doubleValue]))) : 2.0;
     }
-    return backgroundWhite >= 0.0 ? 2.0 - backgroundWhite : [[NSWorkspace 
sharedWorkspace] accessibilityDisplayShouldIncreaseContrast] ? 1.9338 : 1.8972;
+    return 2.0 - backgroundWhite ?: [[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldIncreaseContrast] ? 1.9338 : 1.8972;
 }
 
 NSArray *SKColorEffectFilters(void) {

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to