From b18211bb9d1f8f758e814a5b5f6dc74e78183c51 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 2 Apr 2011 16:39:30 +0000 Subject: (svn r22291) -Add: a linewidth argument to GfxDrawLine() and Blitter::DrawLine(). --- src/gfx.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/gfx.cpp') diff --git a/src/gfx.cpp b/src/gfx.cpp index 6253238a3..62b8b024a 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -192,23 +192,25 @@ void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectM } } -void GfxDrawLine(int x, int y, int x2, int y2, int colour) +void GfxDrawLine(int x, int y, int x2, int y2, int colour, int width) { Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter(); DrawPixelInfo *dpi = _cur_dpi; + assert(width > 0); + x -= dpi->left; x2 -= dpi->left; y -= dpi->top; y2 -= dpi->top; /* Check clipping */ - if (x < 0 && x2 < 0) return; - if (y < 0 && y2 < 0) return; - if (x > dpi->width && x2 > dpi->width) return; - if (y > dpi->height && y2 > dpi->height) return; + if (x + width / 2 < 0 && x2 + width / 2 < 0 ) return; + if (y + width / 2 < 0 && y2 + width / 2 < 0 ) return; + if (x - width / 2 > dpi->width && x2 - width / 2 > dpi->width ) return; + if (y - width / 2 > dpi->height && y2 - width / 2 > dpi->height) return; - blitter->DrawLine(dpi->dst_ptr, x, y, x2, y2, dpi->width, dpi->height, colour); + blitter->DrawLine(dpi->dst_ptr, x, y, x2, y2, dpi->width, dpi->height, colour, width); } void GfxDrawLineUnscaled(int x, int y, int x2, int y2, int colour) @@ -229,7 +231,7 @@ void GfxDrawLineUnscaled(int x, int y, int x2, int y2, int colour) blitter->DrawLine(dpi->dst_ptr, UnScaleByZoom(x, dpi->zoom), UnScaleByZoom(y, dpi->zoom), UnScaleByZoom(x2, dpi->zoom), UnScaleByZoom(y2, dpi->zoom), - UnScaleByZoom(dpi->width, dpi->zoom), UnScaleByZoom(dpi->height, dpi->zoom), colour); + UnScaleByZoom(dpi->width, dpi->zoom), UnScaleByZoom(dpi->height, dpi->zoom), colour, 1); } /** -- cgit v1.2.3-54-g00ecf