Given a CGDirectDisplayID returned from
CGError error = CGGetActiveDisplayList(8, directDisplayIDs, &displayCount);
for the built-in screen on a Retina MacBook Pro, I would expect to fetch the native pixel dimensions using
size_t pixelWidth = CGDisplayPixelsWide(directDisplayID);
size_t pixelHeight = CGDisplayPixelsHigh(directDisplayID);
However, these calls only return the dimensions of the currently selected mode. If I change screen resolution I get back different values. I was looking to get back 2880 x 1800 on a 15" rMBP.
How do I fetch the native pixel dimensions of a Retina MacBook Pro screen?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…