racket/draw: faster (on some platforms) path for drawing a bitmap
The faster path applies in the common case of drawing a whole bitmap, as opposed to a section of the bitmap. Thanks to Laurent Orseau for tracking down this performance issue.
This commit is contained in:
parent
3f5bddfcbd
commit
54e42664df
|
@ -1816,14 +1816,21 @@
|
||||||
(- (- a-dest-y a-src-y)))
|
(- (- a-dest-y a-src-y)))
|
||||||
(cairo_pattern_set_matrix (cairo_get_source cr) m)))
|
(cairo_pattern_set_matrix (cairo_get_source cr) m)))
|
||||||
(adjust-pattern-filter sc (cairo_get_source cr)))
|
(adjust-pattern-filter sc (cairo_get_source cr)))
|
||||||
(if mask
|
(cond
|
||||||
(stamp-pattern mask a-msrc-x a-msrc-y)
|
[mask
|
||||||
(begin
|
(stamp-pattern mask a-msrc-x a-msrc-y)]
|
||||||
(cairo_new_path cr)
|
[(or (and (= 0 src-x)
|
||||||
(cairo_rectangle cr a-dest-x a-dest-y a-dest-w a-dest-h)
|
(= 0 src-y)
|
||||||
(if (= use-alpha 1.0)
|
(= src-w (send src get-width))
|
||||||
(cairo_fill cr)
|
(= src-h (send src get-height)))
|
||||||
(cairo_paint_with_alpha cr use-alpha))))
|
(< use-alpha 1.0))
|
||||||
|
;; cairo_paint may be faster than cairo_fill
|
||||||
|
;; when drawing the whole source:
|
||||||
|
(cairo_paint_with_alpha cr use-alpha)]
|
||||||
|
[else
|
||||||
|
(cairo_new_path cr)
|
||||||
|
(cairo_rectangle cr a-dest-x a-dest-y a-dest-w a-dest-h)
|
||||||
|
(cairo_fill cr)])
|
||||||
(cairo_set_source cr s)
|
(cairo_set_source cr s)
|
||||||
(cairo_pattern_destroy s))]
|
(cairo_pattern_destroy s))]
|
||||||
[else
|
[else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user