mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[WIN32K]
- There is currently no need to lock more than three objects at a time, this permits code simplification/speed - Keep the handles order in GDIOBJ_LockMultipleObjs Still unused... svn path=/branches/reactos-yarotows/; revision=46899
This commit is contained in:
parent
6a8d2ef675
commit
4ec4675b9e
1 changed files with 23 additions and 21 deletions
|
@ -1625,37 +1625,39 @@ GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process)
|
||||||
return MappedView;
|
return MappedView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locks multiple objects at a time */
|
/* Locks up to 3 objects at a time */
|
||||||
VOID
|
VOID
|
||||||
INTERNAL_CALL
|
INTERNAL_CALL
|
||||||
GDIOBJ_LockMultipleObjs(ULONG ulCount,
|
GDIOBJ_LockMultipleObjs(ULONG ulCount,
|
||||||
IN HGDIOBJ* ahObj,
|
IN HGDIOBJ* ahObj,
|
||||||
OUT PGDIOBJ* apObj)
|
OUT PGDIOBJ* apObj)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT iFirst = 0, iSecond = 0, iThird = 0;
|
||||||
HGDIOBJ hTmp ;
|
UINT i ;
|
||||||
BOOL unsorted = TRUE;
|
|
||||||
/* We bubble-sort them */
|
/* First is greatest */
|
||||||
while(unsorted)
|
for(i=1; i<ulCount; i++)
|
||||||
{
|
{
|
||||||
unsorted = FALSE ;
|
if((ULONG_PTR)ahObj[i] >= (ULONG_PTR)ahObj[iFirst])
|
||||||
for(i=0; i<ulCount - 1; i++)
|
|
||||||
{
|
{
|
||||||
/* The greatest the first */
|
iSecond = iFirst ;
|
||||||
if((ULONG_PTR)ahObj[i] < (ULONG_PTR)ahObj[i+1])
|
iFirst = i;
|
||||||
{
|
continue ;
|
||||||
hTmp = ahObj[i];
|
|
||||||
ahObj[i]=ahObj[i+1];
|
|
||||||
ahObj[i+1] = hTmp;
|
|
||||||
unsorted = TRUE ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if((ULONG_PTR)ahObj[i] >= (ULONG_PTR)ahObj[iSecond])
|
||||||
|
{
|
||||||
|
iSecond = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
iThird = i;
|
||||||
}
|
}
|
||||||
/* Then we lock them */
|
|
||||||
for(i=0; i<ulCount; i++)
|
/* We consider that at least two handles were passed */
|
||||||
{
|
apObj[iFirst] = GDIOBJ_LockObj(ahObj[iFirst], GDI_OBJECT_TYPE_DONTCARE);
|
||||||
apObj[i]=GDIOBJ_LockObj(ahObj[i], GDI_OBJECT_TYPE_DONTCARE);
|
apObj[iSecond] = GDIOBJ_LockObj(ahObj[iSecond], GDI_OBJECT_TYPE_DONTCARE);
|
||||||
}
|
if(ulCount == 3)
|
||||||
|
apObj[iThird] = GDIOBJ_LockObj(ahObj[iThird], GDI_OBJECT_TYPE_DONTCARE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue