2013-05-10 08:28 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbgtinfo.ch
    + added HB_GTI_REDRAWMAX
      It sets maximum number of unchanged neighboring chars in redrawn
      line. It may help to optimize screen updates in some GTs.

  * include/hbgtcore.h
  * src/rtl/hbgtcore.c
  * contrib/hbct/ctwin.c
    + respect HB_GTI_REDRAWMAX in default REDRAWDIFF() GT methods.

  * contrib/gtqtc/gtqtc1.cpp
    ! added protection against font resizing for degenerated console
      window size.
    % set HB_GTI_REDRAWMAX to 1

  * src/rtl/gtwvt/gtwvt.c
    ! translate screen base mouse wheel cords to window based ones.
    % set HB_GTI_REDRAWMAX to 1

  * src/rtl/gttrm/gttrm.c
    % set HB_GTI_REDRAWMAX to 8

  * src/rtl/gtwin/gtwin.c
    % set HB_GTI_REDRAWMAX to 4
This commit is contained in:
Przemysław Czerpak
2013-05-10 08:28:56 +02:00
parent 79539c96c2
commit 1062ed644b
9 changed files with 94 additions and 44 deletions

View File

@@ -10,6 +10,32 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-05-10 08:28 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbgtinfo.ch
+ added HB_GTI_REDRAWMAX
It sets maximum number of unchanged neighboring chars in redrawn
line. It may help to optimize screen updates in some GTs.
* include/hbgtcore.h
* src/rtl/hbgtcore.c
* contrib/hbct/ctwin.c
+ respect HB_GTI_REDRAWMAX in default REDRAWDIFF() GT methods.
* contrib/gtqtc/gtqtc1.cpp
! added protection against font resizing for degenerated console
window size.
% set HB_GTI_REDRAWMAX to 1
* src/rtl/gtwvt/gtwvt.c
! translate screen base mouse wheel cords to window based ones.
% set HB_GTI_REDRAWMAX to 1
* src/rtl/gttrm/gttrm.c
% set HB_GTI_REDRAWMAX to 8
* src/rtl/gtwin/gtwin.c
% set HB_GTI_REDRAWMAX to 4
2013-05-08 09:57 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/gtqtc/gtqtc1.cpp
* minor: removed {}

View File

@@ -1621,6 +1621,7 @@ static void hb_gt_qtc_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
/* SUPER GT initialization */
HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr );
HB_GTSELF_RESIZE( pGT, pQTC->iRows, pQTC->iCols );
HB_GTSELF_SETFLAG( pGT, HB_GTI_REDRAWMAX, 1 );
HB_GTSELF_SEMICOLD( pGT );
}
@@ -2456,6 +2457,10 @@ void QTConsole::setFontSize( int iFH, int iFW )
if( iWidth != iFW )
{
iDec = ( iFW * 100 ) / iWidth;
if( iDec < 1 )
iDec = 1;
else if( iDec >= 4000 )
iDec = 3999;
iDir = iDec;
do
{
@@ -2470,15 +2475,17 @@ void QTConsole::setFontSize( int iFH, int iFW )
if( iWidth < iFW )
{
if( iDir <= iDec )
iDec++;
else
if( iDir > iDec )
break;
++iDec;
}
else /* iWidth > iFW */
iDir = iDec--;
{
if( --iDec <= iDir )
iDir = iDec + 1;
}
}
while( iDec >= ( iDir >> 1 ) && iDec <= ( iDir << 1 ) );
while( iDec > ( iDir >> 1 ) && iDec < ( iDir << 1 ) && iDec < 4000 );
}
}

View File

@@ -2354,8 +2354,9 @@ static void hb_ctw_gt_RedrawDiff( PHB_GT pGT )
HB_GTSUPER_REDRAWDIFF( pGT );
else if( pGT->fRefresh )
{
int i, l, r;
int i, l, r, s;
long lIndex;
HB_U32 uiValue;
for( i = 0; i < pGT->iHeight; ++i )
{
@@ -2365,27 +2366,24 @@ static void hb_ctw_gt_RedrawDiff( PHB_GT pGT )
for( l = 0; l < pGT->iWidth; ++l, ++lIndex )
{
if( pGT->prevBuffer[ lIndex ].uiValue !=
hb_ctw_gt_cellValue( pGT, i, l ) )
break;
}
if( l < pGT->iWidth )
{
lIndex = ( long ) ( i + 1 ) * pGT->iWidth - 1;
for( r = pGT->iWidth - 1; r > l; --r, --lIndex )
( uiValue = hb_ctw_gt_cellValue( pGT, i, l ) ) )
{
if( pGT->prevBuffer[ lIndex ].uiValue !=
hb_ctw_gt_cellValue( pGT, i, r ) )
break;
pGT->prevBuffer[ lIndex ].uiValue = uiValue;
s = r = l;
while( ++l < pGT->iWidth )
{
++lIndex;
if( pGT->prevBuffer[ lIndex ].uiValue !=
( uiValue = pGT->screenBuffer[ lIndex ].uiValue ) )
{
pGT->prevBuffer[ lIndex ].uiValue = uiValue;
r = l;
}
else if( pGT->iRedrawMax != 0 && l - r >= pGT->iRedrawMax )
break;
}
HB_GTSELF_REDRAW( pGT, i, s, r - s + 1 );
}
HB_GTSELF_REDRAW( pGT, i, l, r - l + 1 );
lIndex = ( long ) i * pGT->iWidth + l;
do
{
pGT->prevBuffer[ lIndex ].uiValue =
hb_ctw_gt_cellValue( pGT, i, l );
++lIndex;
}
while( ++l <= r );
}
pGT->pLines[ i ] = HB_FALSE;
}

View File

@@ -290,8 +290,9 @@ typedef struct _HB_GT_BASE
PHB_SCREENCELL screenBuffer; /* window foreground (board) current buffer */
PHB_SCREENCELL prevBuffer; /* window foreground (board) previous buffer */
HB_BOOL * pLines; /* Touched Window lines */
HB_BOOL fRefresh; /* Should Window be refreshed */
HB_BOOL * pLines; /* touched Window lines */
HB_BOOL fRefresh; /* should Window be refreshed */
int iRedrawMax; /* maximum number of unchanged neighboring chars in redrawn line */
HB_BOOL fVgaCell;
HB_BOOL fIsColor;

View File

@@ -149,6 +149,7 @@
#define HB_GTI_WINHANDLE 69 /* Get console window low level handle */
#define HB_GTI_MOUSEPOS_XY 70 /* Get mouse position in pixels */
#define HB_GTI_DISPIMAGE 71 /* Display image with given name */
#define HB_GTI_REDRAWMAX 72 /* Maximum number of unchanged neighboring chars in redrawn line */
/* Font weights */
#define HB_GTI_FONTW_THIN 1

View File

@@ -3086,6 +3086,7 @@ static void hb_gt_trm_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr );
HB_GTSELF_RESIZE( pGT, iRows, iCols );
HB_GTSELF_SETFLAG( pGT, HB_GTI_COMPATBUFFER, HB_FALSE );
HB_GTSELF_SETFLAG( pGT, HB_GTI_REDRAWMAX, 8 );
HB_GTSELF_SETFLAG( pGT, HB_GTI_STDOUTCON, pTerm->fStdoutTTY );
HB_GTSELF_SETFLAG( pGT, HB_GTI_STDERRCON, pTerm->fStderrTTY && pTerm->fOutTTY );
pTerm->Init( pTerm );

View File

@@ -971,6 +971,8 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
s_bClosable = s_bOldClosable = hb_gt_win_SetCloseButton( HB_FALSE, HB_FALSE );
s_bResetColors = HB_FALSE;
HB_GTSELF_SETFLAG( pGT, HB_GTI_REDRAWMAX, 4 );
if( hb_fsIsDevice( hFilenoStdout ) )
HB_GTSELF_SETFLAG( pGT, HB_GTI_STDOUTCON, HB_TRUE );
if( hb_fsIsDevice( hFilenoStderr ) )

View File

@@ -2176,6 +2176,9 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L
xy.x = LOWORD( lParam );
xy.y = HIWORD( lParam );
if( message == WM_MOUSEWHEEL )
ScreenToClient( pWVT->hWnd, &xy );
colrow = hb_gt_wvt_GetColRowFromXY( pWVT, xy.x, xy.y );
if( hb_gt_wvt_SetMousePos( pWVT, colrow.y, colrow.x ) )
hb_gt_wvt_AddCharToInputQueue( pWVT,
@@ -3184,6 +3187,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
/* SUPER GT initialization */
HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr );
HB_GTSELF_RESIZE( pGT, pWVT->ROWS, pWVT->COLS );
HB_GTSELF_SETFLAG( pGT, HB_GTI_REDRAWMAX, 1 );
HB_GTSELF_SEMICOLD( pGT );
/* hb_gt_wvt_CreateConsoleWindow( pWVT ); */

View File

@@ -1808,6 +1808,12 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
pGT->fVgaCell = hb_itemGetL( pInfo->pNewVal );
break;
case HB_GTI_REDRAWMAX:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pGT->iRedrawMax );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
pGT->iRedrawMax = hb_itemGetNI( pInfo->pNewVal );
break;
case HB_GTI_BOXCP:
pInfo->pResult = hb_itemPutC( pInfo->pResult,
pGT->cdpBox ? pGT->cdpBox->id : NULL );
@@ -2329,6 +2335,11 @@ static int hb_gt_def_SetFlag( PHB_GT pGT, int iType, int iNewValue )
iPrevValue = pGT->fStdErrCon;
pGT->fStdErrCon = iNewValue != 0;
break;
case HB_GTI_REDRAWMAX:
iPrevValue = pGT->iRedrawMax;
pGT->iRedrawMax = iNewValue;
break;
}
return iPrevValue;
@@ -2515,7 +2526,7 @@ static void hb_gt_def_RedrawDiff( PHB_GT pGT )
{
if( pGT->fRefresh )
{
int i, l, r;
int i, l, r, s;
long lIndex;
for( i = 0; i < pGT->iHeight; ++i )
@@ -2527,26 +2538,25 @@ static void hb_gt_def_RedrawDiff( PHB_GT pGT )
{
if( pGT->prevBuffer[ lIndex ].uiValue !=
pGT->screenBuffer[ lIndex ].uiValue )
break;
}
if( l < pGT->iWidth )
{
lIndex = ( long ) ( i + 1 ) * pGT->iWidth - 1;
for( r = pGT->iWidth - 1; r > l; --r, --lIndex )
{
if( pGT->prevBuffer[ lIndex ].uiValue !=
pGT->screenBuffer[ lIndex ].uiValue )
break;
}
HB_GTSELF_REDRAW( pGT, i, l, r - l + 1 );
lIndex = ( long ) i * pGT->iWidth + l;
do
{
pGT->prevBuffer[ lIndex ].uiValue =
pGT->screenBuffer[ lIndex ].uiValue;
++lIndex;
s = r = l;
while( ++l < pGT->iWidth )
{
++lIndex;
if( pGT->prevBuffer[ lIndex ].uiValue !=
pGT->screenBuffer[ lIndex ].uiValue )
{
pGT->prevBuffer[ lIndex ].uiValue =
pGT->screenBuffer[ lIndex ].uiValue;
r = l;
}
else if( pGT->iRedrawMax != 0 && l - r >= pGT->iRedrawMax )
break;
}
HB_GTSELF_REDRAW( pGT, i, s, r - s + 1 );
}
while( ++l <= r );
}
pGT->pLines[ i ] = HB_FALSE;
}