- Fixed: The true color texture compositing code did not clip the edges
of multipatch textures used as patches on other multipatch textures. SVN r1766 (trunk)
This commit is contained in:
parent
914ccd4ea2
commit
74bdfe19c5
13 changed files with 88 additions and 50 deletions
|
|
@ -86,7 +86,7 @@ public:
|
|||
void Unload ();
|
||||
FTextureFormat GetFormat ();
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
|
||||
protected:
|
||||
|
|
@ -491,12 +491,12 @@ void FTGATexture::MakeTexture ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry pe[256];
|
||||
FWadLump lump = Wads.OpenLumpNum (SourceLump);
|
||||
TGAHeader hdr;
|
||||
WORD w;
|
||||
WORD wr;
|
||||
BYTE r,g,b,a;
|
||||
BYTE * sbuffer;
|
||||
int transval = 0;
|
||||
|
|
@ -504,6 +504,9 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
lump.Read(&hdr, sizeof(hdr));
|
||||
lump.Seek(hdr.id_len, SEEK_CUR);
|
||||
|
||||
if (w < 0 || w > Width) w = Width;
|
||||
if (h < 0 || h > Height) h = Height;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
|
|
@ -520,10 +523,10 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
{
|
||||
case 15:
|
||||
case 16:
|
||||
lump >> w;
|
||||
r = (w & 0x001F) << 3;
|
||||
g = (w & 0x03E0) >> 2;
|
||||
b = (w & 0x7C00) >> 7;
|
||||
lump >> wr;
|
||||
r = (wr & 0x001F) << 3;
|
||||
g = (wr & 0x03E0) >> 2;
|
||||
b = (wr & 0x7C00) >> 7;
|
||||
a = 255;
|
||||
break;
|
||||
|
||||
|
|
@ -576,7 +579,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
switch (hdr.img_type & 7)
|
||||
{
|
||||
case 1: // paletted
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe, inf);
|
||||
bmp->CopyPixelData(x, y, ptr, w, h, step_x, Pitch, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
case 2: // RGB
|
||||
|
|
@ -584,21 +587,21 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
{
|
||||
case 15:
|
||||
case 16:
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_RGB555, inf);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, w, h, step_x, Pitch, rotate, CF_RGB555, inf);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGR, inf);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, w, h, step_x, Pitch, rotate, CF_BGR, inf);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
if ((hdr.img_desc&15)!=8) // 32 bits without a valid alpha channel
|
||||
{
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGR, inf);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, w, h, step_x, Pitch, rotate, CF_BGR, inf);
|
||||
}
|
||||
else
|
||||
{
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGRA, inf);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, w, h, step_x, Pitch, rotate, CF_BGRA, inf);
|
||||
transval = -1;
|
||||
}
|
||||
break;
|
||||
|
|
@ -613,11 +616,11 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
{
|
||||
case 8:
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // gray map
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe, inf);
|
||||
bmp->CopyPixelData(x, y, ptr, w, h, step_x, Pitch, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_I16, inf);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, w, h, step_x, Pitch, rotate, CF_I16, inf);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue