[racket-dev] [plt] Push #25220: master branch updated

From: Neil Toronto (neil.toronto at gmail.com)
Date: Thu Aug 16 20:31:25 EDT 2012

On 08/16/2012 06:17 PM, robby at racket-lang.org wrote:
> 01e7ede Robby Findler <robby at racket-lang.org> 2012-08-16 19:15
> :
> | some performance improvements for the new drracket blueboxes
> | specifically, it doesn't trigger redrawing of the screen
> | as aggressively, which seems to make a little difference
> | under mac os x.
> |
> | I'd have liked to be more sophisticated in the way redraws
> | are triggered, but I don't see how (see long comment in this
> | commit for details)
 >
 > ...
 >
> +    (define/private (invalidate-blue-box-region)
> +      (define c (get-canvas))
> +      (when c (send c refresh))
> +      ;; the code below is what I'd like to do here,
> +      ;; but this doesn't redraw the margin (the part
> +      ;; of the editor-canvas that is always outside
> +      ;; of th editor) and it doesn't seem possible to
> +      ;; trigger a redraw of that part without also
> +      ;; triggering a redraw of the entire editor
> +      ;; so we just do that instead (above)
> +
> +      #;
> +      (begin
> +        (define-values (br bt _1 _2) (get-box-upper-right-and-lock-coordinates))
> +        (when (and bt br)
> +          (cond
> +            [(get-show-docs?)
> +             (define-values (box-width box-height label-overlap?)
> +               (get-blue-box-size (get-dc) (get-style-list) the-strs))
> +             (define x (- br box-width shadow-size))
> +             (invalidate-bitmap-cache (max x 0)
> +                                      (max bt 0)
> +                                      (+ box-width shadow-size)
> +                                      (+ box-height shadow-size))]
> +            [the-strs
> +             (define size (+ corner-radius shadow-size))
> +             (invalidate-bitmap-cache (max 0 (- br size)) (max 0 bt) size size)]))))

Is there a way to invalidate just one part of a GUI element? I'd have 
liked having that recently on a little game I made. All I could find was 
`refresh', which doesn't take parameters. I didn't like having to redraw 
the entire board whenever a single piece was moved.

Neil ⊥


Posted on the dev mailing list.