Commit e4bb7972 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiExtCreatePen for ExtCreatePen.

parent 91621cec
......@@ -90,8 +90,6 @@ done:
BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
{
HGLOBAL hmem = 0;
pattern->info = NULL;
pattern->bits.free = NULL;
......@@ -117,20 +115,16 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
brush->lbColor = 0;
return copy_bitmap( pattern, (HBITMAP)brush->lbHatch );
case BS_DIBPATTERN:
hmem = (HGLOBAL)brush->lbHatch;
if (!(brush->lbHatch = (ULONG_PTR)GlobalLock( hmem ))) return FALSE;
/* fall through */
case BS_DIBPATTERNPT:
pattern->usage = brush->lbColor;
pattern->info = copy_packed_dib( (BITMAPINFO *)brush->lbHatch, pattern->usage );
if (hmem) GlobalUnlock( hmem );
if (!pattern->info) return FALSE;
pattern->bits.ptr = (char *)pattern->info + get_dib_info_size( pattern->info, pattern->usage );
brush->lbStyle = BS_DIBPATTERN;
brush->lbColor = 0;
return TRUE;
case BS_DIBPATTERN:
case BS_DIBPATTERN8X8:
case BS_MONOPATTERN:
case BS_INDEXED:
......
......@@ -399,6 +399,29 @@ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
}
/***********************************************************************
* ExtCreatePen (GDI32.@)
*/
HPEN WINAPI ExtCreatePen( DWORD style, DWORD width, const LOGBRUSH *brush, DWORD style_count,
const DWORD *style_bits )
{
ULONG brush_style = brush->lbStyle;
ULONG_PTR hatch = brush->lbHatch;
HPEN pen;
if (brush_style == BS_DIBPATTERN)
{
if (!(hatch = (ULONG_PTR)GlobalLock( (HGLOBAL)hatch ))) return 0;
brush_style = BS_DIBPATTERNPT;
}
pen = NtGdiExtCreatePen( style, width, brush_style, brush->lbColor, brush->lbHatch, hatch,
style_count, style_bits, /* FIXME */ 0, FALSE, NULL );
if (brush->lbStyle == BS_DIBPATTERN) GlobalUnlock( (HGLOBAL)brush->lbHatch );
return pen;
}
/***********************************************************************
* CreateBrushIndirect (GDI32.@)
*/
HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH *brush )
......
......@@ -93,12 +93,12 @@ HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush )
}
/***********************************************************************
* ExtCreatePen (GDI32.@)
* NtGdiExtCreatePen (win32u.@)
*/
HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
const LOGBRUSH * brush, DWORD style_count,
const DWORD *style_bits )
HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULONG color,
ULONG_PTR client_hatch, ULONG_PTR hatch, DWORD style_count,
const DWORD *style_bits, ULONG dib_size, BOOL old_style,
HBRUSH brush )
{
PENOBJ *penPtr = NULL;
HPEN hpen;
......@@ -110,7 +110,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
switch (style & PS_STYLE_MASK)
{
case PS_NULL:
return CreatePen( PS_NULL, 0, brush->lbColor );
return NtGdiCreatePen( PS_NULL, 0, color, NULL );
case PS_SOLID:
case PS_DASH:
......@@ -154,18 +154,20 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
if ((style & PS_TYPE_MASK) == PS_GEOMETRIC)
{
if (brush->lbStyle == BS_NULL) return CreatePen( PS_NULL, 0, 0 );
if (brush_style == BS_NULL) return NtGdiCreatePen( PS_NULL, 0, 0, NULL );
}
else
{
if (width != 1) goto invalid;
if (brush->lbStyle != BS_SOLID) goto invalid;
if (brush_style != BS_SOLID) goto invalid;
}
if (!(penPtr = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(PENOBJ,logpen.elpStyleEntry[style_count]))))
return 0;
logbrush = *brush;
logbrush.lbStyle = brush_style;
logbrush.lbColor = color;
logbrush.lbHatch = hatch;
if (!store_brush_pattern( &logbrush, &penPtr->pattern )) goto invalid;
if (logbrush.lbStyle == BS_DIBPATTERN) logbrush.lbStyle = BS_DIBPATTERNPT;
......@@ -173,7 +175,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
penPtr->logpen.elpWidth = abs((int)width);
penPtr->logpen.elpBrushStyle = logbrush.lbStyle;
penPtr->logpen.elpColor = logbrush.lbColor;
penPtr->logpen.elpHatch = brush->lbHatch;
penPtr->logpen.elpHatch = client_hatch;
penPtr->logpen.elpNumEntries = style_count;
memcpy(penPtr->logpen.elpStyleEntry, style_bits, style_count * sizeof(DWORD));
......
......@@ -646,8 +646,7 @@ static void test_brush_pens(void)
ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %x\n", elp->elpPenStyle );
ok( elp->elpBrushStyle == BS_DIBPATTERNPT, "wrong brush style %x\n", elp->elpBrushStyle );
ok( elp->elpColor == 0, "wrong color %x\n", elp->elpColor );
ok( elp->elpHatch == lb.lbHatch || broken(elp->elpHatch != lb.lbHatch), /* <= w2k */
"wrong hatch %lx/%lx\n", elp->elpHatch, lb.lbHatch );
ok( elp->elpHatch == lb.lbHatch, "wrong hatch %lx/%lx\n", elp->elpHatch, lb.lbHatch );
ok( elp->elpNumEntries == 0, "wrong entries %x\n", elp->elpNumEntries );
break;
......
......@@ -242,8 +242,10 @@ BOOL WINAPI NtGdiDeleteObjectApp( HGDIOBJ obj );
LONG WINAPI NtGdiDoPalette( HGDIOBJ handle, WORD start, WORD count, void *entries,
DWORD func, BOOL inbound );
INT WINAPI NtGdiEndPage( HDC hdc );
HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, const LOGBRUSH *brush,
DWORD style_count, const DWORD *style_bits );
HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULONG color,
ULONG_PTR client_hatch, ULONG_PTR hatch, DWORD style_count,
const DWORD *style_bits, ULONG dib_size, BOOL old_style,
HBRUSH brush );
HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA *data );
INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer );
INT WINAPI NtGdiExtSelectClipRgn( HDC hdc, HRGN region, INT mode );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment