question about gdk scrolling

Hi All:

In module gnome-mag we are trying to do some smooth scrolling of a
magnified region of the screen.  That magnified region changes in two
ways: the region of interest is moved programmatically (i.e. we magnify
a different part of the screen when we pan the magnified display), and
also if the magnified regions source data changes we need to refresh.  

Since there is no way to get "global" expose notifications for all of
the root window and children, we refresh the source pixels on pan and
also in an idle handler.

So far so good (or bad) :-P

But we are storing our scaled image as a gdkpixbuf; partly because we
need direct access to the pixel data in between the scaling and display
operations, thus we want them in a canonical data format.  

At the moment, when a "pan" ("scroll") occurs, we call gdk_window_scroll
on the window where the scaled image is displayed, which results in
expose events.  In the expose handler we call
gdk_pixbuf_render_to_drawable for the exposed region.

This is functional but somewhat slow; in fact it's slow enough that we
can even refresh our scaled pixbuf inside the expose handler without
appreciably slowing things down!  So gdk_pixbuf_render_to_drawable seems
too slow for snappy panning.

My questions:

* would putting this into a GtkScrolledWindow (without scrollbars, since
we don't use them) give us much improvement in itself?

* would storing the scaled image as a gdkpixmap be lots faster? (It
would mean of course that we'd have to somehow queue refreshes and
refresh the gdkpixmap in an idle handler, but perhaps it would make the
scrolling itself seem smoother).

* Is there a technique I can use so that double buffering helps here, by
doing my expose-handler draws into the back buffer?

TIA, suggestions are very welcome.


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