mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-16 05:07:36 +00:00
d30dfd24d6
Sun Sep 27 14:25:38 1998 Petter Reinholdtsen <pere@td.org.uit.no> * [files/drive.c] Make sure GetDriveType32A() handles param NULL. Added some doc on function. Sun Sep 27 14:07:26 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk> * [controls/edit.c] [windows/win.c] Don't call SetWindowLong() in EDIT_WM_NCREATE. Fix SetWindowLong(GWL_[EX]STYLE) to work for 16bit windows. Remove UpdateWindow() call. Sun Sep 27 13:41:22 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [scheduler/*.c] [server/event.c] [server/mutex.c] [server/semaphore.c] Implemented server-side synchronisation objects. Sun Sep 27 01:13:35 1998 Alex Priem <alexp@sci.kun.nl> * [dlls/comctl32/treeview.c] [include/treeview.h] [include/comctl.h] Treeview implementation. * [dlls/comctl32/trackbar.c] [include/trackbar.h] Trackbar implementation. Sat Sep 26 20:49:13 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [if1632/thunk.c] [tools/build.c] [win32/kernel32.c] Bugfix: several problems with flat thunks fixed. * [memory/selector.c] Bugfix: IsBad...Ptr16 didn't work for limit_in_pages segments. * [scheduler/thread.c] Bugfix: CreateThread: Allow id parameter == NULL. * [objects/gdiobj.c] Bugfix: IsGDIObject: Return correct object type for stock objects. * [msdos/dpmi.c] Bugfix: fixed typo in INT_DoRealModeInt. * [msdos/int21.c] Bugfix: int21 READ *must* use WIN16_hread, not _hread16. * [if1632/kernel.spec] [if1632/dummy.c] [if1632/thunk.c] [loader/ne/module.c] [scheduler/event.c] [scheduler/synchro.c] [scheduler/thread.c] [win32/kernel32.c] [win32/ordinals.c] Added names/stubs for all undocumented KERNEL routines (Win95). Added the following undoc. 16-bit equivalents to Win32 routines: KERNEL.441-443,449-453,456-462,471-476,479-486,488. Added stubs for some other KERNEL routines. * [memory/heap.c] [memory/global.c] [include/global.h] Implemented Local32... 32-bit local heap routines (KERNEL.208-215, 229). * [miscemu/instr.c] [loader/module.c] [include/module.h] Implemented __GP fault handling and HasGPHandler (KERNEL.338). * [misc/error.c] Implemented LogParamErrorRegs (KERNEL.327). * [loader/task.c] [include/windows.h] Implemented GetCodeInfo (KERNEL.104). * [loader/task.c] [scheduler/thread.c] [include/thread.h] Implemented [GS]etThreadQueue and [GS]etFastQueue (KERNEL.463/4, 624/5). * [if1632/gdi.spec] [objects/dc.c] [objects/dib.c] [objects/bitmap.c] [include/windows.h] Bugfix: fixed wrong parameter for CreateDIBSection16. Added [GS]etDIBColorTable16, stub for GetBoundsRect16. Partially implemented BITMAP_GetObject16 for DIBs. * [if1632/gdi.spec] [relay32/gdi32.spec] [objects/palette.c] Added some GDI stubs. * [if1632/Makefile.in] [if1632/display.spec] [if1632/mouse.spec] [if1632/keyboard.spec] [if1632/builtin.c] [windows/keyboard.c] Added some stubs for Win16 drivers: KEYBOARD, MOUSE, DISPLAY. * [if1632/wprocs.spec] [msdos/vxd.c] Added some stubs for VxDs: VMM, ConfigMG, TimerAPI. * [msdos/int2f.c] Added some stubs for real-mode network drivers. Sat Sep 26 18:18:18 1998 Marcus Meissner <marcus@jet.franken.de> * [configure.in] Merged in some more of the FreeBSD ports/emulators/wine patches. (Maintainer(s) of this port: You can just submit these patches to Alexandre directly.) * [loader/pe_image.c] Check filesize of image against size derived from header to spot truncated executeables without crashing. * [files/directory.c] Set envvar "COMSPEC". One win32(!!) program crashes without it. * [multimedia/mmio.c] Added mmioSetInfo32. * [include/file.h] Return STD_ERROR_HANDLE for AUX and PRT dos handles. * [loader/module.c] Handle executeables with spaces in their names a bit better in CreateProcess. * [relay32/msvfw32.spec][if1632/msvideo.spec][multimedia/msvideo.c][include/vfw.h] Started on MS Video support (can load Win32 ICMs). * [tools/testrun] A bit smarter use of ps. * [memory/virtual.c] Report PAGE_GUARDed pages as PAGE_PROTECTED (AutoCAD LT R17 fails without that check (since Win95 doesn't know about PAGE_GUARD)). Sat Sep 26 15:04:05 1998 Ove Kaaven <ovek@arcticnet.no> * [include/miscemu.h] [if1632/builtin.c] [loader/task.c] [miscemu/instr.c] [msdos/dpmi.c] [msdos/int21.c] [msdos/interrupts.c] [windows/user.c] INT_[S|G]etHandler was renamed to INT_[S|G]etPMHandler. Added handlers to deal with real-mode interrupts; DOS programs are now able to hook real-mode interrupts. * [loader/dos/module.c] [msdos/dosmem.c] [msdos/int21.c] Moved real-mode interrupt table initialization to msdos/dosmem.c, and made new V86 tasks get a full copy of the existing "system memory" instead of almost empty space. Misc fixes. * [include/dosexe.h] [loader/dos/module.c] [msdos/dpmi.c] [msdos/int2f.c] First shot at letting DOS programs start up DPMI (but DPMI is still disabled for DOS programs, for pkunzip's sake). * [include/debugger.h] [debugger/break.c] [debugger/dbg.y] [debugger/registers.c] [debugger/memory.c] [debugger/info.c] [loader/dos/dosvm.c] First shot at making Wine's debugger work for DOS programs. The -debug flag works, as do "nexti" and "stepi". Sat Sep 26 13:13:13 1998 Juergen Schmied <juergen.schmied@metronet.de> * [dlls/shell32/dataobject.c] New classes IEnumFORMATETC implemented, IDataObject stubs. * [dlls/shell32/*.*][relay32/shell32.spec] Bugfixes. New: ICM_InsertItem(), ILCreateFromPath(). Implemented: ILCloneFirst(). Stubs: ILIsEqual(), ILFindChild(), SHLogILFromFSIL(), PathMatchSpec(), PathIsExe(). Changed: ILGetSize(), _ILIsDesktop(), PathCombine(). * [include/shlobj.h] New SHLGUID's New structures: DVTARGETDEVICE32, STGMEDIUM32, FORMATETC32, CLIPFORMAT32. New interfaces: IEnumFORMATETC, IDataObject, ICommDlgBrowser IDockingWindowFrame, IServiceProvider. * [dlls/shell32/folders.c] Stubs for IShellLink. * [loader/resource.c] Small fixes. * [misc/crtdll.c][relay32/crtdll.spec] New __dllonexit(). * [windows/message.c] SendNotifyMessageA, SendMessageCallBack32A half implemented. * [controls/edit.c] EDIT_WM_SetText set EF_UPDATE flag not for ES_MULTILINE. * [files/file.c] Handling of fileposition fixed. Fri Sep 25 18:13:30 1998 Patrik Stridvall <ps@leissner.se> * [include/windows.h] [include/wintypes.h] [ole/ole2nls.h] [relay32/kernel32.spec] Implemented EnumDateFormats and EnumTimeFormats. Only adds US English support. * [Makefile.in] [configure.in] [dlls/Makefile.in] [dlls/psapi/Makefile.in] [dlls/psapi/psapi_main.c] New files to implement stubs for PSAPI.DLL (NT only). * [relay32/Makefile.in] [relay32/builtin32.c] [relay32/psapi.spec] New spec file for PSAPI.DLL (NT only). * [scheduler/handle.c] HANDLE_GetObjPtr should only interpret the pseudo handles as the current thread or the current process if a thread or a process is requested. * [include/winversion.h] [misc/version.c] Adds the global function VERSION_GetVersion() so functions can have different behavior depending on the -winver flag. * [include/oledlg.h] [ole/oledlg.c] Minor fixes. * [windows/winproc.c] Minor changes. * [include/imm.h] [misc/imm.c] Now returns correct values under both Windows 95 and NT 4.0. Thu Sep 24 22:11:44 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [configure.in] [include/acconfig.h] [include/thread.h] [scheduler/sysdeps.c] Autoconfig test for non-reentrant libc. Wed Sep 23 19:52:12 1998 Matthew Becker <mbecker@glasscity.net> * [*/*.c] Miscellaneous documentation updates and debugging output standardizations. * [objects/clipping.c] Added ExtSelectClipRgn. Wed Sep 23 00:03:28 EDT 1998 Pete Ratzlaff <pratzlaff@cfa.harvard.edu> * [include/windows.h] [if1632/user.spec] [relay32/user32.spec] [windows/keyboard.c] Added, marginally implemented, GetKeyboardLayoutName(). Only returns US English keyboard name. Tue Sep 22 16:32:41 1998 Marcel Baur <mbaur@iiic.ethz.ch> * [programs/control/*] New Winelib application. Mon Sep 21 00:29:18 1998 Peter Hunnisett <hunnise@nortel.ca> * [include/dplay.h][multimedia/dplay.c][ole/compobj.c] Added all DirectPlayLobby interfaces and enhanced DirectPlay and DirectPlayLobby support. Still not all that much. Useful enough if you just need to start a program, don't try any real dplay/lobby stuff. * [documentation/status/directplay] Added a very little bit. * [graphics/ddraw.c] - Call to SetWindowLong32A wasn't working because there was no memory set aside when the window class was registered. - Fixed some xlib reference counting and change the behaviour of DirectDrawSurface3_SetPalette to mimic observed behaviour (palette is associated will all backbuffers) - Also stored all palette colour fields and spit back our saved colour fields rather than query X for them. - Added plenty of AddRef and Release traces. - Added Xlib support for using -desktop option. - Fixed Xlib message handling. Messages weren't being passed to the application. Fixes mouse movements in some xlib DDraw games. - Added a few stubs. * [windows/win.c][include/winerror.h] Fixed up some error handling in WIN_SetWindowLong. SetLastError wasn't being used. Could cause problems with 0 return codes. Added new error in winerror (1400). * [AUTHORS] [include/authors.h] Added myself as a Wine author. Sun Sep 20 21:22:44 1998 Alexander Larsson <alla@lysator.liu.se> * [loader/module.c] Changed GetModuleFileName32A so that is returns the long version of the filename. Note that just the name is long, not the directories. Sat Sep 19 20:05:30 1998 Per Ångström <pang@mind.nu> * [controls/menu.c] Made a couple of fixes to make life easier for applications that alter their menus at runtime. * [windows/defdlg.c] Removed the cast of the return value from dialog procedures to a 16-bit bool. The return value needs to retain all its 32 bits, since it is not always a bool, such as when responding to the WM_NCHITTEST message. Fri Sep 18 11:30:38 1998 Sergey Turchanov <turchanov@usa.net> * [loader/resource.c] Fixed very funny bug (though gravely affecting further excecution) with FindResource[Ex]32 functions. * [include/multimon.h] [windows/multimon.c] [relay32/user32.spec] [include/windows.h] [windows/sysmetrics.c] Default implementation for Multimonitor API. * [include/windows.h] [windows/winpos.c] Fixed incorrect declaration (and behaviour) of GetWindowRect32. Wed Sep 16 10:21:15 1998 Gerard Patel <G.Patel@Wanadoo.fr> * [controls/edit.c] Fixed EDIT_EM_GetLine to use correctly length of lines. Tue Sep 15 20:40:16 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [misc/tweak.c][include/tweak.h][controls/menu.c] Replaced the tweak graphic routines by calls to DrawEdge32(). * [misc/tweak.c][include/tweak.h][documentation/win95look] [wine.ini][*/*] Changed "look and feel" selection. Allows Win3.1, Win95 and Win98 (no GUI code implemented) look and feel. * [dlls/comctl32/header.c][include/header.h][include/commctrl.h] Started callback item support and did some minor improvements. * [dlls/comctl32/imagelist.c] Fixed bug in transparent image display. ImageList_GetIcon is still buggy :-( * [dlls/comctl32/toolbar.c] Fixed button drawing (partial hack). * [dlls/comctl32/commctrl.c] Fixed MenuHelp(). * [controls/button.c] Added 3d effect for groupbox. * [windows/msgbox.c] Added font support for message boxes. * [windows/nonclient.c] Fixed window moving bug. * [dlls/comctl32/*.c] Various improvements. * [dlls/comctl32/listview.c][dlls/comctl32/rebar.c] [include/commctrl.h] More messages. * [windows/syscolor.c][include/windows.h] Introduced new Win98 system colors. Tue Sep 15 18:29:45 1998 Wesley Filardo <eightknots@aol.com> * [files/profile.c] Added support in PROFILE_LoadWineIni for -config option * [misc/main.c] [include/options.h] Added -config option. Tue Sep 15 18:22:26 1998 Petter Reinholdtsen <pere@td.org.uit.no> * [documentation/Makefile.in] Make sure directory exists before installing into it. Tue Sep 15 01:47:33 1998 Pablo Saratxaga <pablo.sarachaga@ping.be> * [ole/nls/*] [ole/ole2nls.c] [include/winnls.h] Fixed a few errors and completed some NLS files. Mon Sep 14 01:23:45 1998 Joseph Pranevich <knight@baltimore.wwaves.com> * [include/miscemu.h] [msdos/interrupts.c] Removed a compilation warning, added INT 25 to the list of interrupts callable from DOS applications, added a debug message when unsupported interrupts are used. Sun Sep 13 19:55:22 1998 Lawson Whitney <lawson_whitney@juno.com> * [if1632/relay.c] CallProcEx32W should not reverse arguments. Sun Aug 17 21:18:12 1998 Eric Pouech <eric.pouech@lemel.fr> * [multimedia/midi.c] [multimedia/init.c] [multimedia/mmsys.c] [include/multimedia.h] [include/mmsystem.h] [multimedia/Makefile.in] [multimedia/midipatch.c] [if1632/multimedia.spec] Made MIDI input and output functional on OSS capable systems. * [multimedia/timer.c] Changes to trigger callbacks at the accurate pace even when fake timers are used.
1141 lines
33 KiB
C
1141 lines
33 KiB
C
/*
|
|
* Misc. graphics operations
|
|
*
|
|
* Copyright 1993, 1994 Alexandre Julliard
|
|
* Copyright 1997 Bertho A. Stultiens
|
|
*/
|
|
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include "ts_xlib.h"
|
|
#include "ts_xutil.h"
|
|
#include <X11/Intrinsic.h>
|
|
#ifndef PI
|
|
#define PI M_PI
|
|
#endif
|
|
#include "gdi.h"
|
|
#include "dc.h"
|
|
#include "bitmap.h"
|
|
#include "callback.h"
|
|
#include "heap.h"
|
|
#include "metafile.h"
|
|
#include "palette.h"
|
|
#include "cache.h"
|
|
#include "color.h"
|
|
#include "region.h"
|
|
#include "path.h"
|
|
#include "debug.h"
|
|
|
|
/***********************************************************************
|
|
* LineTo16 (GDI.19)
|
|
*/
|
|
BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
|
|
{
|
|
return LineTo32( hdc, x, y );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* LineTo32 (GDI32.249)
|
|
*/
|
|
BOOL32 WINAPI LineTo32( HDC32 hdc, INT32 x, INT32 y )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if(dc && PATH_IsPathOpen(dc->w.path))
|
|
if(!PATH_LineTo(hdc, x, y))
|
|
return FALSE;
|
|
|
|
return dc && dc->funcs->pLineTo &&
|
|
dc->funcs->pLineTo(dc,x,y);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* MoveTo (GDI.20)
|
|
*/
|
|
DWORD WINAPI MoveTo( HDC16 hdc, INT16 x, INT16 y )
|
|
{
|
|
POINT16 pt;
|
|
|
|
if (!MoveToEx16(hdc,x,y,&pt))
|
|
return 0;
|
|
return MAKELONG(pt.x,pt.y);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* MoveToEx16 (GDI.483)
|
|
*/
|
|
BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
|
|
{
|
|
POINT32 pt32;
|
|
|
|
if (!MoveToEx32( (HDC32)hdc, (INT32)x, (INT32)y, &pt32 )) return FALSE;
|
|
if (pt) CONV_POINT32TO16( &pt32, pt );
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* MoveToEx32 (GDI32.254)
|
|
*/
|
|
BOOL32 WINAPI MoveToEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if(dc && PATH_IsPathOpen(dc->w.path))
|
|
if(!PATH_MoveTo(hdc))
|
|
return FALSE;
|
|
|
|
return dc && dc->funcs->pMoveToEx &&
|
|
dc->funcs->pMoveToEx(dc,x,y,pt);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Arc16 (GDI.23)
|
|
*/
|
|
BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
|
|
INT16 bottom, INT16 xstart, INT16 ystart,
|
|
INT16 xend, INT16 yend )
|
|
{
|
|
return Arc32( (HDC32)hdc, (INT32)left, (INT32)top, (INT32)right,
|
|
(INT32)bottom, (INT32)xstart, (INT32)ystart, (INT32)xend,
|
|
(INT32)yend );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Arc32 (GDI32.7)
|
|
*/
|
|
BOOL32 WINAPI Arc32( HDC32 hdc, INT32 left, INT32 top, INT32 right,
|
|
INT32 bottom, INT32 xstart, INT32 ystart,
|
|
INT32 xend, INT32 yend )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if(dc && PATH_IsPathOpen(dc->w.path))
|
|
if(!PATH_Arc(hdc, left, top, right, bottom, xstart, ystart, xend,
|
|
yend))
|
|
return FALSE;
|
|
|
|
return dc && dc->funcs->pArc &&
|
|
dc->funcs->pArc(dc,left,top,right,bottom,xstart,ystart,xend,yend);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Pie16 (GDI.26)
|
|
*/
|
|
BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
|
|
INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
|
|
INT16 xend, INT16 yend )
|
|
{
|
|
return Pie32( (HDC32)hdc, (INT32)left, (INT32)top, (INT32)right,
|
|
(INT32)bottom, (INT32)xstart, (INT32)ystart, (INT32)xend,
|
|
(INT32)yend );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Pie32 (GDI32.262)
|
|
*/
|
|
BOOL32 WINAPI Pie32( HDC32 hdc, INT32 left, INT32 top,
|
|
INT32 right, INT32 bottom, INT32 xstart, INT32 ystart,
|
|
INT32 xend, INT32 yend )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pPie &&
|
|
dc->funcs->pPie(dc,left,top,right,bottom,xstart,ystart,xend,yend);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Chord16 (GDI.348)
|
|
*/
|
|
BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
|
|
INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
|
|
INT16 xend, INT16 yend )
|
|
{
|
|
return Chord32( hdc, left, top, right, bottom, xstart, ystart, xend, yend );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Chord32 (GDI32.14)
|
|
*/
|
|
BOOL32 WINAPI Chord32( HDC32 hdc, INT32 left, INT32 top,
|
|
INT32 right, INT32 bottom, INT32 xstart, INT32 ystart,
|
|
INT32 xend, INT32 yend )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pChord &&
|
|
dc->funcs->pChord(dc,left,top,right,bottom,xstart,ystart,xend,yend);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Ellipse16 (GDI.24)
|
|
*/
|
|
BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
|
|
INT16 right, INT16 bottom )
|
|
{
|
|
return Ellipse32( hdc, left, top, right, bottom );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Ellipse32 (GDI32.75)
|
|
*/
|
|
BOOL32 WINAPI Ellipse32( HDC32 hdc, INT32 left, INT32 top,
|
|
INT32 right, INT32 bottom )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pEllipse &&
|
|
dc->funcs->pEllipse(dc,left,top,right,bottom);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Rectangle16 (GDI.27)
|
|
*/
|
|
BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
|
|
INT16 right, INT16 bottom )
|
|
{
|
|
return Rectangle32( hdc, left, top, right, bottom );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* Rectangle32 (GDI32.283)
|
|
*/
|
|
BOOL32 WINAPI Rectangle32( HDC32 hdc, INT32 left, INT32 top,
|
|
INT32 right, INT32 bottom )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if(dc && PATH_IsPathOpen(dc->w.path))
|
|
if(!PATH_Rectangle(hdc, left, top, right, bottom))
|
|
return FALSE;
|
|
|
|
return dc && dc->funcs->pRectangle &&
|
|
dc->funcs->pRectangle(dc,left,top,right,bottom);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RoundRect16 (GDI.28)
|
|
*/
|
|
BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
|
|
INT16 bottom, INT16 ell_width, INT16 ell_height )
|
|
{
|
|
return RoundRect32( hdc, left, top, right, bottom, ell_width, ell_height );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RoundRect32 (GDI32.291)
|
|
*/
|
|
BOOL32 WINAPI RoundRect32( HDC32 hdc, INT32 left, INT32 top, INT32 right,
|
|
INT32 bottom, INT32 ell_width, INT32 ell_height )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pRoundRect &&
|
|
dc->funcs->pRoundRect(dc,left,top,right,bottom,ell_width,ell_height);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FillRect16 (USER.81)
|
|
*/
|
|
INT16 WINAPI FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
|
|
{
|
|
HBRUSH16 prevBrush;
|
|
|
|
/* coordinates are logical so we cannot fast-check 'rect',
|
|
* it will be done later in the PatBlt().
|
|
*/
|
|
|
|
if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
|
|
PatBlt32( hdc, rect->left, rect->top,
|
|
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
|
|
SelectObject16( hdc, prevBrush );
|
|
return 1;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FillRect32 (USER32.197)
|
|
*/
|
|
INT32 WINAPI FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush )
|
|
{
|
|
HBRUSH32 prevBrush;
|
|
|
|
if (!(prevBrush = SelectObject32( hdc, hbrush ))) return 0;
|
|
PatBlt32( hdc, rect->left, rect->top,
|
|
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
|
|
SelectObject32( hdc, prevBrush );
|
|
return 1;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* InvertRect16 (USER.82)
|
|
*/
|
|
void WINAPI InvertRect16( HDC16 hdc, const RECT16 *rect )
|
|
{
|
|
PatBlt32( hdc, rect->left, rect->top,
|
|
rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* InvertRect32 (USER32.330)
|
|
*/
|
|
void WINAPI InvertRect32( HDC32 hdc, const RECT32 *rect )
|
|
{
|
|
PatBlt32( hdc, rect->left, rect->top,
|
|
rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FrameRect16 (USER.83)
|
|
*/
|
|
INT16 WINAPI FrameRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
|
|
{
|
|
HBRUSH16 prevBrush;
|
|
int left, top, right, bottom;
|
|
|
|
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
|
|
if (!dc) return FALSE;
|
|
|
|
left = XLPTODP( dc, rect->left );
|
|
top = YLPTODP( dc, rect->top );
|
|
right = XLPTODP( dc, rect->right );
|
|
bottom = YLPTODP( dc, rect->bottom );
|
|
|
|
if ( (right <= left) || (bottom <= top) ) return 0;
|
|
if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
|
|
|
|
if (DC_SetupGCForBrush( dc ))
|
|
{
|
|
PatBlt32( hdc, rect->left, rect->top, 1,
|
|
rect->bottom - rect->top, PATCOPY );
|
|
PatBlt32( hdc, rect->right - 1, rect->top, 1,
|
|
rect->bottom - rect->top, PATCOPY );
|
|
PatBlt32( hdc, rect->left, rect->top,
|
|
rect->right - rect->left, 1, PATCOPY );
|
|
PatBlt32( hdc, rect->left, rect->bottom - 1,
|
|
rect->right - rect->left, 1, PATCOPY );
|
|
}
|
|
SelectObject16( hdc, prevBrush );
|
|
return 1;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FrameRect32 (USER32.203)
|
|
*/
|
|
INT32 WINAPI FrameRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush )
|
|
{
|
|
RECT16 rect16;
|
|
CONV_RECT32TO16( rect, &rect16 );
|
|
return FrameRect16( (HDC16)hdc, &rect16, (HBRUSH16)hbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetPixel16 (GDI.31)
|
|
*/
|
|
COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
|
|
{
|
|
return SetPixel32( hdc, x, y, color );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetPixel32 (GDI32.327)
|
|
*/
|
|
COLORREF WINAPI SetPixel32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if (!dc || !dc->funcs->pSetPixel) return 0;
|
|
return dc->funcs->pSetPixel(dc,x,y,color);
|
|
}
|
|
|
|
/***********************************************************************
|
|
* SetPixelV32 (GDI32.329)
|
|
*/
|
|
BOOL32 WINAPI SetPixelV32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if (!dc || !dc->funcs->pSetPixel) return FALSE;
|
|
dc->funcs->pSetPixel(dc,x,y,color);
|
|
return TRUE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* GetPixel16 (GDI.83)
|
|
*/
|
|
COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
|
|
{
|
|
return GetPixel32( hdc, x, y );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetPixel32 (GDI32.211)
|
|
*/
|
|
COLORREF WINAPI GetPixel32( HDC32 hdc, INT32 x, INT32 y )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
if (!dc) return 0;
|
|
#ifdef SOLITAIRE_SPEED_HACK
|
|
return 0;
|
|
#endif
|
|
|
|
/* FIXME: should this be in the graphics driver? */
|
|
if (!PtVisible32( hdc, x, y )) return 0;
|
|
if (!dc || !dc->funcs->pGetPixel) return 0;
|
|
return dc->funcs->pGetPixel(dc,x,y);
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* ChoosePixelFormat [GDI32.13]
|
|
* Matches a pixel format to given format
|
|
*
|
|
* PARAMS
|
|
* hdc [I] Device context to search for best pixel match
|
|
* ppfd [I] Pixel format for which a match is sought
|
|
*
|
|
* RETURNS
|
|
* Success: Pixel format index closest to given format
|
|
* Failure: 0
|
|
*/
|
|
INT32 WINAPI ChoosePixelFormat( HDC32 hdc, PIXELFORMATDESCRIPTOR *ppfd )
|
|
{
|
|
FIXME(gdi, "(%d,%p): stub\n",hdc,ppfd);
|
|
ppfd->nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
|
ppfd->nVersion = 1;
|
|
return 1;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetPixelFormat [GDI32.328]
|
|
* Sets pixel format of device context
|
|
*
|
|
* PARAMS
|
|
* hdc [I] Device context to search for best pixel match
|
|
* iPixelFormat [I] Pixel format index
|
|
* ppfd [I] Pixel format for which a match is sought
|
|
*
|
|
* RETURNS STD
|
|
*/
|
|
BOOL32 WINAPI SetPixelFormat( HDC32 hdc, int iPixelFormat,
|
|
PIXELFORMATDESCRIPTOR * ppfd)
|
|
{
|
|
FIXME(gdi, "(%d,%d,%p): stub\n",hdc,iPixelFormat,ppfd);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* GetPixelFormat [GDI32.212]
|
|
* Gets index of pixel format of DC
|
|
*
|
|
* PARAMETERS
|
|
* hdc [I] Device context whose pixel format index is sought
|
|
*
|
|
* RETURNS
|
|
* Success: Currently selected pixel format
|
|
* Failure: 0
|
|
*/
|
|
int WINAPI GetPixelFormat( HDC32 hdc )
|
|
{
|
|
FIXME(gdi, "(%d): stub\n",hdc);
|
|
return 1;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* DescribePixelFormat [GDI32.71]
|
|
* Gets info about pixel format from DC
|
|
*
|
|
* PARAMS
|
|
* hdc [I] Device context
|
|
* iPixelFormat [I] Pixel format selector
|
|
* nBytes [I] Size of buffer
|
|
* ppfd [O] Pointer to structure to receive pixel format data
|
|
*
|
|
* RETURNS
|
|
* Success: Maximum pixel format index of the device context
|
|
* Failure: 0
|
|
*/
|
|
int WINAPI DescribePixelFormat( HDC32 hdc, int iPixelFormat, UINT32 nBytes,
|
|
LPPIXELFORMATDESCRIPTOR ppfd )
|
|
{
|
|
FIXME(gdi, "(%d,%d,%d,%p): stub\n",hdc,iPixelFormat,nBytes,ppfd);
|
|
ppfd->nSize = nBytes;
|
|
ppfd->nVersion = 1;
|
|
return 3;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SwapBuffers [GDI32.354]
|
|
* Exchanges front and back buffers of window
|
|
*
|
|
* PARAMS
|
|
* hdc [I] Device context whose buffers get swapped
|
|
*
|
|
* RETURNS STD
|
|
*/
|
|
BOOL32 WINAPI SwapBuffers( HDC32 hdc )
|
|
{
|
|
FIXME(gdi, "(%d): stub\n",hdc);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* PaintRgn16 (GDI.43)
|
|
*/
|
|
BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
|
|
{
|
|
return PaintRgn32( hdc, hrgn );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* PaintRgn32 (GDI32.259)
|
|
*/
|
|
BOOL32 WINAPI PaintRgn32( HDC32 hdc, HRGN32 hrgn )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pPaintRgn &&
|
|
dc->funcs->pPaintRgn(dc,hrgn);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FillRgn16 (GDI.40)
|
|
*/
|
|
BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
|
|
{
|
|
return FillRgn32( hdc, hrgn, hbrush );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FillRgn32 (GDI32.101)
|
|
*/
|
|
BOOL32 WINAPI FillRgn32( HDC32 hdc, HRGN32 hrgn, HBRUSH32 hbrush )
|
|
{
|
|
BOOL32 retval;
|
|
HBRUSH32 prevBrush = SelectObject32( hdc, hbrush );
|
|
if (!prevBrush) return FALSE;
|
|
retval = PaintRgn32( hdc, hrgn );
|
|
SelectObject32( hdc, prevBrush );
|
|
return retval;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FrameRgn16 (GDI.41)
|
|
*/
|
|
BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
|
|
INT16 nWidth, INT16 nHeight )
|
|
{
|
|
return FrameRgn32( hdc, hrgn, hbrush, nWidth, nHeight );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FrameRgn32 (GDI32.105)
|
|
*/
|
|
BOOL32 WINAPI FrameRgn32( HDC32 hdc, HRGN32 hrgn, HBRUSH32 hbrush,
|
|
INT32 nWidth, INT32 nHeight )
|
|
{
|
|
HRGN32 tmp = CreateRectRgn32( 0, 0, 0, 0 );
|
|
if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return FALSE;
|
|
FillRgn32( hdc, tmp, hbrush );
|
|
DeleteObject32( tmp );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* InvertRgn16 (GDI.42)
|
|
*/
|
|
BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
|
|
{
|
|
return InvertRgn32( hdc, hrgn );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* InvertRgn32 (GDI32.246)
|
|
*/
|
|
BOOL32 WINAPI InvertRgn32( HDC32 hdc, HRGN32 hrgn )
|
|
{
|
|
HBRUSH32 prevBrush = SelectObject32( hdc, GetStockObject32(BLACK_BRUSH) );
|
|
INT32 prevROP = SetROP232( hdc, R2_NOT );
|
|
BOOL32 retval = PaintRgn32( hdc, hrgn );
|
|
SelectObject32( hdc, prevBrush );
|
|
SetROP232( hdc, prevROP );
|
|
return retval;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* DrawFocusRect16 (USER.466)
|
|
*/
|
|
void WINAPI DrawFocusRect16( HDC16 hdc, const RECT16* rc )
|
|
{
|
|
RECT32 rect32;
|
|
CONV_RECT16TO32( rc, &rect32 );
|
|
DrawFocusRect32( hdc, &rect32 );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* DrawFocusRect32 (USER32.156)
|
|
*
|
|
* FIXME: PatBlt(PATINVERT) with background brush.
|
|
*/
|
|
void WINAPI DrawFocusRect32( HDC32 hdc, const RECT32* rc )
|
|
{
|
|
HPEN32 hOldPen, hnewPen;
|
|
INT32 oldDrawMode, oldBkMode;
|
|
INT32 left, top, right, bottom;
|
|
|
|
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
|
|
if (!dc) return;
|
|
|
|
left = XLPTODP( dc, rc->left );
|
|
top = YLPTODP( dc, rc->top );
|
|
right = XLPTODP( dc, rc->right );
|
|
bottom = YLPTODP( dc, rc->bottom );
|
|
|
|
if(left == right || top == bottom)
|
|
return;
|
|
|
|
hnewPen = CreatePen32(PS_DOT, 1, GetSysColor32(COLOR_WINDOWTEXT) );
|
|
hOldPen = SelectObject32( hdc, hnewPen );
|
|
oldDrawMode = SetROP232(hdc, R2_XORPEN);
|
|
oldBkMode = SetBkMode32(hdc, TRANSPARENT);
|
|
|
|
/* Hack: make sure the XORPEN operation has an effect */
|
|
dc->u.x.pen.pixel = (1 << screenDepth) - 1;
|
|
|
|
if (DC_SetupGCForPen( dc ))
|
|
TSXDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
|
|
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
|
|
right-left-1, bottom-top-1 );
|
|
|
|
SetBkMode32(hdc, oldBkMode);
|
|
SetROP232(hdc, oldDrawMode);
|
|
SelectObject32(hdc, hOldPen);
|
|
DeleteObject32(hnewPen);
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* Polyline16 (GDI.37)
|
|
*/
|
|
BOOL16 WINAPI Polyline16( HDC16 hdc, LPPOINT16 pt, INT16 count )
|
|
{
|
|
register int i;
|
|
BOOL16 ret;
|
|
LPPOINT32 pt32 = (LPPOINT32)HeapAlloc( GetProcessHeap(), 0,
|
|
count*sizeof(POINT32) );
|
|
|
|
if (!pt32) return FALSE;
|
|
for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
|
|
ret = Polyline32(hdc,pt32,count);
|
|
HeapFree( GetProcessHeap(), 0, pt32 );
|
|
return ret;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* Polyline32 (GDI32.276)
|
|
*/
|
|
BOOL32 WINAPI Polyline32( HDC32 hdc, const LPPOINT32 pt, INT32 count )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pPolyline &&
|
|
dc->funcs->pPolyline(dc,pt,count);
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* Polygon16 (GDI.36)
|
|
*/
|
|
BOOL16 WINAPI Polygon16( HDC16 hdc, LPPOINT16 pt, INT16 count )
|
|
{
|
|
register int i;
|
|
BOOL32 ret;
|
|
LPPOINT32 pt32 = (LPPOINT32)HeapAlloc( GetProcessHeap(), 0,
|
|
count*sizeof(POINT32) );
|
|
|
|
if (!pt32) return FALSE;
|
|
for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
|
|
ret = Polygon32(hdc,pt32,count);
|
|
HeapFree( GetProcessHeap(), 0, pt32 );
|
|
return ret;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* Polygon32 (GDI32.275)
|
|
*/
|
|
BOOL32 WINAPI Polygon32( HDC32 hdc, LPPOINT32 pt, INT32 count )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pPolygon &&
|
|
dc->funcs->pPolygon(dc,pt,count);
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* PolyPolygon16 (GDI.450)
|
|
*/
|
|
BOOL16 WINAPI PolyPolygon16( HDC16 hdc, LPPOINT16 pt, LPINT16 counts,
|
|
UINT16 polygons )
|
|
{
|
|
int i,nrpts;
|
|
LPPOINT32 pt32;
|
|
LPINT32 counts32;
|
|
BOOL16 ret;
|
|
|
|
nrpts=0;
|
|
for (i=polygons;i--;)
|
|
nrpts+=counts[i];
|
|
pt32 = (LPPOINT32)HEAP_xalloc( GetProcessHeap(), 0, sizeof(POINT32)*nrpts);
|
|
for (i=nrpts;i--;)
|
|
CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
|
|
counts32 = (LPINT32)HEAP_xalloc( GetProcessHeap(), 0,
|
|
polygons*sizeof(INT32) );
|
|
for (i=polygons;i--;) counts32[i]=counts[i];
|
|
|
|
ret = PolyPolygon32(hdc,pt32,counts32,polygons);
|
|
HeapFree( GetProcessHeap(), 0, counts32 );
|
|
HeapFree( GetProcessHeap(), 0, pt32 );
|
|
return ret;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* PolyPolygon32 (GDI.450)
|
|
*/
|
|
BOOL32 WINAPI PolyPolygon32( HDC32 hdc, LPPOINT32 pt, LPINT32 counts,
|
|
UINT32 polygons )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pPolyPolygon &&
|
|
dc->funcs->pPolyPolygon(dc,pt,counts,polygons);
|
|
}
|
|
|
|
/**********************************************************************
|
|
* PolyPolyline32 (GDI32.272)
|
|
*/
|
|
BOOL32 WINAPI PolyPolyline32( HDC32 hdc, LPPOINT32 pt, LPDWORD counts,
|
|
DWORD polylines )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pPolyPolyline &&
|
|
dc->funcs->pPolyPolyline(dc,pt,counts,polylines);
|
|
}
|
|
|
|
/**********************************************************************
|
|
* ExtFloodFill16 (GDI.372)
|
|
*/
|
|
BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
|
|
UINT16 fillType )
|
|
{
|
|
return ExtFloodFill32( hdc, x, y, color, fillType );
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* ExtFloodFill32 (GDI32.96)
|
|
*/
|
|
BOOL32 WINAPI ExtFloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color,
|
|
UINT32 fillType )
|
|
{
|
|
DC *dc = DC_GetDCPtr( hdc );
|
|
|
|
return dc && dc->funcs->pExtFloodFill &&
|
|
dc->funcs->pExtFloodFill(dc,x,y,color,fillType);
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* FloodFill16 (GDI.25)
|
|
*/
|
|
BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
|
|
{
|
|
return ExtFloodFill32( hdc, x, y, color, FLOODFILLBORDER );
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* FloodFill32 (GDI32.104)
|
|
*/
|
|
BOOL32 WINAPI FloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
|
|
{
|
|
return ExtFloodFill32( hdc, x, y, color, FLOODFILLBORDER );
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* DrawAnimatedRects32 (USER32.153)
|
|
*/
|
|
BOOL32 WINAPI DrawAnimatedRects32( HWND32 hwnd, int idAni,
|
|
const LPRECT32 lprcFrom,
|
|
const LPRECT32 lprcTo )
|
|
{
|
|
FIXME(gdi,"(0x%x,%d,%p,%p): stub\n",hwnd,idAni,lprcFrom,lprcTo);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* PAINTING_DrawStateJam
|
|
*
|
|
* Jams in the requested type in the dc
|
|
*/
|
|
static BOOL32 PAINTING_DrawStateJam(HDC32 hdc, UINT32 opcode,
|
|
DRAWSTATEPROC32 func, LPARAM lp, WPARAM32 wp,
|
|
LPRECT32 rc, UINT32 dtflags,
|
|
BOOL32 unicode, BOOL32 _32bit)
|
|
{
|
|
HDC32 memdc;
|
|
HBITMAP32 hbmsave;
|
|
BOOL32 retval;
|
|
INT32 cx = rc->right - rc->left;
|
|
INT32 cy = rc->bottom - rc->top;
|
|
|
|
switch(opcode)
|
|
{
|
|
case DST_TEXT:
|
|
case DST_PREFIXTEXT:
|
|
if(unicode)
|
|
return DrawText32W(hdc, (LPWSTR)lp, (INT32)wp, rc, dtflags);
|
|
else if(_32bit)
|
|
return DrawText32A(hdc, (LPSTR)lp, (INT32)wp, rc, dtflags);
|
|
else
|
|
return DrawText32A(hdc, (LPSTR)PTR_SEG_TO_LIN(lp), (INT32)wp, rc, dtflags);
|
|
|
|
case DST_ICON:
|
|
return DrawIcon32(hdc, rc->left, rc->top, (HICON32)lp);
|
|
|
|
case DST_BITMAP:
|
|
memdc = CreateCompatibleDC32(hdc);
|
|
if(!memdc) return FALSE;
|
|
hbmsave = (HBITMAP32)SelectObject32(memdc, (HBITMAP32)lp);
|
|
if(!hbmsave)
|
|
{
|
|
DeleteDC32(memdc);
|
|
return FALSE;
|
|
}
|
|
retval = BitBlt32(hdc, rc->left, rc->top, cx, cy, memdc, 0, 0, SRCCOPY);
|
|
SelectObject32(memdc, hbmsave);
|
|
DeleteDC32(memdc);
|
|
return retval;
|
|
|
|
case DST_COMPLEX:
|
|
if(func)
|
|
if(_32bit)
|
|
return func(hdc, lp, wp, cx, cy);
|
|
else
|
|
return (BOOL32)((DRAWSTATEPROC16)func)((HDC16)hdc, (LPARAM)lp, (WPARAM16)wp, (INT16)cx, (INT16)cy);
|
|
else
|
|
return FALSE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* PAINTING_DrawState32()
|
|
*/
|
|
static BOOL32 PAINTING_DrawState32(HDC32 hdc, HBRUSH32 hbr,
|
|
DRAWSTATEPROC32 func, LPARAM lp, WPARAM32 wp,
|
|
INT32 x, INT32 y, INT32 cx, INT32 cy,
|
|
UINT32 flags, BOOL32 unicode, BOOL32 _32bit)
|
|
{
|
|
HBITMAP32 hbm, hbmsave;
|
|
HFONT32 hfsave;
|
|
HBRUSH32 hbsave;
|
|
HDC32 memdc;
|
|
RECT32 rc;
|
|
UINT32 dtflags = DT_NOCLIP;
|
|
COLORREF fg, bg;
|
|
UINT32 opcode = flags & 0xf;
|
|
INT32 len = wp;
|
|
BOOL32 retval, tmp;
|
|
|
|
if((opcode == DST_TEXT || opcode == DST_PREFIXTEXT) && !len) /* The string is '\0' terminated */
|
|
{
|
|
if(unicode)
|
|
len = lstrlen32W((LPWSTR)lp);
|
|
else if(_32bit)
|
|
len = lstrlen32A((LPSTR)lp);
|
|
else
|
|
len = lstrlen32A((LPSTR)PTR_SEG_TO_LIN(lp));
|
|
}
|
|
|
|
/* Find out what size the image has if not given by caller */
|
|
if(!cx || !cy)
|
|
{
|
|
SIZE32 s;
|
|
CURSORICONINFO *ici;
|
|
BITMAPOBJ *bmp;
|
|
|
|
switch(opcode)
|
|
{
|
|
case DST_TEXT:
|
|
case DST_PREFIXTEXT:
|
|
if(unicode)
|
|
retval = GetTextExtentPoint32W(hdc, (LPWSTR)lp, len, &s);
|
|
else if(_32bit)
|
|
retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s);
|
|
else
|
|
retval = GetTextExtentPoint32A(hdc, PTR_SEG_TO_LIN(lp), len, &s);
|
|
if(!retval) return FALSE;
|
|
break;
|
|
|
|
case DST_ICON:
|
|
ici = (CURSORICONINFO *)GlobalLock16((HGLOBAL16)lp);
|
|
if(!ici) return FALSE;
|
|
s.cx = ici->nWidth;
|
|
s.cy = ici->nHeight;
|
|
GlobalUnlock16((HGLOBAL16)lp);
|
|
break;
|
|
|
|
case DST_BITMAP:
|
|
bmp = (BITMAPOBJ *)GDI_GetObjPtr((HBITMAP16)lp, BITMAP_MAGIC);
|
|
if(!bmp) return FALSE;
|
|
s.cx = bmp->bitmap.bmWidth;
|
|
s.cy = bmp->bitmap.bmHeight;
|
|
break;
|
|
|
|
case DST_COMPLEX: /* cx and cy must be set in this mode */
|
|
return FALSE;
|
|
}
|
|
|
|
if(!cx) cx = s.cx;
|
|
if(!cy) cy = s.cy;
|
|
}
|
|
|
|
rc.left = x;
|
|
rc.top = y;
|
|
rc.right = x + cx;
|
|
rc.bottom = y + cy;
|
|
|
|
if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */
|
|
dtflags |= DT_RIGHT;
|
|
if(opcode == DST_TEXT)
|
|
dtflags |= DT_NOPREFIX;
|
|
|
|
/* For DSS_NORMAL we just jam in the image and return */
|
|
if((flags & 0x7ff0) == DSS_NORMAL)
|
|
{
|
|
return PAINTING_DrawStateJam(hdc, opcode, func, lp, len, &rc, dtflags, unicode, _32bit);
|
|
}
|
|
|
|
/* For all other states we need to convert the image to B/W in a local bitmap */
|
|
/* before it is displayed */
|
|
fg = SetTextColor32(hdc, RGB(0, 0, 0));
|
|
bg = SetBkColor32(hdc, RGB(255, 255, 255));
|
|
hbm = (HBITMAP32)NULL; hbmsave = (HBITMAP32)NULL;
|
|
memdc = (HDC32)NULL; hbsave = (HBRUSH32)NULL;
|
|
retval = FALSE; /* assume failure */
|
|
|
|
/* From here on we must use "goto cleanup" when something goes wrong */
|
|
hbm = CreateBitmap32(cx, cy, 1, 1, NULL);
|
|
if(!hbm) goto cleanup;
|
|
memdc = CreateCompatibleDC32(hdc);
|
|
if(!memdc) goto cleanup;
|
|
hbmsave = (HBITMAP32)SelectObject32(memdc, hbm);
|
|
if(!hbmsave) goto cleanup;
|
|
rc.left = rc.top = 0;
|
|
rc.right = cx;
|
|
rc.bottom = cy;
|
|
if(!FillRect32(memdc, &rc, (HBRUSH32)GetStockObject32(WHITE_BRUSH))) goto cleanup;
|
|
SetBkColor32(memdc, RGB(255, 255, 255));
|
|
SetTextColor32(memdc, RGB(0, 0, 0));
|
|
hfsave = (HFONT32)SelectObject32(memdc, GetCurrentObject(hdc, OBJ_FONT));
|
|
if(!hfsave && (opcode == DST_TEXT || opcode == DST_PREFIXTEXT)) goto cleanup;
|
|
tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode, _32bit);
|
|
if(hfsave) SelectObject32(memdc, hfsave);
|
|
if(!tmp) goto cleanup;
|
|
|
|
/* These states cause the image to be dithered */
|
|
if(flags & (DSS_UNION|DSS_DISABLED))
|
|
{
|
|
hbsave = (HBRUSH32)SelectObject32(memdc, CACHE_GetPattern55AABrush());
|
|
if(!hbsave) goto cleanup;
|
|
tmp = PatBlt32(memdc, 0, 0, cx, cy, 0x00FA0089);
|
|
if(hbsave) SelectObject32(memdc, hbsave);
|
|
if(!tmp) goto cleanup;
|
|
}
|
|
|
|
hbsave = (HBRUSH32)SelectObject32(hdc, hbr ? hbr : GetStockObject32(WHITE_BRUSH));
|
|
if(!hbsave) goto cleanup;
|
|
|
|
if(!BitBlt32(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
|
|
|
|
/* DSS_DEFAULT makes the image boldface */
|
|
if(flags & DSS_DEFAULT)
|
|
{
|
|
if(!BitBlt32(hdc, x+1, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
|
|
}
|
|
|
|
retval = TRUE; /* We succeeded */
|
|
|
|
cleanup:
|
|
SetTextColor32(hdc, fg);
|
|
SetBkColor32(hdc, bg);
|
|
|
|
if(hbsave) SelectObject32(hdc, hbsave);
|
|
if(hbmsave) SelectObject32(memdc, hbmsave);
|
|
if(hbm) DeleteObject32(hbm);
|
|
if(memdc) DeleteDC32(memdc);
|
|
|
|
return retval;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* DrawState32A() (USER32.162)
|
|
*/
|
|
BOOL32 WINAPI DrawState32A(HDC32 hdc, HBRUSH32 hbr,
|
|
DRAWSTATEPROC32 func, LPARAM ldata, WPARAM32 wdata,
|
|
INT32 x, INT32 y, INT32 cx, INT32 cy, UINT32 flags)
|
|
{
|
|
return PAINTING_DrawState32(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, FALSE, TRUE);
|
|
}
|
|
|
|
/**********************************************************************
|
|
* DrawState32W() (USER32.163)
|
|
*/
|
|
BOOL32 WINAPI DrawState32W(HDC32 hdc, HBRUSH32 hbr,
|
|
DRAWSTATEPROC32 func, LPARAM ldata, WPARAM32 wdata,
|
|
INT32 x, INT32 y, INT32 cx, INT32 cy, UINT32 flags)
|
|
{
|
|
return PAINTING_DrawState32(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, TRUE, TRUE);
|
|
}
|
|
|
|
/**********************************************************************
|
|
* DrawState16() (USER.449)
|
|
*/
|
|
BOOL16 WINAPI DrawState16(HDC16 hdc, HBRUSH16 hbr,
|
|
DRAWSTATEPROC16 func, LPARAM ldata, WPARAM16 wdata,
|
|
INT16 x, INT16 y, INT16 cx, INT16 cy, UINT16 flags)
|
|
{
|
|
return PAINTING_DrawState32(hdc, hbr, (DRAWSTATEPROC32)func, ldata, wdata, x, y, cx, cy, flags, FALSE, FALSE);
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* PolyBezier16 [GDI.502]
|
|
*/
|
|
BOOL16 WINAPI PolyBezier16( HDC16 hDc, LPPOINT16 lppt, INT16 cPoints )
|
|
{
|
|
int i;
|
|
BOOL16 ret;
|
|
LPPOINT32 pt32 = (LPPOINT32)HeapAlloc( GetProcessHeap(), 0,
|
|
cPoints*sizeof(POINT32) );
|
|
if(!pt32) return FALSE;
|
|
for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
|
|
ret= PolyBezier32(hDc, pt32, cPoints);
|
|
HeapFree( GetProcessHeap(), 0, pt32 );
|
|
return ret;
|
|
}
|
|
|
|
/******************************************************************************
|
|
* PolyBezierTo16 [GDI.503]
|
|
*/
|
|
BOOL16 WINAPI PolyBezierTo16( HDC16 hDc, LPPOINT16 lppt, INT16 cPoints )
|
|
{
|
|
int i;
|
|
BOOL16 ret;
|
|
LPPOINT32 pt32 = (LPPOINT32)HeapAlloc( GetProcessHeap(), 0,
|
|
cPoints*sizeof(POINT32) );
|
|
if(!pt32) return FALSE;
|
|
for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
|
|
ret= PolyBezierTo32(hDc, pt32, cPoints);
|
|
HeapFree( GetProcessHeap(), 0, pt32 );
|
|
return ret;
|
|
}
|
|
|
|
/******************************************************************************
|
|
* PolyBezier32 [GDI32.268]
|
|
* Draws one or more Bezier curves
|
|
*
|
|
* PARAMS
|
|
* hDc [I] Handle to device context
|
|
* lppt [I] Pointer to endpoints and control points
|
|
* cPoints [I] Count of endpoints and control points
|
|
*
|
|
* RETURNS STD
|
|
*/
|
|
BOOL32 WINAPI PolyBezier32( HDC32 hdc, LPPOINT32 lppt, DWORD cPoints )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
if(!dc) return FALSE;
|
|
if(dc && PATH_IsPathOpen(dc->w.path))
|
|
FIXME(gdi, "PATH_PolyBezier is not implemented!\n");
|
|
/* if(!PATH_PolyBezier(hdc, x, y))
|
|
return FALSE; */
|
|
return dc->funcs->pPolyBezier&&
|
|
dc->funcs->pPolyBezier(dc, lppt[0], lppt+1, cPoints-1);
|
|
}
|
|
|
|
/******************************************************************************
|
|
* PolyBezierTo32 [GDI32.269]
|
|
* Draws one or more Bezier curves
|
|
*
|
|
* PARAMS
|
|
* hDc [I] Handle to device context
|
|
* lppt [I] Pointer to endpoints and control points
|
|
* cPoints [I] Count of endpoints and control points
|
|
*
|
|
* RETURNS STD
|
|
*/
|
|
BOOL32 WINAPI PolyBezierTo32( HDC32 hdc, LPPOINT32 lppt, DWORD cPoints )
|
|
{
|
|
DC * dc = DC_GetDCPtr( hdc );
|
|
POINT32 pt;
|
|
BOOL32 ret;
|
|
if(!dc) return FALSE;
|
|
pt.x=dc->w.CursPosX;
|
|
pt.y=dc->w.CursPosY;
|
|
if(dc && PATH_IsPathOpen(dc->w.path))
|
|
FIXME(gdi, "PATH_PolyBezierTo is not implemented!\n");
|
|
/* if(!PATH_PolyBezier(hdc, x, y))
|
|
return FALSE; */
|
|
ret= dc->funcs->pPolyBezier &&
|
|
dc->funcs->pPolyBezier(dc, pt, lppt, cPoints);
|
|
if( dc->funcs->pMoveToEx)
|
|
dc->funcs->pMoveToEx(dc,lppt[cPoints].x,lppt[cPoints].y,&pt);
|
|
return ret;
|
|
}
|