So I'm trying to convert NSRect to CGRect. I used NSRectToCGRect() , which copies everything finely, but does not take into account the y-origin axis.
Problem: The beginning of CGRect (0,0) is the upper left. NSRect origin (0,0) bottom left.
Thus, the NSRect (0,0,100,100) field NSRect (0,0,100,100) is located in the lower left corner of the screen, and the NSRect (0,0,100,100) field NSRect (0,0,100,100) is located in the upper left corner of the screen.
I have a hack that captures y-origin through basic math:
fixedOriginY = screenHeight - NSRect.size.height - NSRect.origin.y
So the equivalent of NSRect (0,0,100,100) is actually CGRect (0,800,100,100) (in my MBA 900px high). However, I do not like it, I have a feeling that I will have problems with the retina or future complications.
Does anyone have a solution or idea on how to properly convert NSRect to CGRect?