aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2018-02-24 14:53:23 -0600
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:56:26 -0600
commit88d8293fb4ba150a5f19d58d133b5db93d9dcfa5 (patch)
treef9e3cce2feda5565049c5d99012e8bd84144b8a2 /st.c
parent05c66cb37d9ff278a3e0c45682c4b5e7945deb42 (diff)
downloadst-88d8293fb4ba150a5f19d58d133b5db93d9dcfa5.tar.gz
st-88d8293fb4ba150a5f19d58d133b5db93d9dcfa5.zip
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.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/st.c b/st.c
index 01791a5..504239e 100644
--- a/st.c
+++ b/st.c
@@ -166,6 +166,8 @@ static int32_t tdefcolor(int *, int *, int);
166static void tdeftran(char); 166static void tdeftran(char);
167static void tstrsequence(uchar); 167static void tstrsequence(uchar);
168 168
169static void drawregion(int, int, int, int);
170
169static void selscroll(int, int); 171static void selscroll(int, int);
170static void selsnap(int *, int *, int); 172static void selsnap(int *, int *, int);
171 173
@@ -2527,6 +2529,29 @@ resettitle(void)
2527} 2529}
2528 2530
2529void 2531void
2532drawregion(int x1, int y1, int x2, int y2)
2533{
2534 int y;
2535 for (y = y1; y < y2; y++) {
2536 if (!term.dirty[y])
2537 continue;
2538
2539 term.dirty[y] = 0;
2540 xdrawline(term.line[y], x1, y, x2);
2541 }
2542}
2543
2544void
2545draw(void)
2546{
2547 if (!xstartdraw())
2548 return;
2549 drawregion(0, 0, term.col, term.row);
2550 xdrawcursor();
2551 xfinishdraw();
2552}
2553
2554void
2530redraw(void) 2555redraw(void)
2531{ 2556{
2532 tfulldirt(); 2557 tfulldirt();