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

Rework the cache reset when resize the canvas #27

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmitrylyzo
Copy link
Collaborator

@dmitrylyzo dmitrylyzo commented May 5, 2022

Changes

  • Extract the options.
  • Compare the resolution of each frame with the current canvas size.
  • Compare the subtitle display end time, not the gap end time. The gap is invisible, after all.
  • Keep some frames within specified time regardless of the resolution. Equal to the 10s time limit in the old version.
  • Discard distant frames if maximum time is specified. Equal to the 30s time limit in the old version, but currently disabled by default.
  • Reduce the guaranteed (minimum) display time (was 10s - the low-res frames are displayed for too long, now 1s).
  • Disable size limit by default.

Issues
In theory (more for increasing the size):
Resizing the canvas with, say, 15% step, the old version keeps ~30s (if the size limit allows) of low-res frames instead of discarding them.

if (item.emptyFinish < 0 || item.eventFinish >= maxTime) break;

if (item.eventFinish >= minTime &&
!fuzzyEqualRect(item.viewport, self.canvas, self.resizeVariation)) continue;
Copy link
Collaborator Author

@dmitrylyzo dmitrylyzo May 5, 2022

Choose a reason for hiding this comment

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

With continue the far good frames take up some size, leaving less room for the near frames and making a gap.
This can happen with smooth resizing, when the far frames are more recent and correspond to the current canvas size.
Using break forces to rerender the good frames.

UPD:
On the other hand, I don't like the fact that the set of newly rendered frames (perfect ones) will be interrupted by the saved "good" ones. So using break makes the set to be consistent in terms of quality.

Compare the resolution of each frame with the current canvas
size.

Compare the subtitle display end time, not the gap end time.

Keep some frames within specified time regardless of the resolution.

Discard distant frames if maximum time is specified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant