login

<     >

2017-11-20 20:25:06 (UTC-02:00)

Marcel Rodrigues <marcelgmr@gmail.com>

Fix palette indexing.

diff --git a/gifdec.c b/gifdec.c
index e5eb702..b80eb05 100644
--- a/gifdec.c
+++ b/gifdec.c
@@ -385,7 +385,7 @@ render_frame_rect(gd_GIF *gif, uint8_t *buffer)
     for (j = 0; j < gif->fh; j++) {
         for (k = 0; k < gif->fw; k++) {
             index = gif->frame[j * gif->fw + k];
-            color = &gif->palette->colors[index];
+            color = &gif->palette->colors[index*3];
             if (!gif->gce.transparency || index != gif->gce.tindex)
                 memcpy(&buffer[i+k*3], color, 3);
         }