diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2018-02-24 14:53:23 -0600 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2018-02-25 21:56:26 -0600 |
commit | 88d8293fb4ba150a5f19d58d133b5db93d9dcfa5 (patch) | |
tree | f9e3cce2feda5565049c5d99012e8bd84144b8a2 /st.c | |
parent | 05c66cb37d9ff278a3e0c45682c4b5e7945deb42 (diff) |
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>
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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); @@ -2527,6 +2529,29 @@ resettitle(void) } 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) { tfulldirt(); |