home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18571 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  3.9 KB

  1. Path: sparky!uunet!mcsun!news.funet.fi!funic!sauna.cs.hut.fi!news.cs.hut.fi!s37732v
  2. From: s37732v@snakemail.hut.fi (Markus Juhani Aalto)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Regions and BOOPSI gadgets?
  5. Date: 12 Jan 93 15:33:16 GMT
  6. Organization: Helsinki University of Technology, Finland
  7. Lines: 92
  8. Distribution: comp
  9. Message-ID: <S37732V.93Jan12173316@lk-hp-3.hut.fi>
  10. References: <S37732V.93Jan8183438@lk-hp-20.hut.fi> <38469@cbmvax.commodore.com>
  11. NNTP-Posting-Host: lk-hp-3.hut.fi
  12. In-reply-to: davidj@cbmvax.commodore.com's message of 11 Jan 93 19:08:38 GMT
  13.  
  14. In article <38469@cbmvax.commodore.com> davidj@cbmvax.commodore.com (David N. Junod) writes:
  15.  
  16.    s37732v@snakemail.hut.fi (Markus Juhani Aalto) writes:
  17.    >
  18.    >Hi!
  19.    >
  20.    >I've been programming a gadtools listview replacement with BOOPSI gadgets
  21.    >and it worked alright until I started to use Regions to clip my drawing
  22.    >to the rastport. I currently InstallClipRegion when I get GM_RENDER
  23.    >message and do my rendering after that. This works fine when I open
  24.    >the gadgets but after I size the window all clipping goes absolutely
  25.    >out of control. So is there a possible way to use Regions in BOOPSI
  26.    >gadgets? 
  27.    >
  28.    >I think that the problem is with InstallClipRegion routine used
  29.    >between Refreshing because of window sizing. I just can't imagine any
  30.    >other way to do clipping properly and fast.
  31.  
  32.    Here's a fragment from one of my boopsi objects that installs a clipping
  33.    region while rendering.
  34.  
  35.    struct Region *
  36.    installclipregion (struct Window *w, struct Layer *l, struct Region *r)
  37.    {
  38.        BOOL refresh = FALSE;
  39.        struct Region *or;
  40.  
  41.        if (w->Flags & WINDOWREFRESH)
  42.        {
  43.        EndRefresh (w, FALSE);
  44.        refresh = TRUE;
  45.        }
  46.        or = InstallClipRegion (l, r);
  47.        if (refresh)
  48.        BeginRefresh (w);
  49.        return (or);
  50.    }
  51.  
  52.    LONG
  53.    renderMethod (Class *cl, Object *o, struct gpRender *msg)
  54.    {
  55.        struct Window *win = msg->gpr_GInfo->gi_Window;
  56.        struct objectData *od = INST_DATA (cl, o);
  57.        struct Rectangle rect;
  58.        struct Region *or;
  59.  
  60.        /* ... your region is created in OM_NEW and deleted in OM_DISPOSE */
  61.        ClearRegion (od->od_Region);
  62.        /* Fill in the rectangle structure here...*/
  63.        /* In 3.x and beyond, you can set up the region in GM_LAYOUT instead
  64.     * of every single GM_RENDER call */
  65.        OrRectRegion (od->od_Region, &rect);
  66.        or = installclipregion (win, msg->gpr_RPort->Layer, od->od_Region);
  67.  
  68.        /* do your rendering in here... */
  69.  
  70.        installclipregion (win, msg->gpr_RPort->Layer, or);
  71.    }
  72.  
  73.    >*         Markus Aalto              | Helsinki University of Technology  *
  74.  
  75.    ~DNJ~
  76.  
  77. Thanks but I got it working already. The problem was that I was installing
  78. a region to the wrong layer. I used msg->gpr_GInfo->Layer which was
  79. wrong layer and after I changed it to msg->gpr_RPort->Layer (or
  80. msg->gpr_GInfo->gi_RastPort->Layer :^) everything worked fine. I didn't
  81. used that REFRESHWINDOW check, so it's good to see that it's needed.
  82.  
  83. After I got it work I got another problem. Regions are too slow! My routine
  84. was a lot simpler but a lot slower when I used regions instead of calculating
  85. text width with TextExtent and TextFit. It now uses the whole list view area
  86. from left edge to right edge though. 
  87.  
  88. I have to check if I can still make it faster. If I can't, then I have
  89. to throw Region code away and use my old method.
  90.  
  91. Thanks anyway!
  92.  
  93.  
  94.  
  95. --
  96.  
  97.  
  98. **************************************************************************
  99. *         Markus Aalto              | Helsinki University of Technology  *
  100. *                                   |                                    *
  101. *  EMail: s37732v@vipunen.hut.fi    | Faculty of Electric Engineering    *
  102. *  Fax:   358-0-8746991 (Sometimes) |                                    *
  103. *                                   | Undergraduate in Computer Science  *
  104. **************************************************************************
  105.         
  106.