From 812f9b0257a99e25175a0b97df9a4b0fba407144 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Mon, 24 Apr 2006 16:09:10 +0000 Subject: [PATCH] polished comments for Kathy svn: r2764 --- collects/htdch/draw/Canvas.java | 3 --- collects/htdch/draw/support.scm | 13 +++++++++++-- collects/htdp/big-draw.ss | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/collects/htdch/draw/Canvas.java b/collects/htdch/draw/Canvas.java index f1cd6e4ccd..e4876d0f7d 100644 --- a/collects/htdch/draw/Canvas.java +++ b/collects/htdch/draw/Canvas.java @@ -14,9 +14,6 @@ public class Canvas { protected native boolean stop(); // I need to figure out how to accomplish these two things, especially stop, // directly at the Scheme level w/o going thru the Java layer. - // BUG: this is actually a bug in ProfessorJ. Making these protected should - // work just fine. Indeed, leaving off the access control qualifier should - // work, too. (That's package protected.) public native boolean show(); public native boolean close(); diff --git a/collects/htdch/draw/support.scm b/collects/htdch/draw/support.scm index 7b71d1a955..10a4d2f119 100644 --- a/collects/htdch/draw/support.scm +++ b/collects/htdch/draw/support.scm @@ -98,7 +98,16 @@ (define (stop-native this accs gets privates) (wrap-start-check ([hash-table-get privates '%end-of-time]))) - + + ;; (copy) restores the viewport and the pixmap so that + ;; (end-draw-sequence) can copy the pixmap into the viewport. + ;; It also clears the pixmap from anything that was on there. + ;; design rationale: the closure is created during the initializtion + ;; of the world (big-bang) and thus encapsulates access to the actual + ;; values of pixmap and viewport. big-bang exists once and for + ;; all and thus can't encapsulate the values. + ;; Alternative: expose these values as a "token", which big-bang must + ;; install. I couldn't figure out how to do this at the time. (define (copy-native this accs gets privates) (wrap-start-check ([hash-table-get privates 'copy]))) @@ -181,7 +190,7 @@ void-or-true) (define (endOfTime-native this accs gets privates) - (define theCanvas ((hash-table-get accs 'theCanvas) this)) + (define theCanvas ((hash-table-get accs 'theCanvas) this)) (send theCanvas stop) #t) diff --git a/collects/htdp/big-draw.ss b/collects/htdp/big-draw.ss index 31fe1f0b01..32d6e2703a 100644 --- a/collects/htdp/big-draw.ss +++ b/collects/htdp/big-draw.ss @@ -226,6 +226,7 @@ #t))) (hash-table-put! h '%stop %stop) ;; --- + ;; see ../htdch/draw/support.scm (copy) for explanation and design rationale (hash-table-put! h 'copy (lambda () (set! @vp vp*) (set! @pm pm*) [(clear-viewport pm*)])) ;; --- ;; --- the following can't happend during a draw sequence ---