From 610d2eec0054af40b82f38ddb81afc09b5bdf73b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 21 Feb 2016 14:41:29 +0100 Subject: GRAPHICS: Make VectorRendererAA::drawLineAlg never divide by zero. It won't crash any longer in the case dx = dy = 0. --- graphics/VectorRendererSpec.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index c5a1d7b3e4..260e621b2b 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -1967,7 +1967,6 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int offset) { template void VectorRendererAA:: drawLineAlg(int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color) { - PixelType *ptr = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1); int pitch = Base::_activeSurface->pitch / Base::_activeSurface->format.bytesPerPixel; int xdir = (x2 > x1) ? 1 : -1; @@ -1993,7 +1992,7 @@ drawLineAlg(int x1, int y1, int x2, int y2, uint dx, uint dy, PixelType color) { this->blendPixelPtr(ptr, color, ~alpha); this->blendPixelPtr(ptr + pitch, color, alpha); } - } else { + } else if (dy != 0) { gradient = (dx << 16) / dy; error_acc = 0; -- cgit v1.2.3