Re: Newbie question



Hi,

Aitor Garcia <carrierphasejitter yahoo com> 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



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