Re: GtkImage expose is badly broken.



Alexander Larsson <alla lysator liu se> writes:

> Quick test: Drag the window from the "buttons" test in testgtk outside the
> screen and then in again. It spews GDK-Critical and the stock images look
> bad.
> 
> The expose method of GtkImage just does a gdk_pixbuf_render_to_drawable_alpha()
> on the whole image, if part of it overlaps the exposed area.
> gdk_pixbuf_render_to_drawable_alpha() then calls
> gdk_pixbuf_get_from_drawable(), which only work if the entire source
> rectangle is inside the screen.

OK, gdk_pixbuf_get_from_drawable() is broken in many ways:

 - It shouldn't be performing the checks for being on-screen when
   the area is double-buffered (as it is here)

 - Performing the checks for being on-screen without a server
   grab is pointless, because the area could always be moved
   between the time that you do the check and 

 - Doing g_return_if_fail() checks here is a bad idea because 
   if you want to avoid dying with an XError you need to
   always do the checks, not just when you have debugging
   turned on. And also, the caller has little control over whether
   the area is on-screen or not.

 - It should just clip the region that it is getting, not 
   warn and return.

 - These checks should be in _gdk_x11_get_image(), not here since
   many many things can happen in between.

It also a serious optimization miss that render_to_drawable_alpha() is
getting the contents for the full size of the pixmap when the result
is only going to be drawn onto the double-buffered region. This will
considerably increase the expense of the operation.

Regards,
                                        Owen






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