Mercurial > hg > dmlib
changeset 950:88d9440afad0
Use dmzlib module in stb_image.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 26 Feb 2015 18:35:29 +0200 |
parents | 6ed9465f3913 |
children | 1723ebe6771c |
files | src/dmimage.c src/stb_image.c |
diffstat | 2 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dmimage.c Thu Feb 26 18:28:32 2015 +0200 +++ b/src/dmimage.c Thu Feb 26 18:35:29 2015 +0200 @@ -2,16 +2,16 @@ * DMLib * -- Bitmap image conversion and loading * Programmed and designed by Matti 'ccr' Hamalainen - * (C) Copyright 2012 Tecnic Software productions (TNSP) + * (C) Copyright 2012-2015 Tecnic Software productions (TNSP) */ #include "dmimage.h" +#include "dmzlib.h" #define STBI_NO_FAILURE_STRINGS 1 #define STBI_FAILURE_USERMSG 1 #define STB_IMAGE_IMPLEMENTATION 1 -#define STBI_INTERNAL_ZLIB 1 #define STBI_NO_STDIO 1 #define STBI_NO_HDR 1
--- a/src/stb_image.c Thu Feb 26 18:28:32 2015 +0200 +++ b/src/stb_image.c Thu Feb 26 18:35:29 2015 +0200 @@ -4263,11 +4263,9 @@ // initial guess for decoded data size to avoid unnecessary reallocs bpl = (s->img_x * depth + 7) / 8; // bytes per line, per component raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */; -#ifdef STBI_INTERNAL_ZLIB + z->expanded = (Uint8 *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone); -#else -# error NOT IMPLEMENTED! -#endif + if (z->expanded == NULL) return 0; // zlib should set error STBI_FREE(z->idata); z->idata = NULL; if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)