Re: Rendering performance on custom text view on Gdk::Drawable
- From: Giuseppe Penone <giuspen gmail com>
- To: gtkmm-list gnome org
- Subject: Re: Rendering performance on custom text view on Gdk::Drawable
- Date: Mon, 11 Jun 2012 23:26:15 +0200
Hi,
It seems to me to understand that you are drawing a pixbuf per byte in a drawing area.
In my opinion you should use a Gtk::TextBuffer / Gtk::TextView.
In a textbuffer you can place characters, pixbufs, widgets... anything.
Cheers,
Giuseppe.
On Mon, Jun 11, 2012 at 10:59 PM, ivar kängsepp
<ivarbug gmail com> wrote:
Hi.
windows, gtkmm 2.24, mingw
I'm trying to write a hex-editor-like thingie using Gtkmm and
Gdk::Drawable and I'm having troubles getting any reasonable
performance out of it. I'm desperate for help.
Right now my code looks something like this: So far I've ended up
using prerendered characters for text.
void HexView::on_vScrl_value_changed() {
drawingArea.queue_draw();
}
bool HexView::DrawingArea::on_expose_event(GdkEventExpose* event) {
/* */
Glib::RefPtr<Gdk::Window> window = get_window();
if(window && data && numBytes) {
/* */
unsigned int scrlY = hexView->vScrl.get_value();
/* */
for(/*loop visible bytes*/) {
/* */
window->draw_pixbuf(char_pixbuf, 0, 0, x, y, 20, 20,
Gdk::RGB_DITHER_NONE, 0, 0);
}
}
return true;
}
Gtk::TexView widget renders huge amounts of text perfectly and
scrolling is nice and fast on a 1600x1200 window. My code gives me 2
updates/second. Using Cairo with Cairo::ToyFontFace and
Cairo::Context::show_text was twice as slow.
Thanks for reading.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]