diff --git a/lib/GfxRenderer/GfxRenderer.cpp b/lib/GfxRenderer/GfxRenderer.cpp index ccb7ad01..8bc69a55 100644 --- a/lib/GfxRenderer/GfxRenderer.cpp +++ b/lib/GfxRenderer/GfxRenderer.cpp @@ -7,8 +7,11 @@ #include #include +#include + #include "FontCacheManager.h" + const uint8_t* GfxRenderer::getGlyphBitmap(const EpdFontData* fontData, const EpdGlyph* glyph) const { if (fontData->groups != nullptr) { auto* fd = fontCacheManager_ ? fontCacheManager_->getDecompressor() : nullptr; @@ -1696,16 +1699,8 @@ void GfxRenderer::fillPolygon(const int* xPoints, const int* yPoints, int numPoi j = i; } - // Sort nodes by X (simple bubble sort, numPoints is small) - for (int i = 0; i < nodes - 1; i++) { - for (int k = i + 1; k < nodes; k++) { - if (nodeX[i] > nodeX[k]) { - int temp = nodeX[i]; - nodeX[i] = nodeX[k]; - nodeX[k] = temp; - } - } - } + // Sort nodes by X + std::sort(nodeX, nodeX + nodes); // Fill between pairs of nodes for (int i = 0; i < nodes - 1; i += 2) {