Commit 6518edfa authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Implement writing SetPageTransform records.

parent 55ad8315
...@@ -59,6 +59,7 @@ extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN; ...@@ -59,6 +59,7 @@ extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN; extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush, extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush,
GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN; GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN;
extern MetafileType METAFILE_GetEmfType(HENHMETAFILE hemf) DECLSPEC_HIDDEN; extern MetafileType METAFILE_GetEmfType(HENHMETAFILE hemf) DECLSPEC_HIDDEN;
......
...@@ -5274,6 +5274,8 @@ GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, ...@@ -5274,6 +5274,8 @@ GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics,
GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale) GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
{ {
GpStatus stat;
TRACE("(%p, %.2f)\n", graphics, scale); TRACE("(%p, %.2f)\n", graphics, scale);
if(!graphics || (scale <= 0.0)) if(!graphics || (scale <= 0.0))
...@@ -5282,6 +5284,13 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale) ...@@ -5282,6 +5284,13 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (graphics->image && graphics->image->type == ImageTypeMetafile)
{
stat = METAFILE_SetPageTransform((GpMetafile*)graphics->image, graphics->unit, scale);
if (stat != Ok)
return stat;
}
graphics->scale = scale; graphics->scale = scale;
return Ok; return Ok;
...@@ -5289,6 +5298,8 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale) ...@@ -5289,6 +5298,8 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale)
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit) GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
{ {
GpStatus stat;
TRACE("(%p, %d)\n", graphics, unit); TRACE("(%p, %d)\n", graphics, unit);
if(!graphics) if(!graphics)
...@@ -5300,6 +5311,13 @@ GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit) ...@@ -5300,6 +5311,13 @@ GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
if(unit == UnitWorld) if(unit == UnitWorld)
return InvalidParameter; return InvalidParameter;
if (graphics->image && graphics->image->type == ImageTypeMetafile)
{
stat = METAFILE_SetPageTransform((GpMetafile*)graphics->image, unit, graphics->scale);
if (stat != Ok)
return stat;
}
graphics->unit = unit; graphics->unit = unit;
return Ok; return Ok;
......
...@@ -64,6 +64,12 @@ typedef struct EmfPlusFillRects ...@@ -64,6 +64,12 @@ typedef struct EmfPlusFillRects
DWORD Count; DWORD Count;
} EmfPlusFillRects; } EmfPlusFillRects;
typedef struct EmfPlusSetPageTransform
{
EmfPlusRecordHeader Header;
REAL PageScale;
} EmfPlusSetPageTransform;
typedef struct EmfPlusRect typedef struct EmfPlusRect
{ {
SHORT X; SHORT X;
...@@ -416,6 +422,29 @@ GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush, ...@@ -416,6 +422,29 @@ GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush,
return Ok; return Ok;
} }
GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale)
{
if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
{
EmfPlusSetPageTransform *record;
GpStatus stat;
stat = METAFILE_AllocateRecord(metafile,
sizeof(EmfPlusSetPageTransform),
(void**)&record);
if (stat != Ok)
return stat;
record->Header.Type = EmfPlusRecordTypeSetPageTransform;
record->Header.Flags = unit;
record->PageScale = scale;
METAFILE_WriteRecords(metafile);
}
return Ok;
}
GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc)
{ {
if (hdc != metafile->record_dc) if (hdc != metafile->record_dc)
......
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