CtrlCore: Fixed DrawLineOp (thanks pvictor)

git-svn-id: svn://ultimatepp.org/upp/trunk@9286 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-12-14 12:53:34 +00:00
parent 14b47d462a
commit c3551f2ab3

View file

@ -187,15 +187,15 @@ void SystemDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color col
if(width == PEN_SOLID)
width = 1;
if(y1 == y2 && width >= 0)
DrawRect(x1, y1, x2 - x1, width, color);
DrawRect(x1, y1 - width / 2, x2 - x1, width, color);
else
if(x1 == x2 && width >= 0)
DrawRect(x1, y1, width, y2 - y1, color);
DrawRect(x1 - width / 2, y1, width, y2 - y1, color);
else {
int w = width < 0 ? 1 : width;
double d = w / 2.0;
if(y1 == y2) {
cairo_move_to(cr, min(x1, x1) + 0.5, y1 + d);
cairo_move_to(cr, min(x1, x2) + 0.5, y1 + d);
cairo_line_to(cr, max(x1, x2) - 0.5, y1 + d);
}
else