From: Jerome St-Louis Date: Thu, 20 Feb 2014 03:48:35 +0000 (-0500) Subject: ecere/gfx/OpenGLDisplayDriver: (~639) Fixed bad lines offset on Surface::DrawLine() X-Git-Tag: 0.44.09.9~12 X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=c950cfc276a2837b4fd9913680fec5913dc8e751 ecere/gfx/OpenGLDisplayDriver: (~639) Fixed bad lines offset on Surface::DrawLine() - Fixes collapse/expand boxes on tree views with OpenGL driver --- diff --git a/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec b/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec index 026b3fc..c5c9f80 100644 --- a/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec +++ b/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec @@ -2583,11 +2583,24 @@ class OpenGLDisplayDriver : DisplayDriver glEnd(); } - void DrawLine(Display display, Surface surface, int x1, int y1, int x2, int y2) + void DrawLine(Display display, Surface surface, int _x1, int _y1, int _x2, int _y2) { OGLSurface oglSurface = surface.driverData; - if(x1 == x2) { y2++; y1--; } - else if(y1 == y2) { x2++; x1--; } + float x1 = _x1, x2 = _x2, y1 = _y1, y2 = _y2; + if(_x1 == _x2) + { + if(_y2 >= _y1) + y2 += 1; + else + y1 += 1; + } + else if(_y1 == _y2) + { + if(_x2 >= _x1) + x2 += 1; + else + x1 += 1; + } x1 += surface.offset.x; y1 += surface.offset.y; x2 += surface.offset.x;