Skip to content

Commit

Permalink
Trivial refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiyas committed Sep 8, 2014
1 parent ac226ec commit d97b3a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/sixel.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func PrintSixel(w io.Writer, code *qr.Code, inverse bool) {
for y := 0; y < code.Size; y++ {
fmt.Fprint(w, "#", white)
color := white
run := 6
repeat := 6
var current string
for x := 0; x < code.Size; x++ {
if code.Black(x, y) {
Expand All @@ -35,16 +35,16 @@ func PrintSixel(w io.Writer, code *qr.Code, inverse bool) {
current = white
}
if current != color {
fmt.Fprint(w, "#", color, "!", run, "~")
fmt.Fprint(w, "#", color, "!", repeat, "~")
color = current
run = 0
repeat = 0
}
run += 6
repeat += 6
}
if color == white {
fmt.Fprintf(w, "#%s!%d~", white, run+6)
fmt.Fprintf(w, "#%s!%d~", white, repeat+6)
} else {
fmt.Fprintf(w, "#%s!%d~#%s!6~", color, run, white)
fmt.Fprintf(w, "#%s!%d~#%s!6~", color, repeat, white)
}
fmt.Fprint(w, "-")
}
Expand Down

0 comments on commit d97b3a6

Please sign in to comment.