Skip to content

Commit

Permalink
GRAPHICS: Use our own sort instead of bubble
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Feb 14, 2016
1 parent 13da5d5 commit bbcd455
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions graphics/primitives.cpp
Expand Up @@ -20,6 +20,7 @@
*
*/

#include "common/algorithm.h"
#include "common/util.h"
#include "graphics/primitives.h"

Expand Down Expand Up @@ -365,17 +366,8 @@ void drawPolygonScan(int *polyX, int *polyY, int npoints, Common::Rect &bbox, in
j = i;
}

// Sort the nodes, via a simple “Bubble” sort.
i = 0;
while (i < nodes - 1) {
if (nodeX[i] > nodeX[i + 1]) {
SWAP(nodeX[i], nodeX[i + 1]);
if (i)
i--;
} else {
i++;
}
}
// Sort the nodes
Common::sort(nodeX, ARRAYEND(nodeX));

// Fill the pixels between node pairs.
for (i = 0; i < nodes; i += 2) {
Expand Down

0 comments on commit bbcd455

Please sign in to comment.