8 IntGdiSetBkColor(HDC hDC
, COLORREF color
)
15 if (!(dc
= DC_LockDc(hDC
)))
17 EngSetLastError(ERROR_INVALID_HANDLE
);
20 pdcattr
= dc
->pdcattr
;
21 oldColor
= pdcattr
->crBackgroundClr
;
22 pdcattr
->crBackgroundClr
= color
;
23 pdcattr
->ulBackgroundClr
= (ULONG
)color
;
24 pdcattr
->ulDirty_
&= ~(DIRTY_BACKGROUND
|DIRTY_LINE
|DIRTY_FILL
); // Clear Flag if set.
25 hBrush
= pdcattr
->hbrush
;
27 NtGdiSelectBrush(hDC
, hBrush
);
32 IntGdiSetBkMode(HDC hDC
, INT Mode
)
38 if (!(dc
= DC_LockDc(hDC
)))
40 EngSetLastError(ERROR_INVALID_HANDLE
);
43 pdcattr
= dc
->pdcattr
;
44 oldMode
= pdcattr
->lBkMode
;
45 pdcattr
->jBkMode
= Mode
;
46 pdcattr
->lBkMode
= Mode
;
53 IntGdiSetTextAlign(HDC hDC
,
63 EngSetLastError(ERROR_INVALID_HANDLE
);
66 pdcattr
= dc
->pdcattr
;
67 prevAlign
= pdcattr
->lTextAlign
;
68 pdcattr
->lTextAlign
= Mode
;
75 IntGdiSetTextColor(HDC hDC
,
85 EngSetLastError(ERROR_INVALID_HANDLE
);
88 pdcattr
= pdc
->pdcattr
;
90 // What about ulForegroundClr, like in gdi32?
91 crOldColor
= pdcattr
->crForegroundClr
;
92 pdcattr
->crForegroundClr
= color
;
93 DC_vUpdateTextBrush(pdc
);
102 DCU_SetDcUndeletable(HDC hDC
)
104 PDC dc
= DC_LockDc(hDC
);
107 EngSetLastError(ERROR_INVALID_HANDLE
);
111 dc
->fs
|= DC_FLAG_PERMANENT
;
118 IntIsPrimarySurface(SURFOBJ
*SurfObj
)
120 if (PrimarySurface
.pSurface
== NULL
)
124 return SurfObj
->hsurf
== PrimarySurface
.pSurface
; // <- FIXME: WTF?
130 IntSetDefaultRegion(PDC pdc
)
134 RECTL rclWnd
, rclClip
;
136 IntGdiReleaseRaoRgn(pdc
);
140 rclWnd
.right
= pdc
->dclevel
.sizl
.cx
;
141 rclWnd
.bottom
= pdc
->dclevel
.sizl
.cy
;
144 // EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
145 if (pdc
->ppdev
->flFlags
& PDEV_META_DEVICE
)
147 pSurface
= pdc
->dclevel
.pSurface
;
148 if (pSurface
&& pSurface
->flags
& PDEV_SURFACE
)
150 rclClip
.left
+= pdc
->ppdev
->ptlOrigion
.x
;
151 rclClip
.top
+= pdc
->ppdev
->ptlOrigion
.y
;
152 rclClip
.right
+= pdc
->ppdev
->ptlOrigion
.x
;
153 rclClip
.bottom
+= pdc
->ppdev
->ptlOrigion
.y
;
156 // EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
160 if (prgn
&& prgn
!= prgnDefault
)
162 REGION_SetRectRgn( prgn
,
170 prgn
= IntSysCreateRectpRgn( rclClip
.left
,
179 pdc
->ptlDCOrig
.x
= 0;
180 pdc
->ptlDCOrig
.y
= 0;
181 pdc
->erclWindow
= rclWnd
;
182 pdc
->erclClip
= rclClip
;
183 /* Might be an InitDC or DCE....*/
184 pdc
->ptlFillOrigin
.x
= pdc
->dcattr
.VisRectRegion
.Rect
.right
;
185 pdc
->ptlFillOrigin
.y
= pdc
->dcattr
.VisRectRegion
.Rect
.bottom
;
189 pdc
->prgnVis
= prgnDefault
;
195 NtGdiCancelDC(HDC hDC
)
203 IntGdiSetHookFlags(HDC hDC
, WORD Flags
)
206 DC
*dc
= DC_LockDc(hDC
);
210 EngSetLastError(ERROR_INVALID_HANDLE
);
214 wRet
= dc
->fs
& DC_FLAG_DIRTY_RAO
; // Fixme wrong flag!
216 /* "Undocumented Windows" info is slightly confusing.
219 DPRINT("DC %p, Flags %04x\n", hDC
, Flags
);
221 if (Flags
& DCHF_INVALIDATEVISRGN
)
223 /* hVisRgn has to be updated */
224 dc
->fs
|= DC_FLAG_DIRTY_RAO
;
226 else if (Flags
& DCHF_VALIDATEVISRGN
|| 0 == Flags
)
228 dc
->fs
&= ~DC_FLAG_DIRTY_RAO
;
248 DWORD SafeResult
= 0;
249 NTSTATUS Status
= STATUS_SUCCESS
;
253 EngSetLastError(ERROR_INVALID_PARAMETER
);
257 pdc
= DC_LockDc(hDC
);
260 EngSetLastError(ERROR_INVALID_HANDLE
);
263 pdcattr
= pdc
->pdcattr
;
271 SafeResult
= pdcattr
->lRelAbs
;
274 case GdiGetBreakExtra
:
275 SafeResult
= pdcattr
->lBreakExtra
;
278 case GdiGerCharBreak
:
279 SafeResult
= pdcattr
->cBreak
;
282 case GdiGetArcDirection
:
283 if (pdcattr
->dwLayout
& LAYOUT_RTL
)
284 SafeResult
= AD_CLOCKWISE
- ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0);
286 SafeResult
= ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0) + AD_COUNTERCLOCKWISE
;
289 case GdiGetEMFRestorDc
:
292 case GdiGetFontLanguageInfo
:
293 SafeResult
= IntGetFontLanguageInfo(pdc
);
297 SafeResult
= pdc
->dctype
;
301 SafeResult
= pdcattr
->iMapMode
;
304 case GdiGetTextCharExtra
:
305 SafeResult
= pdcattr
->lTextExtra
;
309 EngSetLastError(ERROR_INVALID_PARAMETER
);
318 ProbeForWrite(Result
, sizeof(DWORD
), 1);
319 *Result
= SafeResult
;
321 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
323 Status
= _SEH2_GetExceptionCode();
327 if (!NT_SUCCESS(Status
))
329 SetLastNtError(Status
);
340 NtGdiGetAndSetDCDword(
350 DWORD SafeResult
= 0;
351 NTSTATUS Status
= STATUS_SUCCESS
;
355 EngSetLastError(ERROR_INVALID_PARAMETER
);
359 pdc
= DC_LockDc(hDC
);
362 EngSetLastError(ERROR_INVALID_HANDLE
);
365 pdcattr
= pdc
->pdcattr
;
369 case GdiGetSetCopyCount
:
370 SafeResult
= pdc
->ulCopyCount
;
371 pdc
->ulCopyCount
= dwIn
;
374 case GdiGetSetTextAlign
:
375 SafeResult
= pdcattr
->lTextAlign
;
376 pdcattr
->lTextAlign
= dwIn
;
377 // pdcattr->flTextAlign = dwIn; // Flags!
380 case GdiGetSetRelAbs
:
381 SafeResult
= pdcattr
->lRelAbs
;
382 pdcattr
->lRelAbs
= dwIn
;
385 case GdiGetSetTextCharExtra
:
386 SafeResult
= pdcattr
->lTextExtra
;
387 pdcattr
->lTextExtra
= dwIn
;
390 case GdiGetSetSelectFont
:
393 case GdiGetSetMapperFlagsInternal
:
396 EngSetLastError(ERROR_INVALID_PARAMETER
);
400 SafeResult
= pdcattr
->flFontMapper
;
401 pdcattr
->flFontMapper
= dwIn
;
404 case GdiGetSetMapMode
:
405 SafeResult
= IntGdiSetMapMode(pdc
, dwIn
);
408 case GdiGetSetArcDirection
:
409 if (dwIn
!= AD_COUNTERCLOCKWISE
&& dwIn
!= AD_CLOCKWISE
)
411 EngSetLastError(ERROR_INVALID_PARAMETER
);
415 if (pdcattr
->dwLayout
& LAYOUT_RTL
) // Right to Left
417 SafeResult
= AD_CLOCKWISE
- ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0);
418 if (dwIn
== AD_CLOCKWISE
)
420 pdc
->dclevel
.flPath
&= ~DCPATH_CLOCKWISE
;
423 pdc
->dclevel
.flPath
|= DCPATH_CLOCKWISE
;
425 else // Left to Right
427 SafeResult
= ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0) +
429 if (dwIn
== AD_COUNTERCLOCKWISE
)
431 pdc
->dclevel
.flPath
&= ~DCPATH_CLOCKWISE
;
434 pdc
->dclevel
.flPath
|= DCPATH_CLOCKWISE
;
439 EngSetLastError(ERROR_INVALID_PARAMETER
);
448 ProbeForWrite(Result
, sizeof(DWORD
), 1);
449 *Result
= SafeResult
;
451 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
453 Status
= _SEH2_GetExceptionCode();
457 if (!NT_SUCCESS(Status
))
459 SetLastNtError(Status
);