aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2016-02-14 14:00:01 +0100
committerEugene Sandulenko2016-02-14 17:13:22 +0100
commitbbcd45500437aa2faee9240faa07bf2d9fe03666 (patch)
tree98a02a16670c8a31185dd0560aa977b2d2d72340 /graphics
parent13da5d5376050186f79860aa32ab4faf291a4a64 (diff)
downloadscummvm-rg350-bbcd45500437aa2faee9240faa07bf2d9fe03666.tar.gz
scummvm-rg350-bbcd45500437aa2faee9240faa07bf2d9fe03666.tar.bz2
scummvm-rg350-bbcd45500437aa2faee9240faa07bf2d9fe03666.zip
GRAPHICS: Use our own sort instead of bubble
Diffstat (limited to 'graphics')
-rw-r--r--graphics/primitives.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index 0e970655d4..d2ed4b4646 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "common/algorithm.h"
#include "common/util.h"
#include "graphics/primitives.h"
@@ -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) {