diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-10-29 11:22:37 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-10-29 11:22:37 +0000 |
commit | 394336f6112468bf106ef2885bf528e25ded41ef (patch) | |
tree | 68b8ed577a1a955c91b7b4444cc2b1be8c45c7df /src/palette.c | |
parent | 4694cd4f5c1dc6d3cac3eee8c13c35f6394f6036 (diff) | |
download | libnsfb-394336f6112468bf106ef2885bf528e25ded41ef.tar.gz libnsfb-394336f6112468bf106ef2885bf528e25ded41ef.tar.bz2 |
Only memset as much of the error diffusion buffer as is required.
Diffstat (limited to 'src/palette.c')
-rw-r--r-- | src/palette.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/palette.c b/src/palette.c index 1a24127..558ba28 100644 --- a/src/palette.c +++ b/src/palette.c @@ -54,10 +54,11 @@ void nsfb_palette_free(struct nsfb_palette_s *palette) /** Init error diffusion for a plot. */ void nsfb_palette_dither_init(struct nsfb_palette_s *palette, int width) { + width *= 3; palette->dither = true; - memset(palette->dither_ctx.data, 0, palette->dither_ctx.data_len); - palette->dither_ctx.width = width * 3; palette->dither_ctx.current = 0; + palette->dither_ctx.width = width; + memset(palette->dither_ctx.data, 0, width * sizeof(int)); } /** Finalise error diffusion after a plot. */ |