| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | WinBeginPaint () |
If I got it right, I may use WinBeginPaint() ... WinEndPaint()
without having to wait for the receipt of a WM_PAINT message.
I want to make use of this in order to avoid repainting the
complete client area of my terminal type window when text has
to be scrolled upwards. Instead I indend to copy the concerned
window area using GpiBitBlt(), which should be a lot faster.
Unfortunately nothing happens when I call GpiBitBlt(). Maybe
somebody finds the reason:
void TVioWindow :: ScrollUp ( int leftCol,
int topRow,
int rightCol,
int bottomRow,
int count,
int attr )
{
int row,
lastRow,
chCount,
dstPos,
srcPos;
if ( bottomRow >= maxRows )
bottomRow = maxRows - 1;
if ( rightCol >= maxCols )
rightCol = maxCols - 1;
dstPos = maxCols * topRow + leftCol; // Ziel-Offset
srcPos = dstPos + maxCols * count; // Quell-Offset
chCount = rightCol - leftCol + 1; // Zeichen pro Zeile
lastRow = bottomRow + 1 - count;
for ( row = topRow; row <= lastRow; row++, count-- )
{
memcpy ( textBuf + dstPos, textBuf + srcPos, chCount );
memcpy ( attrBuf + dstPos, attrBuf + srcPos, chCount );
srcPos += maxCols;
dstPos += maxCols;
}
while ( row < bottomRow )
{
memset ( textBuf + dstPos, ' ', chCount );
memset ( attrBuf + dstPos, attr, chCount );
dstPos += maxCols;
row++;
}
POINTL ptlArray [3];
HPS hps;
// -----------------------------------------------------
// Ziel links unten
// -----------------------------------------------------
ptlArray [0].x = leftCol * charWidth;
ptlArray [0].y = clientHeight - (bottomRow - count + 1) * charHeight;
// -----------------------------------------------------
// Ziel rechts oben
// -----------------------------------------------------
ptlArray [1].x = (rightCol + 1) * charWidth - 1;
ptlArray [1].y = clientHeight - topRow * charHeight;
// -----------------------------------------------------
// Quelle links unten
// -----------------------------------------------------
ptlArray [2].x = ptlArray [0].x;
ptlArray [2].y = clientHeight - (bottomRow + 1) * charHeight;
hps = WinBeginPaint ( hWindow, NULLHANDLE, NULL );
if ( NULLHANDLE != hps )
{
GpiBitBlt ( hps, // Ziel
hps, // Quelle
3L, // Anzahl Eintrge in ptlArray
ptlArray, // Punkt-Array
ROP_SRCCOPY, // Kopier-Modus
BBO_IGNORE );
// ---------------------------------------------------
// Den Rest mit dem angegebenen Attribut fllen
// ---------------------------------------------------
RECTL rect;
rect.xLeft = ptlArray [0].x;
rect.xRight = ptlArray [1].x;
rect.yTop = ptlArray [1].y;
rect.yBottom = ptlArray [2].y;
WinFillRect ( hps, &rect, BGColorFromAttr (attr) );
WinEndPaint ( hps );
}
}
BGColorFromAttr() and FGColorFromAttr() simply calculate the OS/2
color table index from a video attribute using bit shifts (There
is nothing wrong with these macros). "textBuf" and "attrBuf" are
arrays of "maxCols" * "maxRows" bytes.
Tschuess, Steffen
--- FastEcho 1.45+
* Origin: Sprach's und verschwand von der Bildflaeche (2:2433/1860)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 2433/1860 1800 1200 225 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.