diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-09-07 20:10:35 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-09-08 07:24:43 -0400 |
commit | 407711fecfc5f10fd5c04b248c994403e06698a9 (patch) | |
tree | 77b2149004c99105dac2b550cd23378479350abb | |
parent | 00bb111ab20beae6d1a4dea47326d9e2144c57d8 (diff) |
graphics: path: Fix bounding box state sharing issue.
Create a new bounding box each time the compiled path is reset to
avoid all paths sharing, and clobbering, the same rect object.
-rw-r--r-- | chickadee/graphics/path.scm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chickadee/graphics/path.scm b/chickadee/graphics/path.scm index 5cef98b..8f21394 100644 --- a/chickadee/graphics/path.scm +++ b/chickadee/graphics/path.scm @@ -480,7 +480,7 @@ ;; Step 2: Use compiled points to fill vertex buffers with triangles ;; for filling or stroking. (define-record-type <compiled-path> - (%make-compiled-path point-capacity point-count path-capacity path-count bounding-box) + (%make-compiled-path point-capacity point-count path-capacity path-count) compiled-path? (point-count compiled-path-point-count set-compiled-path-point-count!) (point-capacity compiled-path-point-capacity set-compiled-path-point-capacity!) @@ -489,7 +489,7 @@ (points compiled-path-points set-compiled-path-points!) (offsets compiled-path-offsets set-compiled-path-offsets!) (counts compiled-path-counts set-compiled-path-counts!) - (bounding-box compiled-path-bounding-box)) + (bounding-box compiled-path-bounding-box set-compiled-path-bounding-box!)) (define (resize-compiled-path-offsets-and-counts! compiled-path capacity) (let ((new-offsets (make-u32vector capacity)) @@ -512,14 +512,15 @@ (set-compiled-path-point-capacity! compiled-path capacity))) (define (make-compiled-path) - (let ((compiled-path (%make-compiled-path 0 0 0 0 (make-rect 0.0 0.0 0.0 0.0)))) + (let ((compiled-path (%make-compiled-path 0 0 0 0))) (resize-compiled-path-offsets-and-counts! compiled-path 64) (resize-compiled-path-points! compiled-path 256) compiled-path)) (define (clear-compiled-path compiled-path) (set-compiled-path-count! compiled-path 0) - (set-compiled-path-point-count! compiled-path 0)) + (set-compiled-path-point-count! compiled-path 0) + (set-compiled-path-bounding-box! compiled-path (make-rect 0.0 0.0 0.0 0.0))) (define %origin (vec2 0.0 0.0)) |