[comp.windows.ms] scrolling windows

kipnis@janus.Berkeley.EDU (Gary Kipnis) (12/01/89)

Hi,
    Is it better (mainly faster) to use ScrollWindow or ScrollDC to 
    scroll content of a windows, in either case SetRect has to be used to
    set the scrolling region.

    Also, when scrolling is done fast the screen update is laggins a little
    bit, i.e. new information overwrites the old information before the 
    screen get's a chance to move, in order to avoid this UpdateWindow()
    has to be called between consequitive Scrolls, which tends to be 
    rather slow, any suggestions, solutions to the above.

Thank you,

gary

kipnis@janus.Berkeley.EDU (Gary Kipnis) (12/13/89)

Hi, why is it that every time a window is scrolled UpdatedWindow() has to
be called to make sure everything looks updated.  Is there any way to 
scroll content of a window without calling UpdatedWindow() and getting
instanteneous screen update.

On a related note, is it possible to process WM_PAINT message, without
calling BeginPaint/EndPaint.

Both of the questions have to do with the fact that I need to speed
up window scroll/update performance.

Thank you,

gary

bturner@hpcvlx.cv.hp.com (Bill Turner) (12/15/89)

> Hi, why is it that every time a window is scrolled UpdatedWindow() has to
> be called to make sure everything looks updated.  Is there any way to 
> scroll content of a window without calling UpdatedWindow() and getting
> instanteneous screen update.

ScrollWindow moves the bits, and leaves the "uncovered" portion invalidated
(just as if InvalidateRect had been called).  That leaves a pending paint,
which is done either as the last message before the message queue empties, or
immediately if UpdateWindow is called.  The only other way to handle this
would be to explicitily call some repainting code yourself after doing
the ScrollWindow, but since you've already got the WM_PAINT handler around
why not use it?

> On a related note, is it possible to process WM_PAINT message, without
> calling BeginPaint/EndPaint.

No, BeginPaint and EndPaint do housekeeping that let Windows know the painting
has actually be done.  If you don't call them, you will continue to receive
WM_PAINT messages.  (NOTE: do NOT call BeginPaint or EndPaint unless you are
processing a WM_PAINT message!)

> Both of the questions have to do with the fact that I need to speed
> up window scroll/update performance.

One thing I'd suggest is looking at the general performance of your WM_PAINT
handler.  Is it possible you could pay attention to the update region to avoid
unnecessary output calls?  [I don't know if you can really get it as fast as
you'd like -- I ran some timing tests, and all the Windows graphics output
calls are slow if not clipped (i.e., if they actually do transfer bits to the
screen), and clipped output isn't too slow.]

--Bill Turner (bturner@hp-pcd.hp.com)
HP Corvallis Information Systems