comparison win/dw.c @ 1684:31dd366acfc8

Fixed calculating the GDI+ ratio based on the DPI on Windows. Not sure if I am getting to the result correctly but it is working. Also explicitly turn off anti-aliasing when drawing rectangles in the test program, so the edges don't look odd.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 30 Apr 2012 11:54:19 +0000
parents 19c34a1c1489
children 31f16da1052a
comparison
equal deleted inserted replaced
1683:19c34a1c1489 1684:31dd366acfc8
10106 /* Internal function to increase or decrease coordinates/sizes 10106 /* Internal function to increase or decrease coordinates/sizes
10107 * by the difference of the screen DPI (96) and the context DPI. 10107 * by the difference of the screen DPI (96) and the context DPI.
10108 */ 10108 */
10109 void _convert_dpi(HDC hdc, int *x, int *y, int mult) 10109 void _convert_dpi(HDC hdc, int *x, int *y, int mult)
10110 { 10110 {
10111 float ratiox = (float)GetDeviceCaps(hdc, LOGPIXELSX)/96.0; 10111 int ratiox = (int)GetDeviceCaps(hdc, LOGPIXELSX)/96;
10112 float ratioy = (float)GetDeviceCaps(hdc, LOGPIXELSY)/96.0; 10112 int ratioy = (int)GetDeviceCaps(hdc, LOGPIXELSY)/96;
10113 if(mult) 10113 if(ratiox > 1 && ratioy > 1)
10114 { 10114 {
10115 *x *= ratiox; 10115 if(mult)
10116 *y *= ratioy; 10116 {
10117 } 10117 *x *= ratiox;
10118 else 10118 *y *= ratioy;
10119 { 10119 }
10120 *x /= ratiox; 10120 else
10121 *y /= ratioy; 10121 {
10122 *x /= ratiox;
10123 *y /= ratioy;
10124 }
10122 } 10125 }
10123 } 10126 }
10124 #endif 10127 #endif
10125 10128
10126 /* Draw text on a window (preferably a render window). 10129 /* Draw text on a window (preferably a render window).