Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 1807:d53bdee5ffa5
Remove slight bit of code duplication.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 19 Jun 2018 13:26:48 +0300 |
parents | 0562dd55a1f6 |
children | 4f141426eb31 |
comparison
equal
deleted
inserted
replaced
1806:dcb12cd340d3 | 1807:d53bdee5ffa5 |
---|---|
910 mapping[map->from] = map->to; | 910 mapping[map->from] = map->to; |
911 mapped[map->to] = TRUE; | 911 mapped[map->to] = TRUE; |
912 } | 912 } |
913 } | 913 } |
914 | 914 |
915 | |
916 // Fill in the rest | 915 // Fill in the rest |
917 if (optRemapRemove) | 916 if (optRemapRemove) |
918 { | |
919 dmMsg(2, "Removing unused colors.\n"); | 917 dmMsg(2, "Removing unused colors.\n"); |
920 for (index = 0; index < src->ncolors; index++) | 918 |
921 if (mapping[index] < 0 && used[index]) | 919 for (index = 0; index < src->ncolors; index++) |
922 { | 920 if (mapping[index] < 0 && |
923 for (n = 0; n < src->ncolors; n++) | 921 (!optRemapRemove || (optRemapRemove && used[index]))) |
924 if (!mapped[n]) | 922 { |
925 { | 923 for (n = 0; n < src->ncolors; n++) |
926 mapping[index] = n; | 924 if (!mapped[n]) |
927 mapped[n] = TRUE; | 925 { |
928 break; | 926 mapping[index] = n; |
929 } | 927 mapped[n] = TRUE; |
930 } | 928 break; |
931 } | |
932 else | |
933 { | |
934 for (index = 0; index < src->ncolors; index++) | |
935 if (mapping[index] < 0) | |
936 { | |
937 for (n = 0; n < src->ncolors; n++) | |
938 if (!mapped[n]) | |
939 { | |
940 mapping[index] = n; | |
941 mapped[n] = TRUE; | |
942 break; | |
943 } | |
944 } | 929 } |
945 } | 930 } |
946 | 931 |
947 // Calculate final number of palette colors | 932 // Calculate final number of palette colors |
948 ncolors = 0; | 933 ncolors = 0; |