|
@@ -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)];
|