4 * Copyright David W. Metcalfe, 1994
5 * Niels de Carpentier, Albrecht Kleine, Huw Davies 1996
10 * These functions are primarily involved with metafile playback or anything
11 * that touches a HMETAFILE.
12 * For recording of metafiles look in graphics/metafiledrv/
14 * Note that (32 bit) HMETAFILEs are GDI objects, while HMETAFILE16s are
15 * global memory handles so these cannot be interchanged.
17 * Memory-based metafiles are just stored as a continuous block of memory with
18 * a METAHEADER at the head with METARECORDs appended to it. mtType is
19 * METAFILE_MEMORY (1). Note this is indentical to the disk image of a
20 * disk-based metafile - even mtType is METAFILE_MEMORY.
21 * 16bit HMETAFILE16s are global handles to this block
22 * 32bit HMETAFILEs are GDI handles METAFILEOBJs, which contains a ptr to
24 * Disk-based metafiles are rather different. HMETAFILE16s point to a
25 * METAHEADER which has mtType equal to METAFILE_DISK (2). Following the 9
26 * WORDs of the METAHEADER there are a further 3 WORDs of 0, 1 of 0x117, 1
27 * more 0, then 2 which may be a time stamp of the file and then the path of
28 * the file (METAHEADERDISK). I've copied this for 16bit compatibility.
36 #include "wine/winbase16.h"
41 #include "debugtools.h"
44 DEFAULT_DEBUG_CHANNEL(metafile
)
46 /******************************************************************
49 * Add a handle to an external handle table and return the index
51 static int MF_AddHandle(HANDLETABLE16
*ht
, WORD htlen
, HGDIOBJ16 hobj
)
55 for (i
= 0; i
< htlen
; i
++)
57 if (*(ht
->objectHandle
+ i
) == 0)
59 *(ht
->objectHandle
+ i
) = hobj
;
67 /******************************************************************
68 * MF_Create_HMETATFILE
70 * Creates a (32 bit) HMETAFILE object from a METAHEADER
72 * HMETAFILEs are GDI objects.
74 HMETAFILE
MF_Create_HMETAFILE(METAHEADER
*mh
)
77 METAFILEOBJ
*metaObj
= GDI_AllocObject( sizeof(METAFILEOBJ
), METAFILE_MAGIC
, &hmf
);
81 GDI_ReleaseObj( hmf
);
86 /******************************************************************
87 * MF_Create_HMETATFILE16
89 * Creates a HMETAFILE16 object from a METAHEADER
91 * HMETAFILE16s are Global memory handles.
93 HMETAFILE16
MF_Create_HMETAFILE16(METAHEADER
*mh
)
98 if(mh
->mtType
== METAFILE_MEMORY
)
99 size
= mh
->mtSize
* sizeof(WORD
);
101 size
= sizeof(METAHEADER
) + sizeof(METAHEADERDISK
);
103 hmf
= GLOBAL_CreateBlock( GMEM_MOVEABLE
, mh
, mh
->mtSize
* sizeof(WORD
),
104 GetCurrentPDB16(), FALSE
, FALSE
, FALSE
);
108 /******************************************************************
111 * Returns ptr to METAHEADER associated with HMETAFILE
112 * Should be followed by call to MF_ReleaseMetaHeader
114 static METAHEADER
*MF_GetMetaHeader( HMETAFILE hmf
)
116 METAFILEOBJ
* metaObj
= (METAFILEOBJ
*)GDI_GetObjPtr( hmf
, METAFILE_MAGIC
);
117 return metaObj
? metaObj
->mh
: 0;
120 /******************************************************************
123 * Returns ptr to METAHEADER associated with HMETAFILE16
124 * Should be followed by call to MF_ReleaseMetaHeader16
126 static METAHEADER
*MF_GetMetaHeader16( HMETAFILE16 hmf
)
128 return GlobalLock16(hmf
);
131 /******************************************************************
132 * MF_ReleaseMetaHeader
134 * Releases METAHEADER associated with HMETAFILE
136 static void MF_ReleaseMetaHeader( HMETAFILE hmf
)
138 GDI_ReleaseObj( hmf
);
141 /******************************************************************
142 * MF_ReleaseMetaHeader16
144 * Releases METAHEADER associated with HMETAFILE16
146 static BOOL16
MF_ReleaseMetaHeader16( HMETAFILE16 hmf
)
148 return GlobalUnlock16( hmf
);
152 /******************************************************************
153 * DeleteMetaFile16 (GDI.127)
155 BOOL16 WINAPI
DeleteMetaFile16( HMETAFILE16 hmf
)
157 return !GlobalFree16( hmf
);
160 /******************************************************************
161 * DeleteMetaFile (GDI32.69)
163 * Delete a memory-based metafile.
166 BOOL WINAPI
DeleteMetaFile( HMETAFILE hmf
)
168 METAFILEOBJ
* metaObj
= (METAFILEOBJ
*)GDI_GetObjPtr( hmf
, METAFILE_MAGIC
);
169 if (!metaObj
) return FALSE
;
170 HeapFree( GetProcessHeap(), 0, metaObj
->mh
);
171 GDI_FreeObject( hmf
, metaObj
);
175 /******************************************************************
178 * Returns a pointer to a memory based METAHEADER read in from file HFILE
181 static METAHEADER
*MF_ReadMetaFile(HFILE hfile
)
184 DWORD BytesRead
, size
;
186 size
= sizeof(METAHEADER
);
187 mh
= HeapAlloc( GetProcessHeap(), 0, size
);
189 if(ReadFile( hfile
, mh
, size
, &BytesRead
, NULL
) == 0 ||
191 HeapFree( GetProcessHeap(), 0, mh
);
194 size
= mh
->mtSize
* 2;
195 mh
= HeapReAlloc( GetProcessHeap(), 0, mh
, size
);
197 size
-= sizeof(METAHEADER
);
198 if(ReadFile( hfile
, (char *)mh
+ sizeof(METAHEADER
), size
, &BytesRead
,
201 HeapFree( GetProcessHeap(), 0, mh
);
205 if (mh
->mtType
!= METAFILE_MEMORY
) {
206 WARN("Disk metafile had mtType = %04x\n", mh
->mtType
);
207 mh
->mtType
= METAFILE_MEMORY
;
212 /******************************************************************
213 * GetMetaFile16 (GDI.124)
215 HMETAFILE16 WINAPI
GetMetaFile16( LPCSTR lpFilename
)
220 TRACE("%s\n", lpFilename
);
225 if((hFile
= CreateFileA(lpFilename
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
226 OPEN_EXISTING
, 0, -1)) == HFILE_ERROR
)
229 mh
= MF_ReadMetaFile(hFile
);
232 return MF_Create_HMETAFILE16( mh
);
235 /******************************************************************
236 * GetMetaFileA (GDI32.197)
238 * Read a metafile from a file. Returns handle to a memory-based metafile.
240 HMETAFILE WINAPI
GetMetaFileA( LPCSTR lpFilename
)
245 TRACE("%s\n", lpFilename
);
250 if((hFile
= CreateFileA(lpFilename
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
251 OPEN_EXISTING
, 0, -1)) == HFILE_ERROR
)
254 mh
= MF_ReadMetaFile(hFile
);
257 return MF_Create_HMETAFILE( mh
);
262 /******************************************************************
263 * GetMetaFileW (GDI32.199)
265 HMETAFILE WINAPI
GetMetaFileW( LPCWSTR lpFilename
)
270 TRACE("%s\n", debugstr_w(lpFilename
));
275 if((hFile
= CreateFileW(lpFilename
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
276 OPEN_EXISTING
, 0, -1)) == HFILE_ERROR
)
279 mh
= MF_ReadMetaFile(hFile
);
282 return MF_Create_HMETAFILE( mh
);
286 /******************************************************************
287 * MF_LoadDiskBasedMetaFile
289 * Creates a new memory-based metafile from a disk-based one.
291 static METAHEADER
*MF_LoadDiskBasedMetaFile(METAHEADER
*mh
)
297 if(mh
->mtType
!= METAFILE_DISK
) {
298 ERR("Not a disk based metafile\n");
301 mhd
= (METAHEADERDISK
*)((char *)mh
+ sizeof(METAHEADER
));
303 if((hfile
= CreateFileA(mhd
->filename
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
304 OPEN_EXISTING
, 0, -1)) == HFILE_ERROR
) {
305 WARN("Can't open file of disk based metafile\n");
308 mh2
= MF_ReadMetaFile(hfile
);
313 /******************************************************************
314 * MF_CreateMetaHeaderDisk
316 * Take a memory based METAHEADER and change it to a disk based METAHEADER
317 * assosiated with filename. Note: Trashes contents of old one.
319 METAHEADER
*MF_CreateMetaHeaderDisk(METAHEADER
*mh
, LPCSTR filename
)
324 mh
= HeapReAlloc( GetProcessHeap(), 0, mh
,
325 sizeof(METAHEADER
) + sizeof(METAHEADERDISK
));
326 mh
->mtType
= METAFILE_DISK
;
327 size
= HeapSize( GetProcessHeap(), 0, mh
);
328 mhd
= (METAHEADERDISK
*)((char *)mh
+ sizeof(METAHEADER
));
329 strcpy(mhd
->filename
, filename
);
333 /******************************************************************
334 * CopyMetaFile16 (GDI.151)
336 HMETAFILE16 WINAPI
CopyMetaFile16( HMETAFILE16 hSrcMetaFile
, LPCSTR lpFilename
)
338 METAHEADER
*mh
= MF_GetMetaHeader16( hSrcMetaFile
);
339 METAHEADER
*mh2
= NULL
;
342 TRACE("(%08x,%s)\n", hSrcMetaFile
, lpFilename
);
346 if(mh
->mtType
== METAFILE_DISK
)
347 mh2
= MF_LoadDiskBasedMetaFile(mh
);
349 mh2
= HeapAlloc( GetProcessHeap(), 0, mh
->mtSize
* 2 );
350 memcpy( mh2
, mh
, mh
->mtSize
* 2 );
352 MF_ReleaseMetaHeader16( hSrcMetaFile
);
354 if(lpFilename
) { /* disk based metafile */
355 if((hFile
= CreateFileA(lpFilename
, GENERIC_WRITE
, 0, NULL
,
356 CREATE_ALWAYS
, 0, -1)) == HFILE_ERROR
) {
357 HeapFree( GetProcessHeap(), 0, mh2
);
360 WriteFile(hFile
, mh2
, mh2
->mtSize
* 2, NULL
, NULL
);
362 mh2
= MF_CreateMetaHeaderDisk(mh2
, lpFilename
);
365 return MF_Create_HMETAFILE16( mh2
);
369 /******************************************************************
370 * CopyMetaFileA (GDI32.23)
372 * Copies the metafile corresponding to hSrcMetaFile to either
373 * a disk file, if a filename is given, or to a new memory based
374 * metafile, if lpFileName is NULL.
378 * Handle to metafile copy on success, NULL on failure.
382 * Copying to disk returns NULL even if successful.
384 HMETAFILE WINAPI
CopyMetaFileA(
385 HMETAFILE hSrcMetaFile
, /* handle of metafile to copy */
386 LPCSTR lpFilename
/* filename if copying to a file */
388 METAHEADER
*mh
= MF_GetMetaHeader( hSrcMetaFile
);
389 METAHEADER
*mh2
= NULL
;
392 TRACE("(%08x,%s)\n", hSrcMetaFile
, lpFilename
);
396 if(mh
->mtType
== METAFILE_DISK
)
397 mh2
= MF_LoadDiskBasedMetaFile(mh
);
399 mh2
= HeapAlloc( GetProcessHeap(), 0, mh
->mtSize
* 2 );
400 memcpy( mh2
, mh
, mh
->mtSize
* 2 );
402 MF_ReleaseMetaHeader( hSrcMetaFile
);
404 if(lpFilename
) { /* disk based metafile */
405 if((hFile
= CreateFileA(lpFilename
, GENERIC_WRITE
, 0, NULL
,
406 CREATE_ALWAYS
, 0, -1)) == HFILE_ERROR
) {
407 HeapFree( GetProcessHeap(), 0, mh2
);
410 WriteFile(hFile
, mh2
, mh2
->mtSize
* 2, NULL
, NULL
);
412 mh2
= MF_CreateMetaHeaderDisk(mh2
, lpFilename
);
415 return MF_Create_HMETAFILE( mh2
);
419 /******************************************************************
420 * CopyMetaFileW (GDI32.24)
422 HMETAFILE WINAPI
CopyMetaFileW( HMETAFILE hSrcMetaFile
,
425 LPSTR p
= HEAP_strdupWtoA( GetProcessHeap(), 0, lpFilename
);
426 HMETAFILE ret
= CopyMetaFileA( hSrcMetaFile
, p
);
427 HeapFree( GetProcessHeap(), 0, p
);
432 /******************************************************************
433 * IsValidMetaFile (GDI.410)
435 * Attempts to check if a given metafile is correctly formatted.
436 * Currently, the only things verified are several properties of the
440 * TRUE if hmf passes some tests for being a valid metafile, FALSE otherwise.
443 * This is not exactly what windows does, see _Undocumented_Windows_
446 BOOL16 WINAPI
IsValidMetaFile16(HMETAFILE16 hmf
)
449 METAHEADER
*mh
= MF_GetMetaHeader16(hmf
);
451 if (mh
->mtType
== METAFILE_MEMORY
|| mh
->mtType
== METAFILE_DISK
)
452 if (mh
->mtHeaderSize
== MFHEADERSIZE
/sizeof(INT16
))
453 if (mh
->mtVersion
== MFVERSION
)
455 MF_ReleaseMetaHeader16(hmf
);
457 TRACE("IsValidMetaFile %x => %d\n",hmf
,res
);
462 /*******************************************************************
465 * Helper for PlayMetaFile
467 static BOOL
MF_PlayMetaFile( HDC hdc
, METAHEADER
*mh
)
479 if (!mh
) return FALSE
;
480 if(mh
->mtType
== METAFILE_DISK
) { /* Create a memory-based copy */
481 mh
= MF_LoadDiskBasedMetaFile(mh
);
482 if(!mh
) return FALSE
;
486 /* save the current pen, brush and font */
487 hPen
= GetCurrentObject(hdc
, OBJ_PEN
);
488 hBrush
= GetCurrentObject(hdc
, OBJ_BRUSH
);
489 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
491 /* create the handle table */
492 ht
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
,
493 sizeof(HANDLETABLE16
) * mh
->mtNoObjects
);
494 if(!ht
) return FALSE
;
496 /* loop through metafile playing records */
497 offset
= mh
->mtHeaderSize
* 2;
498 while (offset
< mh
->mtSize
* 2)
500 mr
= (METARECORD
*)((char *)mh
+ offset
);
501 TRACE("offset=%04x,size=%08lx\n",
505 "Entry got size 0 at offset %d, total mf length is %ld\n",
506 offset
,mh
->mtSize
*2);
507 break; /* would loop endlessly otherwise */
509 offset
+= mr
->rdSize
* 2;
510 PlayMetaFileRecord16( hdc
, ht
, mr
, mh
->mtNoObjects
);
513 SelectObject(hdc
, hBrush
);
514 SelectObject(hdc
, hPen
);
515 SelectObject(hdc
, hFont
);
517 /* free objects in handle table */
518 for(i
= 0; i
< mh
->mtNoObjects
; i
++)
519 if(*(ht
->objectHandle
+ i
) != 0)
520 DeleteObject(*(ht
->objectHandle
+ i
));
522 /* free handle table */
523 HeapFree( GetProcessHeap(), 0, ht
);
525 HeapFree( GetProcessHeap(), 0, mh
);
529 /******************************************************************
530 * PlayMetaFile16 (GDI.123)
533 BOOL16 WINAPI
PlayMetaFile16( HDC16 hdc
, HMETAFILE16 hmf
)
536 METAHEADER
*mh
= MF_GetMetaHeader16( hmf
);
537 ret
= MF_PlayMetaFile( hdc
, mh
);
538 MF_ReleaseMetaHeader16( hmf
);
542 /******************************************************************
543 * PlayMetaFile (GDI32.265)
545 * Renders the metafile specified by hmf in the DC specified by
546 * hdc. Returns FALSE on failure, TRUE on success.
548 BOOL WINAPI
PlayMetaFile(
549 HDC hdc
, /* handle of DC to render in */
550 HMETAFILE hmf
/* handle of metafile to render */
554 METAHEADER
*mh
= MF_GetMetaHeader( hmf
);
555 ret
= MF_PlayMetaFile( hdc
, mh
);
556 MF_ReleaseMetaHeader( hmf
);
561 /******************************************************************
562 * EnumMetaFile16 (GDI.175)
565 BOOL16 WINAPI
EnumMetaFile16( HDC16 hdc
, HMETAFILE16 hmf
,
566 MFENUMPROC16 lpEnumFunc
, LPARAM lpData
)
568 METAHEADER
*mh
= MF_GetMetaHeader16(hmf
);
578 BOOL16 result
= TRUE
, loaded
= FALSE
;
580 TRACE("(%04x, %04x, %08lx, %08lx)\n",
581 hdc
, hmf
, (DWORD
)lpEnumFunc
, lpData
);
584 if(!mh
) return FALSE
;
585 if(mh
->mtType
== METAFILE_DISK
) { /* Create a memory-based copy */
586 mh
= MF_LoadDiskBasedMetaFile(mh
);
587 if(!mh
) return FALSE
;
591 /* save the current pen, brush and font */
592 hPen
= GetCurrentObject(hdc
, OBJ_PEN
);
593 hBrush
= GetCurrentObject(hdc
, OBJ_BRUSH
);
594 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
596 /* create the handle table */
598 hHT
= GlobalAlloc16(GMEM_MOVEABLE
| GMEM_ZEROINIT
,
599 sizeof(HANDLETABLE16
) * mh
->mtNoObjects
);
600 spht
= WIN16_GlobalLock16(hHT
);
602 seg
= GlobalHandleToSel16(hmf
);
603 offset
= mh
->mtHeaderSize
* 2;
605 /* loop through metafile records */
607 while (offset
< (mh
->mtSize
* 2))
609 mr
= (METARECORD
*)((char *)mh
+ offset
);
610 if (!lpEnumFunc( hdc
, (HANDLETABLE16
*)spht
,
611 (METARECORD
*) PTR_SEG_OFF_TO_HUGEPTR(seg
, offset
),
612 mh
->mtNoObjects
, (LONG
)lpData
))
619 offset
+= (mr
->rdSize
* 2);
622 SelectObject(hdc
, hBrush
);
623 SelectObject(hdc
, hPen
);
624 SelectObject(hdc
, hFont
);
626 ht
= (HANDLETABLE16
*)GlobalLock16(hHT
);
628 /* free objects in handle table */
629 for(i
= 0; i
< mh
->mtNoObjects
; i
++)
630 if(*(ht
->objectHandle
+ i
) != 0)
631 DeleteObject(*(ht
->objectHandle
+ i
));
633 /* free handle table */
636 HeapFree( GetProcessHeap(), 0, mh
);
637 MF_ReleaseMetaHeader16(hmf
);
641 /******************************************************************
642 * EnumMetaFile (GDI32.88)
644 * Loop through the metafile records in hmf, calling the user-specified
645 * function for each one, stopping when the user's function returns FALSE
646 * (which is considered to be failure)
647 * or when no records are left (which is considered to be success).
650 * TRUE on success, FALSE on failure.
653 * Niels de carpentier, april 1996
655 BOOL WINAPI
EnumMetaFile(
658 MFENUMPROC lpEnumFunc
,
661 METAHEADER
*mh
= MF_GetMetaHeader(hmf
);
664 BOOL result
= TRUE
, loaded
= FALSE
;
670 TRACE("(%08x,%08x,%p,%p)\n",
671 hdc
, hmf
, lpEnumFunc
, (void*)lpData
);
673 if(mh
->mtType
== METAFILE_DISK
) { /* Create a memory-based copy */
674 mh
= MF_LoadDiskBasedMetaFile(mh
);
679 /* save the current pen, brush and font */
680 hPen
= GetCurrentObject(hdc
, OBJ_PEN
);
681 hBrush
= GetCurrentObject(hdc
, OBJ_BRUSH
);
682 hFont
= GetCurrentObject(hdc
, OBJ_FONT
);
684 ht
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
,
685 sizeof(HANDLETABLE
) * mh
->mtNoObjects
);
687 /* loop through metafile records */
688 offset
= mh
->mtHeaderSize
* 2;
690 while (offset
< (mh
->mtSize
* 2))
692 mr
= (METARECORD
*)((char *)mh
+ offset
);
693 TRACE("Calling EnumFunc with record type %x\n",
695 if (!lpEnumFunc( hdc
, ht
, mr
, mh
->mtNoObjects
, (LONG
)lpData
))
701 offset
+= (mr
->rdSize
* 2);
704 /* restore pen, brush and font */
705 SelectObject(hdc
, hBrush
);
706 SelectObject(hdc
, hPen
);
707 SelectObject(hdc
, hFont
);
709 /* free objects in handle table */
710 for(i
= 0; i
< mh
->mtNoObjects
; i
++)
711 if(*(ht
->objectHandle
+ i
) != 0)
712 DeleteObject(*(ht
->objectHandle
+ i
));
714 /* free handle table */
715 HeapFree( GetProcessHeap(), 0, ht
);
717 HeapFree( GetProcessHeap(), 0, mh
);
718 MF_ReleaseMetaHeader(hmf
);
722 static BOOL
MF_Play_MetaCreateRegion( METARECORD
*mr
, HRGN hrgn
);
723 static BOOL
MF_Play_MetaExtTextOut(HDC16 hdc
, METARECORD
*mr
);
724 /******************************************************************
725 * PlayMetaFileRecord16 (GDI.176)
727 * Render a single metafile record specified by *mr in the DC hdc, while
728 * using the handle table *ht, of length nHandles,
729 * to store metafile objects.
732 * The following metafile records are unimplemented:
734 * DRAWTEXT, ANIMATEPALETTE, SETPALENTRIES,
735 * RESIZEPALETTE, EXTFLOODFILL, RESETDC, STARTDOC, STARTPAGE, ENDPAGE,
736 * ABORTDOC, ENDDOC, CREATEBRUSH, CREATEBITMAPINDIRECT, and CREATEBITMAP.
739 void WINAPI
PlayMetaFileRecord16(
740 HDC16 hdc
, /* DC to render metafile into */
741 HANDLETABLE16
*ht
, /* pointer to handle table for metafile objects */
742 METARECORD
*mr
, /* pointer to metafile record to render */
743 UINT16 nHandles
/* size of handle table */
748 BITMAPINFOHEADER
*infohdr
;
750 TRACE("(%04x %08lx %08lx %04x) function %04x\n",
751 hdc
,(LONG
)ht
, (LONG
)mr
, nHandles
, mr
->rdFunction
);
753 switch (mr
->rdFunction
)
758 case META_DELETEOBJECT
:
759 DeleteObject(*(ht
->objectHandle
+ *(mr
->rdParm
)));
760 *(ht
->objectHandle
+ *(mr
->rdParm
)) = 0;
763 case META_SETBKCOLOR
:
764 SetBkColor16(hdc
, MAKELONG(*(mr
->rdParm
), *(mr
->rdParm
+ 1)));
768 SetBkMode16(hdc
, *(mr
->rdParm
));
771 case META_SETMAPMODE
:
772 SetMapMode16(hdc
, *(mr
->rdParm
));
776 SetROP216(hdc
, *(mr
->rdParm
));
780 SetRelAbs16(hdc
, *(mr
->rdParm
));
783 case META_SETPOLYFILLMODE
:
784 SetPolyFillMode16(hdc
, *(mr
->rdParm
));
787 case META_SETSTRETCHBLTMODE
:
788 SetStretchBltMode16(hdc
, *(mr
->rdParm
));
791 case META_SETTEXTCOLOR
:
792 SetTextColor16(hdc
, MAKELONG(*(mr
->rdParm
), *(mr
->rdParm
+ 1)));
795 case META_SETWINDOWORG
:
796 SetWindowOrg16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
799 case META_SETWINDOWEXT
:
800 SetWindowExt16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
803 case META_SETVIEWPORTORG
:
804 SetViewportOrg16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
807 case META_SETVIEWPORTEXT
:
808 SetViewportExt16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
811 case META_OFFSETWINDOWORG
:
812 OffsetWindowOrg16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
815 case META_SCALEWINDOWEXT
:
816 ScaleWindowExt16(hdc
, *(mr
->rdParm
+ 3), *(mr
->rdParm
+ 2),
817 *(mr
->rdParm
+ 1), *(mr
->rdParm
));
820 case META_OFFSETVIEWPORTORG
:
821 OffsetViewportOrg16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
824 case META_SCALEVIEWPORTEXT
:
825 ScaleViewportExt16(hdc
, *(mr
->rdParm
+ 3), *(mr
->rdParm
+ 2),
826 *(mr
->rdParm
+ 1), *(mr
->rdParm
));
830 LineTo(hdc
, (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
834 MoveTo16(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
837 case META_EXCLUDECLIPRECT
:
838 ExcludeClipRect16( hdc
, *(mr
->rdParm
+ 3), *(mr
->rdParm
+ 2),
839 *(mr
->rdParm
+ 1), *(mr
->rdParm
) );
842 case META_INTERSECTCLIPRECT
:
843 IntersectClipRect16( hdc
, *(mr
->rdParm
+ 3), *(mr
->rdParm
+ 2),
844 *(mr
->rdParm
+ 1), *(mr
->rdParm
) );
848 Arc(hdc
, (INT16
)*(mr
->rdParm
+ 7), (INT16
)*(mr
->rdParm
+ 6),
849 (INT16
)*(mr
->rdParm
+ 5), (INT16
)*(mr
->rdParm
+ 4),
850 (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
851 (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
855 Ellipse(hdc
, (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
856 (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
860 FloodFill(hdc
, (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
861 MAKELONG(*(mr
->rdParm
), *(mr
->rdParm
+ 1)));
865 Pie(hdc
, (INT16
)*(mr
->rdParm
+ 7), (INT16
)*(mr
->rdParm
+ 6),
866 (INT16
)*(mr
->rdParm
+ 5), (INT16
)*(mr
->rdParm
+ 4),
867 (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
868 (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
872 Rectangle(hdc
, (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
873 (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
877 RoundRect(hdc
, (INT16
)*(mr
->rdParm
+ 5), (INT16
)*(mr
->rdParm
+ 4),
878 (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
879 (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
883 PatBlt16(hdc
, *(mr
->rdParm
+ 5), *(mr
->rdParm
+ 4),
884 *(mr
->rdParm
+ 3), *(mr
->rdParm
+ 2),
885 MAKELONG(*(mr
->rdParm
), *(mr
->rdParm
+ 1)));
893 SetPixel(hdc
, (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
894 MAKELONG(*(mr
->rdParm
), *(mr
->rdParm
+ 1)));
897 case META_OFFSETCLIPRGN
:
898 OffsetClipRgn16( hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
) );
903 TextOut16(hdc
, *(mr
->rdParm
+ ((s1
+ 1) >> 1) + 2),
904 *(mr
->rdParm
+ ((s1
+ 1) >> 1) + 1),
905 (char *)(mr
->rdParm
+ 1), s1
);
909 Polygon16(hdc
, (LPPOINT16
)(mr
->rdParm
+ 1), *(mr
->rdParm
));
912 case META_POLYPOLYGON
:
913 PolyPolygon16(hdc
, (LPPOINT16
)(mr
->rdParm
+ *(mr
->rdParm
) + 1),
914 (LPINT16
)(mr
->rdParm
+ 1), *(mr
->rdParm
));
918 Polyline16(hdc
, (LPPOINT16
)(mr
->rdParm
+ 1), *(mr
->rdParm
));
922 RestoreDC(hdc
, (INT16
)*(mr
->rdParm
));
925 case META_SELECTOBJECT
:
926 SelectObject(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
)));
930 Chord(hdc
, (INT16
)*(mr
->rdParm
+ 7), (INT16
)*(mr
->rdParm
+ 6),
931 (INT16
)*(mr
->rdParm
+ 5), (INT16
)*(mr
->rdParm
+ 4),
932 (INT16
)*(mr
->rdParm
+ 3), (INT16
)*(mr
->rdParm
+ 2),
933 (INT16
)*(mr
->rdParm
+ 1), (INT16
)*(mr
->rdParm
));
936 case META_CREATEPATTERNBRUSH
:
937 switch (*(mr
->rdParm
))
940 infohdr
= (BITMAPINFOHEADER
*)(mr
->rdParm
+ 2);
941 MF_AddHandle(ht
, nHandles
,
942 CreatePatternBrush(CreateBitmap(infohdr
->biWidth
,
947 (sizeof(BITMAPINFOHEADER
) / 2) + 4))));
951 s1
= mr
->rdSize
* 2 - sizeof(METARECORD
) - 2;
952 hndl
= GlobalAlloc16(GMEM_MOVEABLE
, s1
);
953 ptr
= GlobalLock16(hndl
);
954 memcpy(ptr
, mr
->rdParm
+ 2, s1
);
955 GlobalUnlock16(hndl
);
956 MF_AddHandle(ht
, nHandles
,
957 CreateDIBPatternBrush(hndl
, *(mr
->rdParm
+ 1)));
962 ERR("META_CREATEPATTERNBRUSH: Unknown pattern type %d\n",
968 case META_CREATEPENINDIRECT
:
969 MF_AddHandle(ht
, nHandles
,
970 CreatePenIndirect16((LOGPEN16
*)(&(mr
->rdParm
))));
973 case META_CREATEFONTINDIRECT
:
974 MF_AddHandle(ht
, nHandles
,
975 CreateFontIndirect16((LOGFONT16
*)(&(mr
->rdParm
))));
978 case META_CREATEBRUSHINDIRECT
:
979 MF_AddHandle(ht
, nHandles
,
980 CreateBrushIndirect16((LOGBRUSH16
*)(&(mr
->rdParm
))));
983 case META_CREATEPALETTE
:
984 MF_AddHandle(ht
, nHandles
,
985 CreatePalette16((LPLOGPALETTE
)mr
->rdParm
));
988 case META_SETTEXTALIGN
:
989 SetTextAlign16(hdc
, *(mr
->rdParm
));
992 case META_SELECTPALETTE
:
993 SelectPalette(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
+1)),
997 case META_SETMAPPERFLAGS
:
998 SetMapperFlags16(hdc
, MAKELONG(mr
->rdParm
[0],mr
->rdParm
[1]));
1001 case META_REALIZEPALETTE
:
1002 RealizePalette(hdc
);
1006 FIXME("META_ESCAPE unimplemented.\n");
1009 case META_EXTTEXTOUT
:
1010 MF_Play_MetaExtTextOut( hdc
, mr
);
1013 case META_STRETCHDIB
:
1015 LPBITMAPINFO info
= (LPBITMAPINFO
) &(mr
->rdParm
[11]);
1016 LPSTR bits
= (LPSTR
)info
+ DIB_BitmapInfoSize( info
, mr
->rdParm
[2] );
1017 StretchDIBits16(hdc
,mr
->rdParm
[10],mr
->rdParm
[9],mr
->rdParm
[8],
1018 mr
->rdParm
[7],mr
->rdParm
[6],mr
->rdParm
[5],
1019 mr
->rdParm
[4],mr
->rdParm
[3],bits
,info
,
1020 mr
->rdParm
[2],MAKELONG(mr
->rdParm
[0],mr
->rdParm
[1]));
1024 case META_DIBSTRETCHBLT
:
1026 LPBITMAPINFO info
= (LPBITMAPINFO
) &(mr
->rdParm
[10]);
1027 LPSTR bits
= (LPSTR
)info
+ DIB_BitmapInfoSize( info
, mr
->rdParm
[2] );
1028 StretchDIBits16(hdc
,mr
->rdParm
[9],mr
->rdParm
[8],mr
->rdParm
[7],
1029 mr
->rdParm
[6],mr
->rdParm
[5],mr
->rdParm
[4],
1030 mr
->rdParm
[3],mr
->rdParm
[2],bits
,info
,
1031 DIB_RGB_COLORS
,MAKELONG(mr
->rdParm
[0],mr
->rdParm
[1]));
1035 case META_STRETCHBLT
:
1037 HDC16 hdcSrc
=CreateCompatibleDC16(hdc
);
1038 HBITMAP hbitmap
=CreateBitmap(mr
->rdParm
[10], /*Width */
1039 mr
->rdParm
[11], /*Height*/
1040 mr
->rdParm
[13], /*Planes*/
1041 mr
->rdParm
[14], /*BitsPixel*/
1042 (LPSTR
)&mr
->rdParm
[15]); /*bits*/
1043 SelectObject(hdcSrc
,hbitmap
);
1044 StretchBlt16(hdc
,mr
->rdParm
[9],mr
->rdParm
[8],
1045 mr
->rdParm
[7],mr
->rdParm
[6],
1046 hdcSrc
,mr
->rdParm
[5],mr
->rdParm
[4],
1047 mr
->rdParm
[3],mr
->rdParm
[2],
1048 MAKELONG(mr
->rdParm
[0],mr
->rdParm
[1]));
1055 HDC16 hdcSrc
=CreateCompatibleDC16(hdc
);
1056 HBITMAP hbitmap
=CreateBitmap(mr
->rdParm
[7]/*Width */,
1057 mr
->rdParm
[8]/*Height*/,
1058 mr
->rdParm
[10]/*Planes*/,
1059 mr
->rdParm
[11]/*BitsPixel*/,
1060 (LPSTR
)&mr
->rdParm
[12]/*bits*/);
1061 SelectObject(hdcSrc
,hbitmap
);
1062 BitBlt(hdc
,(INT16
)mr
->rdParm
[6],(INT16
)mr
->rdParm
[5],
1063 (INT16
)mr
->rdParm
[4],(INT16
)mr
->rdParm
[3],
1064 hdcSrc
, (INT16
)mr
->rdParm
[2],(INT16
)mr
->rdParm
[1],
1065 MAKELONG(0,mr
->rdParm
[0]));
1070 case META_CREATEREGION
:
1072 HRGN hrgn
= CreateRectRgn(0,0,0,0);
1074 MF_Play_MetaCreateRegion(mr
, hrgn
);
1075 MF_AddHandle(ht
, nHandles
, hrgn
);
1079 case META_FILLREGION
:
1080 FillRgn16(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
+1)),
1081 *(ht
->objectHandle
+ *(mr
->rdParm
)));
1084 case META_FRAMEREGION
:
1085 FrameRgn16(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
+3)),
1086 *(ht
->objectHandle
+ *(mr
->rdParm
+2)),
1087 *(mr
->rdParm
+1), *(mr
->rdParm
));
1090 case META_INVERTREGION
:
1091 InvertRgn16(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
)));
1094 case META_PAINTREGION
:
1095 PaintRgn16(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
)));
1098 case META_SELECTCLIPREGION
:
1099 SelectClipRgn(hdc
, *(ht
->objectHandle
+ *(mr
->rdParm
)));
1102 case META_DIBCREATEPATTERNBRUSH
:
1103 /* *(mr->rdParm) may be BS_PATTERN or BS_DIBPATTERN:
1104 but there's no difference */
1106 TRACE("%d\n",*(mr
->rdParm
));
1107 s1
= mr
->rdSize
* 2 - sizeof(METARECORD
) - 2;
1108 hndl
= GlobalAlloc16(GMEM_MOVEABLE
, s1
);
1109 ptr
= GlobalLock16(hndl
);
1110 memcpy(ptr
, mr
->rdParm
+ 2, s1
);
1111 GlobalUnlock16(hndl
);
1112 MF_AddHandle(ht
, nHandles
,
1113 CreateDIBPatternBrush16(hndl
, *(mr
->rdParm
+ 1)));
1117 case META_DIBBITBLT
:
1118 /* In practice I've found that there are two layouts for
1119 META_DIBBITBLT, one (the first here) is the usual one when a src
1120 dc is actually passed to it, the second occurs when the src dc is
1121 passed in as NULL to the creating BitBlt. As the second case has
1122 no dib, a size check will suffice to distinguish.
1124 Caolan.McNamara@ul.ie */
1126 if (mr
->rdSize
> 12) {
1127 LPBITMAPINFO info
= (LPBITMAPINFO
) &(mr
->rdParm
[8]);
1128 LPSTR bits
= (LPSTR
)info
+ DIB_BitmapInfoSize(info
, mr
->rdParm
[0]);
1130 StretchDIBits16(hdc
, mr
->rdParm
[7], mr
->rdParm
[6], mr
->rdParm
[5],
1131 mr
->rdParm
[4], mr
->rdParm
[3], mr
->rdParm
[2],
1132 mr
->rdParm
[5], mr
->rdParm
[4], bits
, info
,
1134 MAKELONG(mr
->rdParm
[0], mr
->rdParm
[1]));
1135 } else { /* equivalent to a PatBlt */
1136 PatBlt16(hdc
, mr
->rdParm
[8], mr
->rdParm
[7],
1137 mr
->rdParm
[6], mr
->rdParm
[5],
1138 MAKELONG(mr
->rdParm
[0], mr
->rdParm
[1]));
1142 case META_SETTEXTCHAREXTRA
:
1143 SetTextCharacterExtra16(hdc
, (INT16
)*(mr
->rdParm
));
1146 case META_SETTEXTJUSTIFICATION
:
1147 SetTextJustification(hdc
, *(mr
->rdParm
+ 1), *(mr
->rdParm
));
1150 case META_EXTFLOODFILL
:
1151 ExtFloodFill(hdc
, (INT16
)*(mr
->rdParm
+ 4), (INT16
)*(mr
->rdParm
+ 3),
1152 MAKELONG(*(mr
->rdParm
+1), *(mr
->rdParm
+ 2)),
1156 case META_SETDIBTODEV
:
1158 BITMAPINFO
*info
= (BITMAPINFO
*) &(mr
->rdParm
[9]);
1159 char *bits
= (char *)info
+ DIB_BitmapInfoSize( info
, mr
->rdParm
[0] );
1160 SetDIBitsToDevice(hdc
, (INT16
)mr
->rdParm
[8], (INT16
)mr
->rdParm
[7],
1161 (INT16
)mr
->rdParm
[6], (INT16
)mr
->rdParm
[5],
1162 (INT16
)mr
->rdParm
[4], (INT16
)mr
->rdParm
[3],
1163 mr
->rdParm
[2], mr
->rdParm
[1], bits
, info
,
1168 #define META_UNIMP(x) case x: \
1169 FIXME("PlayMetaFileRecord:record type "#x" not implemented.\n"); \
1171 META_UNIMP(META_DRAWTEXT
)
1172 META_UNIMP(META_ANIMATEPALETTE
)
1173 META_UNIMP(META_SETPALENTRIES
)
1174 META_UNIMP(META_RESIZEPALETTE
)
1175 META_UNIMP(META_RESETDC
)
1176 META_UNIMP(META_STARTDOC
)
1177 META_UNIMP(META_STARTPAGE
)
1178 META_UNIMP(META_ENDPAGE
)
1179 META_UNIMP(META_ABORTDOC
)
1180 META_UNIMP(META_ENDDOC
)
1181 META_UNIMP(META_CREATEBRUSH
)
1182 META_UNIMP(META_CREATEBITMAPINDIRECT
)
1183 META_UNIMP(META_CREATEBITMAP
)
1187 WARN("PlayMetaFileRecord: Unknown record type %x\n",
1192 /******************************************************************
1193 * PlayMetaFileRecord (GDI32.266)
1195 BOOL WINAPI
PlayMetaFileRecord( HDC hdc
, HANDLETABLE
*handletable
,
1196 METARECORD
*metarecord
, UINT handles
)
1198 HANDLETABLE16
* ht
= (void *)GlobalAlloc(GPTR
,
1199 handles
*sizeof(HANDLETABLE16
));
1201 TRACE("(%08x,%p,%p,%d)\n", hdc
, handletable
, metarecord
,
1203 for (i
=0; i
<handles
; i
++)
1204 ht
->objectHandle
[i
] = handletable
->objectHandle
[i
];
1205 PlayMetaFileRecord16(hdc
, ht
, metarecord
, handles
);
1206 for (i
=0; i
<handles
; i
++)
1207 handletable
->objectHandle
[i
] = ht
->objectHandle
[i
];
1208 GlobalFree((HGLOBAL
)ht
);
1212 /******************************************************************
1213 * GetMetaFileBits (GDI.159)
1215 * Trade in a metafile object handle for a handle to the metafile memory.
1219 HGLOBAL16 WINAPI
GetMetaFileBits16(
1220 HMETAFILE16 hmf
/* metafile handle */
1223 TRACE("hMem out: %04x\n", hmf
);
1227 /******************************************************************
1228 * SetMetaFileBits (GDI.160)
1230 * Trade in a metafile memory handle for a handle to a metafile object.
1231 * The memory region should hold a proper metafile, otherwise
1232 * problems will occur when it is used. Validity of the memory is not
1233 * checked. The function is essentially just the identity function.
1235 HMETAFILE16 WINAPI
SetMetaFileBits16(
1237 /* handle to a memory region holding a metafile */
1240 TRACE("hmf out: %04x\n", hMem
);
1245 /******************************************************************
1246 * SetMetaFileBitsBetter (GDI.196)
1248 * Trade in a metafile memory handle for a handle to a metafile object,
1249 * making a cursory check (using IsValidMetaFile()) that the memory
1250 * handle points to a valid metafile.
1253 * Handle to a metafile on success, NULL on failure..
1255 HMETAFILE16 WINAPI
SetMetaFileBitsBetter16( HMETAFILE16 hMeta
)
1257 if( IsValidMetaFile16( hMeta
) )
1258 return (HMETAFILE16
)GlobalReAlloc16( hMeta
, 0,
1259 GMEM_SHARE
| GMEM_NODISCARD
| GMEM_MODIFY
);
1260 return (HMETAFILE16
)0;
1263 /******************************************************************
1264 * SetMetaFileBitsEx (GDI32.323)
1266 * Create a metafile from raw data. No checking of the data is performed.
1267 * Use _GetMetaFileBitsEx_ to get raw data from a metafile.
1269 HMETAFILE WINAPI
SetMetaFileBitsEx(
1270 UINT size
, /* size of metafile, in bytes */
1271 const BYTE
*lpData
/* pointer to metafile data */
1274 METAHEADER
*mh
= HeapAlloc( GetProcessHeap(), 0, size
);
1276 memcpy(mh
, lpData
, size
);
1277 return MF_Create_HMETAFILE(mh
);
1280 /*****************************************************************
1281 * GetMetaFileBitsEx (GDI32.198) Get raw metafile data
1283 * Copies the data from metafile _hmf_ into the buffer _buf_.
1284 * If _buf_ is zero, returns size of buffer required. Otherwise,
1285 * returns number of bytes copied.
1287 UINT WINAPI
GetMetaFileBitsEx(
1288 HMETAFILE hmf
, /* metafile */
1289 UINT nSize
, /* size of buf */
1290 LPVOID buf
/* buffer to receive raw metafile data */
1292 METAHEADER
*mh
= MF_GetMetaHeader(hmf
);
1295 TRACE("(%08x,%d,%p)\n", hmf
, nSize
, buf
);
1296 if (!mh
) return 0; /* FIXME: error code */
1297 if(mh
->mtType
== METAFILE_DISK
)
1298 FIXME("Disk-based metafile?\n");
1299 mfSize
= mh
->mtSize
* 2;
1301 MF_ReleaseMetaHeader(hmf
);
1302 TRACE("returning size %d\n", mfSize
);
1305 if(mfSize
> nSize
) mfSize
= nSize
;
1306 memmove(buf
, mh
, mfSize
);
1307 MF_ReleaseMetaHeader(hmf
);
1311 /******************************************************************
1312 * GetWinMetaFileBits [GDI32.241]
1314 UINT WINAPI
GetWinMetaFileBits(HENHMETAFILE hemf
,
1315 UINT cbBuffer
, LPBYTE lpbBuffer
,
1316 INT fnMapMode
, HDC hdcRef
)
1318 FIXME("(%d,%d,%p,%d,%d): stub\n",
1319 hemf
, cbBuffer
, lpbBuffer
, fnMapMode
, hdcRef
);
1323 /******************************************************************
1324 * MF_Play_MetaCreateRegion
1326 * Handles META_CREATEREGION for PlayMetaFileRecord().
1330 * The layout of the record looks something like this:
1335 * 2 Looks like a handle? - not constant
1337 * 4 Total number of bytes
1338 * 5 No. of seperate bands = n [see below]
1339 * 6 Largest number of x co-ords in a band
1340 * 7-10 Bounding box x1 y1 x2 y2
1343 * Regions are divided into bands that are uniform in the
1344 * y-direction. Each band consists of pairs of on/off x-coords and is
1346 * m y0 y1 x1 x2 x3 ... xm m
1347 * into successive rdParm[]s.
1349 * This is probably just a dump of the internal RGNOBJ?
1355 static BOOL
MF_Play_MetaCreateRegion( METARECORD
*mr
, HRGN hrgn
)
1360 HRGN hrgn2
= CreateRectRgn( 0, 0, 0, 0 );
1362 for(band
= 0, start
= &(mr
->rdParm
[11]); band
< mr
->rdParm
[5];
1363 band
++, start
= end
+ 1) {
1364 if(*start
/ 2 != (*start
+ 1) / 2) {
1365 WARN("Delimiter not even.\n");
1366 DeleteObject( hrgn2
);
1370 end
= start
+ *start
+ 3;
1371 if(end
> (WORD
*)mr
+ mr
->rdSize
) {
1372 WARN("End points outside record.\n");
1373 DeleteObject( hrgn2
);
1377 if(*start
!= *end
) {
1378 WARN("Mismatched delimiters.\n");
1379 DeleteObject( hrgn2
);
1383 y0
= *(INT16
*)(start
+ 1);
1384 y1
= *(INT16
*)(start
+ 2);
1385 for(pair
= 0; pair
< *start
/ 2; pair
++) {
1386 SetRectRgn( hrgn2
, *(INT16
*)(start
+ 3 + 2*pair
), y0
,
1387 *(INT16
*)(start
+ 4 + 2*pair
), y1
);
1388 CombineRgn(hrgn
, hrgn
, hrgn2
, RGN_OR
);
1391 DeleteObject( hrgn2
);
1396 /******************************************************************
1397 * MF_Play_MetaExtTextOut
1399 * Handles META_EXTTEXTOUT for PlayMetaFileRecord().
1402 static BOOL
MF_Play_MetaExtTextOut(HDC16 hdc
, METARECORD
*mr
)
1409 s1
= mr
->rdParm
[2]; /* String length */
1410 len
= sizeof(METARECORD
) + (((s1
+ 1) >> 1) * 2) + 2 * sizeof(short)
1411 + sizeof(UINT16
) + (mr
->rdParm
[3] ? sizeof(RECT16
) : 0);
1412 /* rec len without dx array */
1414 sot
= (LPSTR
)&mr
->rdParm
[4]; /* start_of_text */
1416 sot
+= sizeof(RECT16
); /* there is a rectangle, so add offset */
1418 if (mr
->rdSize
== len
/ 2)
1419 dxx
= NULL
; /* determine if array present */
1421 if (mr
->rdSize
== (len
+ s1
* sizeof(INT16
)) / 2)
1422 dxx
= (LPINT16
)(sot
+(((s1
+1)>>1)*2));
1424 TRACE("%s len: %ld\n", sot
, mr
->rdSize
);
1426 "Please report: ExtTextOut len=%ld slen=%d rdSize=%ld opt=%04x\n",
1427 len
, s1
, mr
->rdSize
, mr
->rdParm
[3]);
1428 dxx
= NULL
; /* should't happen -- but if, we continue with NULL */
1430 ExtTextOut16( hdc
, mr
->rdParm
[1], /* X position */
1431 mr
->rdParm
[0], /* Y position */
1432 mr
->rdParm
[3], /* options */
1433 mr
->rdParm
[3] ? (LPRECT16
) &mr
->rdParm
[4]:NULL
,
1436 s1
, dxx
); /* length, dx array */
1438 TRACE("%s len: %ld dx0: %d\n", sot
, mr
->rdSize
, dxx
[0]);