Moved CreateBrushIndirect16 and CreateDIBPatternBrush16 to gdi16.c.
This commit is contained in:
parent
5cf56a3afe
commit
3b059b2a3e
|
@ -749,6 +749,23 @@ HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateBrushIndirect (GDI.50)
|
||||
*/
|
||||
HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
|
||||
{
|
||||
LOGBRUSH brush32;
|
||||
|
||||
if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
|
||||
return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
|
||||
|
||||
brush32.lbStyle = brush->lbStyle;
|
||||
brush32.lbColor = brush->lbColor;
|
||||
brush32.lbHatch = brush->lbHatch;
|
||||
return HBRUSH_16( CreateBrushIndirect(&brush32) );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateCompatibleBitmap (GDI.51)
|
||||
*/
|
||||
|
@ -1905,6 +1922,21 @@ HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bo
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateDIBPatternBrush (GDI.445)
|
||||
*/
|
||||
HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
|
||||
{
|
||||
BITMAPINFO *bmi;
|
||||
HBRUSH16 ret;
|
||||
|
||||
if (!(bmi = GlobalLock16( hbitmap ))) return 0;
|
||||
ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
|
||||
GlobalUnlock16( hbitmap );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* PolyPolygon (GDI.450)
|
||||
*/
|
||||
|
|
164
objects/brush.c
164
objects/brush.c
|
@ -79,93 +79,6 @@ static HGLOBAL16 dib_copy(BITMAPINFO *info, UINT coloruse)
|
|||
}
|
||||
|
||||
|
||||
|
||||
static BOOL create_brush_indirect(BRUSHOBJ *brushPtr, BOOL v16)
|
||||
{
|
||||
LOGBRUSH *brush = &brushPtr->logbrush;
|
||||
|
||||
switch (brush->lbStyle)
|
||||
{
|
||||
case BS_PATTERN8X8:
|
||||
brush->lbStyle = BS_PATTERN;
|
||||
case BS_PATTERN:
|
||||
brush->lbHatch = (LONG)BITMAP_CopyBitmap( (HBITMAP) brush->lbHatch );
|
||||
if (! brush->lbHatch)
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case BS_DIBPATTERNPT:
|
||||
brush->lbStyle = BS_DIBPATTERN;
|
||||
brush->lbHatch = (LONG)dib_copy( (BITMAPINFO *) brush->lbHatch,
|
||||
brush->lbColor);
|
||||
if (! brush->lbHatch)
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case BS_DIBPATTERN8X8:
|
||||
case BS_DIBPATTERN:
|
||||
{
|
||||
BITMAPINFO* bmi;
|
||||
HGLOBAL h = brush->lbHatch;
|
||||
|
||||
brush->lbStyle = BS_DIBPATTERN;
|
||||
if (v16)
|
||||
{
|
||||
if (!(bmi = (BITMAPINFO *)GlobalLock16( h )))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(bmi = (BITMAPINFO *)GlobalLock( h )))
|
||||
break;
|
||||
}
|
||||
|
||||
brush->lbHatch = dib_copy( bmi, brush->lbColor);
|
||||
|
||||
if (v16) GlobalUnlock16( h );
|
||||
else GlobalUnlock( h );
|
||||
|
||||
if (!brush->lbHatch)
|
||||
break;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
default:
|
||||
if( brush->lbStyle <= BS_MONOPATTERN)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateBrushIndirect (GDI.50)
|
||||
*/
|
||||
HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
|
||||
{
|
||||
BOOL success;
|
||||
BRUSHOBJ * brushPtr;
|
||||
HBRUSH hbrush;
|
||||
|
||||
if (!(brushPtr = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC, &hbrush, &brush_funcs )))
|
||||
return 0;
|
||||
brushPtr->logbrush.lbStyle = brush->lbStyle;
|
||||
brushPtr->logbrush.lbColor = brush->lbColor;
|
||||
brushPtr->logbrush.lbHatch = brush->lbHatch;
|
||||
success = create_brush_indirect(brushPtr, TRUE);
|
||||
if(!success)
|
||||
{
|
||||
GDI_FreeObject( hbrush, brushPtr );
|
||||
hbrush = 0;
|
||||
}
|
||||
else GDI_ReleaseObj( hbrush );
|
||||
TRACE("%04x\n", hbrush);
|
||||
return hbrush;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateBrushIndirect (GDI32.@)
|
||||
*
|
||||
|
@ -177,23 +90,57 @@ HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
|
|||
*/
|
||||
HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
|
||||
{
|
||||
BOOL success;
|
||||
BRUSHOBJ * brushPtr;
|
||||
BRUSHOBJ * ptr;
|
||||
HBRUSH hbrush;
|
||||
if (!(brushPtr = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC, &hbrush, &brush_funcs )))
|
||||
return 0;
|
||||
brushPtr->logbrush.lbStyle = brush->lbStyle;
|
||||
brushPtr->logbrush.lbColor = brush->lbColor;
|
||||
brushPtr->logbrush.lbHatch = brush->lbHatch;
|
||||
success = create_brush_indirect(brushPtr, FALSE);
|
||||
if(!success)
|
||||
|
||||
if (!(ptr = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC, &hbrush, &brush_funcs ))) return 0;
|
||||
ptr->logbrush.lbStyle = brush->lbStyle;
|
||||
ptr->logbrush.lbColor = brush->lbColor;
|
||||
ptr->logbrush.lbHatch = brush->lbHatch;
|
||||
|
||||
switch (ptr->logbrush.lbStyle)
|
||||
{
|
||||
GDI_FreeObject( hbrush, brushPtr );
|
||||
hbrush = 0;
|
||||
case BS_PATTERN8X8:
|
||||
ptr->logbrush.lbStyle = BS_PATTERN;
|
||||
/* fall through */
|
||||
case BS_PATTERN:
|
||||
ptr->logbrush.lbHatch = (LONG)BITMAP_CopyBitmap( (HBITMAP) ptr->logbrush.lbHatch );
|
||||
if (!ptr->logbrush.lbHatch) goto error;
|
||||
break;
|
||||
|
||||
case BS_DIBPATTERNPT:
|
||||
ptr->logbrush.lbStyle = BS_DIBPATTERN;
|
||||
ptr->logbrush.lbHatch = (LONG)dib_copy( (BITMAPINFO *) ptr->logbrush.lbHatch,
|
||||
ptr->logbrush.lbColor);
|
||||
if (!ptr->logbrush.lbHatch) goto error;
|
||||
break;
|
||||
|
||||
case BS_DIBPATTERN8X8:
|
||||
case BS_DIBPATTERN:
|
||||
{
|
||||
BITMAPINFO* bmi;
|
||||
HGLOBAL h = (HGLOBAL)ptr->logbrush.lbHatch;
|
||||
|
||||
ptr->logbrush.lbStyle = BS_DIBPATTERN;
|
||||
if (!(bmi = (BITMAPINFO *)GlobalLock( h ))) goto error;
|
||||
ptr->logbrush.lbHatch = dib_copy( bmi, ptr->logbrush.lbColor);
|
||||
GlobalUnlock( h );
|
||||
if (!ptr->logbrush.lbHatch) goto error;
|
||||
break;
|
||||
}
|
||||
else GDI_ReleaseObj( hbrush );
|
||||
|
||||
default:
|
||||
if(ptr->logbrush.lbStyle > BS_MONOPATTERN) goto error;
|
||||
break;
|
||||
}
|
||||
|
||||
GDI_ReleaseObj( hbrush );
|
||||
TRACE("%08x\n", hbrush);
|
||||
return hbrush;
|
||||
|
||||
error:
|
||||
GDI_FreeObject( hbrush, ptr );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,28 +169,11 @@ HBRUSH WINAPI CreatePatternBrush( HBITMAP hbitmap )
|
|||
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
|
||||
TRACE("%04x\n", hbitmap );
|
||||
|
||||
logbrush.lbHatch = hbitmap;
|
||||
logbrush.lbHatch = (ULONG_PTR)hbitmap;
|
||||
return CreateBrushIndirect( &logbrush );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateDIBPatternBrush (GDI.445)
|
||||
*/
|
||||
HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
|
||||
{
|
||||
LOGBRUSH16 logbrush;
|
||||
|
||||
TRACE("%04x\n", hbitmap );
|
||||
|
||||
logbrush.lbStyle = BS_DIBPATTERN;
|
||||
logbrush.lbColor = coloruse;
|
||||
logbrush.lbHatch = hbitmap;
|
||||
|
||||
return CreateBrushIndirect16( &logbrush );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CreateDIBPatternBrush (GDI32.@)
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue