Subversion Repositories eduke32

Rev

Rev 8488 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8488 Rev 8489
Line 111... Line 111...
111
111
112
    if (mindist == -1)
112
    if (mindist == -1)
113
    for (; i < k; i++)
113
    for (; i < k; i++)
114
        if (col == (colmatchresults[i] & 0x00ffffff)) { mindist = i; break; }
114
        if (col == (colmatchresults[i] & 0x00ffffff)) { mindist = i; break; }
115
115
116
    if (mindist != -1 && colmatchresults[mindist]>>24 < (unsigned)lastokcol)
116
    if (mindist != -1 && colmatchresults[mindist]>>24 <= (unsigned)lastokcol)
117
        return colmatchresults[mindist]>>24;
117
        return colmatchresults[mindist]>>24;
118
118
119
skip:
119
skip:
120
    i = paletteGetClosestColorUpToIndexNoCache(r, g, b, lastokcol);
120
    i = paletteGetClosestColorUpToIndexNoCache(r, g, b, lastokcol);
121
    colmatchresults[numcolmatchresults++ & (COLRESULTSIZ-1)] = col | (i << 24);
121
    colmatchresults[numcolmatchresults++ & (COLRESULTSIZ-1)] = col | (i << 24);
Line 171... Line 171...
171
    if (retcol >= 0)
171
    if (retcol >= 0)
172
        return retcol;
172
        return retcol;
173
173
174
    mindist = INT32_MAX;
174
    mindist = INT32_MAX;
175
175
176
    for (bssize_t i = 0; i < lastokcol; ++i)
176
    for (bssize_t i = 0; i <= lastokcol; ++i)
177
    {
177
    {
178
        char const * const pal1 = (char const *)&colmatch_palette[i*3];
178
        char const * const pal1 = (char const *)&colmatch_palette[i*3];
179
        int dist = gdist[pal1[1]+g];
179
        int dist = gdist[pal1[1]+g];
180
180
181
        if (dist >= mindist) continue;
181
        if (dist >= mindist) continue;