Sped up loading on ipad by a lot.
This commit is contained in:
@@ -122,11 +122,16 @@
|
||||
(defn map-from-resource [filename]
|
||||
(let [pm (pixmap filename)
|
||||
black (color 0 0 0 255)
|
||||
painful (color 255 0 0 255)]
|
||||
(vec (take-nth scale (for [x (range (pixmap! pm :get-width))]
|
||||
(vec (take-nth scale (for [y (reverse (range (pixmap! pm :get-height)))
|
||||
:let [current-color (color (pixmap! pm :get-pixel x y))]]
|
||||
(cond
|
||||
(color! current-color :equals black) 0
|
||||
(color! current-color :equals painful) 2
|
||||
:else 1)))))))))
|
||||
painful (color 255 0 0 255)
|
||||
result (transient [])
|
||||
scale (long scale)
|
||||
height (long (pixmap! pm :get-height))]
|
||||
(doseq [^long x (range (/ (pixmap! pm :get-width) scale))
|
||||
^long y (range (/ height scale))
|
||||
:let [
|
||||
current-color (color (pixmap! pm :get-pixel (unchecked-multiply scale x) (unchecked-subtract height (unchecked-multiply scale y))))]]
|
||||
(conj! result (cond
|
||||
(color! current-color :equals black) 0
|
||||
(color! current-color :equals painful) 2
|
||||
:else 1)))
|
||||
(partition (/ (pixmap! pm :get-height) scale) (persistent! result) )))
|
||||
|
||||
Reference in New Issue
Block a user