diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gdisp/gdisp_image_bmp.c | 24 | ||||
-rw-r--r-- | src/gdisp/gdisp_options.h | 9 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/gdisp/gdisp_image_bmp.c b/src/gdisp/gdisp_image_bmp.c index 2ea4e95f..33087e5d 100644 --- a/src/gdisp/gdisp_image_bmp.c +++ b/src/gdisp/gdisp_image_bmp.c @@ -16,7 +16,7 @@ * Bigger is faster but uses more RAM. * This must be greater than 40 bytes and 32 pixels as we read our headers into this space as well */ -#define BLIT_BUFFER_SIZE_BMP 32 +#define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE 32 typedef struct gdispImagePrivate_BMP { uint8_t bmpflags; @@ -49,7 +49,7 @@ typedef struct gdispImagePrivate_BMP { #endif size_t frame0pos; pixel_t *frame0cache; - pixel_t buf[BLIT_BUFFER_SIZE_BMP]; + pixel_t buf[GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE]; } gdispImagePrivate_BMP; void gdispImageClose_BMP(gdispImage *img) { @@ -379,7 +379,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { pc = priv->buf; len = 0; - while(x < img->width && len <= BLIT_BUFFER_SIZE_BMP-32) { + while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-32) { if (gfileRead(img->f, &b, 4) != 4) return 0; @@ -409,7 +409,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { while(x < img->width) { if (priv->bmpflags & BMP_RLE_ENC) { - while (priv->rlerun && len <= BLIT_BUFFER_SIZE_BMP-2 && x < img->width) { + while (priv->rlerun && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2 && x < img->width) { *pc++ = priv->palette[priv->rlecode >> 4]; priv->rlerun--; len++; @@ -424,7 +424,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { if (priv->rlerun) // Return if we have more run to do return len; } else if (priv->bmpflags & BMP_RLE_ABS) { - while (priv->rlerun && len <= BLIT_BUFFER_SIZE_BMP-2 && x < img->width) { + while (priv->rlerun && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2 && x < img->width) { if (gfileRead(img->f, &b, 1) != 1) return 0; *pc++ = priv->palette[b[0] >> 4]; @@ -484,7 +484,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { { uint8_t b[4]; - while(x < img->width && len <= BLIT_BUFFER_SIZE_BMP-8) { + while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-8) { if (gfileRead(img->f, &b, 4) != 4) return 0; @@ -515,7 +515,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { while(x < img->width) { if (priv->bmpflags & BMP_RLE_ENC) { - while (priv->rlerun && len < BLIT_BUFFER_SIZE_BMP && x < img->width) { + while (priv->rlerun && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE && x < img->width) { *pc++ = priv->palette[priv->rlecode]; priv->rlerun--; len++; @@ -524,7 +524,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { if (priv->rlerun) // Return if we have more run to do return len; } else if (priv->bmpflags & BMP_RLE_ABS) { - while (priv->rlerun && len < BLIT_BUFFER_SIZE_BMP && x < img->width) { + while (priv->rlerun && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE && x < img->width) { if (gfileRead(img->f, &b, 1) != 1) return 0; *pc++ = priv->palette[b[0]]; @@ -578,7 +578,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { { uint8_t b[4]; - while(x < img->width && len <= BLIT_BUFFER_SIZE_BMP-4) { + while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-4) { if (gfileRead(img->f, &b, 4) != 4) return 0; @@ -600,7 +600,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { uint16_t w[2]; color_t r, g, b; - while(x < img->width && len <= BLIT_BUFFER_SIZE_BMP-2) { + while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2) { if (gfileRead(img->f, &w, 4) != 4) return 0; gdispImageMakeLE16(w[0]); @@ -645,7 +645,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { { uint8_t b[3]; - while(x < img->width && len < BLIT_BUFFER_SIZE_BMP) { + while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) { if (gfileRead(img->f, &b, 3) != 3) return 0; *pc++ = RGB2COLOR(b[2], b[1], b[0]); @@ -668,7 +668,7 @@ static coord_t getPixels(gdispImage *img, coord_t x) { uint32_t dw; color_t r, g, b; - while(x < img->width && len < BLIT_BUFFER_SIZE_BMP) { + while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) { if (gfileRead(img->f, &dw, 4) != 4) return 0; gdispImageMakeLE32(dw); diff --git a/src/gdisp/gdisp_options.h b/src/gdisp/gdisp_options.h index 09502618..4ae267ea 100644 --- a/src/gdisp/gdisp_options.h +++ b/src/gdisp/gdisp_options.h @@ -388,6 +388,15 @@ #ifndef GDISP_NEED_IMAGE_BMP_32 #define GDISP_NEED_IMAGE_BMP_32 TRUE #endif + /** + * @brief The blit buffer size. + * @details Defaults to TRUE + * @note Bigger is faster but requires more RAM. + * @note This must be greater than 40 bytes and 32 pixels as we read our headers into this space as well. + */ + #ifndef GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE + #define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE 32 + #endif /** * @} * |