http://git.php.net/?p=php-src.git;a=commit;h=07e52857b5f7a65c1552628e14a8a6aeeea24508 diff -Naurp libgd-2.1.0/src/gd.c libgd-2.1.0.oden/src/gd.c --- libgd-2.1.0/src/gd.c 2013-06-25 11:58:23.000000000 +0200 +++ libgd-2.1.0.oden/src/gd.c 2013-07-22 10:02:40.130046673 +0200 @@ -3481,7 +3481,7 @@ BGD_DECLARE(int) gdImagePaletteToTrueCol for (x = 0; x < sx; x++) { const unsigned char c = *(src_row + x); if (c == src->transparent) { - *(dst_row + x) = gdTrueColorAlpha(0, 0, 0, 127);; + *(dst_row + x) = gdTrueColorAlpha(0, 0, 0, 127); } else { *(dst_row + x) = gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c]); } @@ -3498,6 +3498,12 @@ BGD_DECLARE(int) gdImagePaletteToTrueCol src->pixels = NULL; src->alphaBlendingFlag = 0; src->saveAlphaFlag = 1; + + if (src->transparent >= 0) { + const unsigned char c = src->transparent; + src->transparent = gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c]); + } + return 1; clean_on_error: diff -Naurp libgd-2.1.0/src/gd_interpolation.c libgd-2.1.0.oden/src/gd_interpolation.c --- libgd-2.1.0/src/gd_interpolation.c 2013-06-25 11:58:23.000000000 +0200 +++ libgd-2.1.0.oden/src/gd_interpolation.c 2013-07-22 10:16:49.235122495 +0200 @@ -1690,13 +1690,6 @@ gdImagePtr gdImageRotateNearestNeighbour unsigned int i; gdImagePtr dst; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } - dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; @@ -1756,12 +1749,6 @@ gdImagePtr gdImageRotateGeneric(gdImageP return NULL; } - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { @@ -1815,13 +1802,6 @@ gdImagePtr gdImageRotateBilinear(gdImage unsigned int src_offset_x, src_offset_y; gdImagePtr dst; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } - dst = gdImageCreateTrueColor(new_width, new_height); if (dst == NULL) { return NULL; @@ -1941,13 +1921,6 @@ gdImagePtr gdImageRotateBicubicFixed(gdI unsigned int i; gdImagePtr dst; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } - dst = gdImageCreateTrueColor(new_width, new_height); if (dst == NULL) { @@ -2204,6 +2177,16 @@ BGD_DECLARE(gdImagePtr) gdImageRotateInt return NULL; } + /* impact perf a bit, but not that much. Implementation for palette + images can be done at a later point. + */ + if (src->trueColor == 0) { + if (bgcolor >= 0) { + bgcolor = gdTrueColorAlpha(src->red[bgcolor], src->green[bgcolor], src->blue[bgcolor], src->alpha[bgcolor]); + } + gdImagePaletteToTrueColor(src); + } + /* 0 && 90 degrees multiple rotation, 0 rotation simply clones the return image and convert it to truecolor, as we must return truecolor image. */ switch (angle_rounded) {