I tried your flag version too, I like it, it works without delay and is
simple.
But theoretically you can have situations where the drawn output doesn't
fully represent the current state (if some things were already done and the
data was changed afterwards).
Unless I misunderstand your
On Saturday, May 22, 2021 at 12:42:30 PM UTC+8 schle...@gmail.com wrote:
> Maybe someone has a clever solution to collapse the calls to refresh less
> manually.
>
I experienced a similar problem as you, where I have to refresh a canvas on
a mouse event and the paint method is somewhat slow
The difference between 23ms and 50ms was that the memoization wasn't doing
its job.
I removed some calls to get-brush and set-brush, only calling set-brush
when the color changes. (only writing the value not reading it)
Specialized a function that returned an ignored argument, to not calculate
I tested with Racket v7.8 bc and it was also slow.
I also tested it with a year old version of my code and added similar
`time` calls around the drawing code
and it behaved like the recent version redrawing for all the mouse events,
only difference is that the on-paint takes around 23ms instead
4 matches
Mail list logo