-
Notifications
You must be signed in to change notification settings - Fork 288
Only update the dirty portion of the canvas #1761
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
Only update the dirty portion of the canvas #1761
Conversation
- Split painting for current frame and onion skinning - Introduce blitRect for updating only the dirty portion of the frame - Optimization: Only do an expensive fill when the size changes, otherwise rely on the blitRect to clear the dirty portion.
Aside from cleaning up various extra update methods that are no longer necessary, I've made a minor change in vectorImage, in order to get it's correct dirty region.
This was a necessary change in order to calculate the correct bounds that wouldn't draw artifacts.
This also fixes some inconsistency in the CanvasPainter that I couldn't make sense of..
Found a small bug regarding the polyline on the vector layer that should be fixed now. This also allowed a bit of cleanup regarding some inconsistent transform logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MrStevns. First of all, sorry for the delay in reviewing this. I thought I’d be able to finish this quickly, but evidently I failed quite spectacularly. On the plus side though, I’m happy to report I don’t have much to report. I only noticed one curious little bug which causes the current frame to also be drawn as next onion skin if it is the last keyframe on the layer, which looks like this:
Otherwise, these changes look pretty good to me. Well done!
Although i don't like that this exists in our painter, I believe we added it because for some reason the image hasn't been loaded yet, so let's leave it for now... ideally though i've really like to get rid of such weird mutable things that has little to do with painting.
Hi Jacob Thank you for your thorough review, I appreciate it! I had some time this morning to look into the issue. After tracing over the old code again I noticed that we previously used getLastBitmapImageAtFrame or getBitmapImageAtFrame depending on the context. the onion skin logic previously used the latter so the fix was fortunately trivial. PR is ready for review again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug confirmed fixed, looking good now! Feel free to merge if the change I made meets with your approval.
Changes looks good to me! I will merge the PR 😄 |
This PR is the first of a series #1760 of improvements to address our declining performance issues.
In order to keep the scope as small as possible, I've only applied the changes to the CanvasPainter for now. The same could be done to the CameraPainter as well as the other Painter classes.
A summary of the changes:
closes #1763