summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-05-16 18:59:37 -0400
committerDavid Thompson <dthompson2@worcester.edu>2023-05-16 18:59:37 -0400
commit13291951ca55c16347ad0fd900371d034c734b87 (patch)
tree111a538e0027798ba8d23fb98dd44b31ff90d500
parent022e1e7e4ebaa7c6f173137f2f20db1721a50cea (diff)
graphics: buffer: Reduce closure allocation.
-rw-r--r--chickadee/graphics/buffer.scm16
1 files changed, 8 insertions, 8 deletions
diff --git a/chickadee/graphics/buffer.scm b/chickadee/graphics/buffer.scm
index fff1a88..f2fbfe0 100644
--- a/chickadee/graphics/buffer.scm
+++ b/chickadee/graphics/buffer.scm
@@ -790,23 +790,23 @@ argument may be overridden. The following values are supported:
body ...
(geometry-end* geometry type) ...))
+(define (begin:map buffer-pair)
+ (dynamic-buffer-map! (cdr buffer-pair)))
+
(define (geometry-begin! geometry)
(let ((index-buffer (geometry-index-buffer geometry)))
- (for-each (match-lambda
- ((_ . buffer)
- (dynamic-buffer-map! buffer)))
- (geometry-vertex-buffers geometry))
+ (for-each begin:map (geometry-vertex-buffers geometry))
(when index-buffer
(dynamic-buffer-map! index-buffer))))
+(define (end:unmap buffer-pair)
+ (dynamic-buffer-unmap! (cdr buffer-pair)))
+
(define (geometry-end! geometry)
(let ((index-buffer (geometry-index-buffer geometry)))
(when index-buffer
(dynamic-buffer-unmap! index-buffer))
- (for-each (match-lambda
- ((_ . buffer)
- (dynamic-buffer-unmap! buffer)))
- (geometry-vertex-buffers geometry))))
+ (for-each end:unmap (geometry-vertex-buffers geometry))))
(define-syntax-rule (with-geometry geometry body ...)
(begin