Skip to content

Commit 953c989

Browse files
committed
Fixign alignment issue on ESP and SAMD boards
1 parent 29e91e0 commit 953c989

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/AnimatedGIF/AnimatedGIF_circuitpy.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ typedef struct gif_image_tag
137137
GIF_CLOSE_CALLBACK *pfnClose;
138138
GIFFILE GIFFile;
139139
void *pUser;
140-
unsigned char *pFrameBuffer;
140+
//unsigned char *pFrameBuffer;
141+
unsigned int *pFrameBuffer;
141142
unsigned char *pPixels, *pOldPixels;
142143
unsigned char ucLineBuf[MAX_WIDTH]; // current line
143144
unsigned char ucFileBuf[FILE_BUF_SIZE]; // holds temp data and pixel stack

lib/AnimatedGIF/gif.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ static void DrawNewPixels(GIFIMAGE *pPage, GIFDRAW *pDraw)
753753
int x, iPitch = pPage->iCanvasWidth;
754754

755755
s = pDraw->pPixels;
756-
d = &pPage->pFrameBuffer[pDraw->iX + (pDraw->y + pDraw->iY) * iPitch]; // dest pointer in our complete canvas buffer
756+
d = (uint8_t*)&pPage->pFrameBuffer[pDraw->iX + (pDraw->y + pDraw->iY) * iPitch]; // dest pointer in our complete canvas buffer
757757
if (pDraw->ucDisposalMethod == 2) // restore to background color
758758
{
759759
memset(d, pDraw->ucBackground, pDraw->iWidth);
@@ -785,13 +785,13 @@ static void ConvertNewPixels(GIFIMAGE *pPage, GIFDRAW *pDraw)
785785
uint8_t *d, *s;
786786
int x;
787787

788-
s = &pPage->pFrameBuffer[(pPage->iCanvasWidth * (pDraw->iY + pDraw->y)) + pDraw->iX];
789-
d = &pPage->pFrameBuffer[pPage->iCanvasHeight * pPage->iCanvasWidth]; // point past bottom of frame buffer
788+
s = (uint8_t*)&pPage->pFrameBuffer[(pPage->iCanvasWidth * (pDraw->iY + pDraw->y)) + pDraw->iX];
789+
d = (uint8_t*)&pPage->pFrameBuffer[pPage->iCanvasHeight * pPage->iCanvasWidth]; // point past bottom of frame buffer
790790
if (pPage->ucPaletteType == GIF_PALETTE_RGB565_LE || pPage->ucPaletteType == GIF_PALETTE_RGB565_BE)
791791
{
792792
uint16_t *pPal, *pu16;
793793
pPal = (uint16_t *)pDraw->pPalette;
794-
pu16 = (uint16_t *)d;
794+
pu16 = (uint16_t *)&pPage->pFrameBuffer[pPage->iCanvasHeight * pPage->iCanvasWidth];
795795
for (x=0; x<pPage->iWidth; x++)
796796
{
797797
*pu16++ = pPal[*s++]; // convert to RGB565 pixels
@@ -899,7 +899,7 @@ static void GIFMakePels(GIFIMAGE *pPage, unsigned int code)
899899
if (pPage->ucDrawType == GIF_DRAW_COOKED)
900900
{
901901
ConvertNewPixels(pPage, &gd); // prepare for output
902-
gd.pPixels = &pPage->pFrameBuffer[pPage->iCanvasWidth * pPage->iCanvasHeight];
902+
gd.pPixels = (uint8_t*)&pPage->pFrameBuffer[pPage->iCanvasWidth * pPage->iCanvasHeight];
903903
}
904904
}
905905
(*pPage->pfnDraw)(&gd); // callback to handle this line

0 commit comments

Comments
 (0)