From 69c163cfe9d353060896403a3e844848d4fd54eb Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 13 Apr 2018 21:25:45 +0300 Subject: Unknown changes that possibly fix and/or break things --- lib/ansimage/ansimage.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') 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 } -- cgit v1.2.3