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

How to constrain area redrawing to clip region? #540

Open
AndyObtiva opened this issue Nov 3, 2021 · 1 comment
Open

How to constrain area redrawing to clip region? #540

AndyObtiva opened this issue Nov 3, 2021 · 1 comment

Comments

@AndyObtiva
Copy link

AndyObtiva commented Nov 3, 2021

Hi,

I built this game, Glimmer Tetris

It runs fast with a basic 2D look (each block is a path).

glimmer-dsl-libui-mac-tetris

When I attempt to add a simulated bevel-block 3D look via 4 extra polygons per block where each polygon is a figure of multiple line calls done under a single path (similar to the Glimmer Tetris built with SWT)...

Screen Shot 2021-11-03 at 6 35 17 PM

Area redrawing slows down to a crawl!

I ensured that only a single redraw is happening per movement of the Tetris tetromino blocks.

My question is: I could probably optimize performance by asking the area to redraw only the blocks that changed instead of the entire playfield.

How do I do that with libui? Is that option available? The only thing I saw is queueRedrawAll, which redraws everything.

Is that what save and restore are all about? Initial saving... restoring the whole area, making a small change, and then saving again? Does that improve performance?

If clipped redrawing is not available, this would be a great performance optimization feature to have I think.

@AndyObtiva
Copy link
Author

AndyObtiva commented Nov 4, 2021

BTW, I solved the slowdown problem by dividing the area into many tiny little areas layed out with a vertical box of horizontal boxes (grid did not work as it did not show multiple areas when nested underneath it, so that is another issue). That way, on every change, only changed Tetris blocks got redrawn, making area redraws happen much faster.

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

No branches or pull requests

1 participant