aboutsummaryrefslogtreecommitdiff
path: root/lib/ansimage
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-13 21:25:45 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-13 21:25:45 +0300
commit69c163cfe9d353060896403a3e844848d4fd54eb (patch)
tree3b61d43f66a641c462c33620de90ff9d2b2c1047 /lib/ansimage
parent7e5e802e90e38e7b1de025e792e228ac7b329a53 (diff)
Unknown changes that possibly fix and/or break things
Diffstat (limited to 'lib/ansimage')
-rw-r--r--lib/ansimage/ansimage.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ansimage/ansimage.go b/lib/ansimage/ansimage.go
index a41c833..b117b3d 100644
--- a/lib/ansimage/ansimage.go
+++ b/lib/ansimage/ansimage.go
@@ -124,8 +124,8 @@ func (ai *ANSImage) Render() []tstring.TString {
rows := make([]tstring.TString, ai.h/2)
for y := 0; y < ai.h; y += ai.maxprocs {
ch := make(chan renderData, ai.maxprocs)
- for n, r := 0, y+1; (n <= ai.maxprocs) && (2*r+1 < ai.h); n, r = n+1, y+n+1 {
- go func(r, y int) {
+ for n, row := 0, y; (n <= ai.maxprocs) && (2*row+1 < ai.h); n, row = n+1, y+n {
+ go func(row, y int) {
str := make(tstring.TString, ai.w)
for x := 0; x < ai.w; x++ {
topPixel := ai.pixmap[y][x]
@@ -139,10 +139,10 @@ func (ai *ANSImage) Render() []tstring.TString {
Style: tcell.StyleDefault.Background(topColor).Foreground(bottomColor),
}
}
- ch <- renderData{row: r, render: str}
- }(r, 2*r)
+ ch <- renderData{row: row, render: str}
+ }(row, 2*row)
}
- for n, r := 0, y+1; (n <= ai.maxprocs) && (2*r+1 < ai.h); n, r = n+1, y+n+1 {
+ for n, row := 0, y; (n <= ai.maxprocs) && (2*row+1 < ai.h); n, row = n+1, y+n {
data := <-ch
rows[data.row] = data.render
}