racket/draw: avoid callback-based PNG writing
Doc rendering has been occasionally crashing in Pixman/Cairo. It might have something to do with a non-atomic callback, so let's try avoiding that, first. (If that doesn't work, the next step is to avoid using Cairo in a multi-threaded way, for which this is a first step, too.)
This commit is contained in:
parent
5f3f3e8c54
commit
ec6f3fd610
|
@ -545,10 +545,10 @@
|
|||
(let ([w (create-png-writer out width height #t #f)])
|
||||
(write-png w rows)
|
||||
(destroy-png-writer w)))]
|
||||
[(and (not alpha-channel?)
|
||||
loaded-mask
|
||||
(= width (send loaded-mask get-width))
|
||||
(= height (send loaded-mask get-height)))
|
||||
[else #;(and (not alpha-channel?)
|
||||
loaded-mask
|
||||
(= width (send loaded-mask get-width))
|
||||
(= height (send loaded-mask get-height)))
|
||||
(let ([bstr (make-bytes (* width height 4))])
|
||||
(get-argb-pixels 0 0 width height bstr)
|
||||
(when loaded-mask
|
||||
|
@ -568,6 +568,7 @@
|
|||
(let ([w (create-png-writer out width height #f #t)])
|
||||
(write-png w rows)
|
||||
(destroy-png-writer w))))]
|
||||
#;
|
||||
[else
|
||||
;; Use Cairo built-in support:
|
||||
(let ([proc (lambda (ignored bstr len)
|
||||
|
|
|
@ -306,7 +306,7 @@
|
|||
-> _int)
|
||||
(_pointer = #f)
|
||||
-> _cairo_surface_t/null))
|
||||
|
||||
;; Not recommended, unless it makes sense to make the allback atomic:
|
||||
(define-cairo cairo_surface_write_to_png_stream (_fun _cairo_surface_t
|
||||
(_fun _pointer
|
||||
(s : _pointer)
|
||||
|
|
Loading…
Reference in New Issue
Block a user