Daniel Brötzmann pushed to branch master at gajim / gajim

Commits:

1 changed file:

Changes:

  • gajim/gtk/avatar.py
    ... ... @@ -127,9 +127,8 @@ def make_workspace_avatar(letter: str,
    127 127
                               style: str = 'round-corners') -> cairo.ImageSurface:
    
    128 128
     
    
    129 129
         surface = generate_avatar(letter, color, size, scale)
    
    130
    -    surface = clip(surface, style)
    
    131 130
         surface.set_device_scale(scale, scale)
    
    132
    -    return surface
    
    131
    +    return clip(surface, style)
    
    133 132
     
    
    134 133
     
    
    135 134
     def add_status_to_avatar(surface: cairo.ImageSurface,
    
    ... ... @@ -294,18 +293,21 @@ def clip_circle(surface: cairo.ImageSurface) -> cairo.ImageSurface:
    294 293
     
    
    295 294
     
    
    296 295
     def round_corners(surface: cairo.ImageSurface) -> cairo.ImageSurface:
    
    297
    -    new_surface = cairo.ImageSurface(cairo.Format.ARGB32,
    
    298
    -                                     surface.get_width(),
    
    299
    -                                     surface.get_height())
    
    296
    +    width = surface.get_width()
    
    297
    +    height = surface.get_height()
    
    298
    +    scale = surface.get_device_scale()[0]
    
    300 299
     
    
    300
    +    new_surface = cairo.ImageSurface(cairo.Format.ARGB32,
    
    301
    +                                     width,
    
    302
    +                                     height)
    
    301 303
         new_surface.set_device_scale(*surface.get_device_scale())
    
    302 304
         context = cairo.Context(new_surface)
    
    303 305
         context.set_source_surface(surface, 0, 0)
    
    304 306
     
    
    305
    -    width = surface.get_width()
    
    306
    -    height = surface.get_height()
    
    307
    -    scale = surface.get_device_scale()[0]
    
    308
    -    radius = 9 * scale
    
    307
    +    width = width / scale
    
    308
    +    height = height / scale
    
    309
    +
    
    310
    +    radius = 9
    
    309 311
         degrees = pi / 180
    
    310 312
     
    
    311 313
         context.new_sub_path()