Commit 4cffb2d0 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Add a skeleton dib driver.

parent 231ca429
......@@ -14858,6 +14858,8 @@ test "$srcdir" = "." || wine_fn_config_symlink tools/l_intl.nls
ac_config_links="$ac_config_links wine:tools/winewrapper"
wine_fn_config_symlink wine
ac_config_commands="$ac_config_commands dlls/gdi32/dibdrv"
ac_config_commands="$ac_config_commands dlls/gdi32/enhmfdrv"
ac_config_commands="$ac_config_commands dlls/gdi32/mfdrv"
......@@ -16320,6 +16322,7 @@ do
"fonts/tahomabd.ttf") CONFIG_LINKS="$CONFIG_LINKS fonts/tahomabd.ttf:fonts/tahomabd.ttf" ;;
"tools/l_intl.nls") CONFIG_LINKS="$CONFIG_LINKS tools/l_intl.nls:tools/l_intl.nls" ;;
"wine") CONFIG_LINKS="$CONFIG_LINKS wine:tools/winewrapper" ;;
"dlls/gdi32/dibdrv") CONFIG_COMMANDS="$CONFIG_COMMANDS dlls/gdi32/dibdrv" ;;
"dlls/gdi32/enhmfdrv") CONFIG_COMMANDS="$CONFIG_COMMANDS dlls/gdi32/enhmfdrv" ;;
"dlls/gdi32/mfdrv") CONFIG_COMMANDS="$CONFIG_COMMANDS dlls/gdi32/mfdrv" ;;
"dlls/kernel32/nls") CONFIG_COMMANDS="$CONFIG_COMMANDS dlls/kernel32/nls" ;;
......@@ -16957,6 +16960,8 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
"include/stamp-h":C) echo timestamp > include/stamp-h ;;
"dlls/gdi32/dibdrv":C) test -d "dlls/gdi32/dibdrv" || { { $as_echo "$as_me:${as_lineno-$LINENO}: creating dlls/gdi32/dibdrv" >&5
$as_echo "$as_me: creating dlls/gdi32/dibdrv" >&6;}; as_dir="dlls/gdi32/dibdrv"; as_fn_mkdir_p; } ;;
"dlls/gdi32/enhmfdrv":C) test -d "dlls/gdi32/enhmfdrv" || { { $as_echo "$as_me:${as_lineno-$LINENO}: creating dlls/gdi32/enhmfdrv" >&5
$as_echo "$as_me: creating dlls/gdi32/enhmfdrv" >&6;}; as_dir="dlls/gdi32/enhmfdrv"; as_fn_mkdir_p; } ;;
"dlls/gdi32/mfdrv":C) test -d "dlls/gdi32/mfdrv" || { { $as_echo "$as_me:${as_lineno-$LINENO}: creating dlls/gdi32/mfdrv" >&5
......
......@@ -2347,6 +2347,7 @@ WINE_CONFIG_SYMLINK(fonts/tahomabd.ttf,,enable_fonts)
WINE_CONFIG_SYMLINK(tools/l_intl.nls)
WINE_CONFIG_SYMLINK(wine,tools/winewrapper)
WINE_CONFIG_EXTRA_DIR(dlls/gdi32/dibdrv)
WINE_CONFIG_EXTRA_DIR(dlls/gdi32/enhmfdrv)
WINE_CONFIG_EXTRA_DIR(dlls/gdi32/mfdrv)
WINE_CONFIG_EXTRA_DIR(dlls/kernel32/nls)
......
......@@ -14,6 +14,7 @@ C_SRCS = \
clipping.c \
dc.c \
dib.c \
dibdrv/dc.c \
driver.c \
enhmetafile.c \
enhmfdrv/bitblt.c \
......@@ -44,6 +45,7 @@ C_SRCS = \
RC_SRCS = version.rc
EXTRASUBDIRS = \
dibdrv \
enhmfdrv \
mfdrv
......
......@@ -592,7 +592,7 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev )
if (!(bitmap = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return FALSE;
if (bitmap->funcs != physdev->funcs)
if (!bitmap->dib && bitmap->funcs != physdev->funcs)
{
/* we can only change from the null driver to some other driver */
if (bitmap->funcs == &null_driver)
......@@ -627,7 +627,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
HGDIOBJ ret;
BITMAPOBJ *bitmap;
DC *dc;
PHYSDEV physdev;
PHYSDEV physdev = NULL, old_physdev = NULL;
if (!(dc = get_dc_ptr( hdc ))) return 0;
......@@ -653,7 +653,17 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
goto done;
}
physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
old_physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
if(old_physdev == &dc->dibdrv.dev)
pop_dc_driver( dc, old_physdev );
if(bitmap->dib)
{
physdev = &dc->dibdrv.dev;
push_dc_driver( dc, physdev, physdev->funcs );
}
else
physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
if (!BITMAP_SetOwnerDC( handle, physdev ))
{
......@@ -682,6 +692,11 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
}
done:
if(!ret)
{
if(physdev == &dc->dibdrv.dev) pop_dc_driver( dc, physdev );
if(old_physdev == &dc->dibdrv.dev) push_dc_driver( dc, old_physdev, old_physdev->funcs );
}
release_dc_ptr( dc );
return ret;
}
......
......@@ -79,6 +79,8 @@ DC *alloc_dc_ptr( WORD magic )
dc->nulldrv.funcs = &null_driver;
dc->nulldrv.next = NULL;
dc->dibdrv.dev.funcs = &dib_driver;
dc->dibdrv.dev.next = NULL;
dc->physDev = &dc->nulldrv;
dc->thread = GetCurrentThreadId();
dc->refcount = 1;
......
/*
* DIB driver include file.
*
* Copyright 2011 Huw Davies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
static inline dibdrv_physdev *get_dibdrv_pdev( PHYSDEV dev )
{
return (dibdrv_physdev *)dev;
}
......@@ -79,6 +79,21 @@ typedef struct gdi_physdev
HDC hdc;
} *PHYSDEV;
typedef struct
{
int bit_count, width, height;
int stride; /* stride in bytes. Will be -ve for bottom-up dibs (see bits). */
void *bits; /* points to the top-left corner of the dib. */
DWORD red_mask, green_mask, blue_mask;
} dib_info;
typedef struct dibdrv_physdev
{
struct gdi_physdev dev;
dib_info dib;
} dibdrv_physdev;
typedef struct tagDC_FUNCS
{
INT (CDECL *pAbortDoc)(PHYSDEV);
......@@ -246,6 +261,7 @@ typedef struct tagDC
GDIOBJHDR header;
HDC hSelf; /* Handle to this DC */
struct gdi_physdev nulldrv; /* physdev for the null driver */
struct dibdrv_physdev dibdrv; /* physdev for the dib driver */
PHYSDEV physDev; /* Physical device (driver-specific) */
DWORD thread; /* thread owning the DC */
LONG refcount; /* thread refcount */
......@@ -391,6 +407,7 @@ extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
/* driver.c */
extern const DC_FUNCTIONS null_driver DECLSPEC_HIDDEN;
extern const DC_FUNCTIONS dib_driver DECLSPEC_HIDDEN;
extern const DC_FUNCTIONS *DRIVER_get_display_driver(void) DECLSPEC_HIDDEN;
extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN;
extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN;
......
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