make the code in the contract have a nicer name.

Thanks to Matthias
This commit is contained in:
Robby Findler 2014-07-15 08:56:40 -05:00
parent 6d2dfbff9e
commit 9028e72813

View File

@ -30,13 +30,7 @@
[h real?])
([d (or/c #f real?)]
[a (or/c #f real?)])
#:pre (draw)
(let ()
(define bdc (new bitmap-dc% [bitmap (make-bitmap 1 1)]))
(randomize-state bdc)
(define old-state (get-dc-state bdc))
(draw bdc 0 0)
(equal? (get-dc-state bdc) old-state))
#:pre (draw) (does-draw-restore-the-state-after-being-called? draw)
[p pict?])]
[cellophane (-> pict? (real-in 0 1) pict?)]
[vl-append *-append/c]
@ -83,6 +77,13 @@
[result pict?])]
[disk (->* ((and/c rational? (not/c negative?))) (#:draw-border? any/c) pict?)]))
(define (does-draw-restore-the-state-after-being-called? draw)
(define bdc (new bitmap-dc% [bitmap (make-bitmap 1 1)]))
(randomize-state bdc)
(define old-state (get-dc-state bdc))
(draw bdc 0 0)
(equal? (get-dc-state bdc) old-state))
;; randomizes some portions of the state of the given dc;
;; doesn't pick random values for things that the 'dc'
;; function promises not to change (e.g. the pen/brush style).