Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero palette to be sure it is initialized #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gif.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,17 @@ void GifMakePalette( const uint8_t* lastFrame, const uint8_t* nextFrame, uint32_
const int splitElt = lastElt/2;
const int splitDist = splitElt/2;

memset(pPal->r, 0, lastElt);
memset(pPal->g, 0, lastElt);
memset(pPal->b, 0, lastElt);

GifSplitPalette(destroyableImage, numPixels, 1, lastElt, splitElt, splitDist, 1, buildForDither, pPal);

GIF_TEMP_FREE(destroyableImage);

// add the bottom node for the transparency index
pPal->treeSplit[1 << (bitDepth-1)] = 0;
pPal->treeSplitElt[1 << (bitDepth-1)] = 0;

pPal->r[0] = pPal->g[0] = pPal->b[0] = 0;
}

// Implements Floyd-Steinberg dithering, writes palette value to alpha
Expand Down