Module: wine Branch: master Commit: 9d6e0750f25db9f9df34fed6f091c96bda74710a URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d6e0750f25db9f9df34fed6f0...
Author: Evan Stade estade@gmail.com Date: Mon Aug 13 18:34:46 2007 -0700
gdiplus: Added GdipDrawRectangles.
---
dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/gdiplusflat.h | 1 + 3 files changed, 44 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index f2b3107..664600d 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 319303f..68ceb4b 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 7bafb42..8a45a23 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,