Re: Patch



Joe Shaw <joe ximian com> writes: 
> Consider the following awesome ASCII rendering of my GdkDrawable with
> xoffset/yoffset of 0 and (x,y) coordinates of (0,0).
> +---------------------
> |This is a test.
> |I like tests.
> |
> 
> When I set xoffset and yoffset to 1 (assuming 1 == 1 character), drawing
> to (0,0):
> +---------------------
> | like tests.
> |
> |

So the deal here is that (xoffset, yoffset) is the position of the
drawable you are drawing to in GtkTextLayout overall coordinates.
If your drawable is at 1,1 then you want to draw the region starting 
at (1,1) in the entire layout on (0,0) of that drawable.

The way I imagine the canvas item working is that the canvas item is
the same size as the GtkTextLayout, and 0,0 in item coordinates is 0,0
in the GtkTextLayout. The offsets passed to CanvasItem::draw are in
canvas pixel coordinates. So you have to do some coordinate
conversion on the offsets, from canvas pixel coords to item coords.
 
I'm referring to my book here because I never remember all this. ;-)
Anyway, sections 13.2.3 and 12.2.2 are maybe useful.

I'm not sure what happens when you consider zooming in all this.

> If you understand and I'm not totally on crack, I can commit to remove
> the assertion against negative offsets.
> 

I think you do need to do this, since the canvas can give you a
drawable that covers (0,0) of the canvas item and extends
upward/leftward of it. 

However I think the code in gtktextdisplay.c should establish a clip
rect that avoids drawing outside of (0,0) (width,height) in layout
coords, and it needs checking in general to be sure it works with
negative coords.

Havoc





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