+void update_pixmap_size(ProcessList *process_list, guint width)
+{
+ g_hash_table_foreach(process_list->process_hash,
+ (GHFunc)update_pixmap_size_each,
+ (gpointer)width);
+}
+
+
+typedef struct _CopyPixmap {
+ GdkDrawable *dest;
+ GdkGC *gc;
+ GdkDrawable *src;
+ gint xsrc, ysrc, xdest, ydest, width, height;
+} CopyPixmap;
+
+static void copy_pixmap_region_each(ProcessInfo *key,
+ HashedProcessData *value,
+ CopyPixmap *cp)
+{
+ GdkPixmap *src = cp->src;
+ GdkPixmap *dest = cp->dest;
+
+ if(dest == NULL)
+ dest = value->pixmap;
+ if(src == NULL)
+ src = value->pixmap;
+
+ gdk_draw_drawable (dest,
+ cp->gc,
+ src,
+ cp->xsrc, cp->ysrc,
+ cp->xdest, cp->ydest,
+ cp->width, cp->height);
+}
+
+
+
+
+void copy_pixmap_region(ProcessList *process_list, GdkDrawable *dest,
+ GdkGC *gc, GdkDrawable *src,
+ gint xsrc, gint ysrc,
+ gint xdest, gint ydest, gint width, gint height)
+{
+ CopyPixmap cp = { dest, gc, src, xsrc, ysrc, xdest, ydest, width, height };
+
+ g_hash_table_foreach(process_list->process_hash,
+ (GHFunc)copy_pixmap_region_each,
+ &cp);
+}
+
+
+
+typedef struct _RectanglePixmap {
+ gboolean filled;
+ gint x, y, width, height;
+ GdkGC *gc;
+} RectanglePixmap;
+
+static void rectangle_pixmap_each(ProcessInfo *key,
+ HashedProcessData *value,
+ RectanglePixmap *rp)
+{
+ if(rp->height == -1)
+ rp->height = value->height;
+
+ gdk_draw_rectangle (value->pixmap,
+ rp->gc,
+ rp->filled,
+ rp->x, rp->y,
+ rp->width, rp->height);
+}
+
+
+
+
+void rectangle_pixmap(ProcessList *process_list, GdkGC *gc,
+ gboolean filled, gint x, gint y, gint width, gint height)
+{
+ RectanglePixmap rp = { filled, x, y, width, height, gc };
+
+ g_hash_table_foreach(process_list->process_hash,
+ (GHFunc)rectangle_pixmap_each,
+ &rp);
+}
+
+
+/* Renders each pixmaps into on big drawable */
+void copy_pixmap_to_screen(ProcessList *process_list,
+ GdkDrawable *dest,
+ GdkGC *gc,
+ gint x, gint y,
+ gint width, gint height)
+{
+ if(process_list->index_to_pixmap->len == 0) return;
+ guint cell_height = process_list->cell_height;
+
+ /* Get indexes */
+ gint begin = floor(y/(double)cell_height);
+ gint end = MIN(ceil((y+height)/(double)cell_height),
+ process_list->index_to_pixmap->len);
+ gint i;
+
+ for(i=begin; i<end; i++) {
+ g_assert(i<process_list->index_to_pixmap->len);
+ /* Render the pixmap to the screen */
+ GdkPixmap *pixmap =
+ //(GdkPixmap*)g_ptr_array_index(process_list->index_to_pixmap, i);
+ GDK_PIXMAP(g_ptr_array_index(process_list->index_to_pixmap, i));
+
+ gdk_draw_drawable (dest,
+ gc,
+ pixmap,
+ x, 0,
+ x, i*cell_height,
+ width, cell_height);
+
+ }
+
+
+}
+
+
+
+
+