[Nano-X] clipping region

Subject: Re: Nano-X region code fixed and working
From: Greg Haerr
Date: Thu, 8 Jun 2000 22:44:45 -0600

[the following message is being resent without an attachment;
it was rejected by the list server]

: the crash is because when DYNAMICREGIONS is defined,
: it should be Allocate a new Region.

I have fixed Murphy's cool region code, and it now works
great. There were several issues. The biggest is that the
user clipping region needs to be intersected with the
current clipping region, which is set in GsSetClipWindow;
it can't be set separately. Also, the GdSetClipRegion
code destroys the region after use, which wasn't being
done, and that's why the crash happened. So I set another
paramater to GsSetClipWindow, which is the user clip
region, if one is set in the GC. There were also some
issues with cached window gc's and wp's.

Another small problem was that the region id was never
initialized to 0 in the GrNewGC code.

Everything is working now, the attached patch applied
to 0.88pre8 brings up user clipping in the t1demo program.
It would be interesting to test the polygon shaped region code,
as well as round rect regions, etc. Regions based on other
than a single rectangle might want to be implemented in
the client code in client.c rather than bringing them into the
server...

I have added the attached patch to 0.88pre8. I will also add
all the other cool contributions, like Alex's window manager, shortly.

Regards,

Greg


Subject: Re: [Nano-X] diff.region3.gz
From: Greg Haerr
Date: Thu, 8 Jun 2000 15:23:39 -0600

: Please get the new patch from
: http://hpc.ee.ntu.edu.tw/~murphy/diff.region3.gz
:
: Need to find out why program crashes after calling GrSetGCRegion.

This patch looks well done. I'll test it tonight and try to
find the problem.

Regards,

Greg


Subject: [Nano-X] diff.region3.gz
From: Murphy Chen
Date: Fri, 9 Jun 2000 01:47:03 +0800 (CST)

> i try to use use the Wrapper api of Region .but actually it alway dump
> ,when i use every original sample. i think some pointer operation may have
> problem.but i don't know where.do you find the problems .
> and ,i think it maybe should add the following code

I've added tanghao's fix and changed MWBOOL and MWCOORD to
GR_BOOL and GR_COORD.

Also, I've added the file devrgn2.c which contains functions
for implementing GdCreatePolygonRegion.
Again, it only compiled, not been tested.

Please get the new patch from
http://hpc.ee.ntu.edu.tw/~murphy/diff.region3.gz

Need to find out why program crashes after calling GrSetGCRegion.

Murphy


Subject: Re: [Nano-X] Patch for clipping regions
From: Greg Haerr
Date: Wed, 7 Jun 2000 11:54:55 -0600

: I've add more wrapper functions for clipping regions.

Super. I'll add this ASAP to Nano-X. BTW, the MWBOOL
and MWCOORDs will change to GR_BOOL and GR_COORD...

Regards,

Greg


Subject: [Nano-X] Patch for clipping regions
From: Murphy Chen
Date: Thu, 8 Jun 2000 01:44:34 +0800 (CST)

Dear All,

I've add more wrapper functions for clipping regions.

Please get the patch at
http://hpc.ee.ntu.edu.tw/~murphy/diff.region2.gz

GR_REGION_ID GrNewRegion(void);
void GrDestroyRegion(GR_REGION_ID region);
void GrUnionRectWithRegion(GR_REGION_ID region, MWRECT *rect);
void GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
GR_REGION_ID src_rgn2);
void GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
GR_REGION_ID src_rgn2);
void GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
GR_REGION_ID src_rgn2);
void GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
GR_REGION_ID src_rgn2);
void GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region);
MWBOOL GrPointInRegion(GR_REGION_ID region, MWCOORD x, MWCOORD y);
MWBOOL GrRectInRegion(GR_REGION_ID region, MWRECT *rect);

Test programs needed. :)

With regards,
Murphy