Move win-agnostic parts of draw/drawregion to st.c
Introduces three functions to encapsulate X-specific behavior: * xdrawline: draws a portion of a single line (used by drawregion) * xbegindraw: called to prepare for drawing (will be useful for e.g. Wayland) and returns true if drawing should happen * xfinishdraw: called to finish drawing (used by draw) Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
This commit is contained in:
25
st.c
25
st.c
@ -166,6 +166,8 @@ static int32_t tdefcolor(int *, int *, int);
|
||||
static void tdeftran(char);
|
||||
static void tstrsequence(uchar);
|
||||
|
||||
static void drawregion(int, int, int, int);
|
||||
|
||||
static void selscroll(int, int);
|
||||
static void selsnap(int *, int *, int);
|
||||
|
||||
@ -2526,6 +2528,29 @@ resettitle(void)
|
||||
xsettitle(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
drawregion(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int y;
|
||||
for (y = y1; y < y2; y++) {
|
||||
if (!term.dirty[y])
|
||||
continue;
|
||||
|
||||
term.dirty[y] = 0;
|
||||
xdrawline(term.line[y], x1, y, x2);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
draw(void)
|
||||
{
|
||||
if (!xstartdraw())
|
||||
return;
|
||||
drawregion(0, 0, term.col, term.row);
|
||||
xdrawcursor();
|
||||
xfinishdraw();
|
||||
}
|
||||
|
||||
void
|
||||
redraw(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user