Re: [Goocanvas-devel] *_get_bounds
Status: Beta
Brought to you by:
dachaplin
From: Damon C. <da...@ka...> - 2007-01-03 12:41:49
|
On Mon, 2006-12-25 at 23:17 +0100, Gian Mario Tagliaretti wrote: > Hi all, > > At the moment the method goo_canvas_get_bounds is: > > void goo_canvas_get_bounds (GooCanvas *canvas, > gdouble *left, > gdouble *top, > gdouble *right, > gdouble *bottom); > > why don't we make it return a GooCanvasBounds* instead? We could, though we'd have to change goo_canvas_set_bounds() as well for consistency. That would mean people would need to setup a GooCanvasBounds struct before calling it, making it more awkward. So it's a 50/50 sort of decision, and probably not worth changing. > GooCanvasBounds* goo_canvas_get_bounds (GooCanvas *canvas); > > The same for goo_canvas_item_get_bounds: > > void goo_canvas_item_get_bounds (GooCanvasItem *item, > GooCanvasBounds *bounds); > > Shouldn't be better to return a GooCanvasBounds*? > > GooCanvasBounds* goo_canvas_item_get_bounds (GooCanvasItem *item); It used to be like that, but you python guys complained about it! It used to return a pointer to the item's internal static GooCanvasBounds struct, and I think this made it awkward to create item subclasses in Python. I suppose you are suggesting returning a pointer to an allocated GooCanvasBounds struct. However the function is used quite a bit to search for items so I'd rather it was a fast as possible (i.e. without any memory allocations). Damon |