background_draw: organize code
This commit is contained in:
parent
5a6237cc47
commit
122b0fe3ae
|
@ -1131,15 +1131,19 @@ class Terminal(Gtk.VBox):
|
|||
if self.background_image is None:
|
||||
return False
|
||||
|
||||
# save cairo context
|
||||
cr.save()
|
||||
# draw background image
|
||||
rect = self.vte.get_allocation()
|
||||
xratio = float(rect.width) / float(self.background_image.get_width())
|
||||
yratio = float(rect.height) / float(self.background_image.get_height())
|
||||
cr.save()
|
||||
cr.scale(xratio, yratio)
|
||||
cr.set_source_surface(self.background_image)
|
||||
cr.paint()
|
||||
# draw transparent monochrome layer
|
||||
Gdk.cairo_set_source_rgba(cr, self.bgcolor)
|
||||
cr.paint()
|
||||
# restore cairo context
|
||||
cr.restore()
|
||||
|
||||
def on_draw(self, widget, context):
|
||||
|
|
Loading…
Reference in New Issue