amiga_imgv

diff src/image.c @ 4:0fd37effde29

progress
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Oct 2017 11:36:18 +0300
parents 663471a80c21
children 0d3d7b020e6a
line diff
     1.1 --- a/src/image.c	Thu Oct 26 15:49:56 2017 +0300
     1.2 +++ b/src/image.c	Fri Oct 27 11:36:18 2017 +0300
     1.3 @@ -147,13 +147,15 @@
     1.4  		img->palette[i] = i | (i << 4) | (i << 8);
     1.5  	}
     1.6  
     1.7 -	pptr = img->pixels;
     1.8 -	for(i=0; i<4; i++) {
     1.9 +	for(i=0; i<nbpl; i++) {
    1.10  		pptr = img->pixels + i * w / 8;
    1.11  		for(y=0; y<h; y++) {
    1.12  			pixval = 0;
    1.13  			for(x=0; x<w; x++) {
    1.14 -				pixval = (pixval >> 1) | ((((x ^ y) >> i) & 1) ? 0x80 : 0);
    1.15 +				if(i < 4) {
    1.16 +					unsigned char val = (y & 1) ? 0 : 0xff;
    1.17 +					pixval = (pixval >> 1) | (((val >> i) & 1) ? 0x80 : 0);
    1.18 +				}
    1.19  				if((x & 7) == 7) {
    1.20  					*pptr++ = pixval;
    1.21  					pixval = 0;