gtk: image sizing fix
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user