home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!funic!sauna.cs.hut.fi!news.cs.hut.fi!s37732v
- From: s37732v@snakemail.hut.fi (Markus Juhani Aalto)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Regions and BOOPSI gadgets?
- Date: 12 Jan 93 15:33:16 GMT
- Organization: Helsinki University of Technology, Finland
- Lines: 92
- Distribution: comp
- Message-ID: <S37732V.93Jan12173316@lk-hp-3.hut.fi>
- References: <S37732V.93Jan8183438@lk-hp-20.hut.fi> <38469@cbmvax.commodore.com>
- NNTP-Posting-Host: lk-hp-3.hut.fi
- In-reply-to: davidj@cbmvax.commodore.com's message of 11 Jan 93 19:08:38 GMT
-
- In article <38469@cbmvax.commodore.com> davidj@cbmvax.commodore.com (David N. Junod) writes:
-
- s37732v@snakemail.hut.fi (Markus Juhani Aalto) writes:
- >
- >Hi!
- >
- >I've been programming a gadtools listview replacement with BOOPSI gadgets
- >and it worked alright until I started to use Regions to clip my drawing
- >to the rastport. I currently InstallClipRegion when I get GM_RENDER
- >message and do my rendering after that. This works fine when I open
- >the gadgets but after I size the window all clipping goes absolutely
- >out of control. So is there a possible way to use Regions in BOOPSI
- >gadgets?
- >
- >I think that the problem is with InstallClipRegion routine used
- >between Refreshing because of window sizing. I just can't imagine any
- >other way to do clipping properly and fast.
-
- Here's a fragment from one of my boopsi objects that installs a clipping
- region while rendering.
-
- struct Region *
- installclipregion (struct Window *w, struct Layer *l, struct Region *r)
- {
- BOOL refresh = FALSE;
- struct Region *or;
-
- if (w->Flags & WINDOWREFRESH)
- {
- EndRefresh (w, FALSE);
- refresh = TRUE;
- }
- or = InstallClipRegion (l, r);
- if (refresh)
- BeginRefresh (w);
- return (or);
- }
-
- LONG
- renderMethod (Class *cl, Object *o, struct gpRender *msg)
- {
- struct Window *win = msg->gpr_GInfo->gi_Window;
- struct objectData *od = INST_DATA (cl, o);
- struct Rectangle rect;
- struct Region *or;
-
- /* ... your region is created in OM_NEW and deleted in OM_DISPOSE */
- ClearRegion (od->od_Region);
- /* Fill in the rectangle structure here...*/
- /* In 3.x and beyond, you can set up the region in GM_LAYOUT instead
- * of every single GM_RENDER call */
- OrRectRegion (od->od_Region, &rect);
- or = installclipregion (win, msg->gpr_RPort->Layer, od->od_Region);
-
- /* do your rendering in here... */
-
- installclipregion (win, msg->gpr_RPort->Layer, or);
- }
-
- >* Markus Aalto | Helsinki University of Technology *
-
- ~DNJ~
-
- Thanks but I got it working already. The problem was that I was installing
- a region to the wrong layer. I used msg->gpr_GInfo->Layer which was
- wrong layer and after I changed it to msg->gpr_RPort->Layer (or
- msg->gpr_GInfo->gi_RastPort->Layer :^) everything worked fine. I didn't
- used that REFRESHWINDOW check, so it's good to see that it's needed.
-
- After I got it work I got another problem. Regions are too slow! My routine
- was a lot simpler but a lot slower when I used regions instead of calculating
- text width with TextExtent and TextFit. It now uses the whole list view area
- from left edge to right edge though.
-
- I have to check if I can still make it faster. If I can't, then I have
- to throw Region code away and use my old method.
-
- Thanks anyway!
-
-
-
- --
-
-
- **************************************************************************
- * Markus Aalto | Helsinki University of Technology *
- * | *
- * EMail: s37732v@vipunen.hut.fi | Faculty of Electric Engineering *
- * Fax: 358-0-8746991 (Sometimes) | *
- * | Undergraduate in Computer Science *
- **************************************************************************
-
-