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