Re: gdk_pixbuf_loader_write memory leak



Hi

Thank You VERY VERY much for responding 

I?m new to GTK/GDK and I?m have a hard time
finding (good) information/examples on pixmap/pixbuf

I tried using pixmap?s but kept on getting junk displayed.
I guess I missed a step or two. 

If you can send me a small example or point me to a web page
that has an example on how to do the steps you suggested, I 
would gladly appreciated.



YOUR STEPS

You just need to convert your raw pixels to GdkRGB and display it.

The faster (but it works with local X server only) way is:
1. Create shared pixmap.
2. Allocate all pixels (create relation raw pixel -> actual display 
pixel).
3. Fill pixmap.
4. Put it on screen.
5. Go to 3.


Again,  Thank You for the info.

Milt




--- Olexiy Avramchenko <olexiy irtech cn ua> wrote:
milton soto wrote:

Hello

I desperately need some help.

The following coded works, but has a memory leak.


Code Description:

  The coded will get a  raw gray picture from  a camera every 
  30 millisecond . Each image is converted into a jpeg image 
  (raw_to_jpeg). The jpeg image is then loaded into the loader, 
  passed to the pixbuf, and render to the display window.


Any help will be gladly appreciated.

Also, is this the quickest way to display a jpeg image???

I dont understand what are you doing... Why do you need raw -> jpeg 
conversion ? It consumes CPU time and you getting worse image quality
in 
result.

You just need to convert your raw pixels to GdkRGB and display it.

The faster (but it works with local X server only) way is:
1. Create shared pixmap.
2. Allocate all pixels (create relation raw pixel -> actual display
pixel).
3. Fill pixmap.
4. Put it on screen.
5. Go to 3.

static gboolean update_display (gpointer user_data)
{
 

<skipped>

 gdk_pixbuf_ref(loader_pixbuf);

Dont ref it. You put an additional reference to object, so it will
not 
be freed after single unref.

 gdk_pixbuf_render_to_drawable(loader_pixbuf,
display_area->window,display_area->style->fg_gc[GTK_STATE_NORMAL],
0,
0, 0, 0, 640, 480, GDK_RGB_DITHER_NONE, 0, 0);
                                         
 gdk_pixbuf_unref(loader_pixbuf);

}
 





__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/



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