-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve and optimize the code for background images #551
Improve and optimize the code for background images #551
Conversation
+ Fixed code duplication
Thank you so much for fixing this up. I checked this background image code in in a bad state (in my defense, I wrote this while I was learning about terminator, and GTK and it was a long, frustrating time). I can certainly merge this code as is, as it's much better than the code I wrote, but... I did notice that to get the picture to display I had to restart terminator. Is there any chance you could have the change apply as soon as the config changes? It should be just a matter of altering Terminator().reconfigure to pick up the changes. If not, lemme know and I'll merge the change as-is. |
Also, any ideas you have for fixing up background_draw are welcome. I played around a lot with this function, but this was the only way I could get it to load the image reliably on every draw. |
I've noticed the need to restart. I guess there is some way to update it, just like all the other settings update. Update: first thing done, next I might try to improve performance. There was a setting, |
607fd89
to
5a6237c
Compare
Found a way to optimize it! And I also had the possibility to use First, using Surface instead of PixBuf we get a free performance boost. There is still a performance hit when loading the image (a terminal is initialized/reconfigured), especially noticeable for big files. I might work on that and see if it's possible to optimize that too. Relevant:
|
Can you put the filter FAST patch in this PR as well? It looks really good. If people complain about image quality we can make the filter configurable later, but I'm pretty sure it'll be fine. |
I love it! Thank you so much! |
Plus, fixed code duplication and organized code.
The problem: even if the
background_type
is notimage
, terminator will still print an error saying that the file was not found (when the file was deleted). To fix this, you should go to the config file and manually delete thebackground_image
entry.Solution: check if
background_type
==image
before attempting to read the image file.I also removed the duplicated code, that was identical to set_background_image.
In background_draw (which by the way seems to have bad performance) becomes unnecessary to check for
background_type
.