Re: Converting from gdkregion to xregion on gtk2?



> From: Victor Hernandez Maksimenko <victor planetasur com>
> Hi!,
>
> Thanks for the help!,
>
> i got to compile mozilla with xft and enable-default-toolkit=gtk2!, and
> now i have a gtk2 based mozilla with aa fonts!!
>
> I'll try to make some rpms based on the blizzard mozilla-rc1-xft rpms
> and put them online... 
>
> Thanks again for your help!
>
> On Wed, 2002-05-15 at 11:25, Owen Taylor wrote:
> > Victor Hernandez Maksimenko <victor planetasur com> writes:
> > 
> > > Hi there,
> > > 
> > > I'm just trying to get mozilla with xft compiled with the gtk2 toolkit
> > > (so i can have galeon2 with aa fonts), but i'm having troubles setting
> > > the Clip area for XftDraw... 
> > > 
> > > it uses a code like this for setting the clipping region
> > > 
> > > --
> > > GdkRegionPrivate  *priv = (GdkRegionPrivate *)rgn;
> > > 
> > > XftDrawSetClip(draw, priv->xregion);
> > > --
> > > 
> > > but in gtk/gdk 2, there is no GdkRegionPrivate, so i have tried to find
> > > a way to get and xlib region from a gdkregion but with no success so
> > > far...
> > 
> > void           gdk_region_get_rectangles (GdkRegion     *region,
> >                                           GdkRectangle **rectangles,
> >                                           gint          *n_rectangles);
> > 
> > And then construct the XRegion using XUnionRectWithRegion. If you
> > grab a mid 1.3.x series copy of GTK+, you'll find such code in
> > there, but it's probably easier just to redo it.
> > 
> > The coordinate space is bigger for GdkRegion than for an X Region, so
> > GdkRegion isn't internally implementation as a Region.
> > 
> > Regards,
> >                                         Owen

If you're using the rectangles to set a clip region, it might be
more optimal to allocate an array of XRectangle, convert the GdkRectangle
array returned by gdk_region_get_rectangles() into that, and
call XSetClipRectangles(), since the rectangles returned by
gdk_region_get_rectangles() are YXBanded. Depends on whether knowing
about the banding will help enough to compensate for the memory
allocation.

Ron Steinke



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]