fix canvas dc size reporting

original commit: b69d4322afd417c9b354ea3ca0ba2150fe113119
This commit is contained in:
Matthew Flatt 2010-08-03 14:51:42 -06:00
parent 5746708793
commit 55f34df7de
4 changed files with 16 additions and 9 deletions

View File

@ -226,7 +226,12 @@
(tellv content-cocoa setDelegate: content-cocoa)
(install-control-font content-cocoa #f))
(define dc (make-object dc% (make-graphics-context) 0 0 10 10))
(define dc (make-object dc% (make-graphics-context) 0 0 10 10
(lambda ()
(let ([w (box 0)]
[h (box 0)])
(get-virtual-size w h)
(values (unbox w) (unbox h))))))
(queue-paint)

View File

@ -30,7 +30,7 @@
(define dc-backend%
(class* default-dc-backend% (dc-backend<%>)
(init context dx dy width height)
(init context dx dy width height -get-virtual-size)
(super-new)
(inherit reset-cr set-auto-scroll)
@ -79,9 +79,11 @@
(set-bounds dx dy width height)
(reset-cr cr))
(define get-virtual-size -get-virtual-size)
(def/override (get-size)
(values (exact->inexact clip-width)
(exact->inexact clip-height)))
(let-values ([(w h) (get-virtual-size)])
(values (exact->inexact w)
(exact->inexact h))))
(define/override (get-cr) cr)

View File

@ -218,7 +218,7 @@
[get-client-size (lambda ()
(let ([w (box 0)]
[h (box 0)])
(get-client-size w h)
(get-virtual-size w h)
(values (unbox w) (unbox h))))]
[window-lock (send (get-top-win) get-dc-lock)]
[get-window (lambda (client-gtk)

View File

@ -961,12 +961,12 @@
mem-dc)
(get-dc)))])
(when dc
(send dc clear)
(send dc start-doc "Draw Test")
(send dc start-doc "Draw Test")
(send dc start-page)
(send dc set-alpha current-alpha)
(send dc clear)
(send dc set-alpha current-alpha)
(send dc set-rotation current-rotation)
(send dc set-initial-matrix (if current-skew?
(vector 1 0 0.2 1 3 0)