changeset 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 57a2527ff63d
children eb6dafdd36dc
files tools/gfxconv.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Thu Oct 25 18:47:10 2018 +0300
+++ b/tools/gfxconv.c	Thu Oct 25 18:55:38 2018 +0300
@@ -1381,9 +1381,9 @@
             spec->nplanes = 0;
             for (int n = 8; n >= 0;)
             {
-                if (image->ncolors & (1 << n))
+                if ((image->ncolors - 1) & (1 << n))
                 {
-                    spec->nplanes = n;
+                    spec->nplanes = n + 1;
                     break;
                 }
                 else