Skip to content

Commit

Permalink
Fixing unnecessary 'and do' constructs in color.lisp
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bjergaard committed May 5, 2016
1 parent 25b6bd1 commit 8125c1c
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions color.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -325,31 +325,31 @@ rendered width."
string-or-parts))
(height (max-font-height parts cc)))
(loop
for (part . rest) on parts
for font-height-difference = (- height
(font-height (ccontext-font cc)))
for y-to-center = (floor (/ font-height-difference 2))
if (stringp part)
do (draw-image-glyphs
(ccontext-px cc)
(ccontext-gc cc)
(ccontext-font cc)
draw-x (+ y y-to-center (font-ascent (ccontext-font cc)))
part
:translate #'translate-id
:size 16)
and do (incf draw-x (text-line-width (ccontext-font cc)
part
:translate #'translate-id))
else
do (if (eq :> (first part))
(progn (render-string rest cc
(- (xlib:drawable-width (ccontext-px cc))
x
(rendered-string-size rest cc))
y)
(loop-finish))
(apply #'apply-color cc (first part) (rest part))))
for (part . rest) on parts
for font-height-difference = (- height
(font-height (ccontext-font cc)))
for y-to-center = (floor (/ font-height-difference 2))
if (stringp part)
do (draw-image-glyphs
(ccontext-px cc)
(ccontext-gc cc)
(ccontext-font cc)
draw-x (+ y y-to-center (font-ascent (ccontext-font cc)))
part
:translate #'translate-id
:size 16)
(incf draw-x (text-line-width (ccontext-font cc)
part
:translate #'translate-id))
else
do (if (eq :> (first part))
(progn (render-string rest cc
(- (xlib:drawable-width (ccontext-px cc))
x
(rendered-string-size rest cc))
y)
(loop-finish))
(apply #'apply-color cc (first part) (rest part))))
(values height draw-x)))

(defun render-strings (screen cc padx pady strings highlights)
Expand Down Expand Up @@ -379,17 +379,17 @@ rendered width."
(xlib:drawable-width px)
(xlib:drawable-height px) t))
(loop for parts in strings
for row from 0 to (length strings)
for line-height = (max-font-height parts cc)
if (find row highlights :test 'eql)
do (xlib:draw-rectangle px gc 0 y (xlib:drawable-width px) line-height t)
and do (xlib:with-gcontext (gc :foreground (xlib:gcontext-background gc)
:background (xlib:gcontext-foreground gc))
(render-string parts cc (+ padx 0) (+ pady y)))
else
do (render-string parts cc (+ padx 0) (+ pady y))
end
do (incf y line-height))
for row from 0 to (length strings)
for line-height = (max-font-height parts cc)
if (find row highlights :test 'eql)
do (xlib:draw-rectangle px gc 0 y (xlib:drawable-width px) line-height t)
(xlib:with-gcontext (gc :foreground (xlib:gcontext-background gc)
:background (xlib:gcontext-foreground gc))
(render-string parts cc (+ padx 0) (+ pady y)))
else
do (render-string parts cc (+ padx 0) (+ pady y))
end
do (incf y line-height))
(xlib:copy-area px gc 0 0
(xlib:drawable-width px)
(xlib:drawable-height px) xwin 0 0)
Expand Down

0 comments on commit 8125c1c

Please sign in to comment.