diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index f2b31075acb..664600dc1f5 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -196,7 +196,7 @@ @ stub GdipDrawPolygonI @ stub GdipDrawRectangle @ stdcall GdipDrawRectangleI(ptr ptr long long long long) -@ stub GdipDrawRectangles +@ stdcall GdipDrawRectangles(ptr ptr ptr long) @ stub GdipDrawRectanglesI @ stub GdipDrawString @ stub GdipEmfToWmfBits diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 319303fea0b..68ceb4b154f 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -1228,6 +1228,48 @@ GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, return Ok; } +GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, + GpRectF* rects, INT count) +{ + GpPointF *ptf; + POINT *pti; + INT save_state, i; + + if(!graphics || !pen || !rects || count < 1) + return InvalidParameter; + + ptf = GdipAlloc(4 * count * sizeof(GpPointF)); + pti = GdipAlloc(4 * count * sizeof(POINT)); + + if(!ptf || !pti){ + GdipFree(ptf); + GdipFree(pti); + return OutOfMemory; + } + + for(i = 0; i < count; i++){ + ptf[4 * i + 3].X = ptf[4 * i].X = rects[i].X; + ptf[4 * i + 1].Y = ptf[4 * i].Y = rects[i].Y; + ptf[4 * i + 2].X = ptf[4 * i + 1].X = rects[i].X + rects[i].Width; + ptf[4 * i + 3].Y = ptf[4 * i + 2].Y = rects[i].Y + rects[i].Height; + } + + save_state = prepare_dc(graphics, pen); + SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH)); + + transform_and_round_points(graphics, pti, ptf, 4 * count); + + for(i = 0; i < count; i++) + Polygon(graphics->hdc, &pti[4 * i], 4); + + restore_dc(graphics, save_state); + + GdipFree(ptf); + GdipFree(pti); + + return Ok; +} + GpStatus WINGDIPAPI GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path) { INT save_state; diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 7bafb42c85f..8a45a2332a4 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -75,6 +75,7 @@ GpStatus WINGDIPAPI GdipDrawLines(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT); GpStatus WINGDIPAPI GdipDrawPath(GpGraphics*,GpPen*,GpPath*); GpStatus WINGDIPAPI GdipDrawPie(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics*,GpPen*,INT,INT,INT,INT); +GpStatus WINGDIPAPI GdipDrawRectangles(GpGraphics*,GpPen*,GpRectF*,INT); GpStatus WINGDIPAPI GdipFillPath(GpGraphics*,GpBrush*,GpPath*); GpStatus WINGDIPAPI GdipFillPie(GpGraphics*,GpBrush*,REAL,REAL,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipFillPolygonI(GpGraphics*,GpBrush*,GDIPCONST GpPoint*,INT,