Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 2021:c8c698bb99b6
Calculate number of required bitplanes more correctly.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Oct 2018 18:55:38 +0300 |
parents | 09d548b08150 |
children | eb6dafdd36dc |
comparison
equal
deleted
inserted
replaced
2020:57a2527ff63d | 2021:c8c698bb99b6 |
---|---|
1379 case DM_IMGFMT_IFF: | 1379 case DM_IMGFMT_IFF: |
1380 spec->compression = 1; | 1380 spec->compression = 1; |
1381 spec->nplanes = 0; | 1381 spec->nplanes = 0; |
1382 for (int n = 8; n >= 0;) | 1382 for (int n = 8; n >= 0;) |
1383 { | 1383 { |
1384 if (image->ncolors & (1 << n)) | 1384 if ((image->ncolors - 1) & (1 << n)) |
1385 { | 1385 { |
1386 spec->nplanes = n; | 1386 spec->nplanes = n + 1; |
1387 break; | 1387 break; |
1388 } | 1388 } |
1389 else | 1389 else |
1390 n--; | 1390 n--; |
1391 } | 1391 } |