#include "wine/winbase16.h"
#include "wine/wingdi16.h"
-#include "bitmap.h"
+#include "gdi.h"
#include "wownt32.h"
#include "winreg.h"
#include "winternl.h"
+#include "gdi_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(metafile);
* Take a memory based METAHEADER and change it to a disk based METAHEADER
* assosiated with filename. Note: Trashes contents of old one.
*/
-METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mh, LPCSTR filename)
+METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mh, LPCVOID filename, BOOL uni )
{
METAHEADERDISK *mhd;
DWORD size;
mh->mtType = METAFILE_DISK;
size = HeapSize( GetProcessHeap(), 0, mh );
mhd = (METAHEADERDISK *)((char *)mh + sizeof(METAHEADER));
- strcpy(mhd->filename, filename);
+
+ if( uni )
+ WideCharToMultiByte(CP_ACP, 0, filename, -1,
+ mhd->filename, sizeof mhd->filename, NULL, NULL);
+ else
+ lstrcpynA( mhd->filename, filename, sizeof mhd->filename );
return mh;
}
}
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
CloseHandle(hFile);
- mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename);
+ mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename, FALSE);
}
return MF_Create_HMETAFILE16( mh2 );
*/
HMETAFILE WINAPI CopyMetaFileW(
HMETAFILE hSrcMetaFile, /* [in] handle of metafile to copy */
- LPCWSTR lpFilename /* [in] filename if copying to a file */
-) {
+ LPCWSTR lpFilename /* [in] filename if copying to a file */)
+{
METAHEADER *mh = MF_GetMetaHeader( hSrcMetaFile );
METAHEADER *mh2 = NULL;
HANDLE hFile;
}
if(lpFilename) { /* disk based metafile */
- DWORD len;
- LPSTR lpFilenameA;
if((hFile = CreateFileW(lpFilename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
HeapFree( GetProcessHeap(), 0, mh2 );
}
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
CloseHandle(hFile);
- len = WideCharToMultiByte(CP_ACP, 0, lpFilename, -1, NULL, 0, NULL, NULL);
- lpFilenameA = HeapAlloc(GetProcessHeap(), 0, len);
- WideCharToMultiByte(CP_ACP, 0, lpFilename, -1, lpFilenameA, len, NULL, NULL);
- mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilenameA);
- HeapFree(GetProcessHeap(), 0, lpFilenameA);
+ mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename, TRUE);
}
return MF_Create_HMETAFILE( mh2 );
if (lpFilename) RtlCreateUnicodeStringFromAsciiz(&lpFilenameW, lpFilename);
else lpFilenameW.Buffer = NULL;
- if (lpFilenameW.Buffer) {
- ret = CopyMetaFileW( hSrcMetaFile, lpFilenameW.Buffer );
- }
- RtlFreeUnicodeString(&lpFilenameW);
+ ret = CopyMetaFileW( hSrcMetaFile, lpFilenameW.Buffer );
+ if (lpFilenameW.Buffer)
+ RtlFreeUnicodeString(&lpFilenameW);
return ret;
}
HDC hdc,
HMETAFILE hmf,
MFENUMPROC lpEnumFunc,
- LPARAM lpData
-) {
+ LPARAM lpData)
+{
METAHEADER *mhTemp = NULL, *mh = MF_GetMetaHeader(hmf);
METARECORD *mr;
HANDLETABLE *ht;
}
/*****************************************************************
- * GetMetaFileBitsEx (GDI32.@) Get raw metafile data
+ * GetMetaFileBitsEx (GDI32.@)
+ *
+ * Get raw metafile data.
*
* Copies the data from metafile _hmf_ into the buffer _buf_.
* If _buf_ is zero, returns size of buffer required. Otherwise,
UINT WINAPI GetMetaFileBitsEx(
HMETAFILE hmf, /* [in] metafile */
UINT nSize, /* [in] size of buf */
- LPVOID buf /* [out] buffer to receive raw metafile data */
-) {
+ LPVOID buf /* [out] buffer to receive raw metafile data */)
+{
METAHEADER *mh = MF_GetMetaHeader(hmf);
UINT mfSize;
HDC hdcmf;
HMETAFILE hmf;
UINT ret;
+ RECT rc;
+ INT oldMapMode;
+
+ GetClipBox(hdcRef, &rc);
+ oldMapMode = SetMapMode(hdcRef, fnMapMode);
+
+ TRACE("(%p,%d,%p,%d,%p) rc=%s\n", hemf, cbBuffer, lpbBuffer,
+ fnMapMode, hdcRef, wine_dbgstr_rect(&rc));
- FIXME("(%p,%d,%p,%d,%p): stub\n", hemf, cbBuffer, lpbBuffer, fnMapMode, hdcRef);
hdcmf = CreateMetaFileA(NULL);
-/* PlayEnhMetaFile(hdcmf, hemf, lpRect); where does the bounding rect come from? */
+ PlayEnhMetaFile(hdcmf, hemf, &rc);
hmf = CloseMetaFile(hdcmf);
ret = GetMetaFileBitsEx(hmf, cbBuffer, lpbBuffer);
DeleteMetaFile(hmf);
+
+ SetMapMode(hdcRef, oldMapMode);
+
return ret;
}