Commit b0efe28f authored by Alexandre Julliard's avatar Alexandre Julliard

Removed a few dependencies on GDI internals from USER dll.

parent 74cc65a9
......@@ -82,7 +82,7 @@ static BOOL COMBO_Init()
TRACE("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
hPrevB = SelectObject16( hDC, hComboBmp);
hPrevB = SelectObject( hDC, hComboBmp);
SetRect( &r, 0, 0, CBitWidth, CBitHeight );
InvertRect( hDC, &r );
SelectObject( hDC, hPrevB );
......
......@@ -1137,7 +1137,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
else
{
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
MoveTo16( hdc, rect.left, 0 );
MoveToEx( hdc, rect.left, 0, NULL );
LineTo( hdc, rect.left, height );
}
}
......@@ -1156,7 +1156,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
else
{
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
MoveTo16( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2 );
MoveToEx( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2, NULL );
LineTo( hdc, rect.right, rect.top + SEPARATOR_HEIGHT/2 );
}
return;
......@@ -1185,7 +1185,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* helper lines for debugging */
/* FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
MoveTo16( hdc, rect.left, (rect.top + rect.bottom)/2 );
MoveToEx( hdc, rect.left, (rect.top + rect.bottom)/2, NULL );
LineTo( hdc, rect.right, (rect.top + rect.bottom)/2 );
*/
......@@ -1479,13 +1479,13 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
if (TWEAK_WineLook == WIN31_LOOK)
{
SelectObject( hDC, GetSysColorPen(COLOR_WINDOWFRAME) );
MoveTo16( hDC, lprect->left, lprect->bottom );
MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
LineTo( hDC, lprect->right, lprect->bottom );
}
else
{
SelectObject( hDC, GetSysColorPen(COLOR_3DFACE));
MoveTo16( hDC, lprect->left, lprect->bottom );
MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
LineTo( hDC, lprect->right, lprect->bottom );
}
......
......@@ -46,6 +46,8 @@ static USER_DRIVER user_driver =
TTYDRV_SetScreenSaveActive,
TTYDRV_GetScreenSaveTimeout,
TTYDRV_SetScreenSaveTimeout,
/* resource functions */
TTYDRV_LoadOEMResource,
/* windowing functions */
TTYDRV_IsSingleWindow
};
......
......@@ -65,7 +65,6 @@ static const DC_FUNCTIONS PSDRV_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
PSDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
NULL, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg (optional) */
......
......@@ -59,6 +59,8 @@ static USER_DRIVER user_driver =
X11DRV_SetScreenSaveActive,
X11DRV_GetScreenSaveTimeout,
X11DRV_SetScreenSaveTimeout,
/* resource functions */
X11DRV_LoadOEMResource,
/* windowing functions */
X11DRV_IsSingleWindow
};
......
......@@ -62,7 +62,6 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_IntersectClipRect, /* pIntersectClipRect */
EMFDRV_InvertRgn, /* pInvertRgn */
EMFDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
EMFDRV_MoveToEx, /* pMoveToEx */
EMFDRV_OffsetClipRgn, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg */
......
......@@ -61,7 +61,6 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_IntersectClipRect, /* pIntersectClipRect */
MFDRV_InvertRgn, /* pInvertRgn */
MFDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
MFDRV_MoveToEx, /* pMoveToEx */
MFDRV_OffsetClipRgn, /* pOffsetClipRgn */
MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */
......
......@@ -59,7 +59,6 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
TTYDRV_DC_LineTo, /* pLineTo */
TTYDRV_DC_LoadOEMResource, /* pLoadOEMResource */
NULL, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg (optional) */
......
......@@ -11,9 +11,9 @@
DEFAULT_DEBUG_CHANNEL(ttydrv)
/**********************************************************************
* TTYDRV_DC_LoadOEMBitmap
* TTYDRV_LoadOEMBitmap
*/
static HANDLE TTYDRV_DC_LoadOEMBitmap(WORD resid)
static HANDLE TTYDRV_LoadOEMBitmap(WORD resid)
{
HBITMAP hbitmap;
......@@ -26,31 +26,29 @@ static HANDLE TTYDRV_DC_LoadOEMBitmap(WORD resid)
}
/**********************************************************************
* TTYDRV_DC_LoadOEMCursorIcon
* TTYDRV_LoadOEMCursorIcon
*/
static HANDLE TTYDRV_DC_LoadOEMCursorIcon(WORD resid, BOOL bCursor)
static HANDLE TTYDRV_LoadOEMCursorIcon(WORD resid, BOOL bCursor)
{
return (HANDLE) NULL;
}
/**********************************************************************
* TTYDRV_DC_LoadOEMResource
* TTYDRV_LoadOEMResource
*/
HANDLE TTYDRV_DC_LoadOEMResource(WORD resid, WORD type)
HANDLE TTYDRV_LoadOEMResource(WORD resid, WORD type)
{
switch(type)
{
case OEM_BITMAP:
return TTYDRV_DC_LoadOEMBitmap(resid);
return TTYDRV_LoadOEMBitmap(resid);
case OEM_CURSOR:
return TTYDRV_DC_LoadOEMCursorIcon(resid, TRUE);
return TTYDRV_LoadOEMCursorIcon(resid, TRUE);
case OEM_ICON:
return TTYDRV_DC_LoadOEMCursorIcon(resid, FALSE);
return TTYDRV_LoadOEMCursorIcon(resid, FALSE);
default:
ERR("unknown type (%d)\n", type);
}
return (HANDLE) NULL;
}
......@@ -87,7 +87,6 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
WIN16DRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
WIN16DRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrgEx */
......
......@@ -71,7 +71,6 @@ const DC_FUNCTIONS X11DRV_DC_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
X11DRV_LineTo, /* pLineTo */
X11DRV_LoadOEMResource, /* pLoadOEMResource */
NULL, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg (optional) */
......
......@@ -214,7 +214,6 @@ typedef struct tagDC_FUNCS
INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT);
BOOL (*pInvertRgn)(DC*,HRGN);
BOOL (*pLineTo)(DC*,INT,INT);
HANDLE (*pLoadOEMResource)(WORD,WORD);
BOOL (*pMoveToEx)(DC*,INT,INT,LPPOINT);
INT (*pOffsetClipRgn)(DC*,INT,INT);
BOOL (*pOffsetViewportOrg)(DC*,INT,INT);
......
......@@ -88,7 +88,6 @@ extern COLORREF TTYDRV_DC_GetPixel(struct tagDC *dc, INT x, INT y);
extern BOOL TTYDRV_DC_GetTextExtentPoint(struct tagDC *dc, LPCWSTR str, INT count, LPSIZE size);
extern BOOL TTYDRV_DC_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
extern BOOL TTYDRV_DC_LineTo(struct tagDC *dc, INT x, INT y);
extern HANDLE TTYDRV_DC_LoadOEMResource(WORD resid, WORD type);
extern BOOL TTYDRV_DC_PaintRgn(struct tagDC *dc, HRGN hrgn);
extern BOOL TTYDRV_DC_PatBlt(struct tagDC *dc, INT left, INT top, INT width, INT height, DWORD rop);
extern BOOL TTYDRV_DC_Pie(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
......@@ -184,6 +183,8 @@ typedef struct tagTTYDRV_WND_DATA {
WINDOW *TTYDRV_WND_GetCursesWindow(struct tagWND *wndPtr);
extern HANDLE TTYDRV_LoadOEMResource(WORD resid, WORD type);
extern void TTYDRV_WND_Initialize(struct tagWND *wndPtr);
extern void TTYDRV_WND_Finalize(struct tagWND *wndPtr);
extern BOOL TTYDRV_WND_CreateDesktopWindow(struct tagWND *wndPtr, struct tagCLASS *classPtr, BOOL bUnicode);
......@@ -196,8 +197,8 @@ extern void TTYDRV_WND_SetText(struct tagWND *wndPtr, LPCWSTR text);
extern void TTYDRV_WND_SetFocus(struct tagWND *wndPtr);
extern void TTYDRV_WND_PreSizeMove(struct tagWND *wndPtr);
extern void TTYDRV_WND_PostSizeMove(struct tagWND *wndPtr);
extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
extern void TTYDRV_WND_ScrollWindow(struct tagWND *wndPtr, HDC hdc, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void TTYDRV_WND_SetDrawable(struct tagWND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin);
extern BOOL TTYDRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern BOOL TTYDRV_WND_IsSelfClipping(struct tagWND *wndPtr);
extern void TTYDRV_WND_SetWindowRgn(struct tagWND *wndPtr, HRGN hrgnWnd);
......
......@@ -66,6 +66,8 @@ typedef struct tagUSER_DRIVER {
void (*pSetScreenSaveActive)(BOOL);
int (*pGetScreenSaveTimeout)(void);
void (*pSetScreenSaveTimeout)(int);
/* resource functions */
HANDLE (*pLoadOEMResource)(WORD,WORD);
/* windowing functions */
BOOL (*pIsSingleWindow)(void);
} USER_DRIVER;
......
......@@ -128,8 +128,8 @@ typedef struct tagWND_DRIVER
void (*pSetFocus)(WND *);
void (*pPreSizeMove)(WND *);
void (*pPostSizeMove)(WND *);
void (*pSurfaceCopy)(WND *, struct tagDC *, INT, INT, const RECT *, BOOL);
void (*pSetDrawable)(WND *, struct tagDC *, WORD, BOOL);
void (*pSurfaceCopy)(WND *, HDC, INT, INT, const RECT *, BOOL);
void (*pSetDrawable)(WND *, HDC, WORD, BOOL);
BOOL (*pSetHostAttr)(WND *, INT haKey, INT value);
BOOL (*pIsSelfClipping)(WND *);
void (*pSetWindowRgn)(WND *, const HRGN);
......
......@@ -156,7 +156,6 @@ extern INT X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP hbitmap,
WORD fGet, UINT startscan,
UINT lines, LPSTR bits,
LPBITMAPINFO info, UINT coloruse );
extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
/* OpenGL / X11 driver functions */
extern int X11DRV_ChoosePixelFormat(DC *dc, const PIXELFORMATDESCRIPTOR *pppfd) ;
......@@ -336,6 +335,7 @@ extern BOOL X11DRV_GetScreenSaveActive(void);
extern void X11DRV_SetScreenSaveActive(BOOL bActivate);
extern int X11DRV_GetScreenSaveTimeout(void);
extern void X11DRV_SetScreenSaveTimeout(int nTimeout);
extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
extern BOOL X11DRV_IsSingleWindow(void);
/* X11 clipboard driver */
......@@ -429,8 +429,8 @@ extern void X11DRV_WND_SetText(struct tagWND *wndPtr, LPCWSTR text);
extern void X11DRV_WND_SetFocus(struct tagWND *wndPtr);
extern void X11DRV_WND_PreSizeMove(struct tagWND *wndPtr);
extern void X11DRV_WND_PostSizeMove(struct tagWND *wndPtr);
extern void X11DRV_WND_SurfaceCopy(struct tagWND *wndPtr, struct tagDC *dcPtr, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, struct tagDC *dc, WORD flags, BOOL bSetClipOrigin);
extern void X11DRV_WND_SurfaceCopy(struct tagWND *wndPtr, HDC hdc, INT dx, INT dy, const RECT *clipRect, BOOL bUpdate);
extern void X11DRV_WND_SetDrawable(struct tagWND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin);
extern BOOL X11DRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value);
extern BOOL X11DRV_WND_IsSelfClipping(struct tagWND *wndPtr);
extern void X11DRV_WND_DockWindow(struct tagWND *wndPtr);
......
......@@ -988,7 +988,7 @@ void WINAPI PlayMetaFileRecord16(
break;
case META_SELECTPALETTE:
SelectPalette16(hdc, *(ht->objectHandle + *(mr->rdParm+1)),
SelectPalette(hdc, *(ht->objectHandle + *(mr->rdParm+1)),
*(mr->rdParm));
break;
......@@ -997,7 +997,7 @@ void WINAPI PlayMetaFileRecord16(
break;
case META_REALIZEPALETTE:
RealizePalette16(hdc);
RealizePalette(hdc);
break;
case META_ESCAPE:
......
......@@ -152,8 +152,8 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap,
if (bitmap && (bitmap != 1))
{
BITMAP16 bmp;
if (!GetObject16( bitmap, sizeof(bmp), &bmp )) return FALSE;
BITMAP bmp;
if (!GetObjectA( bitmap, sizeof(bmp), &bmp )) return FALSE;
Caret.width = bmp.bmWidth;
Caret.height = bmp.bmHeight;
/* FIXME: we should make a copy of the bitmap instead of a brush */
......
......@@ -189,7 +189,7 @@ void CLIPBOARD_DeleteRecord(LPWINE_CLIPFORMAT lpFormat, BOOL bChange)
if (lpFormat->hData32)
DeleteObject(lpFormat->hData32);
if (lpFormat->hData16)
DeleteObject16(lpFormat->hData16);
DeleteObject(lpFormat->hData16);
}
else if( lpFormat->wFormatID == CF_METAFILEPICT )
{
......
......@@ -40,8 +40,6 @@
#include "color.h"
#include "bitmap.h"
#include "cursoricon.h"
#include "dc.h"
#include "gdi.h"
#include "global.h"
#include "module.h"
#include "debugtools.h"
......@@ -429,7 +427,7 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
{
int sizeAnd, sizeXor;
HBITMAP hAndBits = 0, hXorBits = 0; /* error condition for later */
BITMAPOBJ *bmpXor, *bmpAnd;
BITMAP bmpXor, bmpAnd;
POINT16 hotspot;
BITMAPINFO *bmi;
HDC hdc;
......@@ -583,10 +581,10 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
}
/* Now create the CURSORICONINFO structure */
bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( hXorBits, BITMAP_MAGIC );
bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( hAndBits, BITMAP_MAGIC );
sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
sizeAnd = bmpAnd->bitmap.bmHeight * bmpAnd->bitmap.bmWidthBytes;
GetObjectA( hXorBits, sizeof(bmpXor), &bmpXor );
GetObjectA( hAndBits, sizeof(bmpAnd), &bmpAnd );
sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes;
sizeAnd = bmpAnd.bmHeight * bmpAnd.bmWidthBytes;
if (hObj) hObj = GlobalReAlloc16( hObj,
sizeof(CURSORICONINFO) + sizeXor + sizeAnd, GMEM_MOVEABLE );
......@@ -602,11 +600,11 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
info = (CURSORICONINFO *)GlobalLock16( hObj );
info->ptHotSpot.x = hotspot.x;
info->ptHotSpot.y = hotspot.y;
info->nWidth = bmpXor->bitmap.bmWidth;
info->nHeight = bmpXor->bitmap.bmHeight;
info->nWidthBytes = bmpXor->bitmap.bmWidthBytes;
info->bPlanes = bmpXor->bitmap.bmPlanes;
info->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel;
info->nWidth = bmpXor.bmWidth;
info->nHeight = bmpXor.bmHeight;
info->nWidthBytes = bmpXor.bmWidthBytes;
info->bPlanes = bmpXor.bmPlanes;
info->bBitsPerPixel = bmpXor.bmBitsPixel;
/* Transfer the bitmap bits to the CURSORICONINFO structure */
......@@ -693,7 +691,6 @@ HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
else if ( !hInstance ) /* Load OEM cursor/icon */
{
WORD resid;
HDC hdc;
if ( HIWORD(name) )
{
......@@ -710,14 +707,7 @@ HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
}
}
else resid = LOWORD(name);
hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
if (hdc) {
DC *dc = DC_GetDCPtr( hdc );
if (dc->funcs->pLoadOEMResource)
h = dc->funcs->pLoadOEMResource( resid, fCursor ? OEM_CURSOR : OEM_ICON );
GDI_HEAP_UNLOCK( hdc );
DeleteDC( hdc );
}
h = USER_Driver->pLoadOEMResource( resid, fCursor ? OEM_CURSOR : OEM_ICON );
}
else /* Load from resource */
......@@ -1819,16 +1809,17 @@ BOOL WINAPI GetIconInfo(HICON hIcon,LPICONINFO iconinfo) {
/**********************************************************************
* CreateIconIndirect (USER32.78)
*/
HICON WINAPI CreateIconIndirect(LPICONINFO iconinfo) {
BITMAPOBJ *bmpXor,*bmpAnd;
HICON WINAPI CreateIconIndirect(LPICONINFO iconinfo)
{
BITMAP bmpXor,bmpAnd;
HICON hObj;
int sizeXor,sizeAnd;
bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( iconinfo->hbmColor, BITMAP_MAGIC );
bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( iconinfo->hbmMask, BITMAP_MAGIC );
GetObjectA( iconinfo->hbmColor, sizeof(bmpXor), &bmpXor );
GetObjectA( iconinfo->hbmMask, sizeof(bmpAnd), &bmpAnd );
sizeXor = bmpXor->bitmap.bmHeight * bmpXor->bitmap.bmWidthBytes;
sizeAnd = bmpAnd->bitmap.bmHeight * bmpAnd->bitmap.bmWidthBytes;
sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes;
sizeAnd = bmpAnd.bmHeight * bmpAnd.bmWidthBytes;
hObj = GlobalAlloc16( GMEM_MOVEABLE,
sizeof(CURSORICONINFO) + sizeXor + sizeAnd );
......@@ -1850,11 +1841,11 @@ HICON WINAPI CreateIconIndirect(LPICONINFO iconinfo) {
info->ptHotSpot.y = iconinfo->yHotspot;
}
info->nWidth = bmpXor->bitmap.bmWidth;
info->nHeight = bmpXor->bitmap.bmHeight;
info->nWidthBytes = bmpXor->bitmap.bmWidthBytes;
info->bPlanes = bmpXor->bitmap.bmPlanes;
info->bBitsPerPixel = bmpXor->bitmap.bmBitsPixel;
info->nWidth = bmpXor.bmWidth;
info->nHeight = bmpXor.bmHeight;
info->nWidthBytes = bmpXor.bmWidthBytes;
info->bPlanes = bmpXor.bmPlanes;
info->bBitsPerPixel = bmpXor.bmBitsPixel;
/* Transfer the bitmap bits to the CURSORICONINFO structure */
......@@ -2104,18 +2095,8 @@ static HBITMAP BITMAP_Load( HINSTANCE instance,LPCWSTR name, UINT loadflags )
if (!(loadflags & LR_LOADFROMFILE)) {
if (!instance) /* OEM bitmap */
{
HDC hdc;
DC *dc;
if (HIWORD((int)name)) return 0;
hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
dc = DC_GetDCPtr( hdc );
if(dc->funcs->pLoadOEMResource)
hbitmap = dc->funcs->pLoadOEMResource( LOWORD((int)name),
OEM_BITMAP );
GDI_HEAP_UNLOCK( hdc );
DeleteDC( hdc );
return hbitmap;
return USER_Driver->pLoadOEMResource( LOWORD((int)name), OEM_BITMAP );
}
if (!(hRsrc = FindResourceW( instance, name, RT_BITMAPW ))) return 0;
......
......@@ -80,7 +80,7 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
WND* wnd;
if (!(dce = HeapAlloc( SystemHeap, 0, sizeof(DCE) ))) return NULL;
if (!(dce->hDC = CreateDC16( "DISPLAY", NULL, NULL, NULL )))
if (!(dce->hDC = CreateDCA( "DISPLAY", NULL, NULL, NULL )))
{
HeapFree( SystemHeap, 0, dce );
return 0;
......@@ -806,7 +806,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
bUpdateVisRgn = bUpdateVisRgn || (dc->w.flags & DC_DIRTY);
/* recompute visible region */
wndPtr->pDriver->pSetDrawable( wndPtr, dc, flags, bUpdateClipOrigin );
wndPtr->pDriver->pSetDrawable( wndPtr, hdc, flags, bUpdateClipOrigin );
if( bUpdateVisRgn )
{
......@@ -975,7 +975,6 @@ BOOL16 WINAPI DCHook16( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
BOOL retv = TRUE;
HRGN hVisRgn;
DCE *dce = (DCE *)data;
DC *dc;
WND *wndPtr;
TRACE("hDC = %04x, %i\n", hDC, code);
......@@ -1000,9 +999,7 @@ BOOL16 WINAPI DCHook16( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
/* Update stale DC in DCX */
wndPtr = WIN_FindWndPtr( dce->hwndCurrent);
dc = (DC *) GDI_GetObjPtr( dce->hDC, DC_MAGIC);
if( dc && wndPtr)
wndPtr->pDriver->pSetDrawable( wndPtr, dc,dce->DCXflags,TRUE);
if (wndPtr) wndPtr->pDriver->pSetDrawable( wndPtr, hDC, dce->DCXflags, TRUE);
SetHookFlags16(hDC, DCHF_VALIDATEVISRGN);
hVisRgn = DCE_GetVisRgn(dce->hwndCurrent, dce->DCXflags, 0, 0);
......
......@@ -161,12 +161,12 @@ static BOOL DIALOG_GetCharSize( HFONT hFont, SIZE * pSize )
*/
BOOL DIALOG_Init(void)
{
HDC16 hdc;
HDC hdc;
SIZE size;
/* Calculate the dialog base units */
if (!(hdc = CreateDC16( "DISPLAY", NULL, NULL, NULL ))) return FALSE;
if (!(hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL ))) return FALSE;
if (!DIALOG_GetCharSizeFromDC( hdc, 0, &size )) return FALSE;
DeleteDC( hdc );
xBaseUnit = size.cx;
......@@ -681,11 +681,11 @@ HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
PROOF_QUALITY, FF_DONTCARE,
(LPCWSTR)template.faceName );
else
hFont = CreateFont16( -pixels, 0, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE,
DEFAULT_CHARSET, 0, 0,
PROOF_QUALITY, FF_DONTCARE,
template.faceName );
hFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE,
DEFAULT_CHARSET, 0, 0,
PROOF_QUALITY, FF_DONTCARE,
template.faceName );
if (hFont)
{
SIZE charSize;
......
......@@ -1489,14 +1489,14 @@ static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd,
SelectObject( hdc, hbrushOld );
}
WIN_ReleaseWndPtr(wndPtr);
MoveTo16( hdc, r.left, r.bottom );
MoveToEx( hdc, r.left, r.bottom, NULL );
LineTo( hdc, r.right, r.bottom );
if (style & WS_SYSMENU)
{
NC_DrawSysButton( hwnd, hdc, FALSE );
r.left += GetSystemMetrics(SM_CXSIZE) + 1;
MoveTo16( hdc, r.left - 1, r.top );
MoveToEx( hdc, r.left - 1, r.top, NULL );
LineTo( hdc, r.left - 1, r.bottom );
}
if (style & WS_MAXIMIZEBOX)
......
......@@ -268,9 +268,29 @@ copyrgn:
*/
HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
{
PAINTSTRUCT ps;
BeginPaint( hwnd, &ps );
lps->hdc = ps.hdc;
lps->fErase = ps.fErase;
lps->rcPaint.top = ps.rcPaint.top;
lps->rcPaint.left = ps.rcPaint.left;
lps->rcPaint.right = ps.rcPaint.right;
lps->rcPaint.bottom = ps.rcPaint.bottom;
lps->fRestore = ps.fRestore;
lps->fIncUpdate = ps.fIncUpdate;
return lps->hdc;
}
/***********************************************************************
* BeginPaint (USER32.10)
*/
HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
{
BOOL bIcon;
HRGN hrgnUpdate;
RECT16 clipRect, clientRect;
RECT clipRect, clientRect;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
......@@ -306,7 +326,7 @@ HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
/* Don't clip the output to the update region for CS_PARENTDC window */
if( hrgnUpdate )
DeleteObject(hrgnUpdate);
lps->hdc = GetDCEx16( hwnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE |
lps->hdc = GetDCEx( hwnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE |
(bIcon ? DCX_WINDOW : 0) );
}
else
......@@ -314,7 +334,7 @@ HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
if( hrgnUpdate ) /* convert to client coordinates */
OffsetRgn( hrgnUpdate, wndPtr->rectWindow.left - wndPtr->rectClient.left,
wndPtr->rectWindow.top - wndPtr->rectClient.top );
lps->hdc = GetDCEx16(hwnd, hrgnUpdate, DCX_INTERSECTRGN |
lps->hdc = GetDCEx(hwnd, hrgnUpdate, DCX_INTERSECTRGN |
DCX_WINDOWPAINT | DCX_USESTYLE | (bIcon ? DCX_WINDOW : 0) );
/* ReleaseDC() in EndPaint() will delete the region */
}
......@@ -333,13 +353,13 @@ HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
than the window itself, so we need to intersect the cliprect with
the window */
GetClipBox16( lps->hdc, &clipRect );
GetClientRect16( hwnd, &clientRect );
GetClipBox( lps->hdc, &clipRect );
GetClientRect( hwnd, &clientRect );
/* The rect obtained by GetClipBox is in logical, so make the client in logical to*/
DPtoLP16(lps->hdc, (LPPOINT16) &clientRect, 2);
DPtoLP(lps->hdc, (LPPOINT)&clientRect, 2);
IntersectRect16(&lps->rcPaint, &clientRect, &clipRect);
IntersectRect(&lps->rcPaint, &clientRect, &clipRect);
TRACE("box = (%i,%i - %i,%i)\n", lps->rcPaint.left, lps->rcPaint.top,
lps->rcPaint.right, lps->rcPaint.bottom );
......@@ -347,9 +367,8 @@ HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
{
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
lps->fErase = !SendMessage16(hwnd, (bIcon) ? WM_ICONERASEBKGND
: WM_ERASEBKGND,
(WPARAM16)lps->hdc, 0 );
lps->fErase = !SendMessageA(hwnd, (bIcon) ? WM_ICONERASEBKGND : WM_ERASEBKGND,
(WPARAM16)lps->hdc, 0 );
}
else lps->fErase = TRUE;
......@@ -359,26 +378,6 @@ HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
/***********************************************************************
* BeginPaint (USER32.10)
*/
HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
{
PAINTSTRUCT16 ps;
BeginPaint16( hwnd, &ps );
lps->hdc = (HDC)ps.hdc;
lps->fErase = ps.fErase;
lps->rcPaint.top = ps.rcPaint.top;
lps->rcPaint.left = ps.rcPaint.left;
lps->rcPaint.right = ps.rcPaint.right;
lps->rcPaint.bottom = ps.rcPaint.bottom;
lps->fRestore = ps.fRestore;
lps->fIncUpdate = ps.fIncUpdate;
return lps->hdc;
}
/***********************************************************************
* EndPaint16 (USER.40)
*/
BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
......@@ -405,10 +404,12 @@ BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
*/
void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
{
RECT16 rect;
GetClientRect16( hwnd, &rect );
DPtoLP16( hdc, (LPPOINT16)&rect, 2 );
PaintRect16( hwndParent, hwnd, hdc, hbrush, &rect );
RECT rect;
RECT16 rc16;
GetClientRect( hwnd, &rect );
DPtoLP( hdc, (LPPOINT)&rect, 2 );
CONV_RECT32TO16( &rect, &rc16 );
PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
}
......@@ -1240,16 +1241,16 @@ INT WINAPI ExcludeUpdateRgn( HDC hdc, HWND hwnd )
*/
INT16 WINAPI FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
{
HBRUSH16 prevBrush;
HBRUSH 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;
if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
SelectObject16( hdc, prevBrush );
SelectObject( hdc, prevBrush );
return 1;
}
......@@ -1641,3 +1642,20 @@ BOOL16 WINAPI DrawState16(HDC16 hdc, HBRUSH16 hbr,
}
/***********************************************************************
* SelectPalette16 (USER.282)
*/
HPALETTE16 WINAPI SelectPalette16( HDC16 hDC, HPALETTE16 hPal,
BOOL16 bForceBackground )
{
return SelectPalette( hDC, hPal, bForceBackground );
}
/***********************************************************************
* RealizePalette16 (USER.283)
*/
UINT16 WINAPI RealizePalette16( HDC16 hDC )
{
return RealizePalette( hDC );
}
......@@ -192,20 +192,21 @@ void TTYDRV_WND_PostSizeMove(WND *wndPtr)
/*****************************************************************
* TTYDRV_WND_ScrollWindow
*/
void TTYDRV_WND_ScrollWindow(
WND *wndPtr, DC *dcPtr, INT dx, INT dy,
const RECT *clipRect, BOOL bUpdate)
void TTYDRV_WND_ScrollWindow( WND *wndPtr, HDC hdc, INT dx, INT dy,
const RECT *clipRect, BOOL bUpdate)
{
FIXME("(%p, %p, %d, %d, %p, %d): stub\n",
wndPtr, dcPtr, dx, dy, clipRect, bUpdate);
FIXME("(%p, %x, %d, %d, %p, %d): stub\n",
wndPtr, hdc, dx, dy, clipRect, bUpdate);
}
/***********************************************************************
* TTYDRV_WND_SetDrawable
*/
void TTYDRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin)
void TTYDRV_WND_SetDrawable(WND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin)
{
TRACE("(%p, %p, %d, %d)\n", wndPtr, dc, flags, bSetClipOrigin);
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return;
TRACE("(%p, %p, %d, %d)\n", wndPtr, dc, flags, bSetClipOrigin);
/* FIXME: Should be done in the common code instead */
if(!wndPtr) {
......@@ -220,6 +221,7 @@ void TTYDRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin
dc->w.DCOrgY = wndPtr->rectClient.top;
}
}
GDI_HEAP_UNLOCK( hdc );
}
/***********************************************************************
......
......@@ -2319,7 +2319,6 @@ nocopy:
{
RECT rClip;
HDC hDC;
DC* dc;
/* get DC and clip rect with drawable rect to avoid superfluous expose events
from copying clipped areas */
......@@ -2339,14 +2338,12 @@ nocopy:
}
rClip.left = rClip.top = 0;
if( (dc = (DC *)GDI_GetObjPtr(hDC, DC_MAGIC)) )
{
if( oh > nh ) r.bottom = r.top + nh;
if( ow < nw ) r.right = r.left + nw;
if( oh > nh ) r.bottom = r.top + nh;
if( ow < nw ) r.right = r.left + nw;
if( IntersectRect( &r, &r, &rClip ) )
{
Wnd->pDriver->pSurfaceCopy( Wnd->parent, dc, dx, dy, &r, TRUE );
if( IntersectRect( &r, &r, &rClip ) )
{
Wnd->pDriver->pSurfaceCopy( Wnd->parent, hDC, dx, dy, &r, TRUE );
/* When you copy the bits without repainting, parent doesn't
get validated appropriately. Therefore, we have to validate
......@@ -2358,9 +2355,6 @@ nocopy:
OffsetRect(&r, dx, dy);
ValidateRect(Wnd->parent->hwndSelf, &r);
}
}
GDI_HEAP_UNLOCK( hDC );
}
ReleaseDC( (uFlags & SWP_EX_PAINTSELF) ?
Wnd->hwndSelf : Wnd->parent->hwndSelf, hDC);
......
......@@ -21,6 +21,7 @@
#include "color.h"
#include "debugtools.h"
#include "dce.h"
#include "dc.h"
#include "options.h"
#include "message.h"
#include "heap.h"
......@@ -755,12 +756,15 @@ void X11DRV_WND_PostSizeMove(WND *wndPtr)
*
* Copies rect to (rect.left + dx, rect.top + dy).
*/
void X11DRV_WND_SurfaceCopy(WND* wndPtr, DC *dcPtr, INT dx, INT dy,
void X11DRV_WND_SurfaceCopy(WND* wndPtr, HDC hdc, INT dx, INT dy,
const RECT *rect, BOOL bUpdate)
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dcPtr->physDev;
X11DRV_PDEVICE *physDev;
POINT dst, src;
DC *dcPtr = DC_GetDCPtr( hdc );
if (!dcPtr) return;
physDev = (X11DRV_PDEVICE *)dcPtr->physDev;
dst.x = (src.x = dcPtr->w.DCOrgX + rect->left) + dx;
dst.y = (src.y = dcPtr->w.DCOrgY + rect->top) + dy;
......@@ -777,6 +781,7 @@ void X11DRV_WND_SurfaceCopy(WND* wndPtr, DC *dcPtr, INT dx, INT dy,
if (bUpdate) /* Make sure exposure events have been processed */
EVENT_Synchronize();
GDI_HEAP_UNLOCK( hdc );
}
/***********************************************************************
......@@ -785,12 +790,15 @@ void X11DRV_WND_SurfaceCopy(WND* wndPtr, DC *dcPtr, INT dx, INT dy,
* Set the drawable, origin and dimensions for the DC associated to
* a given window.
*/
void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin)
void X11DRV_WND_SetDrawable(WND *wndPtr, HDC hdc, WORD flags, BOOL bSetClipOrigin)
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
DC *dc = DC_GetDCPtr( hdc );
X11DRV_PDEVICE *physDev;
INT dcOrgXCopy = 0, dcOrgYCopy = 0;
BOOL offsetClipRgn = FALSE;
if (!dc) return;
physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!wndPtr) /* Get a DC for the whole screen */
{
dc->w.DCOrgX = 0;
......@@ -855,6 +863,7 @@ void X11DRV_WND_SetDrawable(WND *wndPtr, DC *dc, WORD flags, BOOL bSetClipOrigin
TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX, dc->w.DCOrgY );
#endif
}
GDI_HEAP_UNLOCK( hdc );
}
/***********************************************************************
......
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