On Wed, 2008-05-07 at 09:27 +0200, Nicolás Serrano Martínez Santos

> void refresh_preview(GimpPreviewArea *p, GimpDrawable *d){
>    gint width, height; GimpPixelRgn rgn_input; guchar *buf;
>    width = gimp_drawable_width(d->drawable_id);
>    height = gimp_drawable_height(d->drawable_id);
>    buf = g_new(guchar,width*height*3);
>    gimp_pixel_rgn_init (&rgn_input,
>                         d,
>                         0,0,
>                         width, height,
>                         FALSE, FALSE);
>    gimp_pixel_rgn_get_rect(&rgn_input,buf,0,0,width,height);
>    gtk_widget_set_size_request((GtkWidget *) p,width,height);
>    gimp_preview_area_draw(p,0,0,width,
>          height,GIMP_RGB_IMAGE,buf,3*width); /* always RGB    */
>    g_free(buf);
> }

That's a terribly inefficient way to doing things as you are allocating
a large amount of memory here to draw everything in a single call
instead of iterating over the drawable on a tile-by-tile basis (which is
what GimpDrawablePreview is doing). But it should work. I don't see
anything obviously wrong with this code. Perhaps you can make a simple
test application that we can compile and use to reproduce your problem?


Gimp-developer mailing list

Reply via email to