LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * Cocoa's event loop must be in main thread. | 2 * Cocoa's event loop must be in main thread. |
3 * | 3 * |
4 * Unless otherwise stated, all coordinate systems | 4 * Unless otherwise stated, all coordinate systems |
5 * are bottom-left-based. | 5 * are bottom-left-based. |
6 */ | 6 */ |
7 | 7 |
8 #define Cursor OSXCursor | 8 #define Cursor OSXCursor |
9 #define Point OSXPoint | 9 #define Point OSXPoint |
10 #define Rect OSXRect | 10 #define Rect OSXRect |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 samplesPerPixel:3 | 389 samplesPerPixel:3 |
390 hasAlpha:NO | 390 hasAlpha:NO |
391 isPlanar:NO | 391 isPlanar:NO |
392 colorSpaceName:NSDeviceRGBColorSpace | 392 colorSpaceName:NSDeviceRGBColorSpace |
393 bytesPerRow:bytesperline(r, 32) | 393 bytesPerRow:bytesperline(r, 32) |
394 bitsPerPixel:32]; | 394 bitsPerPixel:32]; |
395 ptsize = winsizepoints(); | 395 ptsize = winsizepoints(); |
396 [win.img setSize: ptsize]; | 396 [win.img setSize: ptsize]; |
397 win.topixelscale = size.width / ptsize.width; | 397 win.topixelscale = size.width / ptsize.width; |
398 win.topointscale = 1.0f / win.topixelscale; | 398 win.topointscale = 1.0f / win.topixelscale; |
| 399 ········ |
| 400 // NOTE: This is not really the display DPI. |
| 401 // On retina, topixelscale is 2; otherwise it is 1. |
| 402 // This formula gives us 220 for retina, 110 otherwise. |
| 403 // That's not quite right but it's close to correct. |
| 404 // http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple |
| 405 displaydpi = win.topixelscale * 110; |
| 406 |
399 return i; | 407 return i; |
400 } | 408 } |
401 | 409 |
402 void | 410 void |
403 resizeimg(void) | 411 resizeimg(void) |
404 { | 412 { |
405 [win.img release]; | 413 [win.img release]; |
406 _drawreplacescreenimage(initimg()); | 414 _drawreplacescreenimage(initimg()); |
407 | 415 |
408 mouseresized = 1; | 416 mouseresized = 1; |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 return r; | 1450 return r; |
1443 } | 1451 } |
1444 | 1452 |
1445 static NSPoint | 1453 static NSPoint |
1446 scalepoint(NSPoint pt, CGFloat scale) | 1454 scalepoint(NSPoint pt, CGFloat scale) |
1447 { | 1455 { |
1448 pt.x *= scale; | 1456 pt.x *= scale; |
1449 pt.y *= scale; | 1457 pt.y *= scale; |
1450 return pt; | 1458 return pt; |
1451 } | 1459 } |
LEFT | RIGHT |