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.
This commit is contained in:
parent
dc499feed9
commit
7dc6316272
|
@ -55,15 +55,15 @@ To avoid creating multiple pens with the same characteristics, use the
|
|||
global @racket[pen-list%] object @indexed-racket[the-pen-list], or
|
||||
provide a color, width, and style to @xmethod[dc<%> set-pen].
|
||||
|
||||
When drawing in @racket['smoothed] or @racket['aligned] mode, a pen's
|
||||
When drawing in @racket['unsmoothed] or @racket['aligned] mode, a pen's
|
||||
size is truncated after scaling to an integral size. A pen of size
|
||||
@racket[0] (after truncation, if applicable) uses a non-zero,
|
||||
scale-insensitive line size for the destination drawing context:
|
||||
@racket[1/4] unit (after scaling) for @racket[post-script-dc%] or
|
||||
@racket[pdf-dc%] contexts in @racket['smoothed] mode, or @racket[1]
|
||||
unit (after scaling) for any other context. For example, in unscaled
|
||||
canvas and bitmap contexts, a zero-width pen behaves the same as a
|
||||
pen of size @racket[1].
|
||||
canvas and bitmap contexts with a @tech{backing scale} of 1.0,
|
||||
a zero-width pen behaves the same as a pen of size @racket[1].
|
||||
|
||||
See also @racket[make-pen].
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user