10 // Gdi Batch Flush support functions.
19 GdiFlushUserBatch(HDC hDC
, PGDIBATCHHDR pHdr
)
22 PDC_ATTR Dc_Attr
= NULL
;
28 Dc_Attr
= dc
->pDc_Attr
;
29 if (!Dc_Attr
) Dc_Attr
= &dc
->Dc_Attr
;
32 // The thread is approaching the end of sunset.
35 case GdiBCPatBlt
: // Highest pri first!
43 case GdiBCSetBrushOrg
:
45 PGDIBSSETBRHORG pgSBO
;
46 pgSBO
= (PGDIBSSETBRHORG
) pHdr
;
47 Dc_Attr
->ptlBrushOrigin
= pgSBO
->ptlBrushOrigin
;
50 case GdiBCExtSelClipRgn
:
56 pgO
= (PGDIBSOBJECT
) pHdr
;
57 if(NT_SUCCESS(TextIntRealizeFont((HFONT
) pgO
->hgdiobj
)))
58 Dc_Attr
->hlfntNew
= (HFONT
) pgO
->hgdiobj
;
63 PGDIBSOBJECT pgO
= (PGDIBSOBJECT
) pHdr
;
64 NtGdiDeleteObject( pgO
->hgdiobj
);
70 if (dc
) DC_UnlockDc(dc
);
71 return pHdr
->Size
; // Return the full size of the structure.
77 * Flushes the calling thread's current batch.
89 * Callback for thread batch flush routine.
95 NtGdiFlushUserBatch(VOID
)
97 PTEB pTeb
= NtCurrentTeb();
98 ULONG GdiBatchCount
= pTeb
->GdiBatchCount
;
100 if( (GdiBatchCount
> 0) && (GdiBatchCount
<= (GDIBATCHBUFSIZE
/4)))
102 HDC hDC
= (HDC
) pTeb
->GdiTebBatch
.HDC
;
104 // If hDC is zero and the buffer fills up with delete objects we need to run
105 // anyway. So, hard code to the system batch limit.
107 if ((hDC
) || ((!hDC
) && (GdiBatchCount
>= GDI_BATCH_LIMIT
)))
109 PULONG pHdr
= &pTeb
->GdiTebBatch
.Buffer
[0];
110 // No need to init anything, just go!
111 for (; GdiBatchCount
> 0; GdiBatchCount
--)
113 // Process Gdi Batch!
114 pHdr
+= GdiFlushUserBatch( hDC
, (PGDIBATCHHDR
) pHdr
);
116 // Exit and clear out for the next round.
117 pTeb
->GdiTebBatch
.Offset
= 0;
118 pTeb
->GdiBatchCount
= 0;
119 pTeb
->GdiTebBatch
.HDC
= 0;
122 return STATUS_SUCCESS
;