From: s37732v@snakemail.hut.fi (Markus Juhani Aalto)
Newsgroups: comp.sys.amiga.programmer
Subject: Any known bugs with ClipBlit?
Date: 12 Jan 93 19:00:06 GMT
Organization: Helsinki University of Technology, Finland
Distribution: comp
NNTP-Posting-Host: lk-hp-20.hut.fi


Hi!

I'm still developing my Listview gadget replacement with BOOPSI and
now I'm optimizing it for better speed. Previously I refreshed whole
listview gadget (print all text) when for example arrow gadget was
pressed and this was little too slow. So now I started to use
ClipBlit to blit all valid lines to new places and refresh only few
lines. And now my listview really scrolls. It's blazingly fast even
in about 700*520*4 window. But I got one problem.

When I open the window with listview gadget. Everything goes fine. 
Arrow gadgets and scroll gadget moves text in listview very fast and
smoothly until I put another window over the listview gadget so that
I can still access the control (arrows etc..) gadgets. Also I can
see part of the listview. 

So now if I press for example the UP arrow, text moves up and those places
coming below the overlapping window are totally messed up. All other
parts of the listview are fine.

I'm using SIMPLEREFRESH window if it matters. 

I include here again the parts of my GM_RENDER method and routine which
makes the blitting.

----------------- CLip -------------------
            lvw = (struct ListViewClass *)INST_DATA( cl, o);
            lvw->Locked = 1;
            {
                struct gpRender *gpr = (struct gpRender *)msg;
                ULONG Count = lvw->FirstItemToRender;
                REND_FUNC func = lvw->ItemRenderer;
                struct Node *node = lvw->topNode;
                int i;

                if(gpr->gpr_Redraw == GREDRAW_UPDATE) {
                    for( i=0; i < Count; i++ ) {
                        node = NextNode(node);
                    }

		    /* Check if we are scrolling, so that we have to
		       blit things to right places. */
                    if( lvw->Scroll ) {
                        MakeListViewBlit((struct Gadget *)o,gpr,lvw);
                        lvw->Scroll = FALSE;
                    }

                    while(Count <= lvw->LastItemToRender) {
                        RetVal = (*func)(node, (struct Gadget *)o,
                                gpr,Count,lvw->RenderString);
                        if(node) {
                            node = NextNode(node);
                            if( IsLastNode(node) ) {
                                node = NULL;
                            }
                        }
                        Count++;
                    }
                }



/* Here is the blitting routine. */

VOID MakeListViewBlit(  struct Gadget *gadg,
                        struct gpRender *gpr,
                        struct ListViewClass *lvw)
{
    WORD YSize = gpr->gpr_RPort->Font->tf_YSize;

    WaitBlit();
    if( lvw->FirstItemToRender == 0 ) {
	/* We scroll up. */
        ClipBlit(gpr->gpr_RPort, 2 + gadg->LeftEdge, 2 + gadg->TopEdge,
                gpr->gpr_RPort, 2 + gadg->LeftEdge,
                2 + gadg->TopEdge + (1 + lvw->LastItemToRender)*YSize,
                gadg->Width - 4,
                (lvw->Visible - lvw->LastItemToRender - 1)*YSize,0xC0);
    }
    else if( lvw->LastItemToRender == lvw->Visible - 1) {
	/* We scroll down! */
        ClipBlit(gpr->gpr_RPort, 2 + gadg->LeftEdge,
                2 + gadg->TopEdge + 
		      YSize*(lvw->Visible - lvw->FirstItemToRender),
                gpr->gpr_RPort, 2 + gadg->LeftEdge,
                2 + gadg->TopEdge,
                gadg->Width - 4, lvw->FirstItemToRender*YSize,0xC0);
    }

    /* I just put this here to make sure that ClipBlit problem didn't 
       happen because this was missing. */
    WaitBlit();
}

------------------ clip --------------------

Oh! I'm using KS2.04! 
--


**************************************************************************
*         Markus Aalto              | Helsinki University of Technology  *
*                                   |                                    *
*  EMail: s37732v@vipunen.hut.fi    | Faculty of Electric Engineering    *
*  Fax:   358-0-8746991 (Sometimes) |                                    *
*                                   | Undergraduate in Computer Science  *
**************************************************************************