From f136557c71e0faafe33c547d63850508102e0034 Mon Sep 17 00:00:00 2001 From: Diego Sevilla Ruiz Date: Thu, 19 Dec 2013 11:45:45 +0100 Subject: [PATCH 1/2] Update led_matrix.clj Avoid calculating the digit spec dimensions each time draw-lcd-symbol is called. --- src/com/icyrock/clojure/seesaw/led_matrix.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/icyrock/clojure/seesaw/led_matrix.clj b/src/com/icyrock/clojure/seesaw/led_matrix.clj index 57dccf8..c7c543e 100644 --- a/src/com/icyrock/clojure/seesaw/led_matrix.clj +++ b/src/com/icyrock/clojure/seesaw/led_matrix.clj @@ -115,10 +115,14 @@ "....."] }) +; Assuming all the symbol bitmaps have the same size +(def dot-spec-width (count (first (lcd-symbol-dots \0)))) +(def dot-spec-height (count (lcd-symbol-dots \0))) + (defn draw-lcd-symbol [g width height symbol] (let [dots (lcd-symbol-dots symbol) - dot-width (/ width (count (first dots))) - dot-height (/ height (count dots))] + dot-width (/ width dot-spec-width)) + dot-height (/ height dot-spec-height)] (doseq [row dots] (doseq [cell row] (draw-lcd-dot g dot-width dot-height (= cell \*)) From 63691a5bc54db849de5c39aa6f751671fb52cb58 Mon Sep 17 00:00:00 2001 From: Diego Sevilla Ruiz Date: Thu, 19 Dec 2013 11:48:37 +0100 Subject: [PATCH 2/2] Update led_matrix.clj Typo. --- src/com/icyrock/clojure/seesaw/led_matrix.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/icyrock/clojure/seesaw/led_matrix.clj b/src/com/icyrock/clojure/seesaw/led_matrix.clj index c7c543e..722c0b5 100644 --- a/src/com/icyrock/clojure/seesaw/led_matrix.clj +++ b/src/com/icyrock/clojure/seesaw/led_matrix.clj @@ -121,7 +121,7 @@ (defn draw-lcd-symbol [g width height symbol] (let [dots (lcd-symbol-dots symbol) - dot-width (/ width dot-spec-width)) + dot-width (/ width dot-spec-width) dot-height (/ height dot-spec-height)] (doseq [row dots] (doseq [cell row]