Commit 800cde3c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiStartDoc for StartDoc.

parent 711ce415
......@@ -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.@)
*/
......
......@@ -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.@]
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment