gobadge icon indicating copy to clipboard operation
gobadge copied to clipboard

menu: faster background drawing using FastHLines

Open hervenicol opened this issue 2 years ago • 2 comments

I improved menu's background drawing by using a customized version of FilledTriangle, which relies on DrawFastHLine rather than pixel-by-pixel line drawing.

I have mixed feelings:

  • it would be better to do this in tinydraw
  • but I think not all drivers support DrawFastHLine
  • that is why I copied FilledTriangle here, but if you have a better solution I'd love to hear about.

I'm a beginner with go, so there may be a trick I don't know :wink: The aim of this PR is mostly to have your feedback.

Overall there's a lot of potential in performance improvement with batching pixel drawings and using driver-specific functions when available, but I guess if there was an easy way to do it it would already be done :shrug:

hervenicol avatar Sep 04 '22 16:09 hervenicol

Shouldn't this be in tinydraw instead? I'm ok for merging but maybe it's time to extend displayer interface and add Hline/Vline functions... what do you think?

@doniacld could you test this issue on your badge? If you ok'd it I'll merge it.

conejoninja avatar Sep 09 '22 10:09 conejoninja

Shouldn't this be in tinydraw instead? I'm ok for merging but maybe it's time to extend displayer interface and add Hline/Vline functions... what do you think?

:100: agree. The thing is I don't know how to do this in tinydraw and ensure it works with all graphics drivers. Once I understand how to do that, I think there's a lot of easy performance improvements.

hervenicol avatar Sep 09 '22 14:09 hervenicol