correct backing scale on Retina canvas & derived contexts

One consequence is that drawing with a pen of width 0 into
a canvas% object on a Retina display draws a line that is
half as wide as a pen of width 1.

original commit: 7dc63162728b695b93a28b047dfafc841e4302e4
This commit is contained in:
Matthew Flatt 2014-01-05 12:29:42 -07:00
parent 147a4d67ee
commit 54f8bf10a5

View File

@ -160,12 +160,16 @@
(define is-trans? trans?)
(super-make-object w h trans? 1
(let ([cg (CGLayerGetContext layer)])
(unless flipped?
(CGContextTranslateCTM cg 0 h)
(CGContextScaleCTM cg 1 -1))
cg))
(let ([bs (inexact->exact
(display-bitmap-resolution 0 (lambda () 1)))])
(super-make-object w h trans? bs
(let ([cg (CGLayerGetContext layer)])
(unless flipped?
(CGContextTranslateCTM cg 0 h)
(CGContextScaleCTM cg 1 -1))
(unless (= bs 1)
(CGContextScaleCTM cg (/ 1 bs) (/ 1 bs)))
cg)))
(define/override (draw-bitmap-to cr sx sy dx dy w h alpha clipping-region)
;; Called when the destination rectangle is inside the clipping region