- Fixed: DFrameBuffer::CopyPixelData copied data as RGBA instead of BGRA.

- Temporarily changed FPNGTexture and FDDSTexture to always create True Color
  native textures to preserve the original colors.


SVN r650 (trunk)
This commit is contained in:
Christoph Oelckers 2007-12-27 11:53:09 +00:00
parent f1241099f8
commit e19cd0bec3
4 changed files with 17 additions and 4 deletions

View file

@ -1,4 +1,7 @@
December 27, 2007 (Changes by Graf Zahl) December 27, 2007 (Changes by Graf Zahl)
- Fixed: DFrameBuffer::CopyPixelData copied data as RGBA instead of BGRA.
- Temporarily changed FPNGTexture and FDDSTexture to always create True Color
native textures to preserve the original colors.
- Darkened the console background a little after finding out that on - Darkened the console background a little after finding out that on
very bright title pics it became quite hard to read the console's contents. very bright title pics it became quite hard to read the console's contents.
- Fixed: PROP_Translation needed to be changed for the new value format. - Fixed: PROP_Translation needed to be changed for the new value format.

View file

@ -316,6 +316,7 @@ void FDDSTexture::Unload ()
FTextureFormat FDDSTexture::GetFormat() FTextureFormat FDDSTexture::GetFormat()
{ {
#if 0
switch (Format) switch (Format)
{ {
case ID_DXT1: return TEX_DXT1; case ID_DXT1: return TEX_DXT1;
@ -325,6 +326,10 @@ FTextureFormat FDDSTexture::GetFormat()
case ID_DXT5: return TEX_DXT5; case ID_DXT5: return TEX_DXT5;
default: return TEX_RGB; default: return TEX_RGB;
} }
#else
// For now, create a true color texture to preserve all colors.
return TEX_RGB;
#endif
} }
const BYTE *FDDSTexture::GetColumn (unsigned int column, const Span **spans_out) const BYTE *FDDSTexture::GetColumn (unsigned int column, const Span **spans_out)

View file

@ -270,12 +270,17 @@ void FPNGTexture::Unload ()
FTextureFormat FPNGTexture::GetFormat() FTextureFormat FPNGTexture::GetFormat()
{ {
#if 0
switch (ColorType) switch (ColorType)
{ {
case 3: return TEX_Pal; case 3: return TEX_Pal;
case 0: return TEX_Gray; case 0: return TEX_Gray;
default: return TEX_RGB; default: return TEX_RGB;
} }
#else
// For now, create a true color texture to preserve all colors.
return TEX_RGB;
#endif
} }
const BYTE *FPNGTexture::GetColumn (unsigned int column, const Span **spans_out) const BYTE *FPNGTexture::GetColumn (unsigned int column, const Span **spans_out)

View file

@ -1022,16 +1022,16 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int
int v=(unsigned char)patch[y*step_y+x*step_x]; int v=(unsigned char)patch[y*step_y+x*step_x];
if (palette[v].a==0) if (palette[v].a==0)
{ {
buffer[pos]=palette[v].r; buffer[pos]=palette[v].b;
buffer[pos+1]=palette[v].g; buffer[pos+1]=palette[v].g;
buffer[pos+2]=palette[v].b; buffer[pos+2]=palette[v].r;
buffer[pos+3]=255-palette[v].a; buffer[pos+3]=255-palette[v].a;
} }
else if (palette[v].a!=255) else if (palette[v].a!=255)
{ {
buffer[pos ] = (buffer[pos ] * palette[v].a + palette[v].r * (1-palette[v].a)) / 255; buffer[pos ] = (buffer[pos ] * palette[v].a + palette[v].b * (1-palette[v].a)) / 255;
buffer[pos+1] = (buffer[pos+1] * palette[v].a + palette[v].g * (1-palette[v].a)) / 255; buffer[pos+1] = (buffer[pos+1] * palette[v].a + palette[v].g * (1-palette[v].a)) / 255;
buffer[pos+2] = (buffer[pos+2] * palette[v].a + palette[v].b * (1-palette[v].a)) / 255; buffer[pos+2] = (buffer[pos+2] * palette[v].a + palette[v].r * (1-palette[v].a)) / 255;
buffer[pos+3] = clamp<int>(buffer[pos+3] + (( 255-buffer[pos+3]) * (255-palette[v].a))/255, 0, 255); buffer[pos+3] = clamp<int>(buffer[pos+3] + (( 255-buffer[pos+3]) * (255-palette[v].a))/255, 0, 255);
} }
} }