- Backend update from Raze.

This commit is contained in:
Christoph Oelckers 2022-10-14 20:11:05 +02:00
commit c0c9f8e15c
9 changed files with 81 additions and 36 deletions

View file

@ -1555,10 +1555,10 @@ void VirtualToRealCoordsInt(F2DDrawer *drawer, int &x, int &y, int &w, int &h,
//
//==========================================================================
static void DrawLine(int x0, int y0, int x1, int y1, uint32_t realcolor, int alpha)
static void DrawLine(const DVector2& v1, const DVector2& v2, uint32_t realcolor, int alpha)
{
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
twod->AddLine((float)x0, (float)y0, (float)x1, (float)y1, nullptr, realcolor | MAKEARGB(255, 0, 0, 0), alpha);
twod->AddLine(v1, v2, nullptr, realcolor | MAKEARGB(255, 0, 0, 0), alpha);
}
DEFINE_ACTION_FUNCTION_NATIVE(_Screen, DrawLine, DrawLine)
@ -1570,7 +1570,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Screen, DrawLine, DrawLine)
PARAM_INT(y1);
PARAM_INT(color);
PARAM_INT(alpha);
DrawLine(x0, y0, x1, y1, color, alpha);
DrawLine(DVector2(x0, y0), DVector2(x1, y1), color, alpha);
return 0;
}
@ -1583,15 +1583,15 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawLine)
PARAM_INT(y1);
PARAM_INT(color);
PARAM_INT(alpha);
self->Drawer.AddLine((float)x0, (float)y0, (float)x1, (float)y1, nullptr, color | MAKEARGB(255, 0, 0, 0), alpha);
self->Drawer.AddLine(DVector2(x0, y0), DVector2(x1, y1), nullptr, color | MAKEARGB(255, 0, 0, 0), alpha);
self->Tex->NeedUpdate();
return 0;
}
static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor, int alpha)
static void DrawThickLine(const DVector2& v1, const DVector2& v2, double thickness, uint32_t realcolor, int alpha)
{
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
twod->AddThickLine(x0, y0, x1, y1, thickness, realcolor, alpha);
twod->AddThickLine(v1, v2, thickness, realcolor, alpha);
}
DEFINE_ACTION_FUNCTION_NATIVE(_Screen, DrawThickLine, DrawThickLine)
@ -1604,7 +1604,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Screen, DrawThickLine, DrawThickLine)
PARAM_FLOAT(thickness);
PARAM_INT(color);
PARAM_INT(alpha);
DrawThickLine(x0, y0, x1, y1, thickness, color, alpha);
DrawThickLine(DVector2(x0, y0), DVector2(x1, y1), thickness, color, alpha);
return 0;
}
@ -1618,7 +1618,7 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawThickLine)
PARAM_FLOAT(thickness);
PARAM_INT(color);
PARAM_INT(alpha);
self->Drawer.AddThickLine(x0, y0, x1, y1, thickness, color, alpha);
self->Drawer.AddThickLine(DVector2(x0, y0), DVector2(x1, y1), thickness, color, alpha);
self->Tex->NeedUpdate();
return 0;
}