cocoa: erasing a non-transparent canvas uses white

This commit is contained in:
Matthew Flatt 2011-01-07 14:15:35 -07:00
parent 9d7a7a1520
commit 5f4ee4f9f8
2 changed files with 14 additions and 4 deletions

View File

@ -14,11 +14,13 @@
(define quartz-bitmap%
(class bitmap%
(init w h)
(init w h [with-alpha? #t])
(super-make-object (make-alternate-bitmap-kind w h))
(define s
(let ([s (cairo_quartz_surface_create CAIRO_FORMAT_ARGB32
(let ([s (cairo_quartz_surface_create (if with-alpha?
CAIRO_FORMAT_ARGB32
CAIRO_FORMAT_RGB24)
w
h)])
;; initialize bitmap to empty - needed?
@ -34,8 +36,14 @@
(define/override (is-color?) #t)
(define has-alpha? with-alpha?)
(define/override (has-alpha-channel?) has-alpha?)
(define/override (get-cairo-surface) s)
(define/override (get-cairo-alpha-surface) s)
(define/override (get-cairo-alpha-surface)
(if has-alpha?
s
(super get-cairo-alpha-surface)))
(define/override (release-bitmap-storage)
(atomically

View File

@ -48,7 +48,9 @@
g)))))
;; Use a quartz bitmap so that text looks good:
(define/override (make-backing-bitmap w h) (make-object quartz-bitmap% w h))
(define trans? transparent?)
(define/override (make-backing-bitmap w h)
(make-object quartz-bitmap% w h trans?))
(define/override (can-combine-text? sz) #t)
(define/override (get-backing-size xb yb)