- pass clip rect as pointer to F2DDrawer::AddLine.

This commit is contained in:
Christoph Oelckers 2022-08-04 09:24:36 +02:00
commit 735c2a9545
5 changed files with 32 additions and 11 deletions

View file

@ -1040,19 +1040,19 @@ void F2DDrawer::ClearScreen(PalEntry color)
//
//==========================================================================
void F2DDrawer::AddLine(double x1, double y1, double x2, double y2, int clipx1, int clipy1, int clipx2, int clipy2, uint32_t color, uint8_t alpha)
void F2DDrawer::AddLine(double x1, double y1, double x2, double y2, const IntRect* clip, uint32_t color, uint8_t alpha)
{
PalEntry p = (PalEntry)color;
p.a = alpha;
RenderCommand dg;
if (clipx1 > 0 || clipy1 > 0 || clipx2 < GetWidth()- 1 || clipy2 < GetHeight() - 1)
if (clip != nullptr)
{
dg.mScissor[0] = clipx1 + int(offset.X);
dg.mScissor[1] = clipy1 + int(offset.Y);
dg.mScissor[2] = clipx2 + 1 + int(offset.X);
dg.mScissor[3] = clipy2 + 1 + int(offset.Y);
dg.mScissor[0] = clip->Left() + int(offset.X);
dg.mScissor[1] = clip->Top() + int(offset.Y);
dg.mScissor[2] = clip->Right() + int(offset.X);
dg.mScissor[3] = clip->Bottom() + int(offset.Y);
dg.mFlags |= DTF_Scissor;
}