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


Commits:
90101426 by wurstsalat at 2022-06-11T14:37:33+02:00
fix: Workspaces: Fix image scaling

Fixes #10961

- - - - -


1 changed file:

- gajim/gtk/avatar.py


Changes:

=====================================
gajim/gtk/avatar.py
=====================================
@@ -127,9 +127,8 @@ def make_workspace_avatar(letter: str,
                           style: str = 'round-corners') -> cairo.ImageSurface:
 
     surface = generate_avatar(letter, color, size, scale)
-    surface = clip(surface, style)
     surface.set_device_scale(scale, scale)
-    return surface
+    return clip(surface, style)
 
 
 def add_status_to_avatar(surface: cairo.ImageSurface,
@@ -294,18 +293,21 @@ def clip_circle(surface: cairo.ImageSurface) -> 
cairo.ImageSurface:
 
 
 def round_corners(surface: cairo.ImageSurface) -> cairo.ImageSurface:
-    new_surface = cairo.ImageSurface(cairo.Format.ARGB32,
-                                     surface.get_width(),
-                                     surface.get_height())
+    width = surface.get_width()
+    height = surface.get_height()
+    scale = surface.get_device_scale()[0]
 
+    new_surface = cairo.ImageSurface(cairo.Format.ARGB32,
+                                     width,
+                                     height)
     new_surface.set_device_scale(*surface.get_device_scale())
     context = cairo.Context(new_surface)
     context.set_source_surface(surface, 0, 0)
 
-    width = surface.get_width()
-    height = surface.get_height()
-    scale = surface.get_device_scale()[0]
-    radius = 9 * scale
+    width = width / scale
+    height = height / scale
+
+    radius = 9
     degrees = pi / 180
 
     context.new_sub_path()



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/901014263230f6a8042922fab65a94c150cede48

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/901014263230f6a8042922fab65a94c150cede48
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to