aboutsummaryrefslogtreecommitdiff
path: root/lib/ansimage
diff options
context:
space:
mode:
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
}