Commit d6a91b7a authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Move OEM resources to the x11drv.

parent a8745ea3
......@@ -37,6 +37,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
MFDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
MFDRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */
......
......@@ -42,6 +42,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
PSDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
PSDRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg (optional) */
......
......@@ -12,7 +12,6 @@
#include "gdi.h"
#include "bitmap.h"
#include "heap.h"
#include "color.h"
#include "font.h"
#include "options.h"
#include "xmalloc.h"
......@@ -66,6 +65,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
WIN16DRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */
WIN16DRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrgEx */
......
......@@ -5,7 +5,6 @@
*/
#include "pen.h"
#include "color.h"
#include "win16drv.h"
#include "heap.h"
#include "debug.h"
......
......@@ -14,6 +14,7 @@ C_SRCS = \
graphics.c \
init.c \
objects.c \
oembitmap.c \
pen.c \
text.c \
xfont.c
......
......@@ -42,6 +42,7 @@ static const DC_FUNCTIONS X11DRV_Funcs =
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
X11DRV_LineTo, /* pLineTo */
X11DRV_LoadOEMResource, /* pLoadOEMResource */
X11DRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg (optional) */
......@@ -120,6 +121,8 @@ BOOL32 X11DRV_Init(void)
if( !COLOR_Init() ) return FALSE;
if( !X11DRV_OBM_Init() ) return FALSE;
/* Finish up device caps */
#if 0
......
/*
* GDI OEM bitmap objects
* X11DRV OEM bitmap objects
*
* Copyright 1994, 1995 Alexandre Julliard
*
......@@ -11,6 +11,7 @@
#include "ts_xutil.h"
#include "ts_xpm.h"
#include "gdi.h"
#include "x11drv.h"
#include "bitmap.h"
#include "callback.h"
#include "color.h"
......@@ -399,7 +400,7 @@ static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
/***********************************************************************
* OBM_LoadBitmap
*/
HBITMAP16 OBM_LoadBitmap( WORD id )
static HBITMAP16 OBM_LoadBitmap( WORD id )
{
OBM_BITMAP_DESCR descr;
......@@ -427,7 +428,7 @@ HBITMAP16 OBM_LoadBitmap( WORD id )
/***********************************************************************
* OBM_LoadCursorIcon
*/
HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
{
OBM_BITMAP_DESCR descr;
HGLOBAL16 handle;
......@@ -533,13 +534,35 @@ HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
return handle;
}
/***********************************************************************
* X11DRV_LoadOEMResource
*
*/
HANDLE32 X11DRV_LoadOEMResource(WORD resid, WORD type)
{
switch(type) {
case OEM_BITMAP:
return OBM_LoadBitmap(resid);
case OEM_CURSOR:
return OBM_LoadCursorIcon(resid, TRUE);
case OEM_ICON:
return OBM_LoadCursorIcon(resid, FALSE);
default:
ERR(x11drv, "Unknown type\n");
}
return 0;
}
/***********************************************************************
* OBM_Init
* X11DRV_OBM_Init
*
* Initializes the OBM_Pixmaps_Data and OBM_Icons_Data struct
*/
BOOL32 OBM_Init()
BOOL32 X11DRV_OBM_Init(void)
{
if (TWEAK_WineLook == WIN31_LOOK) {
OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd;
......
......@@ -76,9 +76,4 @@ extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp );
extern void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT32 loadflags,
BYTE pix);
/* objects/oembitmap.c */
extern BOOL32 OBM_Init(void);
extern HBITMAP16 OBM_LoadBitmap( WORD id );
extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor );
#endif /* __WINE_BITMAP_H */
......@@ -188,6 +188,7 @@ typedef struct tagDC_FUNCS
INT32 (*pIntersectClipRect)(DC*,INT32,INT32,INT32,INT32);
INT32 (*pIntersectVisRect)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pLineTo)(DC*,INT32,INT32);
HANDLE32 (*pLoadOEMResource)(WORD,WORD);
BOOL32 (*pMoveToEx)(DC*,INT32,INT32,LPPOINT32);
INT32 (*pOffsetClipRgn)(DC*,INT32,INT32);
BOOL32 (*pOffsetViewportOrg)(DC*,INT32,INT32);
......@@ -233,6 +234,11 @@ typedef struct tagDC_FUNCS
INT32 (*pStretchDIBits)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,const void *,const BITMAPINFO *,UINT32,DWORD);
} DC_FUNCTIONS;
/* LoadOEMResource types */
#define OEM_BITMAP 1
#define OEM_CURSOR 2
#define OEM_ICON 3
/* DC hook codes */
#define DCHC_INVALIDVISRGN 0x0001
#define DCHC_DELETEDC 0x0002
......
......@@ -137,12 +137,15 @@ extern INT32 X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP32 hbitmap,
WORD fGet, UINT32 startscan,
UINT32 lines, LPSTR bits,
LPBITMAPINFO info, UINT32 coloruse );
extern HANDLE32 X11DRV_LoadOEMResource( WORD id, WORD type );
/* X11 driver internal functions */
extern BOOL32 X11DRV_BITMAP_Init(void);
extern BOOL32 X11DRV_BRUSH_Init(void);
extern BOOL32 X11DRV_DIB_Init(void);
extern BOOL32 X11DRV_FONT_Init( struct tagDeviceCaps* );
extern BOOL32 X11DRV_OBM_Init(void);
struct tagBITMAPOBJ;
extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
......
......@@ -192,10 +192,7 @@ BOOL32 WINAPI MAIN_UserInit(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRes
/* Initialize Wine tweaks */
if (!TWEAK_Init()) return FALSE;
/* Initialize OEM Bitmaps */
if (!OBM_Init()) return FALSE;
/* Global atom table initialisation */
/* Global atom table initialisation */
if (!ATOM_Init( USER_HeapSel )) return FALSE;
/* Initialize system colors and metrics*/
......
......@@ -19,7 +19,6 @@ C_SRCS = \
gdiobj.c \
linedda.c \
metafile.c \
oembitmap.c \
palette.c \
pen.c \
region.c \
......
......@@ -215,14 +215,13 @@ HBITMAP32 WINAPI CreateCompatibleBitmap32( HDC32 hdc, INT32 width, INT32 height)
if ((width >0x1000) || (height > 0x1000)) {
FIXME(bitmap,"got bad width %d or height %d, please look for reason\n",
width, height );
return 0;
} else {
hbmpRet = CreateBitmap32( width, height, 1, dc->w.bitsPerPixel, NULL );
if(dc->funcs->pCreateBitmap)
dc->funcs->pCreateBitmap( hbmpRet );
}
hbmpRet = CreateBitmap32( width, height, 1, dc->w.bitsPerPixel, NULL );
if(dc->funcs->pCreateBitmap)
dc->funcs->pCreateBitmap( hbmpRet );
TRACE(bitmap,"\t\t%04x\n", hbmpRet);
GDI_HEAP_UNLOCK(hdc);
return hbmpRet;
}
......@@ -587,8 +586,18 @@ HBITMAP16 WINAPI LoadBitmap16( HINSTANCE16 instance, SEGPTR name )
if (!instance) /* OEM bitmap */
{
HDC32 hdc;
DC *dc;
if (HIWORD((int)name)) return 0;
return OBM_LoadBitmap( LOWORD((int)name) );
hdc = CreateDC32A( "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 );
DeleteDC32( hdc );
return hbitmap;
}
if (!(hRsrc = FindResource16( instance, name, RT_BITMAP16 ))) return 0;
......@@ -625,8 +634,18 @@ HBITMAP32 BITMAP_LoadBitmap32W(HINSTANCE32 instance,LPCWSTR name,
if (!(loadflags & LR_LOADFROMFILE)) {
if (!instance) /* OEM bitmap */
{
if (HIWORD((int)name)) return 0;
return OBM_LoadBitmap( LOWORD((int)name) );
HDC32 hdc;
DC *dc;
if (HIWORD((int)name)) return 0;
hdc = CreateDC32A( "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 );
DeleteDC32( hdc );
return hbitmap;
}
if (!(hRsrc = FindResource32W( instance, name, RT_BITMAP32W ))) return 0;
......
......@@ -37,6 +37,8 @@
#include "color.h"
#include "bitmap.h"
#include "cursoricon.h"
#include "dc.h"
#include "gdi.h"
#include "sysmetrics.h"
#include "global.h"
#include "module.h"
......@@ -608,19 +610,29 @@ static HGLOBAL16 CURSORICON_Load16( HINSTANCE16 hInstance, SEGPTR name,
INT32 width, INT32 height, INT32 colors,
BOOL32 fCursor, UINT32 loadflags)
{
HGLOBAL16 handle;
HGLOBAL16 handle = 0;
HRSRC16 hRsrc;
CURSORICONDIRENTRY dirEntry;
if (!hInstance) /* OEM cursor/icon */
{
HDC32 hdc;
DC *dc;
if (HIWORD(name)) /* Check for '#xxx' name */
{
char *ptr = PTR_SEG_TO_LIN( name );
if (ptr[0] != '#') return 0;
if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
}
return OBM_LoadCursorIcon( LOWORD(name), fCursor );
hdc = CreateDC32A( "DISPLAY", NULL, NULL, NULL );
dc = DC_GetDCPtr( hdc );
if(dc->funcs->pLoadOEMResource)
handle = dc->funcs->pLoadOEMResource( LOWORD(name), fCursor ?
OEM_CURSOR : OEM_ICON);
GDI_HEAP_UNLOCK( hdc );
DeleteDC32( hdc );
return handle;
}
/* Find the best entry in the directory */
......@@ -653,7 +665,7 @@ HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name,
int width, int height, int colors,
BOOL32 fCursor, UINT32 loadflags )
{
HANDLE32 handle, h = 0;
HANDLE32 handle = 0, h = 0;
HANDLE32 hRsrc;
CURSORICONDIRENTRY dirEntry;
LPBYTE bits;
......@@ -663,6 +675,9 @@ HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name,
if (!hInstance) /* OEM cursor/icon */
{
WORD resid;
HDC32 hdc;
DC *dc;
if(HIWORD(name))
{
LPSTR ansi = HEAP_strdupWtoA(GetProcessHeap(),0,name);
......@@ -678,7 +693,14 @@ HGLOBAL32 CURSORICON_Load32( HINSTANCE32 hInstance, LPCWSTR name,
}
}
else resid = LOWORD(name);
return OBM_LoadCursorIcon(resid, fCursor);
hdc = CreateDC32A( "DISPLAY", NULL, NULL, NULL );
dc = DC_GetDCPtr( hdc );
if(dc->funcs->pLoadOEMResource)
handle = dc->funcs->pLoadOEMResource( resid, fCursor ?
OEM_CURSOR : OEM_ICON );
GDI_HEAP_UNLOCK( hdc );
DeleteDC32( hdc );
return handle;
}
/* Find the best entry in the directory */
......
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