Re: [gtk-list] Re: Displaying JPEGs
- From: john giorgio hart bbk ac uk
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Displaying JPEGs
- Date: Wed, 17 Feb 1999 16:35:05 GMT
Larry Lee <lclee@primenet.com> wrote:
>IS THIS REASONABLE, OR HAVE I DONE SOMETHING SILLY?
Hiya:) maybe. In drawmap2, you had:
void
drawmap2 (GtkWidget *drawing_area)
{
int x,y;
char buf[3*VMX];
for (y=0; y<VMY; y++) {
char *bp = buf;
for (x=0; x<VMX; x++) {
*bp++ = 0;
*bp++ = (VMX-x)*256/VMX;
*bp++ = 0;
gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->white_gc,
0, y, VMX, 1, GDK_RGB_DITHER_NONE,
buf, VMX);
}
}
}
So you've got the gdk_draw_rgb_image() inside you inner loop: you're calling
it every time you generate a pixel, rather than every time you finish a line.
I tried moving it out one brace, and I get about 1 sec for 800x600.
You can go a bit quicker still if you render the entire 800x600 image into an
array in your program somewhere, and then do a single call to
gdk_draw_rgb_image(). This gets the time down to about 0.7 secs for me.
Good luck,
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]