diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 682b479a9..35fb4a21a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ May 16, 2008 +- Fixed: 3D hardware texture filling did not copy pixels with 0 alpha, + preserving whatever was underneath in the texture box previously. - Fixed: s_sound.cpp had its own idea of whether or not sounds were paused and did not entirely keep it in sync with the sound system's. This meant that when starting a new game from the menu, all sounds were played as diff --git a/src/textures/bitmap.cpp b/src/textures/bitmap.cpp index 25bfdc4b2..1e00e7fe6 100644 --- a/src/textures/bitmap.cpp +++ b/src/textures/bitmap.cpp @@ -57,7 +57,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in case BLEND_NONE: for(i=0;i(255 - TSrc::Gray(pin),0,255); @@ -91,7 +93,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in // Heretic's golden invulnerability map for(i=0;i(gray+(gray>>1),0,255); @@ -111,7 +114,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in // Skulltag's red Doomsphere map for(i=0;i(gray+(gray>>1),0,255); @@ -130,7 +134,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in // Skulltags's Guardsphere map for(i=0;i(gray+(gray>>1),0,255); @@ -150,7 +155,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in // Since this is done in True Color the purplish tint is fully preserved - even in Doom! for(i=0;i>4; @@ -171,7 +177,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in fac=inf->blend-BLEND_DESATURATE1+1; for(i=0;iblendcolor[0])>>FRACBITS; g = (TSrc::G(pin)*inf->blendcolor[1])>>FRACBITS; @@ -212,7 +220,8 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in for(i=0;iblendcolor[3] + inf->blendcolor[0]) >> FRACBITS; g = (TSrc::G(pin)*inf->blendcolor[3] + inf->blendcolor[1]) >> FRACBITS; @@ -311,6 +320,17 @@ static const CopyFunc copyfuncs[][9]={ iCopyColors, iCopyColors }, + { + iCopyColors, + iCopyColors, + iCopyColors, + iCopyColors, + iCopyColors, + iCopyColors, + iCopyColors, + iCopyColors, + iCopyColors + }, }; //=========================================================================== @@ -461,9 +481,9 @@ void iCopyPaletted(BYTE *buffer, const BYTE * patch, int srcwidth, int srcheight for (x=0;x, iCopyPaletted, iCopyPaletted, + iCopyPaletted }; //=========================================================================== diff --git a/src/textures/bitmap.h b/src/textures/bitmap.h index 75401547f..669218a5b 100644 --- a/src/textures/bitmap.h +++ b/src/textures/bitmap.h @@ -281,7 +281,8 @@ enum ECopyOp OP_SUBTRACT, OP_REVERSESUBTRACT, OP_MODULATE, - OP_COPYALPHA + OP_COPYALPHA, + OP_OVERWRITE }; struct FCopyInfo @@ -297,42 +298,56 @@ struct bCopy { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = s; } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return false; } +}; + +struct bOverwrite +{ + static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = s; } + static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; struct bBlend { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (d*i->invalpha + s*i->alpha) >> FRACBITS; } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; struct bAdd { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MIN((d*FRACUNIT + s*i->alpha) >> FRACBITS, 255); } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; struct bSubtract { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX((d*FRACUNIT - s*i->alpha) >> FRACBITS, 0); } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; struct bReverseSubtract { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX((-d*FRACUNIT + s*i->alpha) >> FRACBITS, 0); } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; struct bModulate { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*d)/255; } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; struct bCopyAlpha { static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; } static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; } + static __forceinline bool ProcessAlpha0() { return true; } }; diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 6fde43848..3e03fa785 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -458,8 +458,9 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt) case TEX_RGB: { + FCopyInfo inf = {OP_OVERWRITE, }; FBitmap bmp(buff, pitch, pitch/4, height); - CopyTrueColorPixels(&bmp, 0, 0); + CopyTrueColorPixels(&bmp, 0, 0, 0, &inf); break; }