- Add missing DrawTextureTags.

DTA_FlipY, DTA_SrcX, DTA_SrcY, DTA_SrcWidth and DTA_SrcHeight.
This commit is contained in:
drfrag 2020-06-09 18:42:52 +02:00
parent 7d20e74603
commit 796c25b056
7 changed files with 58 additions and 4 deletions

View file

@ -101,10 +101,10 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
if (pal) dg.mTranslation = -pal->GetIndex();
}
}
u1 = gltex->GetUL();
v1 = gltex->GetVT();
u2 = gltex->GetUR();
v2 = gltex->GetVB();
u1 = parms.srcx;
v1 = parms.srcy;
u2 = parms.srcx + parms.srcwidth;
v2 = parms.srcy + parms.srcheight;
}
else
@ -119,6 +119,8 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
if (parms.flipX)
std::swap(u1, u2);
if (parms.flipY)
std::swap(v1, v2);
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
{

View file

@ -2778,6 +2778,10 @@ void OpenGLSWFrameBuffer::DrawTextureParms(FTexture *img, DrawParms &parms)
{
swapvalues(u0, u1);
}
if (parms.flipY)
{
swapvalues(v0, v1);
}
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
{
double wi = MIN(parms.windowright, parms.texwidth);

View file

@ -170,6 +170,12 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
xiscale = -xiscale;
}
if (parms.flipY)
{
frac = (img->GetHeight() << FRACBITS) - 1;
iyscale = -iyscale;
}
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
{
double wi = MIN(parms.windowright, parms.texwidth);

View file

@ -622,6 +622,7 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
parms->colorOverlay = 0;
parms->alphaChannel = false;
parms->flipX = false;
parms->flipY = false;
parms->color = 0xffffffff;
//parms->shadowAlpha = 0;
parms->shadowColor = 0;
@ -638,6 +639,10 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
parms->cellx = parms->celly = 0;
parms->maxstrlen = INT_MAX;
parms->virtBottom = false;
parms->srcx = 0.;
parms->srcy = 0.;
parms->srcwidth = 1.;
parms->srcheight = 1.;
parms->monospace = EMonospacing::MOff;
parms->spacing = 0;
parms->fsscalemode = -1;
@ -834,6 +839,26 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
parms->flipX = ListGetInt(tags);
break;
case DTA_FlipY:
parms->flipY = ListGetInt(tags);
break;
case DTA_SrcX:
parms->srcx = ListGetDouble(tags) / img->GetScaledWidthDouble();
break;
case DTA_SrcY:
parms->srcy = ListGetDouble(tags) / img->GetScaledHeightDouble();
break;
case DTA_SrcWidth:
parms->srcwidth = ListGetDouble(tags) / img->GetScaledWidthDouble();
break;
case DTA_SrcHeight:
parms->srcheight = ListGetDouble(tags) / img->GetScaledHeightDouble();
break;
case DTA_TopOffset:
assert(fortext == false);
if (fortext) return false;

View file

@ -149,6 +149,11 @@ enum
// New additions.
DTA_Color,
DTA_FlipY, // bool: flip image vertically
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
DTA_SrcY,
DTA_SrcWidth,
DTA_SrcHeight,
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
DTA_Spacing, // Strings only: Additional spacing between characters
DTA_Monospace, // Fonts only: Use a fixed distance between characters.
@ -202,6 +207,7 @@ struct DrawParms
PalEntry color;
INTBOOL alphaChannel;
INTBOOL flipX;
INTBOOL flipY;
//float shadowAlpha;
int shadowColor;
INTBOOL keepratio;
@ -217,6 +223,8 @@ struct DrawParms
int maxstrlen;
bool fortext;
bool virtBottom;
double srcx, srcy;
double srcwidth, srcheight;
bool burn;
int8_t fsscalemode;
};

View file

@ -2829,6 +2829,10 @@ void D3DFB::DrawTextureParms (FTexture *img, DrawParms &parms)
{
swapvalues(u0, u1);
}
if (parms.flipY)
{
swapvalues(v0, v1);
}
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
{
double wi = MIN(parms.windowright, parms.texwidth);

View file

@ -175,6 +175,11 @@ enum DrawTextureTags
DTA_CellY, // vertical size of character cell
DTA_Color,
DTA_FlipY, // bool: flip image vertically
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
DTA_SrcY,
DTA_SrcWidth,
DTA_SrcHeight,
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
DTA_Spacing, // Strings only: Additional spacing between characters
DTA_Monospace, // Strings only: Use a fixed distance between characters.