Private
Public Access
1
0

gtk: image sizing fix

This commit is contained in:
2026-02-22 00:19:43 -08:00
parent 335ded4752
commit a4bd28b22c
4 changed files with 18 additions and 8 deletions

View File

@@ -60,22 +60,31 @@ private class ImageBubbleLayout : BubbleLayout
this.is_downloaded = false;
this.cached_texture = TextureCache.get_instance().get_texture(attachment_guid);
if (this.cached_texture != null) {
this.image_size = Graphene.Size() {
width = (float)this.cached_texture.get_width(),
height = (float)this.cached_texture.get_height()
};
SizeCache.get_instance().set_size(attachment_guid, this.image_size);
return;
}
// Calculate image dimensions for layout
calculate_image_dimensions(image_size);
}
private void calculate_image_dimensions(Graphene.Size? image_size) {
if (image_size != null) {
this.image_size = image_size;
return;
}
var cached_size = SizeCache.get_instance().get_size(attachment_guid);
if (cached_size != null) {
this.image_size = cached_size;
return;
}
if (image_size != null) {
this.image_size = image_size;
return;
}
this.image_size = Graphene.Size() { width = 200.0f, height = 150.0f };
}