X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=shape.c;fp=shape.c;h=9e03f19a49f395dd47eefad595fed200313783bd;hp=867610e8541993ae7b1a208e1487263b3cdcd721;hb=46dacbe75dac20a1c6e1b61a2eb99ca25fc971ec;hpb=e3ee5ceeccdd8f3b82c7ec2df50e3a9f2c77914d diff --git a/shape.c b/shape.c index 867610e..9e03f19 100644 --- a/shape.c +++ b/shape.c @@ -13,6 +13,7 @@ get_shape(SDL_Surface *img, struct shape *s) exit(1); } + s->area = 0; s->w = img->w; s->h = img->h; s->mw = ((img->w+31)>>5); s->mask = malloc(4*s->mw*s->h); @@ -29,7 +30,7 @@ get_shape(SDL_Surface *img, struct shape *s) bit = 0; for(x=0; xw; x++) { if(!bit) { bits = 0; bit = 0x80000000; } - if(*px++ != transp) bits |= bit; + if(*px++ != transp) { bits |= bit; s->area++; } bit >>= 1; if(!bit || x == img->w - 1) { *(p++) = bits; } }