Re: Scale Gtk::Image
- From: José Alburquerque <jaalburquerque cox net>
- To: Daniel Elstner <daniel kitta googlemail com>
- Cc: Murray Cumming <murrayc murrayc com>, gtkmm-list gnome org
- Subject: Re: Scale Gtk::Image
- Date: Fri, 26 Jun 2009 17:03:59 -0400
On Fri, 2009-06-26 at 21:50 +0200, Daniel Elstner wrote:
> Am Freitag, den 26.06.2009, 14:46 -0400 schrieb José Alburquerque:
> > For learning purposes, am I wrong in thinking that by the time the
> > Gtk::Image is exposed, its size has been allocated? Is it the case that
> > in the allocation phase the widget is informed what its size must be
> > while in the expose phase the size has already been determined?
>
> Yep, that's absolutely correct. For the expose event to occur, the size
> must have been allocated already. Also, the Gdk::Window must exist. (Or
> the Gdk::Window of the parent in case of a NO_WINDOW widget.)
>
> So, yes, Murray's approach is fine in that regard. The code also avoids
> rescaling the image if the widget size hasn't changed, so there is no
> performance difference either.
>
> I called it "bold" purely on my gut feeling that changing the logical
> state of a widget while it is being drawn is asking for trouble. The
> expose event handler is supposed to draw a representation of the current
> logical widget content, and not change the content.
>
> Changing the logical content invalidates the widget area. It doesn't
> enter infinite recursion because invalidating a window only queues the
> expose event for that area, instead of starting to draw right away. But
> my gut tells me it's not a good idea to do that sort of thing if you
> don't have to. :-)
Many thanks for the explanation.
--
José Alburquerque
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]