Fix behavior if bmi null in NtGdiCreateDIBSection. Start internal functions for regions, includes a wine port get_region_type.

svn path=/trunk/; revision=33629
This commit is contained in:
James Tabor 2008-05-21 22:32:13 +00:00
parent 1136b9642b
commit f9814c9de4
3 changed files with 75 additions and 0 deletions

View file

@ -38,6 +38,9 @@ INT STDCALL IntGdiGetRgnBox(HRGN, LPRECT);
BOOL FASTCALL IntGdiPaintRgn(PDC, HRGN );
HRGN FASTCALL GdiCreatePolyPolygonRgn(CONST PPOINT, CONST PINT, INT, INT );
INT FASTCALL IntGdiCombineRgn(PROSRGNDATA, PROSRGNDATA, PROSRGNDATA, INT);
INT FASTCALL REGION_Complexity(PROSRGNDATA);
#define UnsafeIntCreateRectRgnIndirect(prc) \
NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)

View file

@ -994,6 +994,8 @@ HBITMAP STDCALL NtGdiCreateDIBSection(HDC hDC,
DC *dc;
BOOL bDesktopDC = FALSE;
if (!bmi) return hbitmap; // Make sure.
// If the reference hdc is null, take the desktop dc
if (hDC == 0)
{

View file

@ -483,6 +483,20 @@ IntDumpRegion(HRGN hRgn)
}
#endif /* not NDEBUG */
INT
FASTCALL
REGION_Complexity( PROSRGNDATA obj )
{
switch(obj->rdh.nCount)
{
DPRINT("Region Complexity -> %d",obj->rdh.nCount);
case 0: return NULLREGION;
case 1: return SIMPLEREGION;
default: return COMPLEXREGION;
}
}
static
BOOL
FASTCALL
@ -2065,6 +2079,62 @@ REGION_Cleanup(PVOID ObjectBody)
return TRUE;
}
INT
FASTCALL
IntGdiCombineRgn(PROSRGNDATA destRgn,
PROSRGNDATA src1Rgn,
PROSRGNDATA src2Rgn,
INT CombineMode)
{
INT result = ERROR;
if (destRgn)
{
if (src1Rgn)
{
if (CombineMode == RGN_COPY)
{
if ( !REGION_CopyRegion(destRgn, src1Rgn) )
return ERROR;
result = destRgn->rdh.iType;
}
else
{
if (src2Rgn)
{
switch (CombineMode)
{
case RGN_AND:
REGION_IntersectRegion(destRgn, src1Rgn, src2Rgn);
break;
case RGN_OR:
REGION_UnionRegion(destRgn, src1Rgn, src2Rgn);
break;
case RGN_XOR:
REGION_XorRegion(destRgn, src1Rgn, src2Rgn);
break;
case RGN_DIFF:
REGION_SubtractRegion(destRgn, src1Rgn, src2Rgn);
break;
}
result = destRgn->rdh.iType;
}
else if (src2Rgn == NULL)
{
DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine mode %d!\n", CombineMode);
}
}
}
}
else
{
DPRINT("IntGdiCombineRgn: hDest unavailable\n");
result = ERROR;
}
return result;
}
// NtGdi Exported Functions
INT
STDCALL