ReactOS 0.4.15-dev-8109-gd7be748
objects.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "enhmfdrv/enhmetafiledrv.h"
#include "gdi_private.h"
#include "wine/debug.h"
Include dependency graph for objects.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (enhmetafile)
 
static UINT EMFDRV_AddHandle (PHYSDEV dev, HGDIOBJ obj)
 
static UINT EMFDRV_FindObject (PHYSDEV dev, HGDIOBJ obj)
 
BOOL EMFDRV_DeleteObject (PHYSDEV dev, HGDIOBJ obj)
 
HBITMAP EMFDRV_SelectBitmap (PHYSDEV dev, HBITMAP hbitmap)
 
DWORD EMFDRV_CreateBrushIndirect (PHYSDEV dev, HBRUSH hBrush)
 
HBRUSH EMFDRV_SelectBrush (PHYSDEV dev, HBRUSH hBrush, const struct brush_pattern *pattern)
 
static BOOL EMFDRV_CreateFontIndirect (PHYSDEV dev, HFONT hFont)
 
HFONT EMFDRV_SelectFont (PHYSDEV dev, HFONT hFont, UINT *aa_flags)
 
static DWORD EMFDRV_CreatePenIndirect (PHYSDEV dev, HPEN hPen)
 
HPEN EMFDRV_SelectPen (PHYSDEV dev, HPEN hPen, const struct brush_pattern *pattern)
 
static DWORD EMFDRV_CreatePalette (PHYSDEV dev, HPALETTE hPal)
 
HPALETTE EMFDRV_SelectPalette (PHYSDEV dev, HPALETTE hPal, BOOL force)
 
COLORREF EMFDRV_SetDCBrushColor (PHYSDEV dev, COLORREF color)
 
COLORREF EMFDRV_SetDCPenColor (PHYSDEV dev, COLORREF color)
 
BOOL EMFDRV_GdiComment (PHYSDEV dev, UINT bytes, const BYTE *buffer)
 

Function Documentation

◆ EMFDRV_AddHandle()

static UINT EMFDRV_AddHandle ( PHYSDEV  dev,
HGDIOBJ  obj 
)
static

Definition at line 35 of file objects.c.

36{
38 UINT index;
39
40 for(index = 0; index < physDev->handles_size; index++)
41 if(physDev->handles[index] == 0) break;
42 if(index == physDev->handles_size) {
43 physDev->handles_size += HANDLE_LIST_INC;
45 physDev->handles,
46 physDev->handles_size * sizeof(physDev->handles[0]));
47 }
48 physDev->handles[index] = get_full_gdi_handle( obj );
49
50 physDev->cur_handles++;
51 if(physDev->cur_handles > physDev->emh->nHandles)
52 physDev->emh->nHandles++;
53
54 return index + 1; /* index 0 is reserved for the hmf, so we increment everything by 1 */
55}
#define index(s, c)
Definition: various.h:29
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
#define HANDLE_LIST_INC
Definition: gdi32p.h:74
#define get_full_gdi_handle
Definition: gdi_private.h:229
GLuint index
Definition: glext.h:6031
unsigned int UINT
Definition: ndis.h:50
HGDIOBJ * handles
ENHMETAHEADER * emh

Referenced by EMFDRV_CreateBrushIndirect(), EMFDRV_CreateFontIndirect(), EMFDRV_CreatePalette(), and EMFDRV_CreatePenIndirect().

◆ EMFDRV_CreateBrushIndirect()

DWORD EMFDRV_CreateBrushIndirect ( PHYSDEV  dev,
HBRUSH  hBrush 
)

Definition at line 111 of file objects.c.

112{
113 DWORD index = 0;
114 LOGBRUSH logbrush;
115
116 if (!GetObjectA( hBrush, sizeof(logbrush), &logbrush )) return 0;
117
118 switch (logbrush.lbStyle) {
119 case BS_SOLID:
120 case BS_HATCHED:
121 case BS_NULL:
122 {
125 emr.emr.nSize = sizeof(emr);
126 emr.ihBrush = index = EMFDRV_AddHandle( dev, hBrush );
127 emr.lb.lbStyle = logbrush.lbStyle;
128 emr.lb.lbColor = logbrush.lbColor;
129 emr.lb.lbHatch = logbrush.lbHatch;
130
131 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
132 index = 0;
133 }
134 break;
135 case BS_PATTERN:
136 case BS_DIBPATTERN:
137 {
139#ifdef __REACTOS__
140 char buffer[sizeof(BITMAPINFO) + 255 * sizeof(RGBQUAD)]; // ros
141#else
142 char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
143#endif
145 DWORD info_size;
146 void *bits;
147 UINT usage;
148
149 if (!get_brush_bitmap_info( hBrush, info, &bits, &usage )) break;
150 info_size = get_dib_info_size( info, usage );
151
152 emr = HeapAlloc( GetProcessHeap(), 0,
153 sizeof(EMRCREATEDIBPATTERNBRUSHPT)+info_size+info->bmiHeader.biSizeImage );
154 if(!emr) break;
155
156 if (logbrush.lbStyle == BS_PATTERN && info->bmiHeader.biBitCount == 1)
157 {
158 /* Presumably to reduce the size of the written EMF, MS supports an
159 * undocumented iUsage value of 2, indicating a mono bitmap without the
160 * 8 byte 2 entry black/white palette. Stupidly, they could have saved
161 * over 20 bytes more by also ignoring the BITMAPINFO fields that are
162 * irrelevant/constant for monochrome bitmaps.
163 * FIXME: It may be that the DIB functions themselves accept this value.
164 */
167 /* FIXME: There is an extra DWORD written by native before the BMI.
168 * Not sure what it's meant to contain.
169 */
170 emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT ) + sizeof(DWORD);
171 emr->cbBmi = sizeof( BITMAPINFOHEADER );
172 }
173 else
174 {
176 emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT );
177 emr->cbBmi = info_size;
178 }
179 emr->ihBrush = index = EMFDRV_AddHandle( dev, hBrush );
180 emr->iUsage = usage;
181 emr->offBits = emr->offBmi + emr->cbBmi;
182 emr->cbBits = info->bmiHeader.biSizeImage;
183 emr->emr.nSize = emr->offBits + emr->cbBits;
184
185 memcpy( (BYTE *)emr + emr->offBmi, info, emr->cbBmi );
186 memcpy( (BYTE *)emr + emr->offBits, bits, emr->cbBits );
187
188 if(!EMFDRV_WriteRecord( dev, &emr->emr ))
189 index = 0;
190 HeapFree( GetProcessHeap(), 0, emr );
191 }
192 break;
193
194 default:
195 FIXME("Unknown style %x\n", logbrush.lbStyle);
196 break;
197 }
198 return index;
199}
#define FIXME(fmt,...)
Definition: debug.h:114
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
ULONG RGBQUAD
Definition: precomp.h:59
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
static UINT EMFDRV_AddHandle(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:35
unsigned long DWORD
Definition: ntddk_ex.h:95
static int get_dib_info_size(const BITMAPINFO *info, UINT coloruse)
Definition: gdi_private.h:212
BOOL get_brush_bitmap_info(HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage) DECLSPEC_HIDDEN
#define DIB_PAL_MONO
Definition: gdi_private.h:196
GLuint buffer
Definition: glext.h:5915
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define bits
Definition: infblock.c:15
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD iType
Definition: wingdi.h:1690
DWORD nSize
Definition: wingdi.h:1691
ULONG lbHatch
Definition: wingdi.h:1755
UINT lbStyle
Definition: wingdi.h:1753
COLORREF lbColor
Definition: wingdi.h:1754
UINT lbStyle
Definition: wingdi.h:1747
ULONG_PTR lbHatch
Definition: wingdi.h:1749
COLORREF lbColor
Definition: wingdi.h:1748
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define BS_HATCHED
Definition: wingdi.h:1089
#define BS_PATTERN
Definition: wingdi.h:1090
#define EMR_CREATEMONOBRUSH
Definition: wingdi.h:166
#define BS_DIBPATTERN
Definition: wingdi.h:1092
struct tagBITMAPINFO BITMAPINFO
#define BS_NULL
Definition: wingdi.h:1087
struct tagEMRCREATEDIBPATTERNBRUSHPT EMRCREATEDIBPATTERNBRUSHPT
#define EMR_CREATEDIBPATTERNBRUSHPT
Definition: wingdi.h:167
#define EMR_CREATEBRUSHINDIRECT
Definition: wingdi.h:113
#define BS_SOLID
Definition: wingdi.h:1086
unsigned char BYTE
Definition: xxhash.c:193

Referenced by EMFDRV_FillRgn(), EMFDRV_FrameRgn(), EMFDRV_SelectBrush(), and EMFDRV_SetDCBrushColor().

◆ EMFDRV_CreateFontIndirect()

static BOOL EMFDRV_CreateFontIndirect ( PHYSDEV  dev,
HFONT  hFont 
)
static

Definition at line 244 of file objects.c.

245{
246 DWORD index = 0;
248 int i;
249
250 if (!GetObjectW( hFont, sizeof(emr.elfw.elfLogFont), &emr.elfw.elfLogFont )) return FALSE;
251
253 emr.emr.nSize = (sizeof(emr) + 3) / 4 * 4;
255 emr.elfw.elfFullName[0] = '\0';
256 emr.elfw.elfStyle[0] = '\0';
257 emr.elfw.elfVersion = 0;
258 emr.elfw.elfStyleSize = 0;
259 emr.elfw.elfMatch = 0;
260 emr.elfw.elfReserved = 0;
261 for(i = 0; i < ELF_VENDOR_SIZE; i++)
262 emr.elfw.elfVendorId[i] = 0;
274
275 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
276 index = 0;
277 return index;
278}
HFONT hFont
Definition: main.c:53
#define FALSE
Definition: types.h:117
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
DWORD elfStyleSize
Definition: wingdi.h:1929
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:1926
BYTE elfVendorId[ELF_VENDOR_SIZE]
Definition: wingdi.h:1932
PANOSE elfPanose
Definition: wingdi.h:1934
LOGFONTW elfLogFont
Definition: wingdi.h:1925
DWORD elfCulture
Definition: wingdi.h:1933
DWORD elfVersion
Definition: wingdi.h:1928
DWORD elfMatch
Definition: wingdi.h:1930
DWORD elfReserved
Definition: wingdi.h:1931
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:1927
BYTE bMidline
Definition: wingdi.h:1877
BYTE bSerifStyle
Definition: wingdi.h:1870
BYTE bContrast
Definition: wingdi.h:1873
BYTE bArmStyle
Definition: wingdi.h:1875
BYTE bProportion
Definition: wingdi.h:1872
BYTE bWeight
Definition: wingdi.h:1871
BYTE bXHeight
Definition: wingdi.h:1878
BYTE bLetterform
Definition: wingdi.h:1876
BYTE bFamilyType
Definition: wingdi.h:1869
BYTE bStrokeVariation
Definition: wingdi.h:1874
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define PAN_NO_FIT
Definition: wingdi.h:466
#define EMR_EXTCREATEFONTINDIRECTW
Definition: wingdi.h:155
#define PAN_CULTURE_LATIN
Definition: wingdi.h:464
#define ELF_VENDOR_SIZE
Definition: wingdi.h:293

Referenced by EMFDRV_SelectFont().

◆ EMFDRV_CreatePalette()

static DWORD EMFDRV_CreatePalette ( PHYSDEV  dev,
HPALETTE  hPal 
)
static

Definition at line 409 of file objects.c.

410{
411 WORD i;
412 struct {
414 PALETTEENTRY entry[255];
415 } pal;
416
417 memset( &pal, 0, sizeof(pal) );
418
419 if (!GetObjectW( hPal, sizeof(pal.hdr.lgpl) + sizeof(pal.entry), &pal.hdr.lgpl ))
420 return 0;
421
422 for (i = 0; i < pal.hdr.lgpl.palNumEntries; i++)
423 pal.hdr.lgpl.palPalEntry[i].peFlags = 0;
424
425 pal.hdr.emr.iType = EMR_CREATEPALETTE;
426 pal.hdr.emr.nSize = sizeof(pal.hdr) + pal.hdr.lgpl.palNumEntries * sizeof(PALETTEENTRY);
427 pal.hdr.ihPal = EMFDRV_AddHandle( dev, hPal );
428
429 if (!EMFDRV_WriteRecord( dev, &pal.hdr.emr ))
430 pal.hdr.ihPal = 0;
431 return pal.hdr.ihPal;
432}
unsigned short WORD
Definition: ntddk_ex.h:93
char hdr[14]
Definition: iptest.cpp:33
uint32_t entry
Definition: isohybrid.c:63
#define memset(x, y, z)
Definition: compat.h:39
#define EMR_CREATEPALETTE
Definition: wingdi.h:123
struct tagPALETTEENTRY PALETTEENTRY

Referenced by EMFDRV_SelectPalette().

◆ EMFDRV_CreatePenIndirect()

static DWORD EMFDRV_CreatePenIndirect ( PHYSDEV  dev,
HPEN  hPen 
)
static

Definition at line 332 of file objects.c.

333{
334 EMRCREATEPEN emr;
335 DWORD index = 0;
336
337 if (!GetObjectW( hPen, sizeof(emr.lopn), &emr.lopn ))
338 {
339 /* must be an extended pen */
340 EXTLOGPEN *elp;
341 INT size = GetObjectW( hPen, 0, NULL );
342
343 if (!size) return 0;
344
345 elp = HeapAlloc( GetProcessHeap(), 0, size );
346
347 GetObjectW( hPen, size, elp );
348 /* FIXME: add support for user style pens */
349 emr.lopn.lopnStyle = elp->elpPenStyle;
350 emr.lopn.lopnWidth.x = elp->elpWidth;
351 emr.lopn.lopnWidth.y = 0;
352 emr.lopn.lopnColor = elp->elpColor;
353
354 HeapFree( GetProcessHeap(), 0, elp );
355 }
356
357 emr.emr.iType = EMR_CREATEPEN;
358 emr.emr.nSize = sizeof(emr);
359 emr.ihPen = index = EMFDRV_AddHandle( dev, hPen );
360
361 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
362 index = 0;
363 return index;
364}
#define NULL
Definition: types.h:112
GLsizeiptr size
Definition: glext.h:5919
LOGPEN lopn
Definition: wingdi.h:1852
DWORD elpWidth
Definition: wingdi.h:1943
DWORD elpPenStyle
Definition: wingdi.h:1942
COLORREF elpColor
Definition: wingdi.h:1945
COLORREF lopnColor
Definition: wingdi.h:1847
POINT lopnWidth
Definition: wingdi.h:1846
UINT lopnStyle
Definition: wingdi.h:1845
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
int32_t INT
Definition: typedefs.h:58
#define EMR_CREATEPEN
Definition: wingdi.h:112

Referenced by EMFDRV_SelectPen(), and EMFDRV_SetDCPenColor().

◆ EMFDRV_DeleteObject()

BOOL EMFDRV_DeleteObject ( PHYSDEV  dev,
HGDIOBJ  obj 
)

Definition at line 77 of file objects.c.

78{
81 UINT index;
82 BOOL ret = TRUE;
83
84 if(!(index = EMFDRV_FindObject(dev, obj))) return FALSE;
85
87 emr.emr.nSize = sizeof(emr);
88 emr.ihObject = index;
89
90 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
91 ret = FALSE;
92
93 physDev->handles[index - 1] = 0;
94 physDev->cur_handles--;
95 return ret;
96}
#define TRUE
Definition: types.h:120
static UINT EMFDRV_FindObject(PHYSDEV dev, HGDIOBJ obj)
Definition: objects.c:60
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
#define EMR_DELETEOBJECT
Definition: wingdi.h:114

◆ EMFDRV_FindObject()

static UINT EMFDRV_FindObject ( PHYSDEV  dev,
HGDIOBJ  obj 
)
static

Definition at line 60 of file objects.c.

61{
63 UINT index;
64
65 for(index = 0; index < physDev->handles_size; index++)
66 if(physDev->handles[index] == obj) break;
67
68 if(index == physDev->handles_size) return 0;
69
70 return index + 1;
71}

Referenced by EMFDRV_DeleteObject(), EMFDRV_SelectBrush(), EMFDRV_SelectFont(), EMFDRV_SelectPalette(), and EMFDRV_SelectPen().

◆ EMFDRV_GdiComment()

BOOL EMFDRV_GdiComment ( PHYSDEV  dev,
UINT  bytes,
const BYTE buffer 
)

Definition at line 520 of file objects.c.

521{
522 EMRGDICOMMENT *emr;
523 UINT total, rounded_size;
524 BOOL ret;
525
526 rounded_size = (bytes+3) & ~3;
527 total = offsetof(EMRGDICOMMENT,Data) + rounded_size;
528
529 emr = HeapAlloc(GetProcessHeap(), 0, total);
530 emr->emr.iType = EMR_GDICOMMENT;
531 emr->emr.nSize = total;
532 emr->cbData = bytes;
533 memset(&emr->Data[bytes], 0, rounded_size - bytes);
534 memcpy(&emr->Data[0], buffer, bytes);
535
536 ret = EMFDRV_WriteRecord( dev, &emr->emr );
537
538 HeapFree(GetProcessHeap(), 0, emr);
539
540 return ret;
541}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
size_t total
#define offsetof(TYPE, MEMBER)
BYTE Data[1]
Definition: wingdi.h:2024
#define EMR_GDICOMMENT
Definition: wingdi.h:143

◆ EMFDRV_SelectBitmap()

HBITMAP EMFDRV_SelectBitmap ( PHYSDEV  dev,
HBITMAP  hbitmap 
)

Definition at line 102 of file objects.c.

103{
104 return 0;
105}

◆ EMFDRV_SelectBrush()

HBRUSH EMFDRV_SelectBrush ( PHYSDEV  dev,
HBRUSH  hBrush,
const struct brush_pattern pattern 
)

Definition at line 205 of file objects.c.

206{
207 EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
208 EMRSELECTOBJECT emr;
209 DWORD index;
210 int i;
211
212 if (physDev->restoring) return hBrush; /* don't output SelectObject records during RestoreDC */
213
214 /* If the object is a stock brush object, do not need to create it.
215 * See definitions in wingdi.h for range of stock brushes.
216 * We do however have to handle setting the higher order bit to
217 * designate that this is a stock object.
218 */
219 for (i = WHITE_BRUSH; i <= DC_BRUSH; i++)
220 {
221 if (hBrush == GetStockObject(i))
222 {
223 index = i | 0x80000000;
224 goto found;
225 }
226 }
227 if((index = EMFDRV_FindObject(dev, hBrush)) != 0)
228 goto found;
229
230 if (!(index = EMFDRV_CreateBrushIndirect(dev, hBrush ))) return 0;
231 GDI_hdc_using_object(hBrush, dev->hdc);
232
233 found:
235 emr.emr.nSize = sizeof(emr);
236 emr.ihObject = index;
237 return EMFDRV_WriteRecord( dev, &emr.emr ) ? hBrush : 0;
238}
DWORD EMFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush)
Definition: objects.c:111
void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:166
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define EMR_SELECTOBJECT
Definition: wingdi.h:111
#define WHITE_BRUSH
Definition: wingdi.h:902

◆ EMFDRV_SelectFont()

HFONT EMFDRV_SelectFont ( PHYSDEV  dev,
HFONT  hFont,
UINT aa_flags 
)

Definition at line 284 of file objects.c.

285{
286 EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
287 EMRSELECTOBJECT emr;
288 DWORD index;
289 int i;
290
291 if (physDev->restoring) goto done; /* don't output SelectObject records during RestoreDC */
292
293 /* If the object is a stock font object, do not need to create it.
294 * See definitions in wingdi.h for range of stock fonts.
295 * We do however have to handle setting the higher order bit to
296 * designate that this is a stock object.
297 */
298
299 for (i = OEM_FIXED_FONT; i <= DEFAULT_GUI_FONT; i++)
300 {
301 if (i != DEFAULT_PALETTE && hFont == GetStockObject(i))
302 {
303 index = i | 0x80000000;
304 goto found;
305 }
306 }
307
308 if((index = EMFDRV_FindObject(dev, hFont)) != 0)
309 goto found;
310
311 if (!(index = EMFDRV_CreateFontIndirect(dev, hFont ))) return 0;
313
314 found:
316 emr.emr.nSize = sizeof(emr);
317 emr.ihObject = index;
318 if(!EMFDRV_WriteRecord( dev, &emr.emr ))
319 return 0;
320done:
321 *aa_flags = GGO_BITMAP; /* no point in anti-aliasing on metafiles */
322 dev = GET_NEXT_PHYSDEV( dev, pSelectFont );
323 dev->funcs->pSelectFont( dev, hFont, aa_flags );
324 return hFont;
325}
static BOOL EMFDRV_CreateFontIndirect(PHYSDEV dev, HFONT hFont)
Definition: objects.c:244
#define GET_NEXT_PHYSDEV(dev, func)
Definition: gdi_driver.h:215
#define DEFAULT_PALETTE
Definition: wingdi.h:913
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define OEM_FIXED_FONT
Definition: wingdi.h:910
#define GGO_BITMAP
Definition: wingdi.h:849

◆ EMFDRV_SelectPalette()

HPALETTE EMFDRV_SelectPalette ( PHYSDEV  dev,
HPALETTE  hPal,
BOOL  force 
)

Definition at line 437 of file objects.c.

438{
439 EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
441 DWORD index;
442
443 if (physDev->restoring) return hPal; /* don't output SelectObject records during RestoreDC */
444
445 if (hPal == GetStockObject( DEFAULT_PALETTE ))
446 {
447 index = DEFAULT_PALETTE | 0x80000000;
448 goto found;
449 }
450
451 if ((index = EMFDRV_FindObject( dev, hPal )) != 0)
452 goto found;
453
454 if (!(index = EMFDRV_CreatePalette( dev, hPal ))) return 0;
455 GDI_hdc_using_object( hPal, dev->hdc );
456
457found:
459 emr.emr.nSize = sizeof(emr);
460 emr.ihPal = index;
461 return EMFDRV_WriteRecord( dev, &emr.emr ) ? hPal : 0;
462}
static DWORD EMFDRV_CreatePalette(PHYSDEV dev, HPALETTE hPal)
Definition: objects.c:409
#define EMR_SELECTPALETTE
Definition: wingdi.h:122

◆ EMFDRV_SelectPen()

HPEN EMFDRV_SelectPen ( PHYSDEV  dev,
HPEN  hPen,
const struct brush_pattern pattern 
)

Definition at line 369 of file objects.c.

370{
371 EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
372 EMRSELECTOBJECT emr;
373 DWORD index;
374 int i;
375
376 if (physDev->restoring) return hPen; /* don't output SelectObject records during RestoreDC */
377
378 /* If the object is a stock pen object, do not need to create it.
379 * See definitions in wingdi.h for range of stock pens.
380 * We do however have to handle setting the higher order bit to
381 * designate that this is a stock object.
382 */
383
384 for (i = WHITE_PEN; i <= DC_PEN; i++)
385 {
386 if (hPen == GetStockObject(i))
387 {
388 index = i | 0x80000000;
389 goto found;
390 }
391 }
392 if((index = EMFDRV_FindObject(dev, hPen)) != 0)
393 goto found;
394
395 if (!(index = EMFDRV_CreatePenIndirect(dev, hPen))) return 0;
396 GDI_hdc_using_object(hPen, dev->hdc);
397
398 found:
400 emr.emr.nSize = sizeof(emr);
401 emr.ihObject = index;
402 return EMFDRV_WriteRecord( dev, &emr.emr ) ? hPen : 0;
403}
static DWORD EMFDRV_CreatePenIndirect(PHYSDEV dev, HPEN hPen)
Definition: objects.c:332
#define WHITE_PEN
Definition: wingdi.h:905

◆ EMFDRV_SetDCBrushColor()

COLORREF EMFDRV_SetDCBrushColor ( PHYSDEV  dev,
COLORREF  color 
)

Definition at line 467 of file objects.c.

468{
469 EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
470#ifndef __REACTOS__
471 DC *dc = get_physdev_dc( dev );
472#endif
473 EMRSELECTOBJECT emr;
474 DWORD index;
475#ifdef __REACTOS__
476 if (GetCurrentObject( dev->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return color;
477#else
478 if (dc->hBrush != GetStockObject( DC_BRUSH )) return color;
479#endif
480 if (physDev->dc_brush) DeleteObject( physDev->dc_brush );
481 if (!(physDev->dc_brush = CreateSolidBrush( color ))) return CLR_INVALID;
482 if (!(index = EMFDRV_CreateBrushIndirect(dev, physDev->dc_brush ))) return CLR_INVALID;
483 GDI_hdc_using_object( physDev->dc_brush, dev->hdc );
485 emr.emr.nSize = sizeof(emr);
486 emr.ihObject = index;
487 return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
488}
pKey DeleteObject()
GLuint color
Definition: glext.h:6243
static const WCHAR dc[]
#define OBJ_BRUSH
Definition: objidl.idl:1410
Definition: polytest.cpp:41
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
#define CLR_INVALID
Definition: wingdi.h:883
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

◆ EMFDRV_SetDCPenColor()

COLORREF EMFDRV_SetDCPenColor ( PHYSDEV  dev,
COLORREF  color 
)

Definition at line 493 of file objects.c.

494{
495 EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
496#ifndef __REACTOS__
497 DC *dc = get_physdev_dc( dev );
498#endif
499 EMRSELECTOBJECT emr;
500 DWORD index;
501 LOGPEN logpen = { PS_SOLID, { 0, 0 }, color };
502#ifdef __REACTOS__
503 if (GetCurrentObject( dev->hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return color;
504#else
505 if (dc->hPen != GetStockObject( DC_PEN )) return color;
506#endif
507 if (physDev->dc_pen) DeleteObject( physDev->dc_pen );
508 if (!(physDev->dc_pen = CreatePenIndirect( &logpen ))) return CLR_INVALID;
509 if (!(index = EMFDRV_CreatePenIndirect(dev, physDev->dc_pen))) return CLR_INVALID;
510 GDI_hdc_using_object( physDev->dc_pen, dev->hdc );
512 emr.emr.nSize = sizeof(emr);
513 emr.ihObject = index;
514 return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
515}
#define OBJ_PEN
Definition: objidl.idl:1409
HPEN WINAPI CreatePenIndirect(_In_ const LOGPEN *)
#define PS_SOLID
Definition: wingdi.h:586

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( enhmetafile  )