Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Subtitles] Avoid using res and overscan (use rectview instead) #14371

Merged
merged 1 commit into from
Oct 28, 2018

Conversation

enen92
Copy link
Member

@enen92 enen92 commented Aug 28, 2018

Description

Overscan was not being taken into account when drawing the subtitle background causing the background to deviate from the rendered subs.

Motivation and Context

Fix behaviour. Some old tv models force us to use overscan to fix the screen positioning. If a user in those conditions defines a non-opaque background for subtitles, the end result is a mess.

How Has This Been Tested?

Compiled, run time tested, multiple variations of overscan settings, old tv as secondary monitor.

Screenshots (if appropriate):

Master:
Master

This PR:
fix

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@enen92 enen92 added Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality Component: Video rendering v18 Leia labels Aug 28, 2018
Copy link
Contributor

@FernetMenta FernetMenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using res and overscan is wrong because it breaks windowed mode. RectView and RectDest do already consider overscan. Means you have to fix the old code

@enen92
Copy link
Member Author

enen92 commented Aug 29, 2018

res.Overscan is already used above to calculate width_max and y. That being said, what exactly do you mean by old code? Do you mean my prior implementation was correct and is somehow affected by those values (which should be fixed)? Or that I should leave the code above as it is and rely on another approach (RectView and RectDest) instead of using overscan only for the background/Rectangle? Sorry, but it's hard to read between the lines.
Regards

@FernetMenta
Copy link
Contributor

res.Overscan is already used above to calculate width_max and y.

This is wrong and this is what i mean with old code

@enen92
Copy link
Member Author

enen92 commented Aug 29, 2018

Ok, I'll give it a go

@enen92 enen92 changed the title [Subtitles] Respect overscan when drawing the subtitles background [Subtitles] Avoid using res and overscan (use rectview instead) Oct 15, 2018
@enen92
Copy link
Member Author

enen92 commented Oct 15, 2018

@FernetMenta thanks. Can you check if this is correct now?

@@ -432,7 +432,11 @@ COverlay* CRenderer::Convert(CDVDOverlay* o, double pts)
#endif

if(!r && o->IsOverlayType(DVDOVERLAY_TYPE_TEXT))
r = new COverlayText(static_cast<CDVDOverlayText*>(o));
{
int targetWidth = MathUtils::round_int(m_rv.Width());

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

{
int targetWidth = MathUtils::round_int(m_rv.Width());
int targetHeight = MathUtils::round_int(m_rv.Height());
r = new COverlayText(static_cast<CDVDOverlayText*>(o), targetWidth, targetHeight);

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -136,6 +136,10 @@ COverlayText::COverlayText(CDVDOverlayText * src)

m_type = TYPE_GUITEXT;

// entire area of screen

This comment was marked as spam.

@enen92 enen92 added the WIP PR that is still being worked on label Oct 19, 2018
@enen92 enen92 added Type: Cleanup non-breaking change which removes non-working or unmaintained functionality and removed WIP PR that is still being worked on labels Oct 22, 2018
@enen92
Copy link
Member Author

enen92 commented Oct 23, 2018

@FernetMenta mind taking another look? :)

@FernetMenta
Copy link
Contributor

looks good. just one minor, see comment

@@ -136,6 +136,8 @@ COverlayText::COverlayText(CDVDOverlayText * src)

m_type = TYPE_GUITEXT;

// target rect (updated on PrepareRender)
m_rv = CRect(0, 0, 0, 0);

This comment was marked as spam.

@enen92
Copy link
Member Author

enen92 commented Oct 24, 2018

Comment addressed, should be all good now. Thanks a lot (again) for all your comments!
regards

@MartijnKaijser MartijnKaijser added this to the Leia 18.0-beta5 milestone Oct 28, 2018
@MartijnKaijser MartijnKaijser merged commit c929afb into xbmc:master Oct 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Video rendering Type: Cleanup non-breaking change which removes non-working or unmaintained functionality Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants