~ft/zuke

5756ecf17937f697444fe02f6b13a205a78a975c — Sigrid Haflínudóttir 5 months ago 9661ba1
simplify current position logic in drawing
1 files changed, 6 insertions(+), 3 deletions(-)

M zuke.c
M zuke.c => zuke.c +6 -3
@@ 245,17 245,20 @@ redraw(int full)
		}
	}

	vlong msec = 0;
	if(pcurplaying >= 0){
		msec = byteswritten*1000/Bps;
		if(getmeta(pcurplaying)->duration != 0){
			msec = MIN(msec, getmeta(pcurplaying)->duration);
			snprint(tmp, sizeof(tmp), "%s%P/%P %d%%",
				shuffle != nil ? "∫ " : "",
				(int)(byteswritten/Bps),
				(int)msec/1000,
				getmeta(pcurplaying)->duration/1000,
				volume);
		}else{
			snprint(tmp, sizeof(tmp), "%s%P %d%%",
				shuffle != nil ? "∫ " : "",
				(int)(byteswritten/Bps),
				(int)msec/1000,
				volume);
		}
	}else


@@ 291,7 294,7 @@ redraw(int full)
		draw(screen, r, colors[Dfmed].im, nil, ZP);
		r = insetrect(r, 1);
		seekbar = r;
		r.max.x = r.min.x + Dx(r) * 1000.0*(double)byteswritten/Bps / (double)getmeta(pcurplaying)->duration;
		r.max.x = r.min.x + Dx(r) * (double)msec / (double)getmeta(pcurplaying)->duration;
		draw(screen, r, colors[Dbinv].im, nil, ZP);
	}