Re: Newbie question

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

 



Hi,

Aitor Garcia <carrierphasejitter@xxxxxxxxx> writes:

> Why is that if I do not define update_rect and update_rect1
> GdkRectangle variables in the code below I can not see the points
> drawn with gdk_draw_point ?

> gboolean
> on_darea_expose (GtkWidget *widget,
>    GdkEventExpose *event,
>    gpointer user_data)
> {
>   int i;
>   GdkRectangle update_rect;
>   GdkRectangle update_rect1;
>   GdkPoint point;
>   gdk_draw_line(widget->window,
>                 widget->style->black_gc,
>                 0,IMAGE_HEIGHT/2,IMAGE_WIDTH,IMAGE_HEIGHT/2);
>   for(i=0;i<=N_POINTS_IN_WINDOW;i++){
>     point.x = point.x + 1;

Here you are accessing point.x which has never been initialized
before.  The defintion of the two rectangle variables changes the
random value that point.x has. The fact that you see your points when
the variables are defined is pure luck.


Sven
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux