Re: Rendering performance on custom text view on Gdk::Drawable



Cool, I'll see what I can do with the TextView.

But still, it would be interesting to get my own rendering sorted aswell.

I'm not good at reading pure C code, but It seems to me that, GTK+'s
TextView is using Pango, which sounds pretty heavy, and is normally
redrawing all the lines on scrolling(could be wrong on that one. a
very brief skim). So I must be doing something very wrong.

On Tue, Jun 12, 2012 at 12:26 AM, Giuseppe Penone <giuspen gmail com> wrote:
> 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
>
>
>
> _______________________________________________
> 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]