2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * PURPOSE: Coordinate systems
24 * FILE: subsys/win32k/objects/coord.c
28 /* INCLUDES ******************************************************************/
35 /* FUNCTIONS *****************************************************************/
38 IntFixIsotropicMapping(PDC dc
)
42 PDC_ATTR Dc_Attr
= dc
->pDc_Attr
;
43 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
45 xdim
= EngMulDiv(Dc_Attr
->szlViewportExt
.cx
,
46 ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzSize
,
47 ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzRes
) /
48 Dc_Attr
->szlWindowExt
.cx
;
49 ydim
= EngMulDiv(Dc_Attr
->szlViewportExt
.cy
,
50 ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertSize
,
51 ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertRes
) /
52 Dc_Attr
->szlWindowExt
.cy
;
56 Dc_Attr
->szlViewportExt
.cx
= Dc_Attr
->szlViewportExt
.cx
* abs(ydim
/ xdim
);
57 if (!Dc_Attr
->szlViewportExt
.cx
) Dc_Attr
->szlViewportExt
.cx
= 1;
61 Dc_Attr
->szlViewportExt
.cy
= Dc_Attr
->szlViewportExt
.cy
* abs(xdim
/ ydim
);
62 if (!Dc_Attr
->szlViewportExt
.cy
) Dc_Attr
->szlViewportExt
.cy
= 1;
67 IntGdiCombineTransform(LPXFORM XFormResult
,
71 /* Check for illegal parameters */
72 if (!XFormResult
|| !xform1
|| !xform2
)
77 /* Create the result in a temporary XFORM, since xformResult may be
78 * equal to xform1 or xform2 */
79 XFormResult
->eM11
= xform1
->eM11
* xform2
->eM11
+ xform1
->eM12
* xform2
->eM21
;
80 XFormResult
->eM12
= xform1
->eM11
* xform2
->eM12
+ xform1
->eM12
* xform2
->eM22
;
81 XFormResult
->eM21
= xform1
->eM21
* xform2
->eM11
+ xform1
->eM22
* xform2
->eM21
;
82 XFormResult
->eM22
= xform1
->eM21
* xform2
->eM12
+ xform1
->eM22
* xform2
->eM22
;
83 XFormResult
->eDx
= xform1
->eDx
* xform2
->eM11
+ xform1
->eDy
* xform2
->eM21
+ xform2
->eDx
;
84 XFormResult
->eDy
= xform1
->eDx
* xform2
->eM12
+ xform1
->eDy
* xform2
->eM22
+ xform2
->eDy
;
89 BOOL STDCALL
NtGdiCombineTransform(LPXFORM UnsafeXFormResult
,
94 XFORM xform1
= {0}, xform2
= {0};
95 NTSTATUS Status
= STATUS_SUCCESS
;
100 ProbeForWrite(UnsafeXFormResult
,
103 ProbeForRead(Unsafexform1
,
106 ProbeForRead(Unsafexform2
,
109 xform1
= *Unsafexform1
;
110 xform2
= *Unsafexform2
;
114 Status
= _SEH_GetExceptionCode();
118 if(!NT_SUCCESS(Status
))
120 SetLastNtError(Status
);
124 Ret
= IntGdiCombineTransform(&xformTemp
, &xform1
, &xform2
);
126 /* Copy the result to xformResult */
129 /* pointer was already probed! */
130 *UnsafeXFormResult
= xformTemp
;
134 Status
= _SEH_GetExceptionCode();
138 if(!NT_SUCCESS(Status
))
140 SetLastNtError(Status
);
148 CoordDPtoLP(PDC Dc
, LPPOINT Point
)
153 Point
->x
= x
* Dc
->DcLevel
.xformVport2World
.eM11
+
154 y
* Dc
->DcLevel
.xformVport2World
.eM21
+ Dc
->DcLevel
.xformVport2World
.eDx
;
155 Point
->y
= x
* Dc
->DcLevel
.xformVport2World
.eM12
+
156 y
* Dc
->DcLevel
.xformVport2World
.eM22
+ Dc
->DcLevel
.xformVport2World
.eDy
;
161 IntDPtoLP ( PDC dc
, LPPOINT Points
, INT Count
)
167 for ( i
= 0; i
< Count
; i
++ )
168 CoordDPtoLP ( dc
, &Points
[i
] );
173 IntGetGraphicsMode ( PDC dc
)
177 Dc_Attr
= dc
->pDc_Attr
;
178 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
179 return Dc_Attr
->iGraphicsMode
;
184 IntGdiModifyWorldTransform(PDC pDc
,
185 CONST LPXFORM lpXForm
,
188 ASSERT(pDc
&& lpXForm
);
193 pDc
->DcLevel
.xformWorld2Wnd
.eM11
= 1.0f
;
194 pDc
->DcLevel
.xformWorld2Wnd
.eM12
= 0.0f
;
195 pDc
->DcLevel
.xformWorld2Wnd
.eM21
= 0.0f
;
196 pDc
->DcLevel
.xformWorld2Wnd
.eM22
= 1.0f
;
197 pDc
->DcLevel
.xformWorld2Wnd
.eDx
= 0.0f
;
198 pDc
->DcLevel
.xformWorld2Wnd
.eDy
= 0.0f
;
201 case MWT_LEFTMULTIPLY
:
202 IntGdiCombineTransform(&pDc
->DcLevel
.xformWorld2Wnd
, lpXForm
, &pDc
->DcLevel
.xformWorld2Wnd
);
205 case MWT_RIGHTMULTIPLY
:
206 IntGdiCombineTransform(&pDc
->DcLevel
.xformWorld2Wnd
, &pDc
->DcLevel
.xformWorld2Wnd
, lpXForm
);
209 case MWT_MAX
+1: // Must be MWT_SET????
210 pDc
->DcLevel
.xformWorld2Wnd
= *lpXForm
; // Do it like Wine.
214 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
217 DC_UpdateXforms(pDc
);
223 NtGdiGetTransform(HDC hDC
,
228 NTSTATUS Status
= STATUS_SUCCESS
;
230 dc
= DC_LockDc ( hDC
);
233 SetLastWin32Error(ERROR_INVALID_HANDLE
);
239 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
250 case GdiWorldSpaceToPageSpace
:
251 *XForm
= dc
->DcLevel
.xformWorld2Wnd
;
259 Status
= _SEH_GetExceptionCode();
264 return NT_SUCCESS(Status
);
269 CoordLPtoDP ( PDC Dc
, LPPOINT Point
)
278 Point
->x
= x
* Dc
->DcLevel
.xformWorld2Vport
.eM11
+
279 y
* Dc
->DcLevel
.xformWorld2Vport
.eM21
+ Dc
->DcLevel
.xformWorld2Vport
.eDx
;
280 Point
->y
= x
* Dc
->DcLevel
.xformWorld2Vport
.eM12
+
281 y
* Dc
->DcLevel
.xformWorld2Vport
.eM22
+ Dc
->DcLevel
.xformWorld2Vport
.eDy
;
286 IntLPtoDP ( PDC dc
, LPPOINT Points
, INT Count
)
292 for ( i
= 0; i
< Count
; i
++ )
293 CoordLPtoDP ( dc
, &Points
[i
] );
297 * Converts points from logical coordinates into device coordinates. Conversion depends on the mapping mode,
298 * world transfrom, viewport origin settings for the given device context.
299 * \param hDC device context.
300 * \param Points an array of POINT structures (in/out).
301 * \param Count number of elements in the array of POINT structures.
302 * \return TRUE if success.
306 NtGdiTransformPoints( HDC hDC
,
313 NTSTATUS Status
= STATUS_SUCCESS
;
320 SetLastWin32Error(ERROR_INVALID_HANDLE
);
324 if (!UnsafePtsIn
|| !UnsafePtOut
|| Count
<= 0)
327 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
331 Size
= Count
* sizeof(POINT
);
333 Points
= (LPPOINT
)ExAllocatePoolWithTag(PagedPool
, Size
, TAG_COORD
);
337 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY
);
343 ProbeForWrite(UnsafePtOut
,
346 ProbeForRead(UnsafePtsIn
,
349 RtlCopyMemory(Points
,
355 Status
= _SEH_GetExceptionCode();
359 if(!NT_SUCCESS(Status
))
363 SetLastNtError(Status
);
370 IntDPtoLP(dc
, Points
, Count
);
373 IntLPtoDP(dc
, Points
, Count
);
375 case 2: // Not supported yet. Need testing.
380 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
387 /* pointer was already probed! */
388 RtlCopyMemory(UnsafePtOut
,
394 Status
= _SEH_GetExceptionCode();
398 if(!NT_SUCCESS(Status
))
402 SetLastNtError(Status
);
406 // If we are getting called that means User XForms is a mess!
415 NtGdiModifyWorldTransform(HDC hDC
,
425 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
432 SetLastWin32Error(ERROR_INVALID_HANDLE
);
438 ProbeForRead(UnsafeXForm
, sizeof(XFORM
), 1);
439 RtlCopyMemory(&SafeXForm
, UnsafeXForm
, sizeof(XFORM
));
443 SetLastNtError(_SEH_GetExceptionCode());
447 // Safe to handle kernel mode data.
448 Ret
= IntGdiModifyWorldTransform(dc
, &SafeXForm
, Mode
);
455 NtGdiOffsetViewportOrgEx(HDC hDC
,
462 NTSTATUS Status
= STATUS_SUCCESS
;
464 dc
= DC_LockDc ( hDC
);
467 SetLastWin32Error(ERROR_INVALID_HANDLE
);
470 Dc_Attr
= dc
->pDc_Attr
;
471 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
477 ProbeForWrite(UnsafePoint
,
480 UnsafePoint
->x
= Dc_Attr
->ptlViewportOrg
.x
;
481 UnsafePoint
->y
= Dc_Attr
->ptlViewportOrg
.y
;
485 Status
= _SEH_GetExceptionCode();
489 if ( !NT_SUCCESS(Status
) )
491 SetLastNtError(Status
);
497 Dc_Attr
->ptlViewportOrg
.x
+= XOffset
;
498 Dc_Attr
->ptlViewportOrg
.y
+= YOffset
;
506 NtGdiOffsetWindowOrgEx(HDC hDC
,
517 SetLastWin32Error(ERROR_INVALID_HANDLE
);
520 Dc_Attr
= dc
->pDc_Attr
;
521 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
525 NTSTATUS Status
= STATUS_SUCCESS
;
532 Point
->x
= Dc_Attr
->ptlWindowOrg
.x
;
533 Point
->y
= Dc_Attr
->ptlWindowOrg
.y
;
537 Status
= _SEH_GetExceptionCode();
541 if(!NT_SUCCESS(Status
))
543 SetLastNtError(Status
);
549 Dc_Attr
->ptlWindowOrg
.x
+= XOffset
;
550 Dc_Attr
->ptlWindowOrg
.y
+= YOffset
;
560 NtGdiScaleViewportExtEx(HDC hDC
,
572 pDC
= DC_LockDc(hDC
);
575 SetLastWin32Error(ERROR_INVALID_HANDLE
);
578 pDc_Attr
= pDC
->pDc_Attr
;
579 if(!pDc_Attr
) pDc_Attr
= &pDC
->Dc_Attr
;
583 NTSTATUS Status
= STATUS_SUCCESS
;
591 pSize
->cx
= pDc_Attr
->szlViewportExt
.cx
;
592 pSize
->cy
= pDc_Attr
->szlViewportExt
.cy
;
596 Status
= _SEH_GetExceptionCode();
600 if(!NT_SUCCESS(Status
))
602 SetLastNtError(Status
);
608 if (pDc_Attr
->iMapMode
> MM_TWIPS
)
610 if ( ( Xdenom
) && ( Ydenom
) )
612 X
= Xnum
* pDc_Attr
->szlViewportExt
.cx
/ Xdenom
;
615 Y
= Ynum
* pDc_Attr
->szlViewportExt
.cy
/ Ydenom
;
618 pDc_Attr
->szlViewportExt
.cx
= X
;
619 pDc_Attr
->szlViewportExt
.cy
= Y
;
621 IntMirrorWindowOrg(pDC
);
623 pDc_Attr
->flXform
|= (PAGE_EXTENTS_CHANGED
|INVALIDATE_ATTRIBUTES
|DEVICE_TO_WORLD_INVALID
);
625 if (pDc_Attr
->iMapMode
== MM_ISOTROPIC
) IntFixIsotropicMapping(pDC
);
626 DC_UpdateXforms(pDC
);
642 NtGdiScaleWindowExtEx(HDC hDC
,
654 pDC
= DC_LockDc(hDC
);
657 SetLastWin32Error(ERROR_INVALID_HANDLE
);
660 pDc_Attr
= pDC
->pDc_Attr
;
661 if(!pDc_Attr
) pDc_Attr
= &pDC
->Dc_Attr
;
665 NTSTATUS Status
= STATUS_SUCCESS
;
673 X
= pDc_Attr
->szlWindowExt
.cx
;
674 if (pDc_Attr
->dwLayout
& LAYOUT_RTL
) X
= -X
;
676 pSize
->cy
= pDc_Attr
->szlWindowExt
.cy
;
680 Status
= _SEH_GetExceptionCode();
684 if(!NT_SUCCESS(Status
))
686 SetLastNtError(Status
);
692 if (pDc_Attr
->iMapMode
> MM_TWIPS
)
694 if (( Xdenom
) && ( Ydenom
))
696 X
= Xnum
* pDc_Attr
->szlWindowExt
.cx
/ Xdenom
;
699 Y
= Ynum
* pDc_Attr
->szlWindowExt
.cy
/ Ydenom
;
702 pDc_Attr
->szlWindowExt
.cx
= X
;
703 pDc_Attr
->szlWindowExt
.cy
= Y
;
705 IntMirrorWindowOrg(pDC
);
707 pDc_Attr
->flXform
|= (PAGE_EXTENTS_CHANGED
|INVALIDATE_ATTRIBUTES
|DEVICE_TO_WORLD_INVALID
);
709 if (pDc_Attr
->iMapMode
== MM_ISOTROPIC
) IntFixIsotropicMapping(pDC
);
710 DC_UpdateXforms(pDC
);
726 IntGdiSetMapMode(PDC dc
,
730 PDC_ATTR Dc_Attr
= dc
->pDc_Attr
;
731 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
733 PrevMapMode
= Dc_Attr
->iMapMode
;
735 if (MapMode
!= Dc_Attr
->iMapMode
|| (MapMode
!= MM_ISOTROPIC
&& MapMode
!= MM_ANISOTROPIC
))
737 Dc_Attr
->iMapMode
= MapMode
;
742 Dc_Attr
->szlWindowExt
.cx
= 1;
743 Dc_Attr
->szlWindowExt
.cy
= 1;
744 Dc_Attr
->szlViewportExt
.cx
= 1;
745 Dc_Attr
->szlViewportExt
.cy
= 1;
750 Dc_Attr
->szlWindowExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzSize
* 10;
751 Dc_Attr
->szlWindowExt
.cy
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertSize
* 10;
752 Dc_Attr
->szlViewportExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzRes
;
753 Dc_Attr
->szlViewportExt
.cy
= -((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertRes
;
757 Dc_Attr
->szlWindowExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzSize
* 100;
758 Dc_Attr
->szlWindowExt
.cy
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertSize
* 100;
759 Dc_Attr
->szlViewportExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzRes
;
760 Dc_Attr
->szlViewportExt
.cy
= -((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertRes
;
764 Dc_Attr
->szlWindowExt
.cx
= EngMulDiv(1000, ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzSize
, 254);
765 Dc_Attr
->szlWindowExt
.cy
= EngMulDiv(1000, ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertSize
, 254);
766 Dc_Attr
->szlViewportExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzRes
;
767 Dc_Attr
->szlViewportExt
.cy
= -((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertRes
;
771 Dc_Attr
->szlWindowExt
.cx
= EngMulDiv(10000, ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzSize
, 254);
772 Dc_Attr
->szlWindowExt
.cy
= EngMulDiv(10000, ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertSize
, 254);
773 Dc_Attr
->szlViewportExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzRes
;
774 Dc_Attr
->szlViewportExt
.cy
= -((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertRes
;
778 Dc_Attr
->szlWindowExt
.cx
= EngMulDiv(14400, ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzSize
, 254);
779 Dc_Attr
->szlWindowExt
.cy
= EngMulDiv(14400, ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertSize
, 254);
780 Dc_Attr
->szlViewportExt
.cx
= ((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulHorzRes
;
781 Dc_Attr
->szlViewportExt
.cy
= -((PGDIDEVICE
)dc
->pPDev
)->GDIInfo
.ulVertRes
;
796 NtGdiSetViewportExtEx(HDC hDC
,
807 SetLastWin32Error(ERROR_INVALID_HANDLE
);
810 Dc_Attr
= dc
->pDc_Attr
;
811 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
813 switch (Dc_Attr
->iMapMode
)
825 // Here we should (probably) check that SetWindowExtEx *really* has
832 NTSTATUS Status
= STATUS_SUCCESS
;
839 Size
->cx
= Dc_Attr
->szlViewportExt
.cx
;
840 Size
->cy
= Dc_Attr
->szlViewportExt
.cy
;
842 Dc_Attr
->szlViewportExt
.cx
= XExtent
;
843 Dc_Attr
->szlViewportExt
.cy
= YExtent
;
845 if (Dc_Attr
->iMapMode
== MM_ISOTROPIC
)
846 IntFixIsotropicMapping(dc
);
850 Status
= _SEH_GetExceptionCode();
854 if(!NT_SUCCESS(Status
))
856 SetLastNtError(Status
);
871 NtGdiSetViewportOrgEx(HDC hDC
,
882 SetLastWin32Error(ERROR_INVALID_HANDLE
);
885 Dc_Attr
= dc
->pDc_Attr
;
886 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
890 NTSTATUS Status
= STATUS_SUCCESS
;
897 Point
->x
= Dc_Attr
->ptlViewportOrg
.x
;
898 Point
->y
= Dc_Attr
->ptlViewportOrg
.y
;
902 Status
= _SEH_GetExceptionCode();
906 if(!NT_SUCCESS(Status
))
908 SetLastNtError(Status
);
914 Dc_Attr
->ptlViewportOrg
.x
= X
;
915 Dc_Attr
->ptlViewportOrg
.y
= Y
;
925 NtGdiSetWindowExtEx(HDC hDC
,
936 SetLastWin32Error(ERROR_INVALID_HANDLE
);
939 Dc_Attr
= dc
->pDc_Attr
;
940 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
942 switch (Dc_Attr
->iMapMode
)
956 NTSTATUS Status
= STATUS_SUCCESS
;
963 Size
->cx
= Dc_Attr
->szlWindowExt
.cx
;
964 Size
->cy
= Dc_Attr
->szlWindowExt
.cy
;
968 Status
= _SEH_GetExceptionCode();
972 if(!NT_SUCCESS(Status
))
974 SetLastNtError(Status
);
980 Dc_Attr
->szlWindowExt
.cx
= XExtent
;
981 Dc_Attr
->szlWindowExt
.cy
= YExtent
;
991 NtGdiSetWindowOrgEx(HDC hDC
,
1002 SetLastWin32Error(ERROR_INVALID_HANDLE
);
1005 Dc_Attr
= dc
->pDc_Attr
;
1006 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
1010 NTSTATUS Status
= STATUS_SUCCESS
;
1014 ProbeForWrite(Point
,
1017 Point
->x
= Dc_Attr
->ptlWindowOrg
.x
;
1018 Point
->y
= Dc_Attr
->ptlWindowOrg
.y
;
1022 Status
= _SEH_GetExceptionCode();
1026 if(!NT_SUCCESS(Status
))
1028 SetLastNtError(Status
);
1034 Dc_Attr
->ptlWindowOrg
.x
= X
;
1035 Dc_Attr
->ptlWindowOrg
.y
= Y
;
1037 DC_UpdateXforms(dc
);
1044 // Mirror Window function.
1048 IntMirrorWindowOrg(PDC dc
)
1053 Dc_Attr
= dc
->pDc_Attr
;
1054 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
1056 if (!(Dc_Attr
->dwLayout
& LAYOUT_RTL
))
1058 Dc_Attr
->ptlWindowOrg
.x
= Dc_Attr
->lWindowOrgx
; // Flip it back.
1061 if (!Dc_Attr
->szlViewportExt
.cx
) return;
1063 // WOrgx = wox - (Width - 1) * WExtx / VExtx
1065 X
= (dc
->erclWindow
.right
- dc
->erclWindow
.left
) - 1; // Get device width - 1
1067 X
= ( X
* Dc_Attr
->szlWindowExt
.cx
) / Dc_Attr
->szlViewportExt
.cx
;
1069 Dc_Attr
->ptlWindowOrg
.x
= Dc_Attr
->lWindowOrgx
- X
; // Now set the inverted win origion.
1076 // The default is left to right. This function changes it to right to left, which
1077 // is the standard in Arabic and Hebrew cultures.
1093 dc
= DC_LockDc(hdc
);
1096 SetLastWin32Error(ERROR_INVALID_HANDLE
);
1099 Dc_Attr
= dc
->pDc_Attr
;
1100 if(!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
1102 Dc_Attr
->dwLayout
= dwLayout
;
1103 oLayout
= Dc_Attr
->dwLayout
;
1105 if (!(dwLayout
& LAYOUT_ORIENTATIONMASK
))
1111 if (dwLayout
& LAYOUT_RTL
) Dc_Attr
->iMapMode
= MM_ANISOTROPIC
;
1113 Dc_Attr
->szlWindowExt
.cy
= -Dc_Attr
->szlWindowExt
.cy
;
1114 Dc_Attr
->ptlWindowOrg
.x
= -Dc_Attr
->ptlWindowOrg
.x
;
1117 IntMirrorWindowOrg(dc
);
1119 Dc_Attr
->ptlWindowOrg
.x
= wox
- Dc_Attr
->ptlWindowOrg
.x
;
1121 if (!(Dc_Attr
->flTextAlign
& TA_CENTER
)) Dc_Attr
->flTextAlign
|= TA_RIGHT
;
1123 if (dc
->DcLevel
.flPath
& DCPATH_CLOCKWISE
)
1124 dc
->DcLevel
.flPath
&= ~DCPATH_CLOCKWISE
;
1126 dc
->DcLevel
.flPath
|= DCPATH_CLOCKWISE
;
1128 Dc_Attr
->flXform
|= (PAGE_EXTENTS_CHANGED
|INVALIDATE_ATTRIBUTES
|DEVICE_TO_WORLD_INVALID
);
1130 // DC_UpdateXforms(dc);
1140 NtGdiGetDeviceWidth(
1145 dc
= DC_LockDc(hdc
);
1148 SetLastWin32Error(ERROR_INVALID_HANDLE
);
1151 Ret
= dc
->erclWindow
.right
- dc
->erclWindow
.left
;
1161 NtGdiMirrorWindowOrg(
1165 dc
= DC_LockDc(hdc
);
1168 SetLastWin32Error(ERROR_INVALID_HANDLE
);
1171 IntMirrorWindowOrg(dc
);
1183 IN INT cxVirtualDevice
,
1184 IN INT cyVirtualDevice
)
1189 if (!cxVirtualDevice
||
1190 !cyVirtualDevice
) return FALSE
;
1192 dc
= DC_LockDc(hdc
);
1193 if (!dc
) return FALSE
;
1195 pDc_Attr
= dc
->pDc_Attr
;
1196 if(!pDc_Attr
) pDc_Attr
= &dc
->Dc_Attr
;
1198 pDc_Attr
->szlVirtualDeviceSize
.cx
= cxVirtualDevice
;
1199 pDc_Attr
->szlVirtualDeviceSize
.cy
= cyVirtualDevice
;
1201 // DC_UpdateXforms(dc);
1212 NtGdiSetVirtualResolution(
1214 IN INT cxVirtualDevicePixel
,
1215 IN INT cyVirtualDevicePixel
,
1216 IN INT cxVirtualDeviceMm
,
1217 IN INT cyVirtualDeviceMm
)
1222 // Need test types for zeros and non zeros
1224 dc
= DC_LockDc(hdc
);
1225 if (!dc
) return FALSE
;
1227 pDc_Attr
= dc
->pDc_Attr
;
1228 if(!pDc_Attr
) pDc_Attr
= &dc
->Dc_Attr
;
1230 pDc_Attr
->szlVirtualDevicePixel
.cx
= cxVirtualDevicePixel
;
1231 pDc_Attr
->szlVirtualDevicePixel
.cy
= cyVirtualDevicePixel
;
1232 pDc_Attr
->szlVirtualDeviceMm
.cx
= cxVirtualDeviceMm
;
1233 pDc_Attr
->szlVirtualDeviceMm
.cy
= cyVirtualDeviceMm
;
1235 // DC_UpdateXforms(dc);