Billy Patton wrote: > Now I need to speed up my data drawing. > > I have a configure_event that creates a pixmap and draws it black. I want > a black background; > It then calls my draw_cell which draws into the pixmap. > Within this recursive routine I do > gdk_rgb_gc_set_foreground(gc,white); > gdk_draw_rectangle (pixmap,gc,FALSE,mcr.ll.x,mcr.ll.y,w,h); > > and some > gdk_rgb_gc_set_foreground(gc,white); > gdk_draw_polygon(pixmap,gc,FALSE,gpts,npts); > > At the end of this function I do a > > gdk_draw_pixmap(drawing_area->window,gc,pixmap,0,0,0,0,canvas_x,canvas_y); > > > I take it that this is my blitting. Problem is I may call this draw_cell > several hundred thousand times. SO this is ver slow. > > Should this draw_pixmap be placed after the call to draw_cell > so that blitting is done only once? > > My code was originally written for gtk1.???
Hi Billy, I'm not sure, but it sounds like you need to move your drawing to the expose event. - in configure - build your off-screen pixmap - paint your static data into it - in expose - copy the right section of your offscreen pixmap to the display gtk guarantees that you get configure before expose, so everything will be set up by the time you need to paint the screen setting things up like this will make window resize slow, but paints will be very fast. As an alternative, you can do all the painting in expose (ie. no backing pixmap), it won't be much quicker overall, but at least the user will see something happening on the screen while they wait :-) John ========================================================== Coming soon: Fabric of Vision Dress and Drapery in Painting 19 June - 8 September 2002 For information and tickets: http://www.nationalgallery.org.uk/exhibitions/fabric/ _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list