From: Piotr Caban piotr@codeweavers.com
--- dlls/gdi32/dc.c | 9 +++++++++ dlls/gdi32/emfdc.c | 32 ++++++++++++++++++++++++++++++++ dlls/gdi32/gdi_private.h | 2 ++ 3 files changed, 43 insertions(+)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 531fbb1fe85..66832f9012e 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -655,8 +655,17 @@ INT WINAPI Escape( HDC hdc, INT escape, INT in_count, const char *in_data, void INT WINAPI ExtEscape( HDC hdc, INT escape, INT input_size, const char *input, INT output_size, char *output ) { + struct print *print; + DC_ATTR *dc_attr; + if (is_meta_dc( hdc )) return METADC_ExtEscape( hdc, escape, input_size, input, output_size, output ); + if (!(dc_attr = get_dc_attr( hdc ))) return 0; + if ((print = get_dc_print( dc_attr )) && dc_attr->emf) + { + int ret = EMFDC_ExtEscape( dc_attr, escape, input_size, input, output_size, output ); + if (ret) return ret; + } return NtGdiExtEscape( hdc, NULL, 0, escape, input_size, input, output_size, output ); }
diff --git a/dlls/gdi32/emfdc.c b/dlls/gdi32/emfdc.c index ef316fe42a1..5c3d01e43b1 100644 --- a/dlls/gdi32/emfdc.c +++ b/dlls/gdi32/emfdc.c @@ -1167,6 +1167,38 @@ BOOL EMFDC_PolyDraw( DC_ATTR *dc_attr, const POINT *pts, const BYTE *types, DWOR return ret; }
+INT EMFDC_ExtEscape( DC_ATTR *dc_attr, INT escape, INT input_size, const char *input, + INT output_size, char *output) +{ + struct EMREXTESCAPE + { + EMR emr; + DWORD escape; + DWORD size; + BYTE data[1]; + } *emr; + size_t size; + + if (escape == QUERYESCSUPPORT) return 0; + + size = FIELD_OFFSET( struct EMREXTESCAPE, data[input_size] ); + size = (size + 3) & ~3; + if (!(emr = HeapAlloc( GetProcessHeap(), 0, size ))) return 0; + + emr->emr.iType = EMR_EXTESCAPE; + emr->emr.nSize = size; + emr->escape = escape; + emr->size = input_size; + memcpy(emr->data, input, input_size); + emfdc_record( get_dc_emf( dc_attr ), &emr->emr ); + HeapFree( GetProcessHeap(), 0, emr ); + if (output_size && output) return 0; + + if (escape == PASSTHROUGH || escape == POSTSCRIPT_PASSTHROUGH) + input_size -= sizeof(WORD); + return input_size ? input_size : 1; +} + BOOL EMFDC_ExtFloodFill( DC_ATTR *dc_attr, INT x, INT y, COLORREF color, UINT fill_type ) { EMREXTFLOODFILL emr; diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index b8f914fe1f4..b78733103f8 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -187,6 +187,8 @@ extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right, extern BOOL EMFDC_EndPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN; extern BOOL EMFDC_ExcludeClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; +extern INT EMFDC_ExtEscape( DC_ATTR *dc_attr, INT escape, INT input_size, const char *input, + INT output_size, char *output) DECLSPEC_HIDDEN; extern BOOL EMFDC_ExtFloodFill( DC_ATTR *dc_attr, INT x, INT y, COLORREF color, UINT fill_type ) DECLSPEC_HIDDEN; extern BOOL EMFDC_ExtSelectClipRgn( DC_ATTR *dc_attr, HRGN hrgn, INT mode ) DECLSPEC_HIDDEN;