changeset 103:9b81174f0511

Fixed alignment of borders.
author Mikhail Kryshen <mikhail@kryshen.net>
date Thu, 19 May 2011 17:01:46 +0400
parents fd8fb8a3ff5a
children 491152048c89 24e98602b37e
files src/net/kryshen/indyvon/layers.clj
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/net/kryshen/indyvon/layers.clj	Wed May 18 21:28:24 2011 +0400
+++ b/src/net/kryshen/indyvon/layers.clj	Thu May 19 17:01:46 2011 +0400
@@ -81,11 +81,17 @@
   ([content width gap]
      (let [layer (padding content (+ width gap))]
        (decorate-layer layer [_]
-         (with-color :border-color
-           (doseq [i (range 0 width)]
-             (.drawRect *graphics* i i
-                        (- *width* 1 i i)
-                        (- *height* 1 i i))))
+         (let [bw (int width)
+               w (int *width*)
+               h (int *height*)
+               iw (- w bw)
+               ih (- h bw)]
+           (with-color :border-color
+             (doto *graphics*
+               (.fillRect 0 0 iw bw)
+               (.fillRect iw 0 bw ih)
+               (.fillRect bw ih iw bw)
+               (.fillRect 0 bw bw ih))))
          (render! layer)))))
 
 ;; TODO: opacity and blur.