- wrong patch applied for #23792, fixed

This commit is contained in:
Pierre Joye 2003-07-10 00:09:23 +00:00
parent f078959207
commit bf7f45601d

View File

@ -2541,7 +2541,7 @@ void gdImageSkewY (gdImagePtr dst, gdImagePtr src, int uCol, int iOffset, double
gdImagePtr gdImageRotate90 (gdImagePtr src)
{
int uY, uX;
int c;
int c,r,g,b,a;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
@ -2551,6 +2551,7 @@ gdImagePtr gdImageRotate90 (gdImagePtr src)
} else {
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src->sy, src->sx);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
@ -2558,6 +2559,13 @@ gdImagePtr gdImageRotate90 (gdImagePtr src)
for (uY = 0; uY<src->sy; uY++) {
for (uX = 0; uX<src->sx; uX++) {
c = f (src, uX, uY);
if (!src->trueColor) {
r = gdImageRed(src,c);
g = gdImageGreen(src,c);
b = gdImageBlue(src,c);
a = gdImageAlpha(src,c);
c = gdTrueColorAlpha(r, g, b, a);
}
gdImageSetPixel(dst, uY, (dst->sy - uX - 1), c);
}
}
@ -2570,18 +2578,17 @@ gdImagePtr gdImageRotate90 (gdImagePtr src)
gdImagePtr gdImageRotate180 (gdImagePtr src)
{
int uY, uX;
int c;
int c,r,g,b,a;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
if (src->trueColor) {
dst = gdImageCreateTrueColor ( src->sx,src->sy);
f = gdImageGetTrueColorPixel;
} else {
dst = gdImageCreate (src->sx, src->sy);
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src->sx, src->sy);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
@ -2589,6 +2596,13 @@ gdImagePtr gdImageRotate180 (gdImagePtr src)
for (uY = 0; uY<src->sy; uY++) {
for (uX = 0; uX<src->sx; uX++) {
c = f (src, uX, uY);
if (!src->trueColor) {
r = gdImageRed(src,c);
g = gdImageGreen(src,c);
b = gdImageBlue(src,c);
a = gdImageAlpha(src,c);
c = gdTrueColorAlpha(r, g, b, a);
}
gdImageSetPixel(dst, (dst->sx - uX - 1), (dst->sy - uY - 1), c);
}
}
@ -2601,18 +2615,17 @@ gdImagePtr gdImageRotate180 (gdImagePtr src)
gdImagePtr gdImageRotate270 ( gdImagePtr src )
{
int uY, uX;
int c;
int c,r,g,b,a;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
if (src->trueColor) {
dst = gdImageCreateTrueColor (src->sy, src->sx);
f = gdImageGetTrueColorPixel;
} else {
dst = gdImageCreate (src->sy, src->sx);
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor (src->sy, src->sx);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
@ -2620,6 +2633,13 @@ gdImagePtr gdImageRotate270 ( gdImagePtr src )
for (uY = 0; uY<src->sy; uY++) {
for (uX = 0; uX<src->sx; uX++) {
c = f (src, uX, uY);
if (!src->trueColor) {
r = gdImageRed(src,c);
g = gdImageGreen(src,c);
b = gdImageBlue(src,c);
a = gdImageAlpha(src,c);
c = gdTrueColorAlpha(r, g, b, a);
}
gdImageSetPixel(dst, (dst->sx - uY - 1), uX, c);
}
}
@ -2648,13 +2668,12 @@ gdImagePtr gdImageRotate45 (gdImagePtr src, double dAngle, int clrBack)
/* 1st shear */
if (src->trueColor) {
dst1 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
dst1 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
dst1 = gdImageCreateTrueColor(newx, newy);
/******* Perform 1st shear (horizontal) ******/
if (dst1 == NULL) {
return NULL;
@ -2761,15 +2780,9 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack)
return NULL;
}
if (!gdImageTrueColor(src) && clrBack>=gdImageColorsTotal(src)) {
return NULL;
}
clrBackR = gdImageRed(src, clrBack);
clrBackG = gdImageGreen(src, clrBack);
clrBackB = gdImageBlue(src, clrBack);
clrBackA = gdImageAlpha(src, clrBack);
clrBack = gdIlmageColorAllocateAlpha(pMidImg, clrBackR, clrBackG, clrBackB, clrBackA);
if (!gdImageTrueColor(src) && clrBack>=gdImageColorsTotal(src)) {
return NULL;
}
while (dAngle >= 360.0) {
dAngle -= 360.0;
@ -2806,7 +2819,6 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack)
return NULL;
}
rotatedImg = gdImageRotate45 (pMidImg, dAngle, clrBack);
gdImageDestroy(pMidImg);