diff options
-rw-r--r-- | bytepusher.scm | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/bytepusher.scm b/bytepusher.scm index 1182f48..4c8671b 100644 --- a/bytepusher.scm +++ b/bytepusher.scm @@ -135,18 +135,19 @@ ;; rendering ---- -(define (get-pixels) - (let* ((initial (get-initial-pixel)) - (len (* width height)) - (base (make-bytevector len)) - (final (make-bytevector (* 4 len)))) - (let loop ((i 0)) - (bytevector-u32-set! final - (* 4 i) - (pixel->color-fast (get-byte (+ i initial))) - (endianness big)) - (unless (= i (- len 1)) (loop (+ 1 i)))) - final)) +(define get-pixels + ((lambda () + (define len (* width height)) + (define final (make-bytevector (* 4 len))) + (lambda () + (let* ((initial (get-initial-pixel))) + (let loop ((i 0)) + (bytevector-u32-set! final + (* 4 i) + (pixel->color-fast (get-byte (+ i initial))) + (endianness big)) + (unless (= i (- len 1)) (loop (+ 1 i)))) + final))))) (define (make-display-texture renderer) (make-texture renderer 'argb8888 'streaming width height)) |