]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Fri, 20 Dec 2002 03:44:41 +0000 (03:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 20 Dec 2002 03:44:41 +0000 (03:44 +0000)
ext/gd/libgd/gd.c

index 0794ab5467dd83bd67c03d0b25c6facd36e5bea4..fee7687be03ef360fba16b76bb3a84e9c23d9378 100644 (file)
@@ -566,21 +566,19 @@ gdImageColorDeallocate (gdImagePtr im, int color)
   im->open[color] = 1;
 }
 
-void
-gdImageColorTransparent (gdImagePtr im, int color)
+void gdImageColorTransparent (gdImagePtr im, int color)
 {
-  if (!im->trueColor)
-    {
-      if (im->transparent != -1)
-       {
-         im->alpha[im->transparent] = gdAlphaOpaque;
-       }
-      if (color != -1)
-       {
-         im->alpha[color] = gdAlphaTransparent;
+       if (!im->trueColor) {
+               if (im->transparent != -1) {
+                       im->alpha[im->transparent] = gdAlphaOpaque;
+               }
+               if (color > -1 && color <= gdMaxColors) {
+                       im->alpha[color] = gdAlphaTransparent;
+               } else {
+                       return;
+               }
        }
-    }
-  im->transparent = color;
+       im->transparent = color;
 }
 
 void