[Gambas-user] Big change in revision #5382

Benoît Minisini gambas at ...1...
Tue Nov 27 21:36:31 CET 2012


Le 27/11/2012 21:26, Jussi Lahtinen a écrit :
>>
>> I have removed the old Draw class and replaced it with a new Draw class
>> implemented in Gambas inside the gb.gui.base component, that emulates
>> the old Draw class by using the Paint class.
>>
>> I'm starting to remove as much X11 specific code as possible in the
>> Gambas source code, and the Draw class was completely based on the old
>> deprecated X11 drawing API of GTK+, so...
>>
>> Many new methods were added to the Paint class to help the
>> implementation of the Draw emulation class.
>>
>> Of course (!) expect some quirks:
>>
>> - The emulation is not perfect yet, and it won't be 100% compatible
>> pixel to pixel.
>>
>> - Expect some performance loss, even if I try to avoid them as much as
>> possible.
>>
>> - Drawing lines with Cairo is a lot slower that drawing lines with X11,
>> even if antialiasing is disabled.
>>
>> - There is a bug at the moment if you imbricate calls to Paint.Begin()
>> on the same device. It should work, but apparently it does not...
>>
>> - Source code clean-up is not finished.
>>
>> But there is one good news: if you have old printing code from Gambas 2
>> based on the Draw class, you can now use it directly in Gambas 3 without
>> having anything to change (theoritically).
>>
>> All that is an investment to the future, when Wayland will replace X11.
>>
>
> I know too little about how these things work...
> Does this performance loss apply only to GTK+, or does it have effect also
> to Qt4?
>

Qt4 has one drawing model only, so you should not lose too much. Anyway, 
you will see that quickly in the IDE: GridView, TreeView, ListView, 
ColumnView, IconView, ListBox, MenuButton... All these controls are 
entirely implemented with Gambas code now.

Note that there is a bit of speed loss because coordinates in Paint are 
Float and not Integer. So the floating-point versions of drawing methods 
are used, not the integer ones.

Maybe Qt4 does more optimizations when using integer coordinates, I 
don't know. It depends on the drawing instruction I guess...

-- 
Benoît Minisini




More information about the User mailing list