Commit 68b6cca2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Handle metafiles directly in LineTo implementation.

parent 0c82bba7
...@@ -31,4 +31,12 @@ ...@@ -31,4 +31,12 @@
void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN; void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN;
void *get_gdi_client_ptr( HGDIOBJ handle, WORD type ) DECLSPEC_HIDDEN; void *get_gdi_client_ptr( HGDIOBJ handle, WORD type ) DECLSPEC_HIDDEN;
static inline BOOL is_meta_dc( HDC hdc )
{
unsigned int handle = HandleToULong( hdc );
return (handle & NTGDI_HANDLE_TYPE_MASK) >> NTGDI_HANDLE_TYPE_SHIFT == NTGDI_OBJ_METADC;
}
extern BOOL METADC_LineTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
#endif /* __WINE_GDI_PRIVATE_H */ #endif /* __WINE_GDI_PRIVATE_H */
...@@ -31,6 +31,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi); ...@@ -31,6 +31,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi);
BOOL WINAPI LineTo( HDC hdc, INT x, INT y ) BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
{ {
TRACE( "%p, (%d, %d)\n", hdc, x, y ); TRACE( "%p, (%d, %d)\n", hdc, x, y );
if (is_meta_dc( hdc )) return METADC_LineTo( hdc, x, y );
return NtGdiLineTo( hdc, x, y ); return NtGdiLineTo( hdc, x, y );
} }
......
...@@ -39,11 +39,11 @@ BOOL CDECL MFDRV_MoveTo(PHYSDEV dev, INT x, INT y) ...@@ -39,11 +39,11 @@ BOOL CDECL MFDRV_MoveTo(PHYSDEV dev, INT x, INT y)
} }
/*********************************************************************** /***********************************************************************
* MFDRV_LineTo * METADC_LineTo
*/ */
BOOL CDECL MFDRV_LineTo( PHYSDEV dev, INT x, INT y ) BOOL METADC_LineTo( HDC hdc, INT x, INT y )
{ {
return MFDRV_MetaParam2(dev, META_LINETO, x, y); return metadc_param2( hdc, META_LINETO, x, y );
} }
......
...@@ -159,7 +159,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = ...@@ -159,7 +159,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pGradientFill */ NULL, /* pGradientFill */
MFDRV_IntersectClipRect, /* pIntersectClipRect */ MFDRV_IntersectClipRect, /* pIntersectClipRect */
MFDRV_InvertRgn, /* pInvertRgn */ MFDRV_InvertRgn, /* pInvertRgn */
MFDRV_LineTo, /* pLineTo */ NULL, /* pLineTo */
NULL, /* pModifyWorldTransform */ NULL, /* pModifyWorldTransform */
MFDRV_MoveTo, /* pMoveTo */ MFDRV_MoveTo, /* pMoveTo */
MFDRV_OffsetClipRgn, /* pOffsetClipRgn */ MFDRV_OffsetClipRgn, /* pOffsetClipRgn */
...@@ -259,6 +259,7 @@ static DC *MFDRV_AllocMetaFile(void) ...@@ -259,6 +259,7 @@ static DC *MFDRV_AllocMetaFile(void)
} }
push_dc_driver( &dc->physDev, &physDev->dev, &MFDRV_Funcs ); push_dc_driver( &dc->physDev, &physDev->dev, &MFDRV_Funcs );
set_gdi_client_ptr( dc->hSelf, physDev );
physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0])); physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
physDev->handles_size = HANDLE_LIST_INC; physDev->handles_size = HANDLE_LIST_INC;
...@@ -597,3 +598,18 @@ BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2, ...@@ -597,3 +598,18 @@ BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2,
params[7] = param1; params[7] = param1;
return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
static METAFILEDRV_PDEVICE *get_metadc_ptr( HDC hdc )
{
METAFILEDRV_PDEVICE *metafile = get_gdi_client_ptr( hdc, NTGDI_OBJ_METADC );
if (!metafile) SetLastError( ERROR_INVALID_HANDLE );
return metafile;
}
BOOL metadc_param2( HDC hdc, short func, short param1, short param2 )
{
METAFILEDRV_PDEVICE *dev;
if (!(dev = get_metadc_ptr( hdc ))) return FALSE;
return MFDRV_MetaParam2( &dev->dev, func, param1, param2 );
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "ntgdi_private.h" #include "ntgdi_private.h"
#include "gdi_private.h"
/* Metafile driver physical DC */ /* Metafile driver physical DC */
...@@ -58,6 +59,8 @@ extern UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN; ...@@ -58,6 +59,8 @@ extern UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index ) DECLSPEC_HIDDEN; extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index ) DECLSPEC_HIDDEN;
extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) DECLSPEC_HIDDEN; extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) DECLSPEC_HIDDEN;
extern BOOL metadc_param2( HDC hdc, short func, short param1, short param2 ) DECLSPEC_HIDDEN;
/* Metafile driver functions */ /* Metafile driver functions */
extern BOOL CDECL MFDRV_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
...@@ -81,7 +84,6 @@ extern BOOL CDECL MFDRV_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN; ...@@ -81,7 +84,6 @@ extern BOOL CDECL MFDRV_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_MoveTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_MoveTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
......
...@@ -67,6 +67,9 @@ typedef struct _GDI_HANDLE_ENTRY ...@@ -67,6 +67,9 @@ typedef struct _GDI_HANDLE_ENTRY
/* Wine extension, native uses NTGDI_OBJ_DC */ /* Wine extension, native uses NTGDI_OBJ_DC */
#define NTGDI_OBJ_MEMDC 0x41 #define NTGDI_OBJ_MEMDC 0x41
#define NTGDI_HANDLE_TYPE_SHIFT 16
#define NTGDI_HANDLE_TYPE_MASK 0x007f0000
typedef struct _GDI_SHARED_MEMORY typedef struct _GDI_SHARED_MEMORY
{ {
GDI_HANDLE_ENTRY Handles[GDI_MAX_HANDLE_COUNT]; GDI_HANDLE_ENTRY Handles[GDI_MAX_HANDLE_COUNT];
......
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