why not empty the scratch image when flush_all_displays



Hi All,

 

When gdk_window_process_all_updates, flush_all_displays is invoked. Then all the drawing commands are sent to server. Meanwhile, I think the contents of the scratch image corresponding current display are no longer useful, and should be thrown away. Otherwise, it may increase the frequency of invoking to gdk_flush while alloc_scratch_image. So I add the gdk_scratch_image_reset to gdk_window_process_all_updates.

 

/* Mark all regions that we might be filling in as completely dempty */

static void

_scratch_image_reset(GdkScratchImageInfo *image_info)

{

      g_return_if_fail (image_info != NULL);

 

      image_info->static_image_idx = 0;

     

      image_info->horiz_y = GDK_SCRATCH_IMAGE_HEIGHT;

      image_info->vert_x = GDK_SCRATCH_IMAGE_WIDTH;

      image_info->tile_x = GDK_SCRATCH_IMAGE_WIDTH;

      image_info->tile_y1 = image_info->tile_y2 = GDK_SCRATCH_IMAGE_HEIGHT;

}

 

void

gdk_scratch_image_reset(void)

{

        GSList *tmp_list;

        GdkScratchImageInfo *image_info;

        gint i;

 

        tmp_list = scratch_image_infos;

        while (tmp_list)

        {

                image_info = tmp_list->data;

                _scratch_image_reset(image_info);

                tmp_list = tmp_list->next;

        }

}

 

void

gdk_window_process_all_updates (void)

{

  [codes]

  flush_all_displays ();

  gdk_scratch_image_reset();

}

 

Any comments?

 

Jianjun

 



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