diff options
author | Johannes Schickel | 2016-02-21 14:41:29 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-02-21 14:41:29 +0100 |
commit | 610d2eec0054af40b82f38ddb81afc09b5bdf73b (patch) | |
tree | 384eee4384719afe8389fb74a15e9243ca528f98 | |
parent | 5bc3a5aa3f1ed9eeb5a65b509d1bccb50ec43015 (diff) | |
download | scummvm-rg350-610d2eec0054af40b82f38ddb81afc09b5bdf73b.tar.gz scummvm-rg350-610d2eec0054af40b82f38ddb81afc09b5bdf73b.tar.bz2 scummvm-rg350-610d2eec0054af40b82f38ddb81afc09b5bdf73b.zip |
GRAPHICS: Make VectorRendererAA::drawLineAlg never divide by zero.
It won't crash any longer in the case dx = dy = 0.
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 3 |
1 files changed, 1 insertions, 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<typename PixelType> void VectorRendererAA<PixelType>:: 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; |