Selaa lähdekoodia

Optimized display visualization

Thomas Buck 9 vuotta sitten
vanhempi
commit
620c32684b
2 muutettua tiedostoa jossa 7 lisäystä ja 6 poistoa
  1. 6
    5
      CaseLights/AppDelegate.m
  2. 1
    1
      CaseLights/Info.plist

+ 6
- 5
CaseLights/AppDelegate.m Näytä tiedosto

@@ -622,9 +622,10 @@
622 622
 
623 623
 - (void)visualizeDisplay:(NSTimer *)timer {
624 624
     NSBitmapImageRep *screen = [Screenshot screenshot:[timer userInfo]];
625
+    NSInteger spp = [screen samplesPerPixel];
625 626
     
626
-    if ((([screen samplesPerPixel] != 3) && ([screen samplesPerPixel] != 4)) || ([screen isPlanar] == YES) || ([screen numberOfPlanes] != 1)) {
627
-        NSLog(@"Unknown image format (%ld, %c, %ld)!\n", (long)[screen samplesPerPixel], ([screen isPlanar] == YES) ? 'p' : 'n', (long)[screen numberOfPlanes]);
627
+    if (((spp != 3) && (spp != 4)) || ([screen isPlanar] == YES) || ([screen numberOfPlanes] != 1)) {
628
+        NSLog(@"Unknown image format (%ld, %c, %ld)!\n", (long)spp, ([screen isPlanar] == YES) ? 'p' : 'n', (long)[screen numberOfPlanes]);
628 629
         return;
629 630
     }
630 631
     
@@ -639,9 +640,9 @@
639 640
     unsigned long long max = width * height;
640 641
     unsigned long long red = 0, green = 0, blue = 0;
641 642
     for (unsigned long long i = 0; i < max; i++) {
642
-        red += data[([screen samplesPerPixel] * i) + redC];
643
-        green += data[([screen samplesPerPixel] * i) + greenC];
644
-        blue += data[([screen samplesPerPixel] * i) + blueC];
643
+        red += data[(spp * i) + redC];
644
+        green += data[(spp * i) + greenC];
645
+        blue += data[(spp * i) + blueC];
645 646
     }
646 647
     
647 648
     [self setLightsR:(red / max) G:(green / max) B:(blue / max)];

+ 1
- 1
CaseLights/Info.plist Näytä tiedosto

@@ -21,7 +21,7 @@
21 21
 	<key>CFBundleSignature</key>
22 22
 	<string>????</string>
23 23
 	<key>CFBundleVersion</key>
24
-	<string>132</string>
24
+	<string>142</string>
25 25
 	<key>LSApplicationCategoryType</key>
26 26
 	<string>public.app-category.utilities</string>
27 27
 	<key>LSMinimumSystemVersion</key>

Loading…
Peruuta
Tallenna