ReactOS  0.4.14-dev-599-g2d4d3f5
objects.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/wingdi16.h"
#include "mfdrv/metafiledrv.h"
#include "gdi_private.h"
#include "wine/debug.h"
Include dependency graph for objects.c:

Go to the source code of this file.

Macros

#define PALVERSION   0x0300
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (metafile)
 
UINT MFDRV_AddHandle (PHYSDEV dev, HGDIOBJ obj)
 
BOOL MFDRV_RemoveHandle (PHYSDEV dev, UINT index)
 
static INT16 MFDRV_FindObject (PHYSDEV dev, HGDIOBJ obj)
 
BOOL MFDRV_DeleteObject (PHYSDEV dev, HGDIOBJ obj)
 
static BOOL MFDRV_SelectObject (PHYSDEV dev, INT16 index)
 
HBITMAP MFDRV_SelectBitmap (PHYSDEV dev, HBITMAP hbitmap)
 
INT16 MFDRV_CreateBrushIndirect (PHYSDEV dev, HBRUSH hBrush)
 
HBRUSH MFDRV_SelectBrush (PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern)
 
static UINT16 MFDRV_CreateFontIndirect (PHYSDEV dev, HFONT hFont, LOGFONTW *logfont)
 
HFONT MFDRV_SelectFont (PHYSDEV dev, HFONT hfont, UINT *aa_flags)
 
static UINT16 MFDRV_CreatePenIndirect (PHYSDEV dev, HPEN hPen, LOGPEN16 *logpen)
 
HPEN MFDRV_SelectPen (PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern)
 
static BOOL MFDRV_CreatePalette (PHYSDEV dev, HPALETTE hPalette, LOGPALETTE *logPalette, int sizeofPalette)
 
HPALETTE MFDRV_SelectPalette (PHYSDEV dev, HPALETTE hPalette, BOOL bForceBackground)
 
UINT MFDRV_RealizePalette (PHYSDEV dev, HPALETTE hPalette, BOOL dummy)
 

Macro Definition Documentation

◆ PALVERSION

#define PALVERSION   0x0300

Function Documentation

◆ MFDRV_AddHandle()

UINT MFDRV_AddHandle ( PHYSDEV  dev,
HGDIOBJ  obj 
)

Definition at line 39 of file objects.c.

40 {
42  UINT16 index;
43 
44  for(index = 0; index < physDev->handles_size; index++)
45  if(physDev->handles[index] == 0) break;
46  if(index == physDev->handles_size) {
47  physDev->handles_size += HANDLE_LIST_INC;
49  physDev->handles,
50  physDev->handles_size * sizeof(physDev->handles[0]));
51  }
52  physDev->handles[index] = get_full_gdi_handle( obj );
53 
54  physDev->cur_handles++;
55  if(physDev->cur_handles > physDev->mh->mtNoObjects)
56  physDev->mh->mtNoObjects++;
57 
58  return index ; /* index 0 is not reserved for metafiles */
59 }
HGDIOBJ get_full_gdi_handle(HGDIOBJ handle) DECLSPEC_HIDDEN
GLuint index
Definition: glext.h:6031
#define GetProcessHeap()
Definition: compat.h:403
#define index(s, c)
Definition: various.h:29
WORD mtNoObjects
Definition: wingdi.h:2313
#define HeapReAlloc
Definition: compat.h:401
unsigned short UINT16
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HANDLE_LIST_INC
Definition: gdi32p.h:74
METAHEADER * mh
Definition: metafiledrv.h:36

Referenced by MFDRV_CreateBrushIndirect(), MFDRV_CreateFontIndirect(), MFDRV_CreatePalette(), MFDRV_CreatePenIndirect(), and MFDRV_CreateRegion().

◆ MFDRV_CreateBrushIndirect()

INT16 MFDRV_CreateBrushIndirect ( PHYSDEV  dev,
HBRUSH  hBrush 
)

Definition at line 149 of file objects.c.

150 {
151  DWORD size;
152  METARECORD *mr;
153  LOGBRUSH logbrush;
154  BOOL r;
155 
156  if (!GetObjectA( hBrush, sizeof(logbrush), &logbrush )) return -1;
157 
158  switch(logbrush.lbStyle)
159  {
160  case BS_SOLID:
161  case BS_NULL:
162  case BS_HATCHED:
163  {
164  LOGBRUSH16 lb16;
165 
166  lb16.lbStyle = logbrush.lbStyle;
167  lb16.lbColor = logbrush.lbColor;
168  lb16.lbHatch = logbrush.lbHatch;
169  size = sizeof(METARECORD) + sizeof(LOGBRUSH16) - 2;
170  mr = HeapAlloc( GetProcessHeap(), 0, size );
171  mr->rdSize = size / 2;
173  memcpy( mr->rdParm, &lb16, sizeof(LOGBRUSH16));
174  break;
175  }
176  case BS_PATTERN:
177  case BS_DIBPATTERN:
178  {
179 #ifdef __REACTOS__
180  char buffer[sizeof(BITMAPINFO) + 255 * sizeof(RGBQUAD)]; // ros
181 #else
182  char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
183 #endif
184  BITMAPINFO *dst_info, *src_info = (BITMAPINFO *)buffer;
185  DWORD info_size;
186  char *dst_ptr;
187  void *bits;
188  UINT usage;
189 
190  if (!get_brush_bitmap_info( hBrush, src_info, &bits, &usage )) goto done;
191 
192  info_size = get_dib_info_size( src_info, usage );
193  size = FIELD_OFFSET( METARECORD, rdParm[2] ) + info_size + src_info->bmiHeader.biSizeImage;
194 
195  if (!(mr = HeapAlloc( GetProcessHeap(), 0, size ))) goto done;
197  mr->rdSize = size / 2;
198  mr->rdParm[0] = logbrush.lbStyle;
199  mr->rdParm[1] = usage;
200  dst_info = (BITMAPINFO *)(mr->rdParm + 2);
201  memcpy( dst_info, src_info, info_size );
202  if (dst_info->bmiHeader.biClrUsed == 1 << dst_info->bmiHeader.biBitCount)
203  dst_info->bmiHeader.biClrUsed = 0;
204  dst_ptr = (char *)dst_info + info_size;
205 
206  /* always return a bottom-up DIB */
207  if (dst_info->bmiHeader.biHeight < 0)
208  {
209  int i, width_bytes = get_dib_stride( dst_info->bmiHeader.biWidth,
210  dst_info->bmiHeader.biBitCount );
211  dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight;
212  dst_ptr += (dst_info->bmiHeader.biHeight - 1) * width_bytes;
213  for (i = 0; i < dst_info->bmiHeader.biHeight; i++, dst_ptr -= width_bytes)
214  memcpy( dst_ptr, (char *)bits + i * width_bytes, width_bytes );
215  }
216  else memcpy( dst_ptr, bits, src_info->bmiHeader.biSizeImage );
217  break;
218  }
219 
220  default:
221  FIXME("Unknown brush style %x\n", logbrush.lbStyle);
222  return 0;
223  }
224  r = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
225  HeapFree(GetProcessHeap(), 0, mr);
226  if( !r )
227  return -1;
228 done:
229  return MFDRV_AddHandle( dev, hBrush );
230 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
INT16 lbHatch
Definition: wingdi16.h:34
#define BS_DIBPATTERN
Definition: wingdi.h:1091
#define META_CREATEBRUSHINDIRECT
Definition: wingdi.h:276
UINT16 lbStyle
Definition: wingdi16.h:32
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
UINT lbStyle
Definition: wingdi.h:1746
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
ULONG_PTR lbHatch
Definition: wingdi.h:1748
WORD rdFunction
Definition: wingdi.h:2345
GLuint buffer
Definition: glext.h:5915
BOOL get_brush_bitmap_info(HBRUSH handle, BITMAPINFO *info, void **bits, UINT *usage) DECLSPEC_HIDDEN
struct tagMETARECORD METARECORD
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
DWORD rdSize
Definition: wingdi.h:2344
#define BS_NULL
Definition: wingdi.h:1086
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
static int get_dib_stride(int width, int bpp)
Definition: imagelist.c:198
#define FIXME(fmt,...)
Definition: debug.h:110
UINT MFDRV_AddHandle(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:39
#define META_DIBCREATEPATTERNBRUSH
Definition: wingdi.h:268
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
COLORREF lbColor
Definition: wingdi.h:1747
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
static UINT width_bytes(UINT width, UINT bpp)
Definition: tiffformat.c:847
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WORD rdParm[1]
Definition: wingdi.h:2346
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int UINT
Definition: ndis.h:50
#define BS_PATTERN
Definition: wingdi.h:1089
static int get_dib_info_size(const BITMAPINFO *info, UINT coloruse)
Definition: gdi_private.h:180
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475
COLORREF lbColor
Definition: wingdi16.h:33
#define BS_HATCHED
Definition: wingdi.h:1088
#define BS_SOLID
Definition: wingdi.h:1085
#define HeapFree(x, y, z)
Definition: compat.h:402
struct tagBITMAPINFO BITMAPINFO

Referenced by MFDRV_FillRgn(), MFDRV_FrameRgn(), and MFDRV_SelectBrush().

◆ MFDRV_CreateFontIndirect()

static UINT16 MFDRV_CreateFontIndirect ( PHYSDEV  dev,
HFONT  hFont,
LOGFONTW logfont 
)
static

Definition at line 255 of file objects.c.

256 {
257  char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)];
258  METARECORD *mr = (METARECORD *)&buffer;
259  LOGFONT16 *font16;
260  INT written;
261 
262  mr->rdSize = (sizeof(METARECORD) + sizeof(LOGFONT16) - 2) / 2;
264  font16 = (LOGFONT16 *)&mr->rdParm;
265 
266  font16->lfHeight = logfont->lfHeight;
267  font16->lfWidth = logfont->lfWidth;
268  font16->lfEscapement = logfont->lfEscapement;
269  font16->lfOrientation = logfont->lfOrientation;
270  font16->lfWeight = logfont->lfWeight;
271  font16->lfItalic = logfont->lfItalic;
272  font16->lfUnderline = logfont->lfUnderline;
273  font16->lfStrikeOut = logfont->lfStrikeOut;
274  font16->lfCharSet = logfont->lfCharSet;
275  font16->lfOutPrecision = logfont->lfOutPrecision;
276  font16->lfClipPrecision = logfont->lfClipPrecision;
277  font16->lfQuality = logfont->lfQuality;
278  font16->lfPitchAndFamily = logfont->lfPitchAndFamily;
279  written = WideCharToMultiByte( CP_ACP, 0, logfont->lfFaceName, -1, font16->lfFaceName, LF_FACESIZE - 1, NULL, NULL );
280  /* Zero pad the facename buffer, so that we don't write uninitialized data to disk */
281  memset(font16->lfFaceName + written, 0, LF_FACESIZE - written);
282 
283  if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * 2)))
284  return 0;
285  return MFDRV_AddHandle( dev, hFont );
286 }
INT16 lfEscapement
Definition: sysparams.c:505
#define LF_FACESIZE
Definition: dimm.idl:39
BYTE lfPitchAndFamily
Definition: dimm.idl:71
BYTE lfUnderline
Definition: sysparams.c:509
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfClipPrecision
Definition: dimm.idl:69
WORD rdFunction
Definition: wingdi.h:2345
GLuint buffer
Definition: glext.h:5915
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfOutPrecision
Definition: sysparams.c:512
CHAR lfFaceName[LF_FACESIZE]
Definition: sysparams.c:516
struct tagMETARECORD METARECORD
int32_t INT
Definition: typedefs.h:56
DWORD rdSize
Definition: wingdi.h:2344
INT16 lfWidth
Definition: sysparams.c:504
HFONT hFont
Definition: main.c:53
LONG lfOrientation
Definition: dimm.idl:62
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
BYTE lfStrikeOut
Definition: sysparams.c:510
BYTE lfOutPrecision
Definition: dimm.idl:68
BYTE lfClipPrecision
Definition: sysparams.c:513
UINT MFDRV_AddHandle(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:39
INT16 lfWeight
Definition: sysparams.c:507
BYTE lfQuality
Definition: sysparams.c:514
BYTE lfQuality
Definition: dimm.idl:70
WORD rdParm[1]
Definition: wingdi.h:2346
INT16 lfOrientation
Definition: sysparams.c:506
BYTE lfStrikeOut
Definition: dimm.idl:66
#define META_CREATEFONTINDIRECT
Definition: wingdi.h:275
BYTE lfPitchAndFamily
Definition: sysparams.c:515
BYTE lfItalic
Definition: dimm.idl:64
BYTE lfItalic
Definition: sysparams.c:508
INT16 lfHeight
Definition: sysparams.c:503
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475
LONG lfWeight
Definition: dimm.idl:63
BYTE lfCharSet
Definition: sysparams.c:511
BYTE lfUnderline
Definition: dimm.idl:65
#define memset(x, y, z)
Definition: compat.h:39

Referenced by MFDRV_SelectFont().

◆ MFDRV_CreatePalette()

static BOOL MFDRV_CreatePalette ( PHYSDEV  dev,
HPALETTE  hPalette,
LOGPALETTE logPalette,
int  sizeofPalette 
)
static

Definition at line 380 of file objects.c.

381 {
382  int index;
383  BOOL ret;
384  METARECORD *mr;
385 
386  mr = HeapAlloc( GetProcessHeap(), 0, sizeof(METARECORD) + sizeofPalette - sizeof(WORD) );
387  mr->rdSize = (sizeof(METARECORD) + sizeofPalette - sizeof(WORD)) / sizeof(WORD);
389  memcpy(&(mr->rdParm), logPalette, sizeofPalette);
390  if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * sizeof(WORD))))
391  {
392  HeapFree(GetProcessHeap(), 0, mr);
393  return FALSE;
394  }
395 
396  mr->rdSize = sizeof(METARECORD) / sizeof(WORD);
398 
399  if ((index = MFDRV_AddHandle( dev, hPalette )) == -1) ret = FALSE;
400  else
401  {
402  *(mr->rdParm) = index;
403  ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * sizeof(WORD));
404  }
405  HeapFree(GetProcessHeap(), 0, mr);
406  return ret;
407 }
WORD rdFunction
Definition: wingdi.h:2345
struct tagMETARECORD METARECORD
DWORD rdSize
Definition: wingdi.h:2344
#define META_CREATEPALETTE
Definition: wingdi.h:272
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
UINT MFDRV_AddHandle(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:39
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define META_SELECTPALETTE
Definition: wingdi.h:260
unsigned short WORD
Definition: ntddk_ex.h:93
int ret
#define index(s, c)
Definition: various.h:29
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WORD rdParm[1]
Definition: wingdi.h:2346
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by MFDRV_SelectPalette().

◆ MFDRV_CreatePenIndirect()

static UINT16 MFDRV_CreatePenIndirect ( PHYSDEV  dev,
HPEN  hPen,
LOGPEN16 logpen 
)
static

Definition at line 314 of file objects.c.

315 {
316  char buffer[sizeof(METARECORD) - 2 + sizeof(*logpen)];
317  METARECORD *mr = (METARECORD *)&buffer;
318 
319  mr->rdSize = (sizeof(METARECORD) + sizeof(*logpen) - 2) / 2;
321  memcpy(&(mr->rdParm), logpen, sizeof(*logpen));
322  if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * 2)))
323  return 0;
324  return MFDRV_AddHandle( dev, hPen );
325 }
WORD rdFunction
Definition: wingdi.h:2345
GLuint buffer
Definition: glext.h:5915
struct tagMETARECORD METARECORD
DWORD rdSize
Definition: wingdi.h:2344
UINT MFDRV_AddHandle(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:39
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WORD rdParm[1]
Definition: wingdi.h:2346
#define META_CREATEPENINDIRECT
Definition: wingdi.h:274
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475

Referenced by MFDRV_SelectPen().

◆ MFDRV_DeleteObject()

BOOL MFDRV_DeleteObject ( PHYSDEV  dev,
HGDIOBJ  obj 
)

Definition at line 98 of file objects.c.

99 {
100  METARECORD mr;
102  INT16 index;
103  BOOL ret = TRUE;
104 
106  if( index < 0 )
107  return FALSE;
108 
109  mr.rdSize = sizeof mr / 2;
111  mr.rdParm[0] = index;
112 
113  if(!MFDRV_WriteRecord( dev, &mr, mr.rdSize*2 ))
114  ret = FALSE;
115 
116  physDev->handles[index] = 0;
117  physDev->cur_handles--;
118  return ret;
119 }
#define TRUE
Definition: types.h:120
WORD rdFunction
Definition: wingdi.h:2345
DWORD rdSize
Definition: wingdi.h:2344
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
int ret
#define index(s, c)
Definition: various.h:29
static INT16 MFDRV_FindObject(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:81
WORD rdParm[1]
Definition: wingdi.h:2346
#define META_DELETEOBJECT
Definition: wingdi.h:271
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475
signed short INT16

Referenced by DeleteObject().

◆ MFDRV_FindObject()

static INT16 MFDRV_FindObject ( PHYSDEV  dev,
HGDIOBJ  obj 
)
static

Definition at line 81 of file objects.c.

82 {
84  INT16 index;
85 
86  for(index = 0; index < physDev->handles_size; index++)
87  if(physDev->handles[index] == obj) break;
88 
89  if(index == physDev->handles_size) return -1;
90 
91  return index ;
92 }
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
signed short INT16

Referenced by MFDRV_DeleteObject(), MFDRV_SelectBrush(), MFDRV_SelectFont(), and MFDRV_SelectPen().

◆ MFDRV_RealizePalette()

UINT MFDRV_RealizePalette ( PHYSDEV  dev,
HPALETTE  hPalette,
BOOL  dummy 
)

Definition at line 449 of file objects.c.

450 {
451  char buffer[sizeof(METARECORD) - sizeof(WORD)];
452  METARECORD *mr = (METARECORD *)&buffer;
453 
454  mr->rdSize = (sizeof(METARECORD) - sizeof(WORD)) / sizeof(WORD);
456 
457  if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * sizeof(WORD)))) return 0;
458 
459  /* The return value is suppose to be the number of entries
460  in the logical palette mapped to the system palette or 0
461  if the function failed. Since it's not trivial here to
462  get that kind of information and since it's of little
463  use in the case of metafiles, we'll always return 1. */
464  return 1;
465 }
WORD rdFunction
Definition: wingdi.h:2345
GLuint buffer
Definition: glext.h:5915
#define META_REALIZEPALETTE
Definition: wingdi.h:261
struct tagMETARECORD METARECORD
DWORD rdSize
Definition: wingdi.h:2344
unsigned short WORD
Definition: ntddk_ex.h:93
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475

◆ MFDRV_RemoveHandle()

BOOL MFDRV_RemoveHandle ( PHYSDEV  dev,
UINT  index 
)

Definition at line 64 of file objects.c.

65 {
67  BOOL ret = FALSE;
68 
69  if (index < physDev->handles_size && physDev->handles[index])
70  {
71  physDev->handles[index] = 0;
72  physDev->cur_handles--;
73  ret = TRUE;
74  }
75  return ret;
76 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
int ret
#define index(s, c)
Definition: various.h:29

Referenced by MFDRV_ExtSelectClipRgn().

◆ MFDRV_SelectBitmap()

HBITMAP MFDRV_SelectBitmap ( PHYSDEV  dev,
HBITMAP  hbitmap 
)

Definition at line 140 of file objects.c.

141 {
142  return 0;
143 }

◆ MFDRV_SelectBrush()

HBRUSH MFDRV_SelectBrush ( PHYSDEV  dev,
HBRUSH  hbrush,
const struct brush_pattern pattern 
)

Definition at line 236 of file objects.c.

237 {
238  INT16 index;
239 
241  if( index < 0 )
242  {
244  if( index < 0 )
245  return 0;
247  }
248  return MFDRV_SelectObject( dev, index ) ? hbrush : 0;
249 }
static HBRUSH hbrush
static BOOL MFDRV_SelectObject(PHYSDEV dev, INT16 index)
Definition: objects.c:125
GLuint index
Definition: glext.h:6031
INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush)
Definition: objects.c:149
#define index(s, c)
Definition: various.h:29
static INT16 MFDRV_FindObject(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:81
void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:416
signed short INT16

◆ MFDRV_SelectFont()

HFONT MFDRV_SelectFont ( PHYSDEV  dev,
HFONT  hfont,
UINT aa_flags 
)

Definition at line 292 of file objects.c.

293 {
294  LOGFONTW font;
295  INT16 index;
296 
297  *aa_flags = GGO_BITMAP; /* no point in anti-aliasing on metafiles */
299  if( index < 0 )
300  {
301  if (!GetObjectW( hfont, sizeof(font), &font ))
302  return 0;
304  if( index < 0 )
305  return 0;
307  }
308  return MFDRV_SelectObject( dev, index ) ? hfont : 0;
309 }
Definition: mk_font.cpp:20
#define GGO_BITMAP
Definition: wingdi.h:848
static BOOL MFDRV_SelectObject(PHYSDEV dev, INT16 index)
Definition: objects.c:125
GLuint index
Definition: glext.h:6031
static HFONT hfont
static UINT16 MFDRV_CreateFontIndirect(PHYSDEV dev, HFONT hFont, LOGFONTW *logfont)
Definition: objects.c:255
#define index(s, c)
Definition: various.h:29
static INT16 MFDRV_FindObject(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:81
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:416
signed short INT16

◆ MFDRV_SelectObject()

static BOOL MFDRV_SelectObject ( PHYSDEV  dev,
INT16  index 
)
static

Definition at line 125 of file objects.c.

126 {
127  METARECORD mr;
128 
129  mr.rdSize = sizeof mr / 2;
131  mr.rdParm[0] = index;
132 
133  return MFDRV_WriteRecord( dev, &mr, mr.rdSize*2 );
134 }
WORD rdFunction
Definition: wingdi.h:2345
DWORD rdSize
Definition: wingdi.h:2344
#define index(s, c)
Definition: various.h:29
WORD rdParm[1]
Definition: wingdi.h:2346
#define META_SELECTOBJECT
Definition: wingdi.h:254
BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen)
Definition: init.c:475

Referenced by MFDRV_SelectBrush(), MFDRV_SelectFont(), and MFDRV_SelectPen().

◆ MFDRV_SelectPalette()

HPALETTE MFDRV_SelectPalette ( PHYSDEV  dev,
HPALETTE  hPalette,
BOOL  bForceBackground 
)

Definition at line 413 of file objects.c.

414 {
415 #define PALVERSION 0x0300
416 
417  PLOGPALETTE logPalette;
418  WORD wNumEntries = 0;
419  BOOL creationSucceed;
420  int sizeofPalette;
421 
422  GetObjectA(hPalette, sizeof(WORD), &wNumEntries);
423 
424  if (wNumEntries == 0) return 0;
425 
426  sizeofPalette = sizeof(LOGPALETTE) + ((wNumEntries-1) * sizeof(PALETTEENTRY));
427  logPalette = HeapAlloc( GetProcessHeap(), 0, sizeofPalette );
428 
429  if (logPalette == NULL) return 0;
430 
431  logPalette->palVersion = PALVERSION;
432  logPalette->palNumEntries = wNumEntries;
433 
434  GetPaletteEntries(hPalette, 0, wNumEntries, logPalette->palPalEntry);
435 
436  creationSucceed = MFDRV_CreatePalette( dev, hPalette, logPalette, sizeofPalette );
437 
438  HeapFree( GetProcessHeap(), 0, logPalette );
439 
440  if (creationSucceed)
441  return hPalette;
442 
443  return 0;
444 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
WORD palVersion
Definition: wingdi.h:1832
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PALVERSION
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned short WORD
Definition: ntddk_ex.h:93
static BOOL MFDRV_CreatePalette(PHYSDEV dev, HPALETTE hPalette, LOGPALETTE *logPalette, int sizeofPalette)
Definition: objects.c:380
struct tagLOGPALETTE LOGPALETTE
struct tagPALETTEENTRY PALETTEENTRY
WORD palNumEntries
Definition: wingdi.h:1833
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ MFDRV_SelectPen()

HPEN MFDRV_SelectPen ( PHYSDEV  dev,
HPEN  hpen,
const struct brush_pattern pattern 
)

Definition at line 331 of file objects.c.

332 {
333  LOGPEN16 logpen;
334  INT16 index;
335 
337  if( index < 0 )
338  {
339  /* must be an extended pen */
340  INT size = GetObjectW( hpen, 0, NULL );
341 
342  if (!size) return 0;
343 
344  if (size == sizeof(LOGPEN))
345  {
346  LOGPEN pen;
347 
348  GetObjectW( hpen, sizeof(pen), &pen );
349  logpen.lopnStyle = pen.lopnStyle;
350  logpen.lopnWidth.x = pen.lopnWidth.x;
351  logpen.lopnWidth.y = pen.lopnWidth.y;
352  logpen.lopnColor = pen.lopnColor;
353  }
354  else /* must be an extended pen */
355  {
356  EXTLOGPEN *elp = HeapAlloc( GetProcessHeap(), 0, size );
357 
358  GetObjectW( hpen, size, elp );
359  /* FIXME: add support for user style pens */
360  logpen.lopnStyle = elp->elpPenStyle;
361  logpen.lopnWidth.x = elp->elpWidth;
362  logpen.lopnWidth.y = 0;
363  logpen.lopnColor = elp->elpColor;
364 
365  HeapFree( GetProcessHeap(), 0, elp );
366  }
367 
368  index = MFDRV_CreatePenIndirect( dev, hpen, &logpen );
369  if( index < 0 )
370  return 0;
372  }
373  return MFDRV_SelectObject( dev, index ) ? hpen : 0;
374 }
COLORREF elpColor
Definition: wingdi.h:1944
long y
Definition: polytest.cpp:48
DWORD elpWidth
Definition: wingdi.h:1942
long x
Definition: polytest.cpp:48
UINT16 lopnStyle
Definition: wingdi16.h:65
POINT lopnWidth
Definition: wingdi.h:1845
INT16 x
Definition: windef16.h:135
static HPEN hpen
int32_t INT
Definition: typedefs.h:56
DWORD elpPenStyle
Definition: wingdi.h:1941
UINT lopnStyle
Definition: wingdi.h:1844
static BOOL MFDRV_SelectObject(PHYSDEV dev, INT16 index)
Definition: objects.c:125
COLORREF lopnColor
Definition: wingdi.h:1846
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
INT16 y
Definition: windef16.h:136
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define index(s, c)
Definition: various.h:29
static INT16 MFDRV_FindObject(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:81
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:416
static UINT16 MFDRV_CreatePenIndirect(PHYSDEV dev, HPEN hPen, LOGPEN16 *logpen)
Definition: objects.c:314
COLORREF lopnColor
Definition: wingdi16.h:67
POINT16 lopnWidth
Definition: wingdi16.h:66
#define HeapFree(x, y, z)
Definition: compat.h:402
signed short INT16

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( metafile  )