Gdk::pixbuf scale_simple slow on first call
- From: johnmb <johnmblackburn googlemail com>
- To: gtkmm-list gnome org
- Subject: Gdk::pixbuf scale_simple slow on first call
- Date: Tue, 16 Oct 2007 01:25:45 -0700 (PDT)
I am trying to display successive images to a Gtk::Image object and , in
doing so, I need to scale the received images to the size
of the displayed Gtk::Image.
I read a .bmp file into a Gdk::Pixbuf and it is about 1024 x 768 in size
Gdk::COLORSPACE_RGB i.e without alpha information.
Then I scale the Pixbuf down to about 700 x500 using scale_simple and assign
the returned pixbuf to a newly created Glib::RefPtr<Gdk::Pixbuf>.
Using INTERP_NEAREST, this happens instantly; however on the FIRST call
using INTERP_BILINEAR it takes about 20 seconds on a 3Ghz dual core Pentium
D and requires 300 Mb RAM and 100% CPU one one of the cores to do it.
Subsequent calls happen instantly with no noticeable use of RAM and about
10-12% CPU on one of the cores.
I must be doing something wrong; can anyone help ? Here is the code
snippet; I am temporarily testing by successively loading the same test
image from a file:-
<snip>
std::string temp_filename =
"/home/john/barcode_uncalibrated.bmp";
camera_buffer = Gdk::Pixbuf::create_from_file(temp_filename);
Glib::RefPtr<Gdk::Pixbuf> temp_pix =
camera_buffer->scale_simple(camera_preview->get_width(),
camera_preview->get_height(), Gdk::INTERP_BILINEAR);
camera_preview->set(temp_pix);
</snip>
camera_preview points to an instance of Gtk::Image
camera_buffer points to an instance of Gdk::Pixbuf
--
View this message in context: http://www.nabble.com/Gdk%3A%3Apixbuf-scale_simple-slow-on-first-call-tf4632645.html#a13228858
Sent from the Gtkmm mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]