diff options
-rw-r--r-- | chickadee/render/sprite.scm | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/chickadee/render/sprite.scm b/chickadee/render/sprite.scm index 1291687..5c4ecb4 100644 --- a/chickadee/render/sprite.scm +++ b/chickadee/render/sprite.scm @@ -174,9 +174,12 @@ void main (void) { (= (sprite-batch-capacity batch) (sprite-batch-size batch))) (define (double-sprite-batch-size! batch) - (let ((old-index (sprite-batch-index-buffer batch)) - (old-verts (sprite-batch-position-buffer batch)) - (old-tex (sprite-batch-texture-buffer batch))) + (let* ((old-index (sprite-batch-index-buffer batch)) + (old-verts (sprite-batch-position-buffer batch)) + (old-tex (sprite-batch-texture-buffer batch)) + (old-index-data (typed-buffer-data old-index)) + (old-verts-data (typed-buffer-data old-verts)) + (old-tex-data (typed-buffer-data old-tex))) (unmap-typed-buffer! old-index) (unmap-typed-buffer! old-verts) (unmap-typed-buffer! old-tex) @@ -186,12 +189,12 @@ void main (void) { (new-verts (sprite-batch-position-buffer batch)) (new-tex (sprite-batch-texture-buffer batch))) (define (copy from to) - (bytevector-copy! (typed-buffer-data from) 0 + (bytevector-copy! from 0 (typed-buffer-data to) 0 - (bytevector-length (typed-buffer-data from)))) - (copy old-index new-index) - (copy old-verts new-verts) - (copy old-tex new-tex)))) + (bytevector-length from))) + (copy old-index-data new-index) + (copy old-verts-data new-verts) + (copy old-tex-data new-tex)))) (define (sprite-batch-reset! batch) "Reset BATCH to size 0." |