Fix for bug #19700 - code by Wez

This commit is contained in:
Rasmus Lerdorf 2002-10-06 06:47:53 +00:00
parent 0601d1fc41
commit 26b69a7d93

View File

@ -1735,6 +1735,36 @@ gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int s
}
return;
}
/* Destination is palette based */
if (src->trueColor) { /* But source is truecolor (Ouch!) */
for (y = srcY; (y < (srcY + h)); y++)
{
tox = dstX;
for (x = srcX; (x < (srcX + w)); x++)
{
int nc;
c = gdImageGetPixel (src, x, y);
/* Get best match possible. */
nc = gdImageColorResolveAlpha (
dst,
gdTrueColorGetRed(c),
gdTrueColorGetGreen(c),
gdTrueColorGetBlue(c),
gdTrueColorGetAlpha(c));
gdImageSetPixel (dst, tox, toy, nc);
tox++;
}
toy++;
}
return;
}
/* Palette based to palette based */
for (i = 0; (i < gdMaxColors); i++)
{
colorMap[i] = (-1);