aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/jpg
diff options
context:
space:
mode:
authorRob Pike <robpike@gmail.com>2011-05-17 17:46:45 -0400
committerRuss Cox <rsc@swtch.com>2011-05-17 17:46:45 -0400
commit4e247f10fac36e3234aeb6490a66ac57d9520a4a (patch)
treef8ddea1ac7faab67f62862e3803ff0bc214e1bfb /src/cmd/jpg
parent64ef09ff8983d108d67a68a66e9b608354c57e99 (diff)
downloadplan9port-4e247f10fac36e3234aeb6490a66ac57d9520a4a.tar.gz
plan9port-4e247f10fac36e3234aeb6490a66ac57d9520a4a.tar.bz2
plan9port-4e247f10fac36e3234aeb6490a66ac57d9520a4a.zip
gif: fix setting of transparency channels when writing gifs.
R=rsc http://codereview.appspot.com/4538073
Diffstat (limited to 'src/cmd/jpg')
-rw-r--r--src/cmd/jpg/gif.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/jpg/gif.c b/src/cmd/jpg/gif.c
index d154740b..dbe2ce08 100644
--- a/src/cmd/jpg/gif.c
+++ b/src/cmd/jpg/gif.c
@@ -239,7 +239,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;
@@ -251,9 +251,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;
@@ -264,7 +264,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++;
@@ -390,7 +390,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,
@@ -402,7 +402,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);