changeset 2016:7114ea4c3c42

Cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 31 Aug 2018 17:31:54 +0300
parents c5a88bb4ee3f
children 3a768f8d409d
files tools/libgfx.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/libgfx.c	Wed Aug 29 22:01:29 2018 +0300
+++ b/tools/libgfx.c	Fri Aug 31 17:31:54 2018 +0300
@@ -950,7 +950,8 @@
     dmMemset(&hdr, 0, sizeof(hdr));
     if (spec.paletted)
     {
-        for (int i = 0; i < (img->ncolors > DMPCX_PAL_COLORS ? DMPCX_PAL_COLORS : img->ncolors); i++)
+        const int ncolors = img->ncolors > DMPCX_PAL_COLORS ? DMPCX_PAL_COLORS : img->ncolors;
+        for (int i = 0; i < ncolors; i++)
         {
             hdr.colorMap[i].r = img->pal[i].r;
             hdr.colorMap[i].g = img->pal[i].g;