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

Lag with Grid turned on at higher resolutions #369

Closed
Lutia opened this issue Dec 18, 2015 · 2 comments
Closed

Lag with Grid turned on at higher resolutions #369

Lutia opened this issue Dec 18, 2015 · 2 comments

Comments

@Lutia
Copy link

Lutia commented Dec 18, 2015

At higher resolutions, with the grid turned on and zoomed in far enough to render, there is an immense amount of lag when doing any action (very noticeable at 256x256). From what I checked, the grid width had nothing to do with the issue. The issue can be replicated on the desktop and chrome version (didn't check firefox).

@juliandescottes
Copy link
Collaborator

Indeed, it's much slower.

When the grid is activated, Piskel is no longer using the native canvas scale method but uses a custom scale implementation instead.

cf. ImageResizer : https://github.com/juliandescottes/piskel/blob/master/src/js/utils/ImageResizer.js#L35

cf. FrameRenderer : https://github.com/juliandescottes/piskel/blob/master/src/js/rendering/frame/FrameRenderer.js#L267

Leads to investigate :

  • draw the grid separately from the main sprite canvas
  • draw the grid only after a throttling delay

@juliandescottes
Copy link
Collaborator

In the end, simply using clearRect on the already rendered frame gives a good visual result and pretty good performances.

The grid can now be used at higher resolutions without any issue.

I uploaded a video showing the new performance on a 640x640 sprite: https://www.youtube.com/watch?v=Uu9Tz4UDCsg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants