gdiplus: Updated GdipDrawRectangleI.
This commit is contained in:
parent
a4fff71454
commit
14e0df1fa0
|
@ -22,7 +22,7 @@
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "gdiplus.h"
|
#include "gdiplus.h"
|
||||||
|
|
||||||
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT)
|
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_MITER)
|
||||||
|
|
||||||
COLORREF ARGB2COLORREF(ARGB color);
|
COLORREF ARGB2COLORREF(ARGB color);
|
||||||
|
|
||||||
|
|
|
@ -590,31 +590,19 @@ GpStatus WINGDIPAPI GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x,
|
||||||
GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x,
|
GpStatus WINGDIPAPI GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x,
|
||||||
INT y, INT width, INT height)
|
INT y, INT width, INT height)
|
||||||
{
|
{
|
||||||
LOGBRUSH lb;
|
INT save_state;
|
||||||
HPEN hpen;
|
|
||||||
HGDIOBJ old_obj;
|
|
||||||
|
|
||||||
if(!pen || !graphics)
|
if(!pen || !graphics)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
lb.lbStyle = BS_SOLID;
|
save_state = SaveDC(graphics->hdc);
|
||||||
lb.lbColor = pen->color;
|
EndPath(graphics->hdc);
|
||||||
lb.lbHatch = 0;
|
SelectObject(graphics->hdc, pen->gdipen);
|
||||||
|
SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
|
||||||
|
|
||||||
hpen = ExtCreatePen(PS_GEOMETRIC | PS_ENDCAP_SQUARE, (INT) pen->width,
|
Rectangle(graphics->hdc, x, y, x + width, y + height);
|
||||||
&lb, 0, NULL);
|
|
||||||
|
|
||||||
old_obj = SelectObject(graphics->hdc, hpen);
|
RestoreDC(graphics->hdc, save_state);
|
||||||
|
|
||||||
/* assume pen aligment centered */
|
|
||||||
MoveToEx(graphics->hdc, x, y, NULL);
|
|
||||||
LineTo(graphics->hdc, x+width, y);
|
|
||||||
LineTo(graphics->hdc, x+width, y+height);
|
|
||||||
LineTo(graphics->hdc, x, y+height);
|
|
||||||
LineTo(graphics->hdc, x, y);
|
|
||||||
|
|
||||||
SelectObject(graphics->hdc, old_obj);
|
|
||||||
DeleteObject(hpen);
|
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue