ScrollDC fixes.

Alexandre Julliard julliard at winehq.org
Mon Mar 7 12:44:07 CST 2005


Rein Klazes <wijn at wanadoo.nl> writes:

> +        if(( size = GetRegionData( SrcRgn, 0, NULL )) &&
> +                (rdata = HeapAlloc( GetProcessHeap(), 0, size ))) {
> +            GetRegionData( SrcRgn, size, rdata );
> +            /* the rectangles in the region data are ordered top-to-bottom
> +             * So if the scrolling is downward, traverse the array backwards
> +             * to avoid touching pixels that have yet to be scrolled  */
> +            /* FIXME: implement something similar for left-to-right
> +             * scrolling. */
> +            if( dydev < 0 ) {
> +                step = 1;
> +                rect = (RECT *)rdata->Buffer;
> +            } else {
> +                step = -1;
> +                rect = ((RECT *)rdata->Buffer) + rdata->rdh.nCount - 1;
> +            }
> +            for( i = 0; i < rdata->rdh.nCount; i++, rect += step) {
> +                DPtoLP(hdc, (LPPOINT)rect, 2);
> +                TRACE("Bit blitting %s to %ld,%ld\n", wine_dbgstr_rect(rect),
> +                        rect->left + dx, rect->top + dy);
> +                BitBlt( hdc, rect->left + dx, rect->top + dy,
> +                            rect->right - rect->left, rect->bottom -rect->top,
> +                            hdc, rect->left, rect->top, SRCCOPY);
> +            }

You really shouldn't need to scroll the region rectangle by
rectangle. Selecting the proper clip region and then copying the whole
area should have the same effect.

>                          {
>                              XEvent event;
>  
> -                            XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
> -                            if (event.type == NoExpose) break;
> +                            if( !XCheckWindowEvent( gdi_display, physDev->drawable, ~0, &event ))
> +                                break;
> +                            if (event.type == NoExpose) continue;

You can't use XCheckWindowEvent, you need to wait for the events that
haven't arrived yet.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list