diff options
Diffstat (limited to 'src/core-units')
-rw-r--r-- | src/core-units/affine.lisp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core-units/affine.lisp b/src/core-units/affine.lisp index e4db874..cabe17c 100644 --- a/src/core-units/affine.lisp +++ b/src/core-units/affine.lisp @@ -21,29 +21,27 @@ scale-y (* amount scale-y)))) (defun set-width-preserve-aspect (affine new-width) - (scale-by affine (/ new-width (unit-width affine)))) + (scale-by affine (/ new-width (width affine)))) (defun set-height-preserve-aspect (affine new-height) - (scale-by affine (/ new-height (unit-height affine) ))) + (scale-by affine (/ new-height (height affine) ))) -(defmethod unit-width ((affine affine)) +(defun width (affine) (with-slots (scale-x base-width) affine (* scale-x base-width))) -(defmethod unit-height ((affine affine)) +(defun height (affine) (with-slots (scale-y base-height) affine (* scale-y base-height))) -(defmethod (setf unit-width) (newval (affine affine)) +(defun (setf width) (newval affine) (with-slots (scale-x base-width) affine (setf scale-x (coerce (/ newval base-width) 'single-float)))) -(defmethod (setf unit-height) (newval (affine affine)) +(defun (setf height) (newval affine) (with-slots (scale-y base-height) affine (setf scale-y (coerce (/ newval base-height) 'single-float)))) - - (defmethod model-matrix :around ((u affine)) (or (cached-model u) (setf (cached-model u) |