do not write zero alpha values

This commit is contained in:
Rudolf Polzer 2010-08-28 11:29:36 +02:00
parent 443b4bfa9f
commit aa9677f5b9

View File

@ -270,6 +270,8 @@ void hmap_to_nmap(unsigned char *map, int w, int h, int src_chan, double scale)
imgspace1[(w*y+x)][0] = (v - 128.0) / 127.0; imgspace1[(w*y+x)][0] = (v - 128.0) / 127.0;
imgspace1[(w*y+x)][1] = 0; imgspace1[(w*y+x)][1] = 0;
#endif #endif
if(v < 1)
v = 1; /* do not write alpha zero */
map[(w*y+x)*4+3] = floor(v + 0.5); map[(w*y+x)*4+3] = floor(v + 0.5);
} }
@ -380,6 +382,8 @@ void hmap_to_nmap_local(unsigned char *map, int w, int h, int src_chan, double s
break; break;
} }
img_reduced[(w*y+x)] = (v - 128.0) / 127.0; img_reduced[(w*y+x)] = (v - 128.0) / 127.0;
if(v < 1)
v = 1; /* do not write alpha zero */
map[(w*y+x)*4+3] = floor(v + 0.5); map[(w*y+x)*4+3] = floor(v + 0.5);
} }