Re: expose vs draw
On Wed, 16 Jul 2014 18:57:16 +0200 ax487 wrote: > Well, assume that drawing the widget requires a large amount of work > per pixel. If I knew the region that I need to repaint then I could > save myself a lot of time. If the context is clipped this would not > help much if I don't know the relevant region, would it? >From the documentation on the draw signal: "The signal handler will get a cr with a clip region already set to the widget's dirty region, i.e. to the area that needs repainting. Complicated widgets that want to avoid redrawing themselves completely can get the full extents of the clip region with gdk_cairo_get_clip_rectangle(), or they can get a finer-grained representation of the dirty region with cairo_copy_clip_rectangle_list()." Chris ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: expose vs draw
if you're drawing with cairo, as you should, the operations falling outside of the clipped region will be discarded automatically by cairo. if you're referring to you own calculations, and you want to save some time with those, then you can get the clip extents from the cairo_t itself. ciao, Emmanuele. On 16 July 2014 17:57, ax487 wrote: > Well, assume that drawing the widget requires a large amount of work per > pixel. If I knew the region that I need to repaint then I could save > myself a lot of time. If the context is clipped this would not help much > if I don't know the relevant region, would it? > > On 16.07.2014 18:36, Jasper St. Pierre wrote: >> The cairo context you get is already clipped to the exposed region. You >> don't need to do any extra work. >> >> >> On Wed, Jul 16, 2014 at 12:33 PM, ax487 wrote: >> >>> Hello all, >>> >>> I am currently porting an application from gtk2 to gtk3. I just noticed >>> that the "expose_event" is no longer supported, instead there is a >>> "draw" signal. I was just wondering, the "expose_event" always came with >>> a GdkEventExpose* attached which did in particular contain the rectangle >>> which was invalidated. Is it possible to obtain the invalidated >>> rectangle inside the "draw" handler or is it necessary to repaint the >>> entire widget? (I could not find a suitable function in the gtk3/gdk3 >>> documentation so far) >>> >>> ax487 >>> ___ >>> gtk-list mailing list >>> gtk-list@gnome.org >>> https://mail.gnome.org/mailman/listinfo/gtk-list >>> >> >> >> > ___ > gtk-list mailing list > gtk-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-list -- W: http://www.emmanuelebassi.name B: http://blogs.gnome.org/ebassi/ ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: expose vs draw
Well, assume that drawing the widget requires a large amount of work per pixel. If I knew the region that I need to repaint then I could save myself a lot of time. If the context is clipped this would not help much if I don't know the relevant region, would it? On 16.07.2014 18:36, Jasper St. Pierre wrote: > The cairo context you get is already clipped to the exposed region. You > don't need to do any extra work. > > > On Wed, Jul 16, 2014 at 12:33 PM, ax487 wrote: > >> Hello all, >> >> I am currently porting an application from gtk2 to gtk3. I just noticed >> that the "expose_event" is no longer supported, instead there is a >> "draw" signal. I was just wondering, the "expose_event" always came with >> a GdkEventExpose* attached which did in particular contain the rectangle >> which was invalidated. Is it possible to obtain the invalidated >> rectangle inside the "draw" handler or is it necessary to repaint the >> entire widget? (I could not find a suitable function in the gtk3/gdk3 >> documentation so far) >> >> ax487 >> ___ >> gtk-list mailing list >> gtk-list@gnome.org >> https://mail.gnome.org/mailman/listinfo/gtk-list >> > > > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: expose vs draw
The cairo context you get is already clipped to the exposed region. You don't need to do any extra work. On Wed, Jul 16, 2014 at 12:33 PM, ax487 wrote: > Hello all, > > I am currently porting an application from gtk2 to gtk3. I just noticed > that the "expose_event" is no longer supported, instead there is a > "draw" signal. I was just wondering, the "expose_event" always came with > a GdkEventExpose* attached which did in particular contain the rectangle > which was invalidated. Is it possible to obtain the invalidated > rectangle inside the "draw" handler or is it necessary to repaint the > entire widget? (I could not find a suitable function in the gtk3/gdk3 > documentation so far) > > ax487 > ___ > gtk-list mailing list > gtk-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-list > -- Jasper ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list