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

Missing clipping for polygons with holes leads to slow rendering performance on Windows CE and SDL #869

Closed
metalstrolch opened this issue Sep 7, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@metalstrolch
Copy link
Contributor

metalstrolch commented Sep 7, 2019

Currently the core is lacking clipping support before handing over polygons that contain holes (attr_hole) to graphics back end. As Windows CE and SDL are rendering by manually raycasting polygons (with or without holes), and do not support clipping as well, rendering performance is poor when the screen shows many small portions of large polygons.

This was reported in #861 by @gefin first.

@metalstrolch
Copy link
Contributor Author

Seems this happens because of two really large polygons with many holes having a quite high node count each:
https://www.openstreetmap.org/relation/2892951
and
https://www.openstreetmap.org/relation/68363
At the location 48°8'24'' N 12°1`50`` E along the B12.

Currently core doesn't implement clipping for polygons with holes. It does for polygons without holes.
And the WindowsCE (and SDL) graphics do not implement clipping as well.
So the polygons are completely raycasted and drawn even if only small portions of them are really on screen.

I'll try two things:

  1. Port the "clipping" version of polygon handling in graphics.c to support holes as well. I've left a TODO there anyways.

  2. Check layer geometry on Windows / SDL graphics to only raycast lines which are actually on layer.

@metalstrolch metalstrolch added this to the 0.5.4 milestone Sep 7, 2019
@metalstrolch metalstrolch self-assigned this Sep 7, 2019
@gefin
Copy link
Contributor

gefin commented Sep 8, 2019

you are right. The location B12 is fast and smooth drawn with poly_wood removed from layout.
With a active polygon with hole the slowdown begins a screen width away from the polygon.
Thanks for explain.

@metalstrolch
Copy link
Contributor Author

#870 should fix this.
@gefin: can you give it a try?

@gefin
Copy link
Contributor

gefin commented Sep 10, 2019

Tested Build16731 Tomtom730 . Polygons with Holes work very well. The delay is gone. Thanks
Thursday real drive...

@metalstrolch
Copy link
Contributor Author

Will wait for Thursday before merging #870

@gefin
Copy link
Contributor

gefin commented Sep 13, 2019

Build16731 work well while real driving. No lags or other problems.

metalstrolch added a commit that referenced this issue Sep 13, 2019
* fix:core:refactor polygon clipping

This commit extracts the polygon clipping into its own function to be
re used for polygon with holes clipping.

* fix:core:Clip polygons with holes prior drawing.

While this helps drawing for limited graphics like SDL or WindowsCE,
it will slightly slow down on graphics that do clipping themselves like
qt5. As this is done for polygons already, we do this for polygons with
holes as well.
@metalstrolch
Copy link
Contributor Author

Fixed in #870

viktorgino pushed a commit that referenced this issue Sep 22, 2020
* fix:core:refactor polygon clipping

This commit extracts the polygon clipping into its own function to be
re used for polygon with holes clipping.

* fix:core:Clip polygons with holes prior drawing.

While this helps drawing for limited graphics like SDL or WindowsCE,
it will slightly slow down on graphics that do clipping themselves like
qt5. As this is done for polygons already, we do this for polygons with
holes as well.
jkoan pushed a commit to jkoan/navit that referenced this issue Jun 30, 2021
…avit-gps#869)

* fix:core:refactor polygon clipping

This commit extracts the polygon clipping into its own function to be
re used for polygon with holes clipping.

* fix:core:Clip polygons with holes prior drawing.

While this helps drawing for limited graphics like SDL or WindowsCE,
it will slightly slow down on graphics that do clipping themselves like
qt5. As this is done for polygons already, we do this for polygons with
holes as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants