mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 20:18:28 +00:00
gdiplus/metafile: Implement DrawRectangles() recording.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Esme Povirk <esme@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b733e39ae5
commit
81bbc4872e
3 changed files with 60 additions and 0 deletions
|
@ -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,
|
||||||
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
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue