summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-08-26 03:28:09 +0200
committercinap_lenrek <cinap_lenrek@localhost>2011-08-26 03:28:09 +0200
commit00161ca7fcd1422bfede7b50776fbf2f871e67c9 (patch)
treedf5d96e02d79206d3ac7a35b070a0ef2704a3b01
parentc9b707cd5632a84d44ab089e02e65407dcc4ed54 (diff)
downloadplan9front-00161ca7fcd1422bfede7b50776fbf2f871e67c9.tar.xz
gif: fix setting of transparency channels when writing gifs. (from rsc p9p)
-rw-r--r--sys/src/cmd/jpg/gif.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/src/cmd/jpg/gif.c b/sys/src/cmd/jpg/gif.c
index f99270176..7034ff888 100644
--- a/sys/src/cmd/jpg/gif.c
+++ b/sys/src/cmd/jpg/gif.c
@@ -229,7 +229,7 @@ addalpha(Rawimage *i)
* r is used only for reference; the image is already in c.
*/
void
-whiteout(Rawimage *r, Rawimage *c)
+blackout(Rawimage *r, Rawimage *c)
{
int i, trindex;
uchar *rp, *cp;
@@ -241,9 +241,9 @@ whiteout(Rawimage *r, Rawimage *c)
for(i=0; i<r->chanlen; i++){
if(*rp == trindex){
*cp++ = 0x00;
- *cp++ = 0xFF;
- *cp++ = 0xFF;
- *cp++ = 0xFF;
+ *cp++ = 0x00;
+ *cp++ = 0x00;
+ *cp++ = 0x00;
}else{
*cp++ = 0xFF;
cp += 3;
@@ -254,7 +254,7 @@ whiteout(Rawimage *r, Rawimage *c)
for(i=0; i<r->chanlen; i++){
if(*rp == trindex){
*cp++ = 0x00;
- *cp++ = 0xFF;
+ *cp++ = 0x00;
}else{
*cp++ = 0xFF;
cp++;
@@ -380,7 +380,7 @@ show(int fd, char *name)
if(nineflag){
if(images[0]->gifflags&TRANSP){
addalpha(rgbv[0]);
- whiteout(images[0], rgbv[0]);
+ blackout(images[0], rgbv[0]);
}
chantostr(buf, outchan);
print("%11s %11d %11d %11d %11d ", buf,
@@ -392,7 +392,7 @@ show(int fd, char *name)
}else if(cflag){
if(images[0]->gifflags&TRANSP){
addalpha(rgbv[0]);
- whiteout(images[0], rgbv[0]);
+ blackout(images[0], rgbv[0]);
}
if(writerawimage(1, rgbv[0]) < 0){
fprint(2, "gif: %s: write error: %r\n", name);