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
(define/public (set tag v)
(define nw (coerce tag v))
(if (equal? value nw)
#t
;; this is the old Robby "optimization" for not triggering draw
;; when the world doesn't change
;if (equal? value nw)
; #t
(begin
(set! value nw)
(when pb (show-state))
#f)))
#f))
;; -> ok?
(define/public (get) value)

View File

@ -58,7 +58,7 @@
i
(if (1:image? 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)
(format "image with pinhole at (~s,~s)" (1:pinhole-x i) (1:pinhole-y i)))

View File

@ -242,7 +242,8 @@
(callback-stop! 'name)
(enable-images-button))
(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
(cond
[(not drawing)
@ -264,7 +265,7 @@
(set! draw last-picture)
(pdraw))
(callback-stop! 'name)
(enable-images-button)))
(enable-images-button))
changed-world?)))))))
;; tick, tock : deal with a tick event for this world
@ -314,8 +315,9 @@
(define/public (start!)
(queue-callback
(lambda ()
(with-handlers ([exn? (handler #t)])
(when draw (show-canvas))
(when register (register-with-host)))))
(when register (register-with-host))))))
(define/public (stop! w)
(set! live #f)