fix dc<%> `clear' method to draw white on non-alpha context

This commit is contained in:
Matthew Flatt 2010-12-14 16:31:43 -07:00
parent de271aa698
commit 3622a68449
3 changed files with 19 additions and 4 deletions

View File

@ -73,6 +73,11 @@
(define/override (collapse-bitmap-b&w?) b&w?)
(define/override (get-clear-operator)
(if (send bm has-alpha-channel?)
CAIRO_OPERATOR_CLEAR
CAIRO_OPERATOR_OVER))
(super-new)))
(define black (send the-color-database find-color "black"))

View File

@ -151,7 +151,12 @@
;; erase : -> void
;; A public method: erases all drawing
erase))
erase
;; get-clear-operator : -> int
;; Gets the Cairo operator used by the default
;; `clear' implementation
get-clear-operator))
(define default-dc-backend%
(class* object% (dc-backend<%>)
@ -206,6 +211,9 @@
(define/public (get-gl-context)
#f)
(define/public (get-clear-operator)
CAIRO_OPERATOR_CLEAR)
(super-new)))
(define hilite-color (send the-color-database find-color "black"))
@ -228,7 +236,7 @@
(inherit flush-cr get-cr release-cr end-cr init-cr-matrix get-pango
install-color dc-adjust-smoothing reset-clip
collapse-bitmap-b&w?
ok? can-combine-text? can-mask-bitmap?)
ok? can-combine-text? can-mask-bitmap? get-clear-operator)
;; Using the global lock here is troublesome, becase
;; operations involving paths, regions, and text can
@ -651,7 +659,7 @@
(with-cr
(check-ok 'erase)
cr
(cairo_set_operator cr CAIRO_OPERATOR_CLEAR)
(cairo_set_operator cr (get-clear-operator))
(cairo_set_source_rgba cr 1.0 1.0 1.0 1.0)
(cairo_paint cr)
(cairo_set_operator cr CAIRO_OPERATOR_OVER)))

View File

@ -43,4 +43,6 @@
install-color
dc-adjust-smoothing
can-combine-text?
can-mask-bitmap?)
can-mask-bitmap?
reset-clip
get-clear-operator)