racket/gui cocoa: fix flipped drawing for combo-field%
content
This was another bug in9cb646bbd2
. (cherry picked from commit991659a9e3
)
This commit is contained in:
parent
9e50c633cc
commit
07d686f13c
|
@ -65,7 +65,9 @@
|
||||||
;; Use a quartz bitmap so that text looks good:
|
;; Use a quartz bitmap so that text looks good:
|
||||||
(define trans? transparent?)
|
(define trans? transparent?)
|
||||||
(define/override (make-backing-bitmap w h)
|
(define/override (make-backing-bitmap w h)
|
||||||
(make-window-bitmap w h (send canvas get-cocoa-window) trans?))
|
(make-window-bitmap w h (send canvas get-cocoa-window)
|
||||||
|
trans?
|
||||||
|
(send canvas is-flipped?)))
|
||||||
|
|
||||||
(define/override (can-combine-text? sz) #t)
|
(define/override (can-combine-text? sz) #t)
|
||||||
|
|
||||||
|
@ -106,7 +108,7 @@
|
||||||
(cond
|
(cond
|
||||||
[(bm . is-a? . layer-bitmap%)
|
[(bm . is-a? . layer-bitmap%)
|
||||||
(define layer (send bm get-layer))
|
(define layer (send bm get-layer))
|
||||||
(CGContextDrawLayerAtPoint cg (make-NSPoint 0 0) layer)]
|
(CGContextDrawLayerAtPoint cg (make-NSPoint dx dy) layer)]
|
||||||
[else
|
[else
|
||||||
(unless (send canvas is-flipped?)
|
(unless (send canvas is-flipped?)
|
||||||
(CGContextTranslateCTM cg 0 (unbox h))
|
(CGContextTranslateCTM cg 0 (unbox h))
|
||||||
|
@ -142,19 +144,14 @@
|
||||||
(make-object quartz-bitmap% w h #t
|
(make-object quartz-bitmap% w h #t
|
||||||
(display-bitmap-resolution 0 void)))
|
(display-bitmap-resolution 0 void)))
|
||||||
|
|
||||||
(define (make-window-bitmap w h win [trans? #t])
|
(define (make-window-bitmap w h win [trans? #t] [flipped? #f])
|
||||||
(if win
|
(if win
|
||||||
(make-object layer-bitmap% w h win
|
(make-object layer-bitmap% w h win trans? flipped?)
|
||||||
;; Force to non-transparent, because trying to
|
|
||||||
;; draw a layer into a transparent context
|
|
||||||
;; (when conversion to a bitmap is needed)
|
|
||||||
;; doesn't seem to work.
|
|
||||||
trans?)
|
|
||||||
(make-screen-bitmap w h)))
|
(make-screen-bitmap w h)))
|
||||||
|
|
||||||
(define layer-bitmap%
|
(define layer-bitmap%
|
||||||
(class quartz-bitmap%
|
(class quartz-bitmap%
|
||||||
(init w h win trans?)
|
(init w h win trans? flipped?)
|
||||||
|
|
||||||
(define layer (make-layer win w h))
|
(define layer (make-layer win w h))
|
||||||
(define layer-w w)
|
(define layer-w w)
|
||||||
|
@ -165,8 +162,9 @@
|
||||||
|
|
||||||
(super-make-object w h trans? 1
|
(super-make-object w h trans? 1
|
||||||
(let ([cg (CGLayerGetContext layer)])
|
(let ([cg (CGLayerGetContext layer)])
|
||||||
(CGContextTranslateCTM cg 0 h)
|
(unless flipped?
|
||||||
(CGContextScaleCTM cg 1 -1)
|
(CGContextTranslateCTM cg 0 h)
|
||||||
|
(CGContextScaleCTM cg 1 -1))
|
||||||
cg))
|
cg))
|
||||||
|
|
||||||
(define/override (draw-bitmap-to cr sx sy dx dy w h alpha clipping-region)
|
(define/override (draw-bitmap-to cr sx sy dx dy w h alpha clipping-region)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user