From 9340dc4eca77724a952eeb99603d42b617cd30d3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 10 May 2012 03:07:30 +0000 Subject: [PATCH] - Changed FMultiPatchTexture::CopyTrueColorPixels() so that all parts use their copy info. Previously, "complex" parts would ignore it and use the copy info passed to the function instead. The copy info passed to the function is now only used to decide to if it should clear the destination image. I'm not sure if this really matters, since it itself is the only place aside from FTexture::FillBuffer() that ever calls CopyTrueColorPixels() with a copy info, and when it does so for a multipatch texture, it does so to a temporary buffer. SVN r3634 (trunk) --- src/textures/multipatchtexture.cpp | 59 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 2013294a8..4e7d344db 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -573,12 +573,37 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota // rotated multipatch parts cannot be composited directly bool rotatedmulti = Parts[i].Rotate != 0 && Parts[i].Texture->bMultiPatch; + memset (&info, 0, sizeof (info)); + info.alpha = Parts[i].Alpha; + info.invalpha = FRACUNIT - info.alpha; + info.op = ECopyOp(Parts[i].op); + PalEntry b = Parts[i].Blend; + if (b.a == 0 && b != BLEND_NONE) + { + info.blend = EBlend(b.d); + } + else if (b.a != 0) + { + if (b.a == 255) + { + info.blendcolor[0] = b.r * FRACUNIT / 255; + info.blendcolor[1] = b.g * FRACUNIT / 255; + info.blendcolor[2] = b.b * FRACUNIT / 255; + info.blend = BLEND_MODULATE; + } + else + { + info.blendcolor[3] = b.a * FRACUNIT / 255; + info.blendcolor[0] = b.r * (FRACUNIT-info.blendcolor[3]); + info.blendcolor[1] = b.g * (FRACUNIT-info.blendcolor[3]); + info.blendcolor[2] = b.b * (FRACUNIT-info.blendcolor[3]); + + info.blend = BLEND_OVERLAY; + } + } + if ((!Parts[i].Texture->bComplex || inf == NULL) && !rotatedmulti) { - memset (&info, 0, sizeof (info)); - info.alpha = Parts[i].Alpha; - info.invalpha = FRACUNIT - info.alpha; - info.op = ECopyOp(Parts[i].op); if (Parts[i].Translation != NULL) { // Using a translation forces downconversion to the base palette @@ -586,30 +611,6 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota } else { - PalEntry b = Parts[i].Blend; - if (b.a == 0 && b != BLEND_NONE) - { - info.blend = EBlend(b.d); - } - else if (b.a != 0) - { - if (b.a == 255) - { - info.blendcolor[0] = b.r * FRACUNIT / 255; - info.blendcolor[1] = b.g * FRACUNIT / 255; - info.blendcolor[2] = b.b * FRACUNIT / 255; - info.blend = BLEND_MODULATE; - } - else - { - info.blendcolor[3] = b.a * FRACUNIT / 255; - info.blendcolor[0] = b.r * (FRACUNIT-info.blendcolor[3]); - info.blendcolor[1] = b.g * (FRACUNIT-info.blendcolor[3]); - info.blendcolor[2] = b.b * (FRACUNIT-info.blendcolor[3]); - - info.blend = BLEND_OVERLAY; - } - } ret = Parts[i].Texture->CopyTrueColorPixels(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, &info); } } @@ -625,7 +626,7 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota bmp1.Zero(); Parts[i].Texture->CopyTrueColorPixels(&bmp1, 0, 0); bmp->CopyPixelDataRGB(x+Parts[i].OriginX, y+Parts[i].OriginY, bmp1.GetPixels(), - bmp1.GetWidth(), bmp1.GetHeight(), 4, bmp1.GetPitch(), Parts[i].Rotate, CF_BGRA, inf); + bmp1.GetWidth(), bmp1.GetHeight(), 4, bmp1.GetPitch(), Parts[i].Rotate, CF_BGRA, &info); } }