Article View: comp.sys.amiga.tech
Article #11664Bug in layers.library
From: David Gay
Date: Fri, 03 Mar 1989 23:01
Date: Fri, 03 Mar 1989 23:01
116 lines
3474 bytes
3474 bytes
I've found a bug in the layers.library:
If InstallClipRegion is called with a NULL pointer as a region between a
BeginRefresh/EndRefresh pair, the layers get trashed. The following program
exemplifies the problem:
/* To show bug:
compile (with lc -L lbug)
click on window to back gadget
resize window so that it overlaps another (is behind)
click on window to front
admire the result
close the window for even more fun
The above procedure is easiest with an interlaced WB, and a CLI window in
the second half of the screen.
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <stdio.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/layers.h>
#include <proto/graphics.h>
extern struct GfxBase *GfxBase;
extern struct IntuitionBase *IntuitionBase;
struct LayersBase *LayersBase;
static struct NewWindow graph_win = {
0, 0,
640, 200,
-1, -1,
REFRESHWINDOW | CLOSEWINDOW,
WINDOWSIZING | WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE | SIMPLE_REFRESH,
NULL,
NULL,
"Graph",
NULL,
NULL,
80, 40,
640, -1,
WBENCHSCREEN
};
struct Window *win;
void generate_bug(void)
{
struct Rectangle rect;
struct Region *r, *oldRegion;
r = NewRegion();
rect.MinX = 10;
rect.MaxX = win->Width - 10;
rect.MinY = 10;
rect.MaxY = win->Height - 10;
OrRectRegion(r, &rect);
oldRegion = InstallClipRegion(win->WLayer, r);
#ifdef CURE_BUG
if (oldRegion == NULL) oldRegion = win->WLayer->DamageList; /* something mor
e or less innocuous */
#endif
printf("oldRegion = %lx\n", oldRegion);
InstallClipRegion(win->WLayer, oldRegion);
DisposeRegion(r);
}
void main(int argc, char **argv)
{
struct IntuiMessage *msg;
int quit;
ULONG class;
GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0);
IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 33)
;
LayersBase = (struct LayersBase *)OpenLibrary("layers.library", 33);
win = OpenWindow(&graph_win);
quit = FALSE;
while (!quit)
{
WaitPort(win->UserPort);
while (!quit && (msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
{
class = msg->Class;
ReplyMsg((struct Message *)msg);
quit = class == CLOSEWINDOW;
if (class == REFRESHWINDOW)
{
BeginRefresh(win);
generate_bug();
EndRefresh(win, TRUE);
}
}
}
CloseWindow(win);
if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
if (LayersBase) CloseLibrary((struct Library *)LayersBase);
if (GfxBase) CloseLibrary((struct Library *)GfxBase);
}
This was the cause for all my problems with clipping ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Gay 6 x 9 = 42
GAY@ELDE.EPFL.CH, or GAY%ELDE.EPFL.CH@CLSEPF51.bitnet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID:
<890304000143.20c00384@elcc.epfl.ch>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!elde.epfl.ch!gayShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!elde.epfl.ch!gay From: gay@elde.epfl.ch (David Gay) Newsgroups: comp.sys.amiga.tech Subject: Bug in layers.library Message-ID: <890304000143.20c00384@elcc.epfl.ch> Date: 3 Mar 89 23:01:43 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 116