Mercurial > hg > dmlib
changeset 1807:d53bdee5ffa5
Remove slight bit of code duplication.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 19 Jun 2018 13:26:48 +0300 |
parents | dcb12cd340d3 |
children | 4b08e6a26564 |
files | tools/gfxconv.c |
diffstat | 1 files changed, 10 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/gfxconv.c Tue Jun 19 12:03:16 2018 +0300 +++ b/tools/gfxconv.c Tue Jun 19 13:26:48 2018 +0300 @@ -912,35 +912,20 @@ } } - // Fill in the rest if (optRemapRemove) + dmMsg(2, "Removing unused colors.\n"); + + for (index = 0; index < src->ncolors; index++) + if (mapping[index] < 0 && + (!optRemapRemove || (optRemapRemove && used[index]))) { - dmMsg(2, "Removing unused colors.\n"); - for (index = 0; index < src->ncolors; index++) - if (mapping[index] < 0 && used[index]) + for (n = 0; n < src->ncolors; n++) + if (!mapped[n]) { - for (n = 0; n < src->ncolors; n++) - if (!mapped[n]) - { - mapping[index] = n; - mapped[n] = TRUE; - break; - } - } - } - else - { - for (index = 0; index < src->ncolors; index++) - if (mapping[index] < 0) - { - for (n = 0; n < src->ncolors; n++) - if (!mapped[n]) - { - mapping[index] = n; - mapped[n] = TRUE; - break; - } + mapping[index] = n; + mapped[n] = TRUE; + break; } }