fixed small bug in draw check; eliminated the 'equal' optimization

svn: r17649
This commit is contained in:
Matthias Felleisen 2010-01-14 17:43:44 +00:00
parent 485900bfa6
commit be76ed2add
3 changed files with 45 additions and 41 deletions

View File

@ -73,12 +73,14 @@
;; effect: set value to v if distinct, also display it if pb exists ;; effect: set value to v if distinct, also display it if pb exists
(define/public (set tag v) (define/public (set tag v)
(define nw (coerce tag v)) (define nw (coerce tag v))
(if (equal? value nw) ;; this is the old Robby "optimization" for not triggering draw
#t ;; when the world doesn't change
;if (equal? value nw)
; #t
(begin (begin
(set! value nw) (set! value nw)
(when pb (show-state)) (when pb (show-state))
#f))) #f))
;; -> ok? ;; -> ok?
(define/public (get) value) (define/public (get) value)

View File

@ -58,7 +58,7 @@
i i
(if (1:image? i) (if (1:image? i)
(check-result tname 1:scene? "scene" i (image-pins i)) (check-result tname 1:scene? "scene" i (image-pins i))
(check-result tname #f "scene" i)))) (check-result tname (lambda _ #f) "scene" i))))
(define (image-pins i) (define (image-pins i)
(format "image with pinhole at (~s,~s)" (1:pinhole-x i) (1:pinhole-y i))) (format "image with pinhole at (~s,~s)" (1:pinhole-x i) (1:pinhole-y i)))

View File

@ -242,7 +242,8 @@
(callback-stop! 'name) (callback-stop! 'name)
(enable-images-button)) (enable-images-button))
(let ([changed-world? (send world set tag nw)]) (let ([changed-world? (send world set tag nw)])
(unless changed-world? ;; this is the old "Robby optimization" see checked-cell:
; unless changed-world?
(when draw (when draw
(cond (cond
[(not drawing) [(not drawing)
@ -264,7 +265,7 @@
(set! draw last-picture) (set! draw last-picture)
(pdraw)) (pdraw))
(callback-stop! 'name) (callback-stop! 'name)
(enable-images-button))) (enable-images-button))
changed-world?))))))) changed-world?)))))))
;; tick, tock : deal with a tick event for this world ;; tick, tock : deal with a tick event for this world
@ -314,8 +315,9 @@
(define/public (start!) (define/public (start!)
(queue-callback (queue-callback
(lambda () (lambda ()
(with-handlers ([exn? (handler #t)])
(when draw (show-canvas)) (when draw (show-canvas))
(when register (register-with-host))))) (when register (register-with-host))))))
(define/public (stop! w) (define/public (stop! w)
(set! live #f) (set! live #f)