prevent dc<%> state contamination among transparent canvases

This commit is contained in:
Matthew Flatt 2010-12-27 17:42:33 -07:00
parent 51ff346e2f
commit 719df98d83
3 changed files with 32 additions and 0 deletions

View File

@ -194,6 +194,7 @@
(define (backing-draw-bm bm cr w h)
(if (procedure? bm)
(begin
(send cairo-dc reset-config)
(send cairo-dc set-cr cr w h)
(bm cairo-dc)
(send cairo-dc set-cr #f 0 0))

View File

@ -322,6 +322,36 @@
(define current-xform (vector 1.0 0.0 0.0 1.0 0.0 0.0))
(define/public (reset-config)
(start-atomic)
(set! matrix (make-cairo_matrix_t 1 0 0 1 0 0))
(set! origin-x 0.0)
(set! origin-y 0.0)
(set! scale-x 1.0)
(set! scale-y 1.0)
(set! rotation 0.0)
(set! effective-scale-x 1.0)
(set! effective-scale-y 1.0)
(set! effective-origin-x 0.0)
(set! effective-origin-y 0.0)
(set! current-xform (vector 1.0 0.0 0.0 1.0 0.0 0.0))
(set! pen (send the-pen-list find-or-create-pen "black" 1 'solid))
(set! brush (send the-brush-list find-or-create-brush "white" 'solid))
(set! font (send the-font-list find-or-create-font 12 'default))
(set! text-fg (send the-color-database find-color "black"))
(set! text-bg (send the-color-database find-color "white"))
(set! text-mode 'transparent)
(set! bg (send the-color-database find-color "white"))
(set! pen-stipple-s #f)
(set! brush-stipple-s #f)
(set! x-align-delta 0.5)
(set! y-align-delta 0.5)
(set! smoothing 'unsmoothed)
(set! current-smoothing #f)
(set! alpha 1.0)
(set! clipping-region #f)
(end-atomic))
(define/private (reset-effective!)
(let* ([mx (make-cairo_matrix_t 1 0 0 1 0 0)])
(cairo_matrix_multiply mx mx matrix)

View File

@ -21,6 +21,7 @@
;; dc%
in-cairo-context
get-clipping-matrix
reset-config
;; region%
install-region