Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
d53ef36c
by Philipp Hörist at 2019-07-13T22:46:24Z
1 changed file:
Changes:
| ... | ... | @@ -87,14 +87,17 @@ def clip_circle(surface): |
| 87 | 87 |
new_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
|
| 88 | 88 |
surface.get_width(),
|
| 89 | 89 |
surface.get_height())
|
| 90 |
+ |
|
| 91 |
+ new_surface.set_device_scale(*surface.get_device_scale())
|
|
| 90 | 92 |
context = cairo.Context(new_surface)
|
| 91 | 93 |
context.set_source_surface(surface, 0, 0)
|
| 92 | 94 |
|
| 93 | 95 |
width = surface.get_width()
|
| 94 | 96 |
height = surface.get_height()
|
| 95 |
- radius = width / 2
|
|
| 97 |
+ scale = surface.get_device_scale()[0]
|
|
| 98 |
+ radius = width / 2 / scale
|
|
| 96 | 99 |
|
| 97 |
- context.arc(width / 2, height / 2, radius, 0, 2 * pi)
|
|
| 100 |
+ context.arc(width / 2 / scale, height / 2 / scale, radius, 0, 2 * pi)
|
|
| 98 | 101 |
|
| 99 | 102 |
context.clip()
|
| 100 | 103 |
context.paint()
|
| ... | ... | @@ -239,4 +242,6 @@ class AvatarStorage(metaclass=Singleton): |
| 239 | 242 |
color_string = contact.jid
|
| 240 | 243 |
color = text_to_color(color_string)
|
| 241 | 244 |
surface = generate_avatar(letter, color, size, scale)
|
| 242 |
- return clip_circle(surface)
|
|
| 245 |
+ surface = clip_circle(surface)
|
|
| 246 |
+ surface.set_device_scale(scale, scale)
|
|
| 247 |
+ return surface
|