]> granicus.if.org Git - php/commitdiff
MFH (fix for crash in gdImageCopyMergeGray()).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 25 Feb 2003 03:53:22 +0000 (03:53 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 25 Feb 2003 03:53:22 +0000 (03:53 +0000)
ext/gd/libgd/gd.c

index 3292caaeb74e52a8ba23bc028365c0a34675894f..0c4d307596daeec828bcd126f390cbb27c4ae502 100644 (file)
@@ -2000,9 +2000,7 @@ gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int sr
          else
            {
              dc = gdImageGetPixel (dst, tox, toy);
-             g = 0.29900f * dst->red[dc]
-               + 0.58700f * dst->green[dc]
-               + 0.11400f * dst->blue[dc];
+             g = (0.29900f * gdImageRed(dst, dc)) + (0.58700f * gdImageGreen(dst, dc)) + (0.11400f * gdImageBlue(dst, dc));
 
              ncR = (int)( gdImageRed (src, c) * (pct / 100.0f)
                         + gdImageRed (dst, dc) * g * ((100 - pct) / 100.0f));