Welcome, Guest. Please login or register.

Author Topic: Problem with SA_BackFill  (Read 4001 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ami_stuffTopic starter

  • Full Member
  • ***
  • Join Date: May 2009
  • Posts: 100
    • Show all replies
Problem with SA_BackFill
« on: April 03, 2011, 03:45:26 AM »
Hi,

Maybe someone can tell me what is wrong with this code. WA_BackFill works correctly, but SA_BackFill not :/

Quote

   #include
   #include
   #include
   #include
   #include
   #include
   #include

struct Library *CyberGfxBase;

struct BackfillMsg
{
ULONG dummy;
struct Rectangle rect;
LONG offsetx, offsety;
};


void sbackfillfunc (struct Hook *hook, struct RastPort *frp, struct BackfillMsg *bfm)
{

    struct RastPort rp;

    CopyMem(frp, &rp, sizeof(struct RastPort));
    rp.Layer = NULL;    

FillPixelArray(&rp,bfm->rect.MinX, bfm->rect.MinY, bfm->rect.MaxX - bfm->rect.MinX + 1, bfm->rect.MaxY - bfm->rect.MinY + 1, 0x00000000);
}

struct Hook bfhook;



int main (void)

   {

        CyberGfxBase = OpenLibrary("cybergraphics.library",0);


         struct Window *win;
         struct Screen *scr;

                        bfhook.h_Entry    = (HOOKFUNC)HookEntry;
              bfhook.h_SubEntry = (HOOKFUNC)sbackfillfunc;


                        scr = OpenScreenTags(NULL,
                         SA_LikeWorkbench,TRUE,
               SA_BackFill,&bfhook,
               TAG_DONE);


         if (win = OpenWindowTags (NULL,
               WA_Left,200,
               WA_Top,200,
               WA_Width,scr->Width / 2,
               WA_Height,scr->Height / 2,
               WA_Flags,WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_SIZEGADGET | WFLG_ACTIVATE | WFLG_NOCAREREFRESH,
               WA_IDCMP,IDCMP_CLOSEWINDOW,
               WA_Title,"Test",
               WA_BackFill,&bfhook,
               WA_PubScreen, scr,
               TAG_END))
            {
            BOOL cont = TRUE;

            do   {
               struct IntuiMessage *imsg;

               if (Wait ((1L << win->UserPort->mp_SigBit) | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
                  cont = FALSE;

               while (imsg = (struct IntuiMessage *) GetMsg (win->UserPort))
                  {
                  switch (imsg->Class)
                     {
                  case IDCMP_CLOSEWINDOW:
                     cont = FALSE;
                     break;
                     }
                  ReplyMsg ((struct Message *) imsg);
                  }
               }
            while (cont);

            CloseWindow (win);
            }


   CloseScreen (scr);

   return (RETURN_OK);
   }


Regards
 

Offline ami_stuffTopic starter

  • Full Member
  • ***
  • Join Date: May 2009
  • Posts: 100
    • Show all replies
Re: Problem with SA_BackFill
« Reply #1 on: April 03, 2011, 11:07:03 AM »
Thanks Thomas. To reduce the flickering on the screen (gray->black)  I decided to use SA_Behind + ScreenToFront() combination, but maybe there is a better method?
 

Offline ami_stuffTopic starter

  • Full Member
  • ***
  • Join Date: May 2009
  • Posts: 100
    • Show all replies
Re: Problem with SA_BackFill
« Reply #2 on: April 03, 2011, 04:47:22 PM »
@matthey

This flickers as well, because screen is still gray at the beginning and next "repleaced" by black window.
« Last Edit: April 03, 2011, 05:08:18 PM by ami_stuff »