[racket] limiting refresh rate of scroll bar calls to canvas%'s 'draw'

From: John Clements (clements at brinckerhoff.org)
Date: Fri Mar 21 15:58:55 EDT 2014

On Mar 21, 2014, at 11:58 AM, Laurent <laurent.orseau at gmail.com> wrote:

> Probably a silly question: Are you drawing in a bitmap (buffer) so that each calls to the `paint-callback` that refreshes the canvas only does a copy of a section of the bitmap?

Oh, good question! I forgot to mention that.

These sounds can be as long as five or 10 minutes; at a 44.1K sample rate, that would be 10x60x44100 = 26 *million* pixels wide, at full zoom. I thought about caching the bitmap for smaller sizes, and trying to add heuristics, but I figured it would just make things more complex without solving the difficult case.

> Also, just in case, `canvas%` can be initialized with `[style '(no-autoclear)]` to avoid being erased before each call to `paint-callback`.

Ah! That’s very helpful, thanks.


Posted on the users mailing list.