Use GdiAllocBatchCommand in SetBrushOrgEx instead of manual and broken fiddling with GdiTebBatch. Fixes CID 716217.

svn path=/trunk/; revision=64040
This commit is contained in:
Timo Kreuzer 2014-09-05 20:16:52 +00:00
parent e5134bc5e0
commit a780f4c921
2 changed files with 17 additions and 24 deletions

View file

@ -323,7 +323,7 @@ GdiAllocBatchCommand(
else if (Cmd == GdiBCPolyPatBlt) cjSize = 0; else if (Cmd == GdiBCPolyPatBlt) cjSize = 0;
else if (Cmd == GdiBCTextOut) cjSize = 0; else if (Cmd == GdiBCTextOut) cjSize = 0;
else if (Cmd == GdiBCExtTextOut) cjSize = 0; else if (Cmd == GdiBCExtTextOut) cjSize = 0;
else if (Cmd == GdiBCSetBrushOrg) cjSize = 0; else if (Cmd == GdiBCSetBrushOrg) cjSize = sizeof(GDIBSSETBRHORG);
else if (Cmd == GdiBCExtSelClipRgn) cjSize = 0; else if (Cmd == GdiBCExtSelClipRgn) cjSize = 0;
else if (Cmd == GdiBCSelObj) cjSize = sizeof(GDIBSOBJECT); else if (Cmd == GdiBCSelObj) cjSize = sizeof(GDIBSOBJECT);
else if (Cmd == GdiBCDelRgn) cjSize = sizeof(GDIBSOBJECT); else if (Cmd == GdiBCDelRgn) cjSize = sizeof(GDIBSOBJECT);

View file

@ -393,44 +393,37 @@ SetBrushOrgEx(HDC hdc,
return FALSE; return FALSE;
} }
#endif #endif
if (GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) if (GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID)&Dc_Attr))
{ {
PTEB pTeb = NtCurrentTeb(); PGDIBSSETBRHORG pgSBO;
/* Does the caller want the current brush origin to be returned? */
if (lppt) if (lppt)
{ {
lppt->x = Dc_Attr->ptlBrushOrigin.x; lppt->x = Dc_Attr->ptlBrushOrigin.x;
lppt->y = Dc_Attr->ptlBrushOrigin.y; lppt->y = Dc_Attr->ptlBrushOrigin.y;
} }
if ((nXOrg == Dc_Attr->ptlBrushOrigin.x) && (nYOrg == Dc_Attr->ptlBrushOrigin.y))
/* Check if we have nothing to do */
if ((nXOrg == Dc_Attr->ptlBrushOrigin.x) &&
(nYOrg == Dc_Attr->ptlBrushOrigin.y))
return TRUE; return TRUE;
if(((pTeb->GdiTebBatch.HDC == NULL) || (pTeb->GdiTebBatch.HDC == hdc)) && /* Allocate a batch command buffer */
((pTeb->GdiTebBatch.Offset + sizeof(GDIBSSETBRHORG)) <= GDIBATCHBUFSIZE) && pgSBO = GdiAllocBatchCommand(hdc, GdiBCSetBrushOrg);
(!(Dc_Attr->ulDirty_ & DC_DIBSECTION)) ) if (pgSBO != NULL)
{ {
PGDIBSSETBRHORG pgSBO = (PGDIBSSETBRHORG)(&pTeb->GdiTebBatch.Buffer[0] + /* Set current brush origin in the DC attribute */
pTeb->GdiTebBatch.Offset);
Dc_Attr->ptlBrushOrigin.x = nXOrg; Dc_Attr->ptlBrushOrigin.x = nXOrg;
Dc_Attr->ptlBrushOrigin.y = nYOrg; Dc_Attr->ptlBrushOrigin.y = nYOrg;
pgSBO->gbHdr.Cmd = GdiBCSetBrushOrg; /* Setup the GDI batch command */
pgSBO->gbHdr.Size = sizeof(GDIBSSETBRHORG);
pgSBO->ptlBrushOrigin = Dc_Attr->ptlBrushOrigin; pgSBO->ptlBrushOrigin = Dc_Attr->ptlBrushOrigin;
pTeb->GdiTebBatch.Offset += sizeof(GDIBSSETBRHORG);
pTeb->GdiTebBatch.HDC = hdc;
pTeb->GdiBatchCount++;
DPRINT("Loading the Flush!! COUNT-> %lu\n", pTeb->GdiBatchCount);
if (pTeb->GdiBatchCount >= GDI_BatchLimit)
{
DPRINT("Call GdiFlush!!\n");
NtGdiFlush();
DPRINT("Exit GdiFlush!!\n");
}
return TRUE; return TRUE;
} }
} }
return NtGdiSetBrushOrg(hdc,nXOrg,nYOrg,lppt);
/* Fall back to the slower kernel path */
return NtGdiSetBrushOrg(hdc, nXOrg, nYOrg, lppt);
} }