summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-12-27 12:11:18 -0500
committerDavid Thompson <dthompson2@worcester.edu>2022-12-28 12:18:33 -0500
commitde9fe35b94afe0225d721a7c5f29b7b34b125581 (patch)
treeb049c3ecf16e872b48712a23ca127d348413597d
parent761a0f71e62da694d05895873c91abff70d8ec23 (diff)
node-2d: Short-circuit resize if size hasn't actually changed.
-rw-r--r--catbird/node-2d.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/catbird/node-2d.scm b/catbird/node-2d.scm
index 6e7eb41..41f82db 100644
--- a/catbird/node-2d.scm
+++ b/catbird/node-2d.scm
@@ -455,10 +455,13 @@
(next-method))
(define-method (resize (node <node-2d>) w h)
- (set! (width node) w)
- (set! (height node) h)
- (expire-local-bounding-box node)
- (on-child-resize (parent node) node))
+ ;; No-op if the size is the same.
+ (unless (and (= (width node) w)
+ (= (height node) h))
+ (set! (width node) w)
+ (set! (height node) h)
+ (expire-local-bounding-box node)
+ (on-child-resize (parent node) node)))
;;;