Rendering performance on custom text view on Gdk::Drawable



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.


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