From 221e7a6b85d2f37983a33a837c9ae1cb40199b87 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 23 Dec 2019 07:03:46 +0000 Subject: [PATCH] paletteGetClosestColor: I think these < should be <= git-svn-id: https://svn.eduke32.com/eduke32@8489 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/colmatch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/build/src/colmatch.cpp b/source/build/src/colmatch.cpp index 89f4c2b50..3e5ab9aca 100644 --- a/source/build/src/colmatch.cpp +++ b/source/build/src/colmatch.cpp @@ -113,7 +113,7 @@ int32_t paletteGetClosestColorUpToIndex(int32_t const r, int32_t const g, int32_ for (; i < k; i++) if (col == (colmatchresults[i] & 0x00ffffff)) { mindist = i; break; } - if (mindist != -1 && colmatchresults[mindist]>>24 < (unsigned)lastokcol) + if (mindist != -1 && colmatchresults[mindist]>>24 <= (unsigned)lastokcol) return colmatchresults[mindist]>>24; skip: @@ -173,7 +173,7 @@ int32_t paletteGetClosestColorUpToIndexNoCache(int32_t r, int32_t g, int32_t b, mindist = INT32_MAX; - for (bssize_t i = 0; i < lastokcol; ++i) + for (bssize_t i = 0; i <= lastokcol; ++i) { char const * const pal1 = (char const *)&colmatch_palette[i*3]; int dist = gdist[pal1[1]+g];