http://git.php.net/?p=php-src.git;a=commit;h=07e52857b5f7a65c1552628e14a8a6aeeea24508 diff -Naurp libgd-2.1.1/src/gd.c libgd-2.1.1.oden/src/gd.c --- libgd-2.1.1/src/gd.c 2015-01-06 10:16:03.000000000 +0100 +++ libgd-2.1.1.oden/src/gd.c 2015-02-02 09:25:06.107771087 +0100 @@ -3631,7 +3631,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]); } @@ -3648,6 +3648,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.1/src/gd_interpolation.c libgd-2.1.1.oden/src/gd_interpolation.c --- libgd-2.1.1/src/gd_interpolation.c 2015-01-06 10:16:03.000000000 +0100 +++ libgd-2.1.1.oden/src/gd_interpolation.c 2015-02-02 09:25:06.107771087 +0100 @@ -1684,13 +1684,6 @@ gdImageRotateNearestNeighbour(gdImagePtr 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; @@ -1751,12 +1744,6 @@ gdImageRotateGeneric(gdImagePtr src, con 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) { @@ -1811,13 +1798,6 @@ gdImageRotateBilinear(gdImagePtr src, co 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; @@ -1938,13 +1918,6 @@ gdImageRotateBicubicFixed(gdImagePtr src 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) { @@ -2201,6 +2174,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) {