diff --git a/mgraph440/pixelbase.cpp b/mgraph440/pixelbase.cpp index 2d13ad30..a02a3f63 100644 --- a/mgraph440/pixelbase.cpp +++ b/mgraph440/pixelbase.cpp @@ -79,10 +79,14 @@ PixelRefVector PixelBase::pixelateLine( Line l, int scalefactor ) const else { // Special case: exactly diagonal step (should only require one step): // (Should actually never happen) (Doesn't: checked with RFH) - a.x += 1; - pixel_list.push_back( PixelRef(a.x,parity * a.y) ); - a.y += 1; - pixel_list.push_back( PixelRef(a.x,parity * a.y) ); + if (a.x < b.x) { + a.x += 1; + pixel_list.push_back( PixelRef(a.x,parity * a.y) ); + } + if (a.y < b.y) { + a.y += 1; + pixel_list.push_back( PixelRef(a.x,parity * a.y) ); + } } } } diff --git a/salalib/spacepix.cpp b/salalib/spacepix.cpp index 2f45857b..3294eed2 100644 --- a/salalib/spacepix.cpp +++ b/salalib/spacepix.cpp @@ -128,10 +128,14 @@ PixelRefVector PixelBase::pixelateLine(Line l, int scalefactor) const { } else { // Special case: exactly diagonal step (should only require one step): // (Should actually never happen) (Doesn't: checked with RFH) - a.x += 1; - pixel_list.push_back(PixelRef(a.x, parity * a.y)); - a.y += 1; - pixel_list.push_back(PixelRef(a.x, parity * a.y)); + if (a.x < b.x) { + a.x += 1; + pixel_list.push_back(PixelRef(a.x, parity * a.y)); + } + if (a.y < b.y) { + a.y += 1; + pixel_list.push_back(PixelRef(a.x, parity * a.y)); + } } } }