fix pen-cap support for narrow pens
by limiting a hack for bitmap drawing so that it doesn't affect PS/PDF drawing
This commit is contained in:
parent
a20a77508f
commit
1f790d9428
|
@ -122,6 +122,12 @@
|
||||||
;; Used to keep smoothing disabled for b&w contexts
|
;; Used to keep smoothing disabled for b&w contexts
|
||||||
dc-adjust-smoothing
|
dc-adjust-smoothing
|
||||||
|
|
||||||
|
;; dc-adjust-cap-shape
|
||||||
|
;;
|
||||||
|
;; Adjusts cap shape, used to get more consistent drawing
|
||||||
|
;; in bitmaps with small pens
|
||||||
|
dc-adjust-cap-shape
|
||||||
|
|
||||||
;; get-hairline-width
|
;; get-hairline-width
|
||||||
;;
|
;;
|
||||||
;; Gets the pen width to use in place of 0 in 'smoothed mode
|
;; Gets the pen width to use in place of 0 in 'smoothed mode
|
||||||
|
@ -192,6 +198,10 @@
|
||||||
|
|
||||||
(define/public (dc-adjust-smoothing s) s)
|
(define/public (dc-adjust-smoothing s) s)
|
||||||
(define/public (get-hairline-width sx) (/ 1 sx))
|
(define/public (get-hairline-width sx) (/ 1 sx))
|
||||||
|
(define/public (dc-adjust-cap-shape shape sx pw)
|
||||||
|
(if ((* pw sx) . <= . 1.0)
|
||||||
|
'round
|
||||||
|
shape))
|
||||||
|
|
||||||
(define/public (install-color cr c a bg?)
|
(define/public (install-color cr c a bg?)
|
||||||
(let ([norm (lambda (v) (/ v 255.0))])
|
(let ([norm (lambda (v) (/ v 255.0))])
|
||||||
|
@ -242,7 +252,8 @@
|
||||||
(super-new)
|
(super-new)
|
||||||
|
|
||||||
(inherit flush-cr get-cr release-cr end-cr init-cr-matrix get-pango
|
(inherit flush-cr get-cr release-cr end-cr init-cr-matrix get-pango
|
||||||
install-color dc-adjust-smoothing get-hairline-width reset-clip
|
install-color dc-adjust-smoothing get-hairline-width dc-adjust-cap-shape
|
||||||
|
reset-clip
|
||||||
collapse-bitmap-b&w?
|
collapse-bitmap-b&w?
|
||||||
ok? can-combine-text? can-mask-bitmap? get-clear-operator)
|
ok? can-combine-text? can-mask-bitmap? get-clear-operator)
|
||||||
|
|
||||||
|
@ -915,9 +926,9 @@
|
||||||
[(eq? s 'dot-dash) 4]
|
[(eq? s 'dot-dash) 4]
|
||||||
[else 0])))
|
[else 0])))
|
||||||
(cairo_set_line_cap cr
|
(cairo_set_line_cap cr
|
||||||
(case (if ((send pen get-width) . <= . 1.0)
|
(case (dc-adjust-cap-shape (send pen get-cap)
|
||||||
'round
|
effective-scale-x
|
||||||
(send pen get-cap))
|
(send pen get-width))
|
||||||
[(butt) CAIRO_LINE_CAP_BUTT]
|
[(butt) CAIRO_LINE_CAP_BUTT]
|
||||||
[(round) CAIRO_LINE_CAP_ROUND]
|
[(round) CAIRO_LINE_CAP_ROUND]
|
||||||
[(projecting) CAIRO_LINE_CAP_SQUARE]))
|
[(projecting) CAIRO_LINE_CAP_SQUARE]))
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
get-font-metrics-key
|
get-font-metrics-key
|
||||||
install-color
|
install-color
|
||||||
dc-adjust-smoothing
|
dc-adjust-smoothing
|
||||||
|
dc-adjust-cap-shape
|
||||||
get-hairline-width
|
get-hairline-width
|
||||||
can-combine-text?
|
can-combine-text?
|
||||||
can-mask-bitmap?
|
can-mask-bitmap?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user