cache bitmap and dc for snip sizing

svn: r4708
This commit is contained in:
Matthew Flatt 2006-10-30 06:50:14 +00:00
parent 97a56ca84c
commit b61846baba
2 changed files with 13 additions and 11 deletions

View File

@ -11,15 +11,17 @@
(define (image? a)
(or (is-a? a image-snip%)
(is-a? a cache-image-snip%)))
(define size-dc (delay (make-object bitmap-dc% (make-object bitmap% 1 1))))
(define (snip-size a)
(cond
[(is-a? a cache-image-snip%)
(send a get-size)]
[else
(let ([dc (make-object bitmap-dc% (make-object bitmap% 1 1))]
[wb (box 0)]
[hb (box 0)])
(let* ([dc (force size-dc)]
[wb (box 0)]
[hb (box 0)])
(send a get-extent dc 0 0 wb hb #f #f #f #f)
(values (unbox wb)
(unbox hb)))]))

View File

@ -28,16 +28,16 @@
(syntax args))
stx)]
[id
(syntax-property
(datum->syntax-object
check-proc
(list check-proc
(list 'quote (syntax id))
tmp-id)
stx)
(syntax-property
(datum->syntax-object
check-proc
(list check-proc
(list 'quote (syntax id))
tmp-id)
stx)
'stepper-skipto
'(syntax-e cdr syntax-e cdr cdr car))]))))) ; this may make other stepper-skipto annotations obsolete.
(define (appropriate-use what)
(case what
[(constructor)