mirror of
https://github.com/reactos/wine.git
synced 2024-12-04 09:53:54 +00:00
a69b88b2f2
Sun Mar 15 03:46:50 1998 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [*/*] Fixed some dprintf_ such that there is one and only one new line for each dprintf and that new line occurs at the end. Transformed some fprintfs into proper debug statements. Removed much redundancy from most of the debug statements. The redundancy appeared because now the component and function name is output automatically. Most debug statements also used to output the name of the function. All these changes prepared the source to switch completely to the new debugging interface. For more info, refer to ./documentation/debug-msg Sat Mar 14 19:45:23 1997 Andreas Mohr <100.30936@germany.net> * [misc/shell.c] [if1632/kernel.spec] Changed parameters of FUNC004() to fix a crash. Not sure if this fix is correct (doc wanted). * [windows/user.c] [if1632/user.spec] [include/user.h] Implemented UserSeeUserDo. * [msdos/int21.c] [include/msdos.h] Added "GET LIST OF LISTS" (INT 21/52h). Sat Mar 14 15:48:02 1998 Douglas Ridgway <ridgway@gmcl.com> * [include/windows.h] [relay32/gdi32.spec] [objects/enhmetafile.c] Beginnings of enhanced metafile support. Fri Mar 13 20:53:09 1998 John Richardson <jrichard@zko.dec.com> * [win32/console.c] Restart interrupted console writes. Fri Mar 13 18:59:24 1998 Matthew Becker <mbecker@glasscity.net> * [*/*.c] Updated documentation for API manpages. * [windows/dce.c] ReleaseDC16: Fixed cast. * [include/windows.h] [memory/virtual.c] VirtualQuery{Ex} should return DWORD instead of BOOL32. Fri Mar 13 13:03:06 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [README][documentation/status/] README updated, added lzexpand,version and multimedia status notes to new documentation/status directory. * [ole/*.c][if1632/typelib.spec] Added typelib stubs, several small additions and fixes. * [loader/pe_image.c] Fixed a small bug (fixup_imports got passed the wrong hModule in a remapcase). * [loader/signal.c][if1632/signal.c][misc/winsock_dns.c] [loader/module.c] Fixed some recursive debugger crashes (caused by invalid FS). * [misc/registry.c] Two bugs fixed. Fri Mar 13 04:55:01 1998 David Lee Lambert <lamber45@egr.msu.edu> * [include/winnt.h] [include/winnls.h] Moved LANG_xxx flags to winnls.h * [include/winnls.h] Added flags for GetDateFormat(); fixed validity of LOCALE_SYSTEM_DEFAULT. * [include/windows.h] Added GetTimeFormat() prototypes. * [ole/ole2nls.c] Implemented ASCII date- and time-functions, using an optimized common core; added stubs for Unicode versions; started work on a Unicode core. * [AUTHORS] Added my name. Mon Mar 9 20:10:15 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [relay32/comctl32.spec] [include/imagelist.h] [include/commctrl.h] [misc/imagelist.c] [misc/Makefile.in] First attempt at implementing ImageLists. Sun Mar 8 20:19:49 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [files/dos_fs.c] [configure.in] Try to get FileTimeToLocalFileTime,FileTimeToSystemTime and SystemTimeToFileTime right. Use timegm() where available. * [misc/lstr.c] Fix an off by one error in FormatMessage and handle the case when args = NULL (used by programs to get the length of the string). * [win32/console.c] Actual display a per-process Title string, better working attempt for WriteConsole32W and ReadConsole32W. Fri Mar 6 20:33:45 1998 Slaven Rezic <eserte@cs.tu-berlin.de> * [include/config.h.in][configure.in][multimedia/audio.c] [multimedia/dsound.c] Added check for FreeBSD sound system. Sun Mar 1 17:40:10 1998 Jason Schonberg <schon@mti.sgi.com> * [controls/edit.c] [include/ole.h] [include/shlobj.h] Removed final commas in enum types. Mon Feb 23 07:52:18 1998 Luiz Otavio L. Zorzella <zorzella@nr.conexware.com> * [multimedia/time.c] Workaround to avoid infinite recursion inside timeGetTime. * [multimedia/audio.c] WODM_GETNUMDEVS and WIDM_GETNUMDEVS only return 1 now if the SOUND_DEV can be opened, or if it's busy.
290 lines
8.4 KiB
C
290 lines
8.4 KiB
C
/*
|
|
* GDI brush objects
|
|
*
|
|
* Copyright 1993, 1994 Alexandre Julliard
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include "brush.h"
|
|
#include "bitmap.h"
|
|
#include "metafile.h"
|
|
#include "color.h"
|
|
#include "debug.h"
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateBrushIndirect16 (GDI.50)
|
|
*/
|
|
HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
|
|
{
|
|
BRUSHOBJ * brushPtr;
|
|
HBRUSH16 hbrush = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC );
|
|
if (!hbrush) return 0;
|
|
brushPtr = (BRUSHOBJ *) GDI_HEAP_LOCK( hbrush );
|
|
brushPtr->logbrush.lbStyle = brush->lbStyle;
|
|
brushPtr->logbrush.lbColor = brush->lbColor;
|
|
brushPtr->logbrush.lbHatch = brush->lbHatch;
|
|
GDI_HEAP_UNLOCK( hbrush );
|
|
return hbrush;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateBrushIndirect32 (GDI32.27)
|
|
*/
|
|
HBRUSH32 WINAPI CreateBrushIndirect32( const LOGBRUSH32 * brush )
|
|
{
|
|
BRUSHOBJ * brushPtr;
|
|
HBRUSH32 hbrush = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC );
|
|
if (!hbrush) return 0;
|
|
brushPtr = (BRUSHOBJ *) GDI_HEAP_LOCK( hbrush );
|
|
brushPtr->logbrush.lbStyle = brush->lbStyle;
|
|
brushPtr->logbrush.lbColor = brush->lbColor;
|
|
brushPtr->logbrush.lbHatch = brush->lbHatch;
|
|
GDI_HEAP_UNLOCK( hbrush );
|
|
return hbrush;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateHatchBrush16 (GDI.58)
|
|
*/
|
|
HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_HATCHED, color, style };
|
|
TRACE(gdi, "%d %06lx\n", style, color );
|
|
if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateHatchBrush32 (GDI32.48)
|
|
*/
|
|
HBRUSH32 WINAPI CreateHatchBrush32( INT32 style, COLORREF color )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_HATCHED, color, style };
|
|
TRACE(gdi, "%d %06lx\n", style, color );
|
|
if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreatePatternBrush16 (GDI.60)
|
|
*/
|
|
HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
|
|
{
|
|
return (HBRUSH16)CreatePatternBrush32( hbitmap );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreatePatternBrush32 (GDI32.54)
|
|
*/
|
|
HBRUSH32 WINAPI CreatePatternBrush32( HBITMAP32 hbitmap )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_PATTERN, 0, 0 };
|
|
BITMAPOBJ *bmp, *newbmp;
|
|
|
|
TRACE(gdi, "%04x\n", hbitmap );
|
|
|
|
/* Make a copy of the bitmap */
|
|
|
|
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
|
|
return 0;
|
|
logbrush.lbHatch = (INT32)CreateBitmapIndirect16( &bmp->bitmap );
|
|
newbmp = (BITMAPOBJ *) GDI_GetObjPtr( (HGDIOBJ32)logbrush.lbHatch,
|
|
BITMAP_MAGIC );
|
|
if (!newbmp)
|
|
{
|
|
GDI_HEAP_UNLOCK( hbitmap );
|
|
return 0;
|
|
}
|
|
TSXCopyArea( display, bmp->pixmap, newbmp->pixmap, BITMAP_GC(bmp),
|
|
0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, 0, 0 );
|
|
GDI_HEAP_UNLOCK( hbitmap );
|
|
GDI_HEAP_UNLOCK( logbrush.lbHatch );
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateDIBPatternBrush16 (GDI.445)
|
|
*/
|
|
HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_DIBPATTERN, coloruse, 0 };
|
|
BITMAPINFO *info, *newInfo;
|
|
INT32 size;
|
|
|
|
TRACE(gdi, "%04x\n", hbitmap );
|
|
|
|
/* Make a copy of the bitmap */
|
|
|
|
if (!(info = (BITMAPINFO *)GlobalLock16( hbitmap ))) return 0;
|
|
|
|
if (info->bmiHeader.biCompression)
|
|
size = info->bmiHeader.biSizeImage;
|
|
else
|
|
size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32
|
|
* 8 * info->bmiHeader.biHeight;
|
|
size += DIB_BitmapInfoSize( info, coloruse );
|
|
|
|
if (!(logbrush.lbHatch = (INT16)GlobalAlloc16( GMEM_MOVEABLE, size )))
|
|
{
|
|
GlobalUnlock16( hbitmap );
|
|
return 0;
|
|
}
|
|
newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch );
|
|
memcpy( newInfo, info, size );
|
|
GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch );
|
|
GlobalUnlock16( hbitmap );
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateDIBPatternBrush32 (GDI32.34)
|
|
*/
|
|
HBRUSH32 WINAPI CreateDIBPatternBrush32( HGLOBAL32 hbitmap, UINT32 coloruse )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_DIBPATTERN, coloruse, 0 };
|
|
BITMAPINFO *info, *newInfo;
|
|
INT32 size;
|
|
|
|
TRACE(gdi, "%04x\n", hbitmap );
|
|
|
|
/* Make a copy of the bitmap */
|
|
|
|
if (!(info = (BITMAPINFO *)GlobalLock32( hbitmap ))) return 0;
|
|
|
|
if (info->bmiHeader.biCompression)
|
|
size = info->bmiHeader.biSizeImage;
|
|
else
|
|
size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32
|
|
* 8 * info->bmiHeader.biHeight;
|
|
size += DIB_BitmapInfoSize( info, coloruse );
|
|
|
|
if (!(logbrush.lbHatch = (INT32)GlobalAlloc16( GMEM_MOVEABLE, size )))
|
|
{
|
|
GlobalUnlock16( hbitmap );
|
|
return 0;
|
|
}
|
|
newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch );
|
|
memcpy( newInfo, info, size );
|
|
GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch );
|
|
GlobalUnlock16( hbitmap );
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateSolidBrush (GDI.66)
|
|
*/
|
|
HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_SOLID, color, 0 };
|
|
TRACE(gdi, "%06lx\n", color );
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CreateSolidBrush32 (GDI32.64)
|
|
*/
|
|
HBRUSH32 WINAPI CreateSolidBrush32( COLORREF color )
|
|
{
|
|
LOGBRUSH32 logbrush = { BS_SOLID, color, 0 };
|
|
TRACE(gdi, "%06lx\n", color );
|
|
return CreateBrushIndirect32( &logbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetBrushOrg (GDI.148)
|
|
*/
|
|
DWORD WINAPI SetBrushOrg( HDC16 hdc, INT16 x, INT16 y )
|
|
{
|
|
DWORD retval;
|
|
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
|
|
if (!dc) return FALSE;
|
|
retval = dc->w.brushOrgX | (dc->w.brushOrgY << 16);
|
|
dc->w.brushOrgX = x;
|
|
dc->w.brushOrgY = y;
|
|
return retval;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetBrushOrgEx (GDI32.308)
|
|
*/
|
|
BOOL32 WINAPI SetBrushOrgEx( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 oldorg )
|
|
{
|
|
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
|
|
|
|
if (!dc) return FALSE;
|
|
if (oldorg)
|
|
{
|
|
oldorg->x = dc->w.brushOrgX;
|
|
oldorg->y = dc->w.brushOrgY;
|
|
}
|
|
dc->w.brushOrgX = x;
|
|
dc->w.brushOrgY = y;
|
|
return TRUE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* FixBrushOrgEx (GDI32.102)
|
|
* SDK says discontinued, but in Win95 GDI32 this is the same as SetBrushOrgEx
|
|
*/
|
|
BOOL32 WINAPI FixBrushOrgEx( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 oldorg )
|
|
{
|
|
return SetBrushOrgEx(hdc,x,y,oldorg);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BRUSH_DeleteObject
|
|
*/
|
|
BOOL32 BRUSH_DeleteObject( HBRUSH16 hbrush, BRUSHOBJ * brush )
|
|
{
|
|
switch(brush->logbrush.lbStyle)
|
|
{
|
|
case BS_PATTERN:
|
|
DeleteObject32( (HGDIOBJ32)brush->logbrush.lbHatch );
|
|
break;
|
|
case BS_DIBPATTERN:
|
|
GlobalFree16( (HGLOBAL16)brush->logbrush.lbHatch );
|
|
break;
|
|
}
|
|
return GDI_FreeObject( hbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BRUSH_GetObject16
|
|
*/
|
|
INT16 BRUSH_GetObject16( BRUSHOBJ * brush, INT16 count, LPSTR buffer )
|
|
{
|
|
LOGBRUSH16 logbrush;
|
|
|
|
logbrush.lbStyle = brush->logbrush.lbStyle;
|
|
logbrush.lbColor = brush->logbrush.lbColor;
|
|
logbrush.lbHatch = brush->logbrush.lbHatch;
|
|
if (count > sizeof(logbrush)) count = sizeof(logbrush);
|
|
memcpy( buffer, &logbrush, count );
|
|
return count;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BRUSH_GetObject32
|
|
*/
|
|
INT32 BRUSH_GetObject32( BRUSHOBJ * brush, INT32 count, LPSTR buffer )
|
|
{
|
|
if (count > sizeof(brush->logbrush)) count = sizeof(brush->logbrush);
|
|
memcpy( buffer, &brush->logbrush, count );
|
|
return count;
|
|
}
|