Sure :) We're passing width and height as int pointers to obtain the image dimensions and then try to find a matching video mode. While lodepng uses unsigned ints, that would always give us warnings. This is a simple way of addressing that issue. We can expect fairly small numbers, so the sign shouldn't matter here.
I also wrote patches to allow images smaller than the screen resolution to center them and fill the paddings with black. I believe that makes more sense these days, avoiding mode switches entirely if possible. I'll send those some other time. :) On Mon, Nov 4, 2019, 3:28 PM Philippe Mathieu-Daudé <phi...@redhat.com> wrote: > Hi Daniel, > > On 10/29/19 6:42 PM, cyrev...@googlemail.com wrote: > > From: Daniel Maslowski <i...@orangecms.org> > > Can you explain the rational of this patch? > In particular why use signed vs unsigned. > > Thanks, > > Phil. > > > Signed-off-by: Daniel Maslowski <i...@orangecms.org> > > --- > > src/lodepng.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/src/lodepng.c b/src/lodepng.c > > index d9c8443..490fc8e 100644 > > --- a/src/lodepng.c > > +++ b/src/lodepng.c > > @@ -1925,7 +1925,7 @@ static void Adam7_getpassvalues(unsigned passw[7], > unsigned passh[7], size_t fil > > /* > ////////////////////////////////////////////////////////////////////////// > */ > > > > /*read the information from the header and store it in the > LodePNGInfo. return value is error*/ > > -unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, > > +unsigned lodepng_inspect(int* w, int* h, LodePNGState* state, > > const unsigned char* in, size_t insize) { > > unsigned width, height; > > LodePNGInfo* info = &state->info_png; > > @@ -2275,7 +2275,7 @@ unsigned lodepng_inspect_chunk(LodePNGState* > state, size_t pos, > > } > > > > /*read a PNG, the result will be in the same color type as the PNG > (hence "generic")*/ > > -static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, > > +static void decodeGeneric(unsigned char** out, int* w, int* h, > > LodePNGState* state, > > const unsigned char* in, size_t insize) { > > unsigned char IEND = 0; > > @@ -2403,7 +2403,7 @@ static void decodeGeneric(unsigned char** out, > unsigned* w, unsigned* h, > > ucvector_cleanup(&scanlines); > > } > > > > -unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, > > +unsigned lodepng_decode(unsigned char** out, int* w, int* h, > > LodePNGState* state, > > const unsigned char* in, size_t insize) { > > *out = 0; > > @@ -2441,7 +2441,7 @@ unsigned lodepng_decode(unsigned char** out, > unsigned* w, unsigned* h, > > return state->error; > > } > > > > -unsigned lodepng_decode_memory(unsigned char** out, unsigned* w, > unsigned* h, const unsigned char* in, > > +unsigned lodepng_decode_memory(unsigned char** out, int* w, int* h, > const unsigned char* in, > > size_t insize, LodePNGColorType > colortype, unsigned bitdepth) { > > unsigned error; > > LodePNGState state; > > @@ -2453,11 +2453,11 @@ unsigned lodepng_decode_memory(unsigned char** > out, unsigned* w, unsigned* h, co > > return error; > > } > > > > -unsigned lodepng_decode32(unsigned char** out, unsigned* w, unsigned* > h, const unsigned char* in, size_t insize) { > > +unsigned lodepng_decode32(unsigned char** out, int* w, int* h, const > unsigned char* in, size_t insize) { > > return lodepng_decode_memory(out, w, h, in, insize, LCT_RGBA, 8); > > } > > > > -unsigned lodepng_decode24(unsigned char** out, unsigned* w, unsigned* > h, const unsigned char* in, size_t insize) { > > +unsigned lodepng_decode24(unsigned char** out, int* w, int* h, const > unsigned char* in, size_t insize) { > > return lodepng_decode_memory(out, w, h, in, insize, LCT_RGB, 8); > > } > > > > > >
_______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org