Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * GDI mapping mode functions |
| 3 | * |
| 4 | * Copyright 1993 Alexandre Julliard |
| 5 | */ |
| 6 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 7 | #include "gdi.h" |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 8 | #include "debugtools.h" |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 9 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 10 | DEFAULT_DEBUG_CHANNEL(gdi); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 11 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 12 | |
| 13 | /*********************************************************************** |
| 14 | * MAPPING_FixIsotropic |
| 15 | * |
| 16 | * Fix viewport extensions for isotropic mode. |
| 17 | */ |
| 18 | void MAPPING_FixIsotropic( DC * dc ) |
| 19 | { |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 20 | double xdim = (double)dc->vportExtX * GetDeviceCaps( dc->hSelf, HORZSIZE ) / |
| 21 | (GetDeviceCaps( dc->hSelf, HORZRES ) * dc->wndExtX); |
| 22 | double ydim = (double)dc->vportExtY * GetDeviceCaps( dc->hSelf, VERTSIZE ) / |
| 23 | (GetDeviceCaps( dc->hSelf, VERTRES ) * dc->wndExtY); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 24 | if (xdim > ydim) |
| 25 | { |
| 26 | dc->vportExtX = dc->vportExtX * fabs( ydim / xdim ); |
| 27 | if (!dc->vportExtX) dc->vportExtX = 1; |
| 28 | } |
| 29 | else |
| 30 | { |
| 31 | dc->vportExtY = dc->vportExtY * fabs( xdim / ydim ); |
| 32 | if (!dc->vportExtY) dc->vportExtY = 1; |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 33 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | |
| 37 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 38 | * DPtoLP (GDI.67) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 39 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 40 | BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 41 | { |
| 42 | DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); |
| 43 | if (!dc) return FALSE; |
| 44 | |
| 45 | while (count--) |
| 46 | { |
| 47 | points->x = XDPTOLP( dc, points->x ); |
| 48 | points->y = YDPTOLP( dc, points->y ); |
| 49 | points++; |
| 50 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 51 | GDI_ReleaseObj( hdc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 52 | return TRUE; |
| 53 | } |
| 54 | |
| 55 | |
| 56 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 57 | * DPtoLP (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 58 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 59 | BOOL WINAPI DPtoLP( HDC hdc, LPPOINT points, INT count ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 60 | { |
| 61 | DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); |
| 62 | if (!dc) return FALSE; |
| 63 | |
| 64 | while (count--) |
| 65 | { |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 66 | if (!INTERNAL_DPTOLP( dc, points )) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 67 | break; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 68 | points++; |
| 69 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 70 | GDI_ReleaseObj( hdc ); |
| 71 | return (count < 0); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | |
| 75 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 76 | * LPtoDP (GDI.99) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 77 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 78 | BOOL16 WINAPI LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 79 | { |
| 80 | DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); |
| 81 | if (!dc) return FALSE; |
| 82 | |
| 83 | while (count--) |
| 84 | { |
| 85 | points->x = XLPTODP( dc, points->x ); |
| 86 | points->y = YLPTODP( dc, points->y ); |
| 87 | points++; |
| 88 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 89 | GDI_ReleaseObj( hdc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 90 | return TRUE; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 95 | * LPtoDP (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 96 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 97 | BOOL WINAPI LPtoDP( HDC hdc, LPPOINT points, INT count ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 98 | { |
| 99 | DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); |
| 100 | if (!dc) return FALSE; |
| 101 | |
| 102 | while (count--) |
| 103 | { |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 104 | INTERNAL_LPTODP( dc, points ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 105 | points++; |
| 106 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 107 | GDI_ReleaseObj( hdc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 108 | return TRUE; |
| 109 | } |
| 110 | |
| 111 | |
| 112 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 113 | * SetMapMode (GDI.3) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 114 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 115 | INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 116 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 117 | return SetMapMode( hdc, mode ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | |
| 121 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 122 | * SetMapMode (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 123 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 124 | INT WINAPI SetMapMode( HDC hdc, INT mode ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 125 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 126 | INT prevMode; |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 127 | INT horzSize, vertSize, horzRes, vertRes; |
| 128 | |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 129 | DC * dc = DC_GetDCPtr( hdc ); |
| 130 | if (!dc) return 0; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 131 | if (dc->funcs->pSetMapMode) |
| 132 | { |
| 133 | prevMode = dc->funcs->pSetMapMode( dc, mode ); |
| 134 | goto done; |
| 135 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 136 | |
Alexandre Julliard | 61fece0 | 1999-06-26 19:09:08 +0000 | [diff] [blame] | 137 | TRACE("%04x %d\n", hdc, mode ); |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 138 | |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 139 | prevMode = dc->MapMode; |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 140 | horzSize = GetDeviceCaps( hdc, HORZSIZE ); |
| 141 | vertSize = GetDeviceCaps( hdc, VERTSIZE ); |
| 142 | horzRes = GetDeviceCaps( hdc, HORZRES ); |
| 143 | vertRes = GetDeviceCaps( hdc, VERTRES ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 144 | switch(mode) |
| 145 | { |
Alexandre Julliard | 99bb9f9 | 2001-07-28 00:18:02 +0000 | [diff] [blame] | 146 | case MM_TEXT: |
| 147 | dc->wndExtX = 1; |
| 148 | dc->wndExtY = 1; |
| 149 | dc->vportExtX = 1; |
| 150 | dc->vportExtY = 1; |
| 151 | break; |
| 152 | case MM_LOMETRIC: |
| 153 | case MM_ISOTROPIC: |
| 154 | dc->wndExtX = horzSize; |
| 155 | dc->wndExtY = vertSize; |
| 156 | dc->vportExtX = horzRes / 10; |
| 157 | dc->vportExtY = vertRes / -10; |
| 158 | break; |
| 159 | case MM_HIMETRIC: |
| 160 | dc->wndExtX = horzSize * 10; |
| 161 | dc->wndExtY = vertSize * 10; |
| 162 | dc->vportExtX = horzRes / 10; |
| 163 | dc->vportExtY = vertRes / -10; |
| 164 | break; |
| 165 | case MM_LOENGLISH: |
| 166 | dc->wndExtX = horzSize; |
| 167 | dc->wndExtY = vertSize; |
| 168 | dc->vportExtX = 254L * horzRes / 1000; |
| 169 | dc->vportExtY = -254L * vertRes / 1000; |
| 170 | break; |
| 171 | case MM_HIENGLISH: |
| 172 | dc->wndExtX = horzSize * 10; |
| 173 | dc->wndExtY = vertSize * 10; |
| 174 | dc->vportExtX = 254L * horzRes / 1000; |
| 175 | dc->vportExtY = -254L * vertRes / 1000; |
| 176 | break; |
| 177 | case MM_TWIPS: |
| 178 | dc->wndExtX = 144L * horzSize / 10; |
| 179 | dc->wndExtY = 144L * vertSize / 10; |
| 180 | dc->vportExtX = 254L * horzRes / 1000; |
| 181 | dc->vportExtY = -254L * vertRes / 1000; |
| 182 | break; |
| 183 | case MM_ANISOTROPIC: |
| 184 | break; |
| 185 | default: |
| 186 | goto done; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 187 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 188 | dc->MapMode = mode; |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 189 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 190 | done: |
| 191 | GDI_ReleaseObj( hdc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 192 | return prevMode; |
| 193 | } |
| 194 | |
| 195 | |
| 196 | /*********************************************************************** |
| 197 | * SetViewportExt (GDI.14) |
| 198 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 199 | DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 200 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 201 | SIZE size; |
| 202 | if (!SetViewportExtEx( hdc, x, y, &size )) return 0; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 203 | return MAKELONG( size.cx, size.cy ); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 208 | * SetViewportExtEx (GDI.479) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 209 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 210 | BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 211 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 212 | SIZE size32; |
| 213 | BOOL16 ret = SetViewportExtEx( hdc, x, y, &size32 ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 214 | if (size) { size->cx = size32.cx; size->cy = size32.cy; } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 215 | return ret; |
| 216 | } |
| 217 | |
| 218 | |
| 219 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 220 | * SetViewportExtEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 221 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 222 | BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 223 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 224 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 225 | DC * dc = DC_GetDCPtr( hdc ); |
| 226 | if (!dc) return FALSE; |
| 227 | if (dc->funcs->pSetViewportExt) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 228 | { |
| 229 | ret = dc->funcs->pSetViewportExt( dc, x, y ); |
| 230 | goto done; |
| 231 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 232 | if (size) |
| 233 | { |
| 234 | size->cx = dc->vportExtX; |
| 235 | size->cy = dc->vportExtY; |
| 236 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 237 | if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 238 | goto done; |
| 239 | if (!x || !y) |
| 240 | { |
| 241 | ret = FALSE; |
| 242 | goto done; |
| 243 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 244 | dc->vportExtX = x; |
| 245 | dc->vportExtY = y; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 246 | if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 247 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 248 | done: |
| 249 | GDI_ReleaseObj( hdc ); |
| 250 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | |
| 254 | /*********************************************************************** |
| 255 | * SetViewportOrg (GDI.13) |
| 256 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 257 | DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 258 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 259 | POINT pt; |
| 260 | if (!SetViewportOrgEx( hdc, x, y, &pt )) return 0; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 261 | return MAKELONG( pt.x, pt.y ); |
| 262 | } |
| 263 | |
| 264 | |
| 265 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 266 | * SetViewportOrgEx (GDI.480) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 267 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 268 | BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 269 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 270 | POINT pt32; |
| 271 | BOOL16 ret = SetViewportOrgEx( hdc, x, y, &pt32 ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 272 | if (pt) CONV_POINT32TO16( &pt32, pt ); |
| 273 | return ret; |
| 274 | } |
| 275 | |
| 276 | |
| 277 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 278 | * SetViewportOrgEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 279 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 280 | BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 281 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 282 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 283 | DC * dc = DC_GetDCPtr( hdc ); |
| 284 | if (!dc) return FALSE; |
| 285 | if (dc->funcs->pSetViewportOrg) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 286 | ret = dc->funcs->pSetViewportOrg( dc, x, y ); |
| 287 | else |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 288 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 289 | if (pt) |
| 290 | { |
| 291 | pt->x = dc->vportOrgX; |
| 292 | pt->y = dc->vportOrgY; |
| 293 | } |
| 294 | dc->vportOrgX = x; |
| 295 | dc->vportOrgY = y; |
| 296 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 297 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 298 | GDI_ReleaseObj( hdc ); |
| 299 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | |
| 303 | /*********************************************************************** |
| 304 | * SetWindowExt (GDI.12) |
| 305 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 306 | DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 307 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 308 | SIZE size; |
| 309 | if (!SetWindowExtEx( hdc, x, y, &size )) return 0; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 310 | return MAKELONG( size.cx, size.cy ); |
| 311 | } |
| 312 | |
| 313 | |
| 314 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 315 | * SetWindowExtEx (GDI.481) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 316 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 317 | BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 318 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 319 | SIZE size32; |
| 320 | BOOL16 ret = SetWindowExtEx( hdc, x, y, &size32 ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 321 | if (size) { size->cx = size32.cx; size->cy = size32.cy; } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 322 | return ret; |
| 323 | } |
| 324 | |
| 325 | |
| 326 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 327 | * SetWindowExtEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 328 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 329 | BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 330 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 331 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 332 | DC * dc = DC_GetDCPtr( hdc ); |
| 333 | if (!dc) return FALSE; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 334 | if (dc->funcs->pSetWindowExt) |
| 335 | { |
| 336 | ret = dc->funcs->pSetWindowExt( dc, x, y ); |
| 337 | goto done; |
| 338 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 339 | if (size) |
| 340 | { |
| 341 | size->cx = dc->wndExtX; |
| 342 | size->cy = dc->wndExtY; |
| 343 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 344 | if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 345 | goto done; |
| 346 | if (!x || !y) |
| 347 | { |
| 348 | ret = FALSE; |
| 349 | goto done; |
| 350 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 351 | dc->wndExtX = x; |
| 352 | dc->wndExtY = y; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 353 | if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 354 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 355 | done: |
| 356 | GDI_ReleaseObj( hdc ); |
| 357 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | |
| 361 | /*********************************************************************** |
| 362 | * SetWindowOrg (GDI.11) |
| 363 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 364 | DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 365 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 366 | POINT pt; |
| 367 | if (!SetWindowOrgEx( hdc, x, y, &pt )) return 0; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 368 | return MAKELONG( pt.x, pt.y ); |
| 369 | } |
| 370 | |
| 371 | |
| 372 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 373 | * SetWindowOrgEx (GDI.482) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 374 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 375 | BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 376 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 377 | POINT pt32; |
| 378 | BOOL16 ret = SetWindowOrgEx( hdc, x, y, &pt32 ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 379 | if (pt) CONV_POINT32TO16( &pt32, pt ); |
| 380 | return ret; |
| 381 | } |
| 382 | |
| 383 | |
| 384 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 385 | * SetWindowOrgEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 386 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 387 | BOOL WINAPI SetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 388 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 389 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 390 | DC * dc = DC_GetDCPtr( hdc ); |
| 391 | if (!dc) return FALSE; |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 392 | if (dc->funcs->pSetWindowOrg) ret = dc->funcs->pSetWindowOrg( dc, x, y ); |
| 393 | else |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 394 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 395 | if (pt) |
| 396 | { |
| 397 | pt->x = dc->wndOrgX; |
| 398 | pt->y = dc->wndOrgY; |
| 399 | } |
| 400 | dc->wndOrgX = x; |
| 401 | dc->wndOrgY = y; |
| 402 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 403 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 404 | GDI_ReleaseObj( hdc ); |
| 405 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | |
| 409 | /*********************************************************************** |
| 410 | * OffsetViewportOrg (GDI.17) |
| 411 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 412 | DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 413 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 414 | POINT pt; |
| 415 | if (!OffsetViewportOrgEx( hdc, x, y, &pt )) return 0; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 416 | return MAKELONG( pt.x, pt.y ); |
| 417 | } |
| 418 | |
| 419 | |
| 420 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 421 | * OffsetViewportOrgEx (GDI.476) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 422 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 423 | BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 424 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 425 | POINT pt32; |
| 426 | BOOL16 ret = OffsetViewportOrgEx( hdc, x, y, &pt32 ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 427 | if (pt) CONV_POINT32TO16( &pt32, pt ); |
| 428 | return ret; |
| 429 | } |
| 430 | |
| 431 | |
| 432 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 433 | * OffsetViewportOrgEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 434 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 435 | BOOL WINAPI OffsetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 436 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 437 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 438 | DC * dc = DC_GetDCPtr( hdc ); |
| 439 | if (!dc) return FALSE; |
| 440 | if (dc->funcs->pOffsetViewportOrg) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 441 | ret = dc->funcs->pOffsetViewportOrg( dc, x, y ); |
| 442 | else |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 443 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 444 | if (pt) |
| 445 | { |
| 446 | pt->x = dc->vportOrgX; |
| 447 | pt->y = dc->vportOrgY; |
| 448 | } |
| 449 | dc->vportOrgX += x; |
| 450 | dc->vportOrgY += y; |
| 451 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 452 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 453 | GDI_ReleaseObj( hdc ); |
| 454 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | |
| 458 | /*********************************************************************** |
| 459 | * OffsetWindowOrg (GDI.15) |
| 460 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 461 | DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 462 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 463 | POINT pt; |
| 464 | if (!OffsetWindowOrgEx( hdc, x, y, &pt )) return 0; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 465 | return MAKELONG( pt.x, pt.y ); |
| 466 | } |
| 467 | |
| 468 | |
| 469 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 470 | * OffsetWindowOrgEx (GDI.477) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 471 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 472 | BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 473 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 474 | POINT pt32; |
| 475 | BOOL16 ret = OffsetWindowOrgEx( hdc, x, y, &pt32 ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 476 | if (pt) CONV_POINT32TO16( &pt32, pt ); |
| 477 | return ret; |
| 478 | } |
| 479 | |
| 480 | |
| 481 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 482 | * OffsetWindowOrgEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 483 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 484 | BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 485 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 486 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 487 | DC * dc = DC_GetDCPtr( hdc ); |
| 488 | if (!dc) return FALSE; |
| 489 | if (dc->funcs->pOffsetWindowOrg) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 490 | ret = dc->funcs->pOffsetWindowOrg( dc, x, y ); |
| 491 | else |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 492 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 493 | if (pt) |
| 494 | { |
| 495 | pt->x = dc->wndOrgX; |
| 496 | pt->y = dc->wndOrgY; |
| 497 | } |
| 498 | dc->wndOrgX += x; |
| 499 | dc->wndOrgY += y; |
| 500 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 501 | } |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 502 | GDI_ReleaseObj( hdc ); |
| 503 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | |
| 507 | /*********************************************************************** |
| 508 | * ScaleViewportExt (GDI.18) |
| 509 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 510 | DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 511 | INT16 yNum, INT16 yDenom ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 512 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 513 | SIZE size; |
| 514 | if (!ScaleViewportExtEx( hdc, xNum, xDenom, yNum, yDenom, &size )) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 515 | return FALSE; |
| 516 | return MAKELONG( size.cx, size.cy ); |
| 517 | } |
| 518 | |
| 519 | |
| 520 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 521 | * ScaleViewportExtEx (GDI.484) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 522 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 523 | BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom, |
| 524 | INT16 yNum, INT16 yDenom, LPSIZE16 size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 525 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 526 | SIZE size32; |
| 527 | BOOL16 ret = ScaleViewportExtEx( hdc, xNum, xDenom, yNum, yDenom, |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 528 | &size32 ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 529 | if (size) { size->cx = size32.cx; size->cy = size32.cy; } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 530 | return ret; |
| 531 | } |
| 532 | |
| 533 | |
| 534 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 535 | * ScaleViewportExtEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 536 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 537 | BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT xNum, INT xDenom, |
| 538 | INT yNum, INT yDenom, LPSIZE size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 539 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 540 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 541 | DC * dc = DC_GetDCPtr( hdc ); |
| 542 | if (!dc) return FALSE; |
| 543 | if (dc->funcs->pScaleViewportExt) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 544 | { |
| 545 | ret = dc->funcs->pScaleViewportExt( dc, xNum, xDenom, yNum, yDenom ); |
| 546 | goto done; |
| 547 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 548 | if (size) |
| 549 | { |
| 550 | size->cx = dc->vportExtX; |
| 551 | size->cy = dc->vportExtY; |
| 552 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 553 | if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 554 | goto done; |
| 555 | if (!xNum || !xDenom || !xNum || !yDenom) |
| 556 | { |
| 557 | ret = FALSE; |
| 558 | goto done; |
| 559 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 560 | dc->vportExtX = (dc->vportExtX * xNum) / xDenom; |
| 561 | dc->vportExtY = (dc->vportExtY * yNum) / yDenom; |
| 562 | if (dc->vportExtX == 0) dc->vportExtX = 1; |
| 563 | if (dc->vportExtY == 0) dc->vportExtY = 1; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 564 | if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 565 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 566 | done: |
| 567 | GDI_ReleaseObj( hdc ); |
| 568 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 569 | } |
| 570 | |
| 571 | |
| 572 | /*********************************************************************** |
| 573 | * ScaleWindowExt (GDI.16) |
| 574 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 575 | DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom, |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 576 | INT16 yNum, INT16 yDenom ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 577 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 578 | SIZE size; |
| 579 | if (!ScaleWindowExtEx( hdc, xNum, xDenom, yNum, yDenom, &size )) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 580 | return FALSE; |
| 581 | return MAKELONG( size.cx, size.cy ); |
| 582 | } |
| 583 | |
| 584 | |
| 585 | /*********************************************************************** |
Patrik Stridvall | 01d5e5b | 2001-07-02 19:59:40 +0000 | [diff] [blame] | 586 | * ScaleWindowExtEx (GDI.485) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 587 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 588 | BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom, |
| 589 | INT16 yNum, INT16 yDenom, LPSIZE16 size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 590 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 591 | SIZE size32; |
| 592 | BOOL16 ret = ScaleWindowExtEx( hdc, xNum, xDenom, yNum, yDenom, |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 593 | &size32 ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 594 | if (size) { size->cx = size32.cx; size->cy = size32.cy; } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 595 | return ret; |
| 596 | } |
| 597 | |
| 598 | |
| 599 | /*********************************************************************** |
Patrik Stridvall | d0a4177 | 2001-02-14 23:11:17 +0000 | [diff] [blame] | 600 | * ScaleWindowExtEx (GDI32.@) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 601 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 602 | BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT xNum, INT xDenom, |
| 603 | INT yNum, INT yDenom, LPSIZE size ) |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 604 | { |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 605 | BOOL ret = TRUE; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 606 | DC * dc = DC_GetDCPtr( hdc ); |
| 607 | if (!dc) return FALSE; |
| 608 | if (dc->funcs->pScaleWindowExt) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 609 | { |
| 610 | ret = dc->funcs->pScaleWindowExt( dc, xNum, xDenom, yNum, yDenom ); |
| 611 | goto done; |
| 612 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 613 | if (size) |
| 614 | { |
| 615 | size->cx = dc->wndExtX; |
| 616 | size->cy = dc->wndExtY; |
| 617 | } |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 618 | if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 619 | goto done; |
| 620 | if (!xNum || !xDenom || !xNum || !yDenom) |
| 621 | { |
| 622 | ret = FALSE; |
| 623 | goto done; |
| 624 | } |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 625 | dc->wndExtX = (dc->wndExtX * xNum) / xDenom; |
| 626 | dc->wndExtY = (dc->wndExtY * yNum) / yDenom; |
| 627 | if (dc->wndExtX == 0) dc->wndExtX = 1; |
| 628 | if (dc->wndExtY == 0) dc->wndExtY = 1; |
Alexandre Julliard | 2239abb | 2000-11-05 02:05:07 +0000 | [diff] [blame] | 629 | if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); |
Alexandre Julliard | dadf78f | 1998-05-17 17:13:43 +0000 | [diff] [blame] | 630 | DC_UpdateXforms( dc ); |
Alexandre Julliard | 2a2321b | 2000-08-19 21:38:55 +0000 | [diff] [blame] | 631 | done: |
| 632 | GDI_ReleaseObj( hdc ); |
| 633 | return ret; |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 634 | } |