Skip to content

Commit

Permalink
Fix use of iclip and movevc with larger values causing content invisible
Browse files Browse the repository at this point in the history
  • Loading branch information
computerfan authored and sorayuki committed May 21, 2022
1 parent 4364568 commit 79f476b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/subtitles/RTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3756,6 +3756,7 @@ STDMETHODIMP CRenderedTextSubtitle::Render(SubPicDesc& spd, REFERENCE_TIME rt, d
}
else mod_vc.pos = vcpos2;
mod_vc.enable = true;
mod_vc.isInverse = s->m_pClipper ? s->m_pClipper->m_inverse : false;
}
#endif
break;
Expand Down
5 changes: 3 additions & 2 deletions src/subtitles/Rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,7 @@ void MOD_MOVEVC::clear()
curpos = CPoint(0, 0);
hfull = 0;
alphamask = NULL;
isInverse = false;
}

byte MOD_MOVEVC::GetAlphaValue(int wx, int wy)
Expand All @@ -2178,9 +2179,9 @@ byte MOD_MOVEVC::GetAlphaValue(int wx, int wy)

//check if the point is in canvas, in case of crash
if (xInCanvas < 0 || xInCanvas >= spd.cx)
alpham = 0;
alpham = isInverse ? 0x40 : 0; // assume content outside canvas is visible when using iclip. mask is 6 bit
else if (yInCanvas < 0 || yInCanvas >= spd.cy)
alpham = 0;
alpham = isInverse ? 0x40 : 0;
else
{
if ((wx - pos.x) < -curpos.x + 1) alpham = 0;
Expand Down
1 change: 1 addition & 0 deletions src/subtitles/Rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class MOD_MOVEVC
CPoint curpos; // output origin point
int hfull; // full height
byte* alphamask;
bool isInverse;

MOD_MOVEVC();

Expand Down

0 comments on commit 79f476b

Please sign in to comment.