- Fixed: Coordinate handling for multipatch texture compositing was not correct
for true color. Instead of using a clipping rectangle on the destination it tried to alter the source offsets which produced incorrect results for mirrored or rotated patches. SVN r1889 (trunk)
This commit is contained in:
parent
ed8f1ec8db
commit
7e4504f9d6
13 changed files with 158 additions and 102 deletions
|
|
@ -158,7 +158,7 @@ public:
|
|||
void Unload ();
|
||||
virtual void SetFrontSkyLayer ();
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, int rotate, FCopyInfo *inf = NULL);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
int GetSourceLump() { return DefinitionLump; }
|
||||
|
||||
protected:
|
||||
|
|
@ -542,13 +542,15 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, int rotate, FCopyInfo *inf)
|
||||
int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
int retv = -1;
|
||||
FCopyInfo info;
|
||||
|
||||
if (w < 0 || w > Width) w = Width;
|
||||
if (h < 0 || h > Height) h = Height;
|
||||
// When compositing a multipatch texture with multipatch parts
|
||||
// drawing must be restricted to the actual area which is covered by this texture.
|
||||
FClipRect saved_cr = bmp->GetClipRect();
|
||||
bmp->IntersectClipRect(x, y, Width, Height);
|
||||
|
||||
if (inf != NULL && inf->op == OP_OVERWRITE)
|
||||
{
|
||||
|
|
@ -568,10 +570,7 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, i
|
|||
if (Parts[i].Translation != NULL)
|
||||
{
|
||||
// Using a translation forces downconversion to the base palette
|
||||
ret = Parts[i].Texture->CopyTrueColorTranslated(bmp,
|
||||
x+Parts[i].OriginX, y+Parts[i].OriginY,
|
||||
Parts[i].Texture->GetWidth(), Parts[i].Texture->GetHeight(),
|
||||
Parts[i].Rotate, Parts[i].Translation, &info);
|
||||
ret = Parts[i].Texture->CopyTrueColorTranslated(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, Parts[i].Translation, &info);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -599,10 +598,7 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, i
|
|||
info.blend = BLEND_OVERLAY;
|
||||
}
|
||||
}
|
||||
ret = Parts[i].Texture->CopyTrueColorPixels(bmp,
|
||||
x+Parts[i].OriginX, y+Parts[i].OriginY,
|
||||
Parts[i].Texture->GetWidth(), Parts[i].Texture->GetHeight(),
|
||||
Parts[i].Rotate, &info);
|
||||
ret = Parts[i].Texture->CopyTrueColorPixels(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, &info);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -615,15 +611,15 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, i
|
|||
if (bmp1.Create(Parts[i].Texture->GetWidth(), Parts[i].Texture->GetHeight()))
|
||||
{
|
||||
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()*4, Parts[i].Rotate, CF_BGRA, inf);
|
||||
bmp->CopyPixelDataRGB(x+Parts[i].OriginX, y+Parts[i].OriginY, bmp1.GetPixels(),
|
||||
bmp1.GetWidth(), bmp1.GetHeight(), 4, bmp1.GetPitch()*4, Parts[i].Rotate, CF_BGRA, inf);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret > retv) retv = ret;
|
||||
}
|
||||
// Restore previous clipping rectangle.
|
||||
bmp->SetClipRect(saved_cr);
|
||||
return retv;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue