Gitweb links:

...log 
http://git.netsurf-browser.org/libnsgif.git/shortlog/245bd38ecdb75340065f0a05e292828261a241a5
...commit 
http://git.netsurf-browser.org/libnsgif.git/commit/245bd38ecdb75340065f0a05e292828261a241a5
...tree 
http://git.netsurf-browser.org/libnsgif.git/tree/245bd38ecdb75340065f0a05e292828261a241a5

The branch, master has been updated
       via  245bd38ecdb75340065f0a05e292828261a241a5 (commit)
       via  e55a0a37099caec739bcddd2f1a459a322bbec0c (commit)
      from  c5096a31de6493c9d88d72bc339e50a45afd052d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libnsgif.git/commit/?id=245bd38ecdb75340065f0a05e292828261a241a5
commit 245bd38ecdb75340065f0a05e292828261a241a5
Author: Michael Drake <t...@netsurf-browser.org>
Commit: Michael Drake <t...@netsurf-browser.org>

    Test: Update gif decoder to new API.

diff --git a/test/nsgif.c b/test/nsgif.c
index a32a0ef..e91d151 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -135,15 +135,17 @@ static void warning(const char *context, nsgif_error err)
 
 static void print_gif_info(const nsgif_info_t *info)
 {
+       const uint8_t *bg = (uint8_t *) &info->background;
+
        fprintf(stdout, "gif:\n");
        fprintf(stdout, "  width: %"PRIu32"\n", info->width);
        fprintf(stdout, "  height: %"PRIu32"\n", info->height);
        fprintf(stdout, "  max-loops: %"PRIu32"\n", info->loop_max);
        fprintf(stdout, "  frame-count: %"PRIu32"\n", info->frame_count);
        fprintf(stdout, "  background:\n");
-       fprintf(stdout, "    red: 0x%"PRIx8"\n", info->background[0]);
-       fprintf(stdout, "    green: 0x%"PRIx8"\n", info->background[1]);
-       fprintf(stdout, "    blue: 0x%"PRIx8"\n", info->background[2]);
+       fprintf(stdout, "    red: 0x%"PRIx8"\n", bg[0]);
+       fprintf(stdout, "    green: 0x%"PRIx8"\n", bg[1]);
+       fprintf(stdout, "    blue: 0x%"PRIx8"\n", bg[2]);
        fprintf(stdout, "  frames:\n");
 }
 


commitdiff 
http://git.netsurf-browser.org/libnsgif.git/commit/?id=e55a0a37099caec739bcddd2f1a459a322bbec0c
commit e55a0a37099caec739bcddd2f1a459a322bbec0c
Author: Michael Drake <t...@netsurf-browser.org>
Commit: Michael Drake <t...@netsurf-browser.org>

    API: Use uint32_t for background colour info member.
    
    This avoids increasing alignment of pointer type where we
    handle the background fill.

diff --git a/include/nsgif.h b/include/nsgif.h
index 655486b..0ee00e8 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -346,7 +346,7 @@ typedef struct nsgif_info {
        /** number of animation loops so far */
        int loop_count;
        /** background colour in same pixel format as \ref nsgif_bitmap_t. */
-       uint8_t background[4];
+       uint32_t background;
 } nsgif_info_t;
 
 /**
diff --git a/src/gif.c b/src/gif.c
index b37b517..4966677 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -591,18 +591,6 @@ static inline nsgif_error nsgif__decode(
 }
 
 /**
- * Helper to assign a pixel representation from a gif background colour array.
- *
- * \param[in]  bg  The background colour to read from.
- * \param[out] px  The pixel colour to write.
- */
-static inline void nsgif__gif_bg_to_px(
-               const uint8_t bg[4], uint32_t *px)
-{
-       *px = *(uint32_t *)bg;
-}
-
-/**
  * Helper to assign a gif background colour array from a pixel representation.
  *
  * \param[in]  px  The pixel colour to read from.
@@ -656,9 +644,7 @@ static void nsgif__restore_bg(
                                uint32_t *scanline = bitmap + offset_x +
                                                (offset_y + y) * 
gif->info.width;
                                for (uint32_t x = 0; x < width; x++) {
-                                       nsgif__gif_bg_to_px(
-                                                       gif->info.background,
-                                                       &scanline[x]);
+                                       scanline[x] = gif->info.background;
                                }
                        }
                }
@@ -1662,13 +1648,9 @@ nsgif_error nsgif_data_scan(
                if (gif->global_colours &&
                    gif->bg_index < gif->colour_table_size) {
                        size_t bg_idx = gif->bg_index;
-                       nsgif__gif_px_to_bg(
-                                       &gif->global_colour_table[bg_idx],
-                                       gif->info.background);
+                       gif->info.background = gif->global_colour_table[bg_idx];
                } else {
-                       nsgif__gif_px_to_bg(
-                                       &gif->global_colour_table[0],
-                                       gif->info.background);
+                       gif->info.background = gif->global_colour_table[0];
                }
        }
 


-----------------------------------------------------------------------

Summary of changes:
 include/nsgif.h |    2 +-
 src/gif.c       |   24 +++---------------------
 test/nsgif.c    |    8 +++++---
 3 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/include/nsgif.h b/include/nsgif.h
index 655486b..0ee00e8 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -346,7 +346,7 @@ typedef struct nsgif_info {
        /** number of animation loops so far */
        int loop_count;
        /** background colour in same pixel format as \ref nsgif_bitmap_t. */
-       uint8_t background[4];
+       uint32_t background;
 } nsgif_info_t;
 
 /**
diff --git a/src/gif.c b/src/gif.c
index b37b517..4966677 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -591,18 +591,6 @@ static inline nsgif_error nsgif__decode(
 }
 
 /**
- * Helper to assign a pixel representation from a gif background colour array.
- *
- * \param[in]  bg  The background colour to read from.
- * \param[out] px  The pixel colour to write.
- */
-static inline void nsgif__gif_bg_to_px(
-               const uint8_t bg[4], uint32_t *px)
-{
-       *px = *(uint32_t *)bg;
-}
-
-/**
  * Helper to assign a gif background colour array from a pixel representation.
  *
  * \param[in]  px  The pixel colour to read from.
@@ -656,9 +644,7 @@ static void nsgif__restore_bg(
                                uint32_t *scanline = bitmap + offset_x +
                                                (offset_y + y) * 
gif->info.width;
                                for (uint32_t x = 0; x < width; x++) {
-                                       nsgif__gif_bg_to_px(
-                                                       gif->info.background,
-                                                       &scanline[x]);
+                                       scanline[x] = gif->info.background;
                                }
                        }
                }
@@ -1662,13 +1648,9 @@ nsgif_error nsgif_data_scan(
                if (gif->global_colours &&
                    gif->bg_index < gif->colour_table_size) {
                        size_t bg_idx = gif->bg_index;
-                       nsgif__gif_px_to_bg(
-                                       &gif->global_colour_table[bg_idx],
-                                       gif->info.background);
+                       gif->info.background = gif->global_colour_table[bg_idx];
                } else {
-                       nsgif__gif_px_to_bg(
-                                       &gif->global_colour_table[0],
-                                       gif->info.background);
+                       gif->info.background = gif->global_colour_table[0];
                }
        }
 
diff --git a/test/nsgif.c b/test/nsgif.c
index a32a0ef..e91d151 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -135,15 +135,17 @@ static void warning(const char *context, nsgif_error err)
 
 static void print_gif_info(const nsgif_info_t *info)
 {
+       const uint8_t *bg = (uint8_t *) &info->background;
+
        fprintf(stdout, "gif:\n");
        fprintf(stdout, "  width: %"PRIu32"\n", info->width);
        fprintf(stdout, "  height: %"PRIu32"\n", info->height);
        fprintf(stdout, "  max-loops: %"PRIu32"\n", info->loop_max);
        fprintf(stdout, "  frame-count: %"PRIu32"\n", info->frame_count);
        fprintf(stdout, "  background:\n");
-       fprintf(stdout, "    red: 0x%"PRIx8"\n", info->background[0]);
-       fprintf(stdout, "    green: 0x%"PRIx8"\n", info->background[1]);
-       fprintf(stdout, "    blue: 0x%"PRIx8"\n", info->background[2]);
+       fprintf(stdout, "    red: 0x%"PRIx8"\n", bg[0]);
+       fprintf(stdout, "    green: 0x%"PRIx8"\n", bg[1]);
+       fprintf(stdout, "    blue: 0x%"PRIx8"\n", bg[2]);
        fprintf(stdout, "  frames:\n");
 }
 


-- 
NetSurf GIF Decoder
_______________________________________________
netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org
To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org

Reply via email to