diff --git a/curspriv.h b/curspriv.h index 455221d4..23b1be46 100644 --- a/curspriv.h +++ b/curspriv.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curspriv.h,v 1.106 2006/07/30 22:00:22 wmcbrine Exp $ */ +/* $Id: curspriv.h,v 1.107 2006/07/31 22:28:53 wmcbrine Exp $ */ /* CURSPRIV.H @@ -86,8 +86,6 @@ extern MOUSE_STATUS Trapped_Mouse_status; void PDC_beep(void); bool PDC_check_bios_key(void); -int PDC_copy_win(const WINDOW *, WINDOW *, int, int, int, - int, int, int, bool); int PDC_curs_set(int); void PDC_flushinp(void); int PDC_get_bios_key(void); diff --git a/pdcurses/overlay.c b/pdcurses/overlay.c index b8823413..ad6565ae 100644 --- a/pdcurses/overlay.c +++ b/pdcurses/overlay.c @@ -29,7 +29,7 @@ # undef wmove #endif -RCSID("$Id: overlay.c,v 1.19 2006/07/15 15:38:24 wmcbrine Exp $"); +RCSID("$Id: overlay.c,v 1.20 2006/07/31 22:28:53 wmcbrine Exp $"); /*man-start************************************************************** @@ -87,6 +87,75 @@ RCSID("$Id: overlay.c,v 1.19 2006/07/15 15:38:24 wmcbrine Exp $"); **man-end****************************************************************/ +static int PDC_copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr, + int src_tc, int src_br, int src_bc, int dst_tr, + int dst_tc, bool overlay) +{ + int col, line, y1, fc, *minchng, *maxchng; + chtype *w1ptr, *w2ptr; + + int lc = 0; + int xdiff = src_bc - src_tc; + int ydiff = src_br - src_tr; + + PDC_LOG(("PDC_copy_win() - called\n")); + + if ((src_w == (WINDOW *)NULL) || (dst_w == (WINDOW *)NULL)) + return ERR; + + minchng = dst_w->_firstch; + maxchng = dst_w->_lastch; + + for (y1 = 0; y1 < dst_tr; y1++) + { + minchng++; + maxchng++; + } + + for (line = 0; line < ydiff; line++) + { + w1ptr = src_w->_y[line + src_tr] + src_tc; + w2ptr = dst_w->_y[line + dst_tr] + dst_tc; + + fc = _NO_CHANGE; + + for (col = 0; col < xdiff; col++) + { + if ((*w1ptr) != (*w2ptr) && !((*w1ptr & A_CHARTEXT) + == ' ' && overlay)) + { + *w2ptr = *w1ptr; + + if (fc == _NO_CHANGE) + fc = col + dst_tc; + + lc = col + dst_tc; + } + + w1ptr++; + w2ptr++; + } + + if (*minchng == _NO_CHANGE) + { + *minchng = fc; + *maxchng = lc; + } + else if (fc != _NO_CHANGE) + { + if (fc < *minchng) + *minchng = fc; + if (lc > *maxchng) + *maxchng = lc; + } + + minchng++; + maxchng++; + } + + return OK; +} + int overlay(const WINDOW *src_w, WINDOW *dst_w) { int first_line, first_col, last_line, last_col; diff --git a/pdcurses/pdcwin.c b/pdcurses/pdcwin.c index a55e4cdc..f4a21eae 100644 --- a/pdcurses/pdcwin.c +++ b/pdcurses/pdcwin.c @@ -20,102 +20,10 @@ #include #include -RCSID("$Id: pdcwin.c,v 1.49 2006/07/30 19:18:00 wmcbrine Exp $"); +RCSID("$Id: pdcwin.c,v 1.50 2006/07/31 22:28:53 wmcbrine Exp $"); static int PDC_newline(WINDOW *, int); -/*man-start************************************************************** - - PDC_copy_win() - Common routine for copywin(), overlay() and - overwrite() functions. - - PDCurses Description: - This function copies the region of the source window specified - over the specified region of the destination window. All - validation of limits are done by the calling function. - - Thanks to Andreas Otte (venn@uni-paderborn.de) for the code - changes. - - PDCurses Errors: - ERR is returned if either src or dst windows are NULL; - - Portability: - PDCurses int PDC_copy_win(const WINDOW *src_w, WINDOW *dst_w, - int src_tr, int src_tc, int src_br, int src_bc, - int dst_tr, int dst_tc, bool overlay); - -**man-end****************************************************************/ - -int PDC_copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr, - int src_tc, int src_br, int src_bc, int dst_tr, - int dst_tc, bool overlay) -{ - int col, line, y1, fc, *minchng, *maxchng; - chtype *w1ptr, *w2ptr; - - int lc = 0; - int xdiff = src_bc - src_tc; - int ydiff = src_br - src_tr; - - PDC_LOG(("PDC_copy_win() - called\n")); - - if ((src_w == (WINDOW *)NULL) || (dst_w == (WINDOW *)NULL)) - return ERR; - - minchng = dst_w->_firstch; - maxchng = dst_w->_lastch; - - for (y1 = 0; y1 < dst_tr; y1++) - { - minchng++; - maxchng++; - } - - for (line = 0; line < ydiff; line++) - { - w1ptr = src_w->_y[line + src_tr] + src_tc; - w2ptr = dst_w->_y[line + dst_tr] + dst_tc; - - fc = _NO_CHANGE; - - for (col = 0; col < xdiff; col++) - { - if ((*w1ptr) != (*w2ptr) && !((*w1ptr & A_CHARTEXT) - == ' ' && overlay)) - { - *w2ptr = *w1ptr; - - if (fc == _NO_CHANGE) - fc = col + dst_tc; - - lc = col + dst_tc; - } - - w1ptr++; - w2ptr++; - } - - if (*minchng == _NO_CHANGE) - { - *minchng = fc; - *maxchng = lc; - } - else if (fc != _NO_CHANGE) - { - if (fc < *minchng) - *minchng = fc; - if (lc > *maxchng) - *maxchng = lc; - } - - minchng++; - maxchng++; - } - - return OK; -} - /*man-start************************************************************** PDC_makenew() - Create a WINDOW* (sans line allocation)