From 84908853d4d30b7709f0e70efb59f8c2d094dc1d Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 11 Dec 2015 08:09:30 +0100 Subject: Remove term::wipe_hook After all it's only an optimization and systems these days should be fast enough to ignore it. --- src/main-gcu.c | 29 -------------------------- src/main-gtk2.c | 1 - src/main-sdl.c | 28 ------------------------- src/main-win.c | 29 -------------------------- src/main-x11.c | 20 ------------------ src/z-term.c | 64 ++++----------------------------------------------------- src/z-term.h | 4 ---- 7 files changed, 4 insertions(+), 171 deletions(-) diff --git a/src/main-gcu.c b/src/main-gcu.c index b129770d..c253daf2 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -701,34 +701,6 @@ static errr Term_curs_gcu(int x, int y) } -/* - * Erase a grid of space - * Hack -- try to be "semi-efficient". - */ -static errr Term_wipe_gcu(int x, int y, int n) -{ - term_data *td = (term_data *)(Term->data); - - /* Place cursor */ - wmove(td->win, y, x); - - /* Clear to end of line */ - if (x + n >= td->t.wid) - { - wclrtoeol(td->win); - } - - /* Clear some characters */ - else - { - while (n-- > 0) waddch(td->win, ' '); - } - - /* Success */ - return (0); -} - - /* * Place some text on the screen using an attribute */ @@ -790,7 +762,6 @@ static errr term_data_init_gcu(term_data *td, int rows, int cols, int y, int x) /* Set some more hooks */ t->text_hook = Term_text_gcu; - t->wipe_hook = Term_wipe_gcu; t->curs_hook = Term_curs_gcu; t->xtra_hook = Term_xtra_gcu; diff --git a/src/main-gtk2.c b/src/main-gtk2.c index 7bb1b14d..ca3eff60 100644 --- a/src/main-gtk2.c +++ b/src/main-gtk2.c @@ -1274,7 +1274,6 @@ static errr term_data_init(term_data *td, int i) /* Hooks */ t->xtra_hook = Term_xtra_gtk; t->text_hook = Term_text_gtk; - t->wipe_hook = Term_wipe_gtk; t->curs_hook = Term_curs_gtk; t->nuke_hook = Term_nuke_gtk; diff --git a/src/main-sdl.c b/src/main-sdl.c index a110efb2..9a177cbb 100644 --- a/src/main-sdl.c +++ b/src/main-sdl.c @@ -970,33 +970,6 @@ static errr Term_curs_sdl(int x, int y) return (0); } -/* routine for wiping terminal locations - simply draws -a black rectangle over the offending spots! */ -static errr Term_wipe_sdl(int x, int y, int n) -{ - static SDL_Rect base; - term_data *td = (term_data*)(Term->data); - - /* calculate boundaries of the area to clear */ - base.x = td->surf->clip_rect.x + x*t_width; - base.y = td->surf->clip_rect.y + y*t_height; - base.w = n*t_width; - base.h = t_height; - - SDL_LOCK(td->surf); - - /* blank the screen area */ - SDL_FillRect(td->surf, &base, td->black); - - SDL_UNLOCK(td->surf); - - /* And... UPDATE the rectangle we just wrote to! */ - drawTermStuff(td,&base); - - /* Success */ - return (0); -} - /* Perform a full clear of active terminal; redraw the borders.*/ void eraseTerminal(void) { @@ -1764,7 +1737,6 @@ static errr term_data_init(term_data *td, int i) /* Hooks */ t->xtra_hook = Term_xtra_sdl; t->curs_hook = Term_curs_sdl; - t->wipe_hook = Term_wipe_sdl; t->text_hook = Term_text_sdl; /* Save the data */ diff --git a/src/main-win.c b/src/main-win.c index 2ca6704b..a2daffbe 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -1560,34 +1560,6 @@ static errr Term_curs_win(int x, int y) } -/* - * Low level graphics (Assumes valid input). - * - * Erase a "block" of "n" characters starting at (x,y). - */ -static errr Term_wipe_win(int x, int y, int n) -{ - term_data *td = (term_data*)(Term->data); - - HDC hdc; - RECT rc; - - /* Rectangle to erase in client coords */ - rc.left = x * td->tile_wid + td->size_ow1; - rc.right = rc.left + n * td->tile_wid; - rc.top = y * td->tile_hgt + td->size_oh1; - rc.bottom = rc.top + td->tile_hgt; - - hdc = GetDC(td->w); - SetBkColor(hdc, RGB(0, 0, 0)); - SelectObject(hdc, td->font_id); - ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL); - ReleaseDC(td->w, hdc); - - /* Success */ - return 0; -} - /* * Low level graphics. Assumes valid input. * @@ -1700,7 +1672,6 @@ static void term_data_link(term_data *td) /* Prepare the template hooks */ t->xtra_hook = Term_xtra_win; t->curs_hook = Term_curs_win; - t->wipe_hook = Term_wipe_win; t->text_hook = Term_text_win; /* Remember where we came from */ diff --git a/src/main-x11.c b/src/main-x11.c index ef828555..b4b242e5 100644 --- a/src/main-x11.c +++ b/src/main-x11.c @@ -2198,25 +2198,6 @@ static errr Term_curs_x11(int x, int y) } -/* - * Erase some characters. - */ -static errr Term_wipe_x11(int x, int y, int n) -{ - /* Erase (use black) */ - Infoclr_set(clr[TERM_DARK]); - - /* Mega-Hack -- Erase some space */ - Infofnt_text_non(x, y, "", n); - - /* Redraw the selection if any, as it may have been obscured. (later) */ - s_ptr->drawn = FALSE; - - /* Success */ - return (0); -} - - /* * Draw some textual characters. */ @@ -2479,7 +2460,6 @@ static errr term_data_init(term_data *td, int i) /* Hooks */ t->xtra_hook = Term_xtra_x11; t->curs_hook = Term_curs_x11; - t->wipe_hook = Term_wipe_x11; t->text_hook = Term_text_x11; /* Save the data */ diff --git a/src/z-term.c b/src/z-term.c index db4aea66..53b23c02 100644 --- a/src/z-term.c +++ b/src/z-term.c @@ -176,7 +176,6 @@ * Term->nuke_hook = Nuke the term * Term->xtra_hook = Perform extra actions * Term->curs_hook = Draw (or Move) the cursor - * Term->wipe_hook = Draw some blank spaces * Term->text_hook = Draw some text in the window * * The "Term->xtra_hook" hook provides a variety of different functions, @@ -192,10 +191,6 @@ * redrawn if "nothing" has happened to the screen (even temporarily). * This hook is required. * - * The "Term->wipe_hook" hook provides this package with a simple way - * to "erase", starting at "x,y", the next "n" grids. This hook assumes - * that the input is valid. - * * The "Term->text_hook" hook provides this package with a simple way * to "draw", starting at "x,y", the "n" chars contained in "cp", using * the attr "a". This hook assumes that the input is valid, and that @@ -370,18 +365,6 @@ static errr Term_curs_hack(int x, int y) return ( -1); } -/* - * Hack -- fake hook for "Term_wipe()" (see above) - */ -static errr Term_wipe_hack(int x, int y, int n) -{ - /* Compiler silliness */ - if (x || y || n) return ( -2); - - /* Oops */ - return ( -1); -} - /* * Hack -- fake hook for "Term_text()" (see above) */ @@ -529,17 +512,7 @@ static void Term_fresh_row_text(int y, int x1, int x2) /* Flush */ if (fn) { - /* Draw pending chars (normal) */ - if (fa) - { - (void)((*Term->text_hook)(fx, y, fn, fa, &scr_cc[fx])); - } - - /* Draw pending chars (black) */ - else - { - (void)((*Term->wipe_hook)(fx, y, fn)); - } + (void)((*Term->text_hook)(fx, y, fn, fa, &scr_cc[fx])); /* Forget */ fn = 0; @@ -560,16 +533,7 @@ static void Term_fresh_row_text(int y, int x1, int x2) if (fn) { /* Draw the pending chars */ - if (fa) - { - (void)((*Term->text_hook)(fx, y, fn, fa, &scr_cc[fx])); - } - - /* Hack -- Erase "leading" spaces */ - else - { - (void)((*Term->wipe_hook)(fx, y, fn)); - } + (void)((*Term->text_hook)(fx, y, fn, fa, &scr_cc[fx])); /* Forget */ fn = 0; @@ -586,17 +550,7 @@ static void Term_fresh_row_text(int y, int x1, int x2) /* Flush */ if (fn) { - /* Draw pending chars (normal) */ - if (fa) - { - (void)((*Term->text_hook)(fx, y, fn, fa, &scr_cc[fx])); - } - - /* Draw pending chars (black) */ - else - { - (void)((*Term->wipe_hook)(fx, y, fn)); - } + (void)((*Term->text_hook)(fx, y, fn, fa, &scr_cc[fx])); } } @@ -715,7 +669,6 @@ errr Term_fresh(void) /* Paranoia -- use "fake" hooks to prevent core dumps */ if (!Term->curs_hook) Term->curs_hook = Term_curs_hack; - if (!Term->wipe_hook) Term->wipe_hook = Term_wipe_hack; if (!Term->text_hook) Term->text_hook = Term_text_hack; @@ -778,16 +731,7 @@ errr Term_fresh(void) char oc = old_cc[tx]; /* Hack -- restore the actual character */ - if (oa) - { - (void)((*Term->text_hook)(tx, ty, 1, oa, &oc)); - } - - /* Hack -- erase the grid */ - else - { - (void)((*Term->wipe_hook)(tx, ty, 1)); - } + (void)((*Term->text_hook)(tx, ty, 1, oa, &oc)); } } diff --git a/src/z-term.h b/src/z-term.h index 60d2ad94..01795629 100644 --- a/src/z-term.h +++ b/src/z-term.h @@ -105,8 +105,6 @@ struct term_win * * - Hook for placing the cursor * - * - Hook for drawing some blank spaces - * * - Hook for drawing a string of chars using an attr * * - Hook for drawing a sequence of special attr/char pairs @@ -150,8 +148,6 @@ struct term errr (*curs_hook)(int x, int y); - errr (*wipe_hook)(int x, int y, int n); - errr (*text_hook)(int x, int y, int n, byte a, cptr s); void (*resize_hook)(void); -- cgit v1.2.3