[bknr-cvs] hans changed trunk/projects/quickhoney/src/imageproc.lisp

BKNR Commits bknr at bknr.net
Fri Aug 29 14:18:37 UTC 2008


Revision: 3750
Author: hans
URL: http://bknr.net/trac/changeset/3750

Always use integer scale factor for pixel images when creating button.

U   trunk/projects/quickhoney/src/imageproc.lisp

Modified: trunk/projects/quickhoney/src/imageproc.lisp
===================================================================
--- trunk/projects/quickhoney/src/imageproc.lisp	2008-08-29 13:51:00 UTC (rev 3749)
+++ trunk/projects/quickhoney/src/imageproc.lisp	2008-08-29 14:18:35 UTC (rev 3750)
@@ -64,13 +64,12 @@
          (button-height (parse-integer button-height))
          (button-image (create-image button-width button-height t))
          (category (bknr.utils:make-keyword-from-string category))
-         (scale-factor (apply #'max
-                              (if (> (/ (image-width input-image) (image-height input-image))
-                                     (/ button-width button-height))
-                                  (/ button-height (image-height input-image))
-                                  (/ button-width (image-width input-image)))
-                              (when (eq :pixel category)
-                                (list 1))))
+         (scale-factor (funcall (if (eq :pixel category)
+                                    #'ceiling #'identity)
+                                (if (> (/ (image-width input-image) (image-height input-image))
+                                       (/ button-width button-height))
+                                    (/ button-height (image-height input-image))
+                                    (/ button-width (image-width input-image)))))
          (cutout-width (floor (/ button-width scale-factor)))
          (cutout-height (floor (/ button-height scale-factor)))
          (radius (parse-integer radius)))




More information about the Bknr-cvs mailing list