From 8bb5248464cb483160e8a5c2aaa5e8a6061ffd1e Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 4 Aug 2013 23:53:10 +0200 Subject: Fixed BMP generation. Fixed line padding. --- bmp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bmp.c b/bmp.c index 7ee3750..5ca1594 100644 --- a/bmp.c +++ b/bmp.c @@ -91,10 +91,12 @@ bmp_write_pixel(bmp_write_handle_t* bmph, color_t col) { return 0; } - if(--(bmph->line_left) == 0) { - bmph->line_left = bmph->width; - - return (fwrite(padding, bmph->line_padding, 1, bmph->fh) == 1); + if(bmph->line_padding != 0) { + if(--(bmph->line_left) == 0) { + bmph->line_left = bmph->width; + + return (fwrite(padding, bmph->line_padding, 1, bmph->fh) == 1); + } } return 1; -- cgit v1.2.3-70-g09d2