Jacek Caban : gdi32: Use NtGdiStartDoc for StartDoc.
Alexandre Julliard
julliard at winehq.org
Thu Sep 2 15:45:31 CDT 2021
Module: wine
Branch: master
Commit: 800cde3cf4bffa3a2909e5ae00326db6eb1b42b1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=800cde3cf4bffa3a2909e5ae00326db6eb1b42b1
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Sep 2 14:14:38 2021 +0200
gdi32: Use NtGdiStartDoc for StartDoc.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/gdidc.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
dlls/gdi32/printdrv.c | 55 ++----------------------------------------
include/ntgdi.h | 2 +-
3 files changed, 70 insertions(+), 54 deletions(-)
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 0f01e28696d..f50b10dd3c7 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -23,6 +23,7 @@
#include "gdi_private.h"
#include "winternl.h"
#include "ddrawgdi.h"
+#include "winnls.h"
#include "wine/debug.h"
@@ -1821,6 +1822,72 @@ BOOL WINAPI CancelDC(HDC hdc)
return TRUE;
}
+/***********************************************************************
+ * StartDocW [GDI32.@]
+ *
+ * StartDoc calls the STARTDOC Escape with the input data pointing to DocName
+ * and the output data (which is used as a second input parameter).pointing at
+ * the whole docinfo structure. This seems to be an undocumented feature of
+ * the STARTDOC Escape.
+ *
+ * Note: we now do it the other way, with the STARTDOC Escape calling StartDoc.
+ */
+INT WINAPI StartDocW( HDC hdc, const DOCINFOW *doc )
+{
+ DC_ATTR *dc_attr;
+
+ TRACE("DocName %s, Output %s, Datatype %s, fwType %#x\n",
+ debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput),
+ debugstr_w(doc->lpszDatatype), doc->fwType);
+
+ if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
+
+ if (dc_attr->abort_proc && !dc_attr->abort_proc( hdc, 0 )) return 0;
+ return NtGdiStartDoc( hdc, doc, NULL, 0 );
+}
+
+/***********************************************************************
+ * StartDocA [GDI32.@]
+ */
+INT WINAPI StartDocA( HDC hdc, const DOCINFOA *doc )
+{
+ WCHAR *doc_name = NULL, *output = NULL, *data_type = NULL;
+ DOCINFOW docW;
+ INT ret, len;
+
+ docW.cbSize = doc->cbSize;
+ if (doc->lpszDocName)
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, doc->lpszDocName, -1, NULL, 0 );
+ doc_name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, doc->lpszDocName, -1, doc_name, len );
+ }
+ if (doc->lpszOutput)
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, doc->lpszOutput, -1, NULL, 0 );
+ output = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, doc->lpszOutput, -1, output, len );
+ }
+ if (doc->lpszDatatype)
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, doc->lpszDatatype, -1, NULL, 0);
+ data_type = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, doc->lpszDatatype, -1, data_type, len );
+ }
+
+ docW.lpszDocName = doc_name;
+ docW.lpszOutput = output;
+ docW.lpszDatatype = data_type;
+ docW.fwType = doc->fwType;
+
+ ret = StartDocW(hdc, &docW);
+
+ HeapFree( GetProcessHeap(), 0, doc_name );
+ HeapFree( GetProcessHeap(), 0, output );
+ HeapFree( GetProcessHeap(), 0, data_type );
+ return ret;
+}
+
/**********************************************************************
* SetAbortProc (GDI32.@)
*/
diff --git a/dlls/gdi32/printdrv.c b/dlls/gdi32/printdrv.c
index ee8ae295daf..19f23ccbc12 100644
--- a/dlls/gdi32/printdrv.c
+++ b/dlls/gdi32/printdrv.c
@@ -56,16 +56,9 @@ DWORD WINAPI NtGdiInitSpool(void)
}
/******************************************************************
- * StartDocW [GDI32.@]
- *
- * StartDoc calls the STARTDOC Escape with the input data pointing to DocName
- * and the output data (which is used as a second input parameter).pointing at
- * the whole docinfo structure. This seems to be an undocumented feature of
- * the STARTDOC Escape.
- *
- * Note: we now do it the other way, with the STARTDOC Escape calling StartDoc.
+ * NtGdiStartDoc (win32u.@)
*/
-INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
+INT WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc, BOOL *banding, INT job )
{
INT ret;
DC *dc = get_dc_ptr( hdc );
@@ -86,50 +79,6 @@ INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
return ret;
}
-/*************************************************************************
- * StartDocA [GDI32.@]
- *
- */
-INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
-{
- LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL;
- DOCINFOW docW;
- INT ret, len;
-
- docW.cbSize = doc->cbSize;
- if (doc->lpszDocName)
- {
- len = MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,NULL,0);
- szDocName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,szDocName,len);
- }
- if (doc->lpszOutput)
- {
- len = MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,NULL,0);
- szOutput = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,szOutput,len);
- }
- if (doc->lpszDatatype)
- {
- len = MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,NULL,0);
- szDatatype = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,szDatatype,len);
- }
-
- docW.lpszDocName = szDocName;
- docW.lpszOutput = szOutput;
- docW.lpszDatatype = szDatatype;
- docW.fwType = doc->fwType;
-
- ret = StartDocW(hdc, &docW);
-
- HeapFree( GetProcessHeap(), 0, szDocName );
- HeapFree( GetProcessHeap(), 0, szOutput );
- HeapFree( GetProcessHeap(), 0, szDatatype );
-
- return ret;
-}
-
/******************************************************************
* EndDoc [GDI32.@]
diff --git a/include/ntgdi.h b/include/ntgdi.h
index 8bff1d4338f..23247c09e4a 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -397,7 +397,7 @@ UINT WINAPI NtGdiSetSystemPaletteUse( HDC hdc, UINT use );
BOOL WINAPI NtGdiSetTextJustification( HDC hdc, INT extra, INT breaks );
BOOL WINAPI NtGdiSetVirtualResolution( HDC hdc, DWORD horz_res, DWORD vert_res,
DWORD horz_size, DWORD vert_size );
-INT WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc );
+INT WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc, BOOL *banding, INT job );
INT WINAPI NtGdiStartPage( HDC hdc );
BOOL WINAPI NtGdiStretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
More information about the wine-cvs
mailing list