gdi32: Use NtGdiStartDoc for StartDoc.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-02 14:14:38 +02:00 committed by Alexandre Julliard
parent 711ce415c0
commit 800cde3cf4
3 changed files with 70 additions and 54 deletions

View file

@ -23,6 +23,7 @@
#include "gdi_private.h" #include "gdi_private.h"
#include "winternl.h" #include "winternl.h"
#include "ddrawgdi.h" #include "ddrawgdi.h"
#include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -1821,6 +1822,72 @@ BOOL WINAPI CancelDC(HDC hdc)
return TRUE; 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.@) * SetAbortProc (GDI32.@)
*/ */

View file

@ -56,16 +56,9 @@ DWORD WINAPI NtGdiInitSpool(void)
} }
/****************************************************************** /******************************************************************
* StartDocW [GDI32.@] * NtGdiStartDoc (win32u.@)
*
* 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) INT WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc, BOOL *banding, INT job )
{ {
INT ret; INT ret;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
@ -86,50 +79,6 @@ INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
return ret; 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.@] * EndDoc [GDI32.@]

View file

@ -397,7 +397,7 @@ UINT WINAPI NtGdiSetSystemPaletteUse( HDC hdc, UINT use );
BOOL WINAPI NtGdiSetTextJustification( HDC hdc, INT extra, INT breaks ); BOOL WINAPI NtGdiSetTextJustification( HDC hdc, INT extra, INT breaks );
BOOL WINAPI NtGdiSetVirtualResolution( HDC hdc, DWORD horz_res, DWORD vert_res, BOOL WINAPI NtGdiSetVirtualResolution( HDC hdc, DWORD horz_res, DWORD vert_res,
DWORD horz_size, DWORD vert_size ); 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 ); INT WINAPI NtGdiStartPage( HDC hdc );
BOOL WINAPI NtGdiStretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst, 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, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,