Re: GtkLayout and Pango



Peter Lund wrote:
I have observed that while the drawing primitives I use work fine with 32 bit coordinates, Pango inexplicable fails to plot anything beyond an X coordinate of 2^21 (2097152) (Y coordinates may be similarly affected, but my application does not use large Y coordinates).

It is not all that inexplicable. Pango needs to use values less than one pixel's worth and floating-point is slow on some platforms and can easily lead to rounding errors. Therefore, Pango uses fixed-point internally.

I found this in the Pango Reference Manual (I use devhelp as my viewer):

> [...]

#define PANGO_PIXELS(d) (((int)(d) + 512) >> 10)


Converts a dimension to device units.

/d/ :   a dimension in Pango units.


(The addition of 512 is for rounding.)

As 1024 is 2^10, that fits nicely with your observation.

Ah yes, this certainly fits what I'm seeing.

Also, if you blithely draw to the whole scrolled area, you might end up with very slow code because so much work goes into drawing something that isn't visible anyway.

Yes, I'm aware of that and do only draw to the visible area and occasionally a few pixels beyond. Drawing to the entire layout is not only slow, but also causes "wrapping" effects within the visible area if you attempt to draw too far outside it.

Thank you for you prompt assistance. :)

Sham




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