Commit 81bbc487 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus/metafile: Implement DrawRectangles() recording.

parent b733e39a
...@@ -112,6 +112,7 @@ extern GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush, ...@@ -112,6 +112,7 @@ extern GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush,
extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN; extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_DrawEllipse(GpMetafile *metafile, GpPen *pen, GpRectF *rect) DECLSPEC_HIDDEN; extern GpStatus METAFILE_DrawEllipse(GpMetafile *metafile, GpPen *pen, GpRectF *rect) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rect) DECLSPEC_HIDDEN; extern GpStatus METAFILE_FillEllipse(GpMetafile *metafile, GpBrush *brush, GpRectF *rect) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_DrawRectangles(GpMetafile *metafile, GpPen *pen, const GpRectF *rects, INT count) DECLSPEC_HIDDEN;
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN; REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
......
...@@ -4132,6 +4132,9 @@ GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, ...@@ -4132,6 +4132,9 @@ GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen,
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
if (is_metafile_graphics(graphics))
return METAFILE_DrawRectangles((GpMetafile *)graphics->image, pen, rects, count);
status = GdipCreatePath(FillModeAlternate, &path); status = GdipCreatePath(FillModeAlternate, &path);
if (status != Ok) return status; if (status != Ok) return status;
......
...@@ -5102,3 +5102,59 @@ GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush, GpRegion* reg ...@@ -5102,3 +5102,59 @@ GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush, GpRegion* reg
return Ok; return Ok;
} }
GpStatus METAFILE_DrawRectangles(GpMetafile *metafile, GpPen *pen, const GpRectF *rects, INT count)
{
EmfPlusDrawRects *record;
GpStatus stat;
BOOL integer_rects = TRUE;
DWORD pen_id;
int i;
if (metafile->metafile_type == MetafileTypeEmf)
{
FIXME("stub!\n");
return NotImplemented;
}
stat = METAFILE_AddPenObject(metafile, pen, &pen_id);
if (stat != Ok) return stat;
for (i = 0; i < count; i++)
{
if (!is_integer_rect(&rects[i]))
{
integer_rects = FALSE;
break;
}
}
stat = METAFILE_AllocateRecord(metafile, FIELD_OFFSET(EmfPlusDrawRects, RectData) +
count * (integer_rects ? sizeof(record->RectData.rect) : sizeof(record->RectData.rectF)),
(void **)&record);
if (stat != Ok)
return stat;
record->Header.Type = EmfPlusRecordTypeDrawRects;
record->Header.Flags = pen_id;
if (integer_rects)
record->Header.Flags |= 0x4000;
record->Count = count;
if (integer_rects)
{
for (i = 0; i < count; i++)
{
record->RectData.rect[i].X = (SHORT)rects[i].X;
record->RectData.rect[i].Y = (SHORT)rects[i].Y;
record->RectData.rect[i].Width = (SHORT)rects[i].Width;
record->RectData.rect[i].Height = (SHORT)rects[i].Height;
}
}
else
memcpy(record->RectData.rectF, rects, sizeof(*rects) * count);
METAFILE_WriteRecords(metafile);
return Ok;
}
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