diff --git a/changelog.txt b/changelog.txt index 339a95a2..fb55aa20 100644 --- a/changelog.txt +++ b/changelog.txt @@ -13,6 +13,7 @@ FEATURE: Added GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE configuration option FEATURE: Added GDISP_IMAGE_PNG_BLIT_BUFFER_SIZE configuration option FEATURE: Added GDISP_IMAGE_PNG_FILE_BUFFER_SIZE configuration option FEATURE: Added GDISP_IMAGE_PNG_Z_BUFFER_SIZE configuration option +FEATURE: Added GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE configuration option *** Release 2.7 *** diff --git a/gfxconf.example.h b/gfxconf.example.h index 67792d26..4fa31d0c 100644 --- a/gfxconf.example.h +++ b/gfxconf.example.h @@ -109,6 +109,7 @@ //#define GDISP_NEED_IMAGE FALSE // #define GDISP_NEED_IMAGE_NATIVE FALSE // #define GDISP_NEED_IMAGE_GIF FALSE +// #define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE 32 // #define GDISP_NEED_IMAGE_BMP FALSE // #define GDISP_NEED_IMAGE_BMP_1 TRUE // #define GDISP_NEED_IMAGE_BMP_4 TRUE diff --git a/src/gdisp/gdisp_image_gif.c b/src/gdisp/gdisp_image_gif.c index 5b29ec06..91a47b6c 100644 --- a/src/gdisp/gdisp_image_gif.c +++ b/src/gdisp/gdisp_image_gif.c @@ -11,12 +11,6 @@ #include "gdisp_image_support.h" -/** - * How big an array to allocate for blitting (in pixels) - * Bigger is faster but uses more RAM. - */ -#define BLIT_BUFFER_SIZE_GIF 32 - // We need a special error to indicate the end of file (which may not actually be an error) #define GDISP_IMAGE_GIF_EOF ((gdispImageError)-1) #define GDISP_IMAGE_GIF_LOOP ((gdispImageError)-2) @@ -50,7 +44,7 @@ typedef struct gifimgdecode { uint16_t code_last; uint32_t shiftdata; color_t * palette; - uint8_t buf[BLIT_BUFFER_SIZE_GIF]; // Buffer for decoded pixels + uint8_t buf[GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE]; // Buffer for decoded pixels uint16_t prefix[1<buf */ @@ -839,7 +833,7 @@ gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, coord_t x, coo continue; } priv->buf[gcnt++] = cache->palette[col]; - if (gcnt >= BLIT_BUFFER_SIZE_GIF) { + if (gcnt >= GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE) { // We have run out of buffer - dump it to the display gdispGBlitArea(g, x+mx-sx-gcnt+1, y+my-sy, gcnt, 1, 0, 0, gcnt, priv->buf); gcnt = 0; @@ -893,7 +887,7 @@ gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, coord_t x, coo continue; } priv->buf[gcnt++] = decode->palette[col]; - if (gcnt >= BLIT_BUFFER_SIZE_GIF) { + if (gcnt >= GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE) { // We have run out of buffer - dump it to the display gdispGBlitArea(g, x+mx-sx-gcnt+1, y+my-sy, gcnt, 1, 0, 0, gcnt, priv->buf); gcnt = 0; @@ -939,7 +933,7 @@ gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, coord_t x, coo continue; } priv->buf[gcnt++] = decode->palette[col]; - if (gcnt >= BLIT_BUFFER_SIZE_GIF) { + if (gcnt >= GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE) { // We have run out of buffer - dump it to the display gdispGBlitArea(g, x+mx-sx-gcnt+1, y+my-sy, gcnt, 1, 0, 0, gcnt, priv->buf); gcnt = 0; @@ -985,7 +979,7 @@ gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, coord_t x, coo continue; } priv->buf[gcnt++] = decode->palette[col]; - if (gcnt >= BLIT_BUFFER_SIZE_GIF) { + if (gcnt >= GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE) { // We have run out of buffer - dump it to the display gdispGBlitArea(g, x+mx-sx-gcnt+1, y+my-sy, gcnt, 1, 0, 0, gcnt, priv->buf); gcnt = 0; @@ -1031,7 +1025,7 @@ gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, coord_t x, coo continue; } priv->buf[gcnt++] = decode->palette[col]; - if (gcnt >= BLIT_BUFFER_SIZE_GIF) { + if (gcnt >= GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE) { // We have run out of buffer - dump it to the display gdispGBlitArea(g, x+mx-sx-gcnt+1, y+my-sy, gcnt, 1, 0, 0, gcnt, priv->buf); gcnt = 0; @@ -1078,7 +1072,7 @@ gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, coord_t x, coo continue; } priv->buf[gcnt++] = decode->palette[col]; - if (gcnt >= BLIT_BUFFER_SIZE_GIF) { + if (gcnt >= GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE) { // We have run out of buffer - dump it to the display gdispGBlitArea(g, x+mx-sx-gcnt+1, y+my-sy, gcnt, 1, 0, 0, gcnt, priv->buf); gcnt = 0; diff --git a/src/gdisp/gdisp_options.h b/src/gdisp/gdisp_options.h index 0b250cd9..91055a1c 100644 --- a/src/gdisp/gdisp_options.h +++ b/src/gdisp/gdisp_options.h @@ -397,6 +397,21 @@ #ifndef GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE #define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE 32 #endif +/** + * @} + * + * @name GDISP GIF Image Options + * @pre GDISP_NEED_IMAGE and GDISP_NEED_IMAGE_GIF must be TRUE + * @{ + */ + /** + * @brief The GIF blit buffer size. + * @details Defaults to 32 + * @note Bigger is faster but requires more RAM. + */ + #ifndef GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE + #define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE 32 + #endif /** * @} *