Skip to content

Commit d9b41b2

Browse files
committed
Removes function-cache dependency for now
1 parent a2037e7 commit d9b41b2

File tree

4 files changed

+7
-25
lines changed

4 files changed

+7
-25
lines changed

README.org

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ Go make something pretty!
315315

316316
** License
317317

318-
Copyright (c) 2015, 2016 Danilo Vidovic (vydd)
318+
Copyright (c) 2015, 2016, 2017 Danilo Vidovic (vydd)
319319

320320
Permission is hereby granted, free of charge, to any person obtaining a copy
321321
of this software and associated documentation files (the "Software"), to deal

sketch.asd

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
:license "MIT"
77
:depends-on (#:alexandria
88
#:cl-geometry
9-
#:function-cache
109
#:glkit
1110
#:mathkit
1211
#:md5

src/package.lisp

-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
:keyboard-event
1111
:other-event
1212
:close-window)
13-
(:import-from :function-cache
14-
*bypass-cache*)
1513
(:export :sketch
1614
:setup
1715
:draw
@@ -148,7 +146,4 @@
148146
:with-font
149147
:set-font
150148
:text
151-
152-
;; Cache
153-
:*bypass-cache*
154149
))

src/shapes.lisp

+6-18
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,12 @@
88
;;; ___) | _ |/ ___ \| __/| |___ ___) |
99
;;; |____/|_| |_/_/ \_\_| |_____|____/
1010

11-
(defparameter *shape-cache-capacity* 1024)
12-
13-
;; (defmacro define-cached-shape (name arglist &body body)
14-
;; `(function-cache:defcached (,name :cache-class 'function-cache:lru-cache
15-
;; :capacity *shape-cache-capacity*)
16-
;; ,arglist
17-
;; ,@body))
18-
19-
(defmacro define-cached-shape (name arglist &body body)
20-
`(defun ,name ,arglist
21-
,@body))
22-
2311
(defun point (x y)
2412
(declare (type real x y))
2513
(with-pen (make-pen :fill (pen-stroke (env-pen *env*)))
2614
(rect x y 1 1)))
2715

28-
(define-cached-shape make-line (x1 y1 x2 y2)
16+
(defun make-line (x1 y1 x2 y2)
2917
(let* ((a (atan (- y2 y1) (- x2 x1)))
3018
(w (/ (or (pen-weight (env-pen *env*)) 1) 2))
3119
(dx (* 2 (sin a) w))
@@ -56,7 +44,7 @@
5644
(cdar (last lines)))
5745
nil)))
5846

59-
(define-cached-shape make-polyline (&rest coordinates)
47+
(defun make-polyline (&rest coordinates)
6048
(multiple-value-bind (d+ d-)
6149
(div2-inexact (pen-weight (env-pen *env*)))
6250
(let* ((lines (edges (group coordinates) nil))
@@ -77,7 +65,7 @@
7765
(t (with-pen (flip-pen (env-pen *env*))
7866
(funcall (apply #'make-polyline coordinates))))))
7967

80-
(define-cached-shape make-rect (x y w h)
68+
(defun make-rect (x y w h)
8169
(if (and (plusp w) (plusp h))
8270
(lambda ()
8371
(draw-shape
@@ -106,7 +94,7 @@
10694
y (* radial (- y (* x tangential)))))
10795
(nreverse vertices)))
10896

109-
(define-cached-shape make-ngon (n cx cy rx ry &optional (angle 0))
97+
(defun make-ngon (n cx cy rx ry &optional (angle 0))
11098
(let ((vertices (ngon-vertices n cx cy rx ry angle)))
11199
(lambda ()
112100
(draw-shape :triangle-fan vertices vertices))))
@@ -116,7 +104,7 @@
116104
(type real cx cy rx ry angle))
117105
(funcall (make-ngon n cx cy rx ry angle)))
118106

119-
(define-cached-shape make-star (n cx cy ra rb &optional (angle 0))
107+
(defun make-star (n cx cy ra rb &optional (angle 0))
120108
(let ((vertices (mix-lists (ngon-vertices n cx cy ra ra (+ 90 angle))
121109
(ngon-vertices n cx cy rb rb (- (+ 90 angle) (/ 180 n))))))
122110
(lambda ()
@@ -137,7 +125,7 @@
137125
(when (not (zerop r))
138126
(ellipse x y (abs r) (abs r))))
139127

140-
(define-cached-shape make-polygon (&rest coordinates)
128+
(defun make-polygon (&rest coordinates)
141129
(list
142130
:triangles
143131
(triangulate coordinates)

0 commit comments

Comments
 (0)