aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-07-09 10:25:30 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-07-09 10:40:32 +0200
commit5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e (patch)
treeece4f8c3b7f7fc5ef2396f30cd09886c6a76ef8e
parent840e7f172ce3b805dc5c3e4889e1166159942dc3 (diff)
downloadfiv-5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e.tar.gz
fiv-5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e.tar.xz
fiv-5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e.zip
Slightly optimize SVG loading
-rw-r--r--fiv-view.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fiv-view.c b/fiv-view.c
index 0b15e5e..626fb28 100644
--- a/fiv-view.c
+++ b/fiv-view.c
@@ -407,6 +407,11 @@ prescale_page(FivView *self)
// TODO(p): Restart the animation. No vector formats currently animate.
g_return_if_fail(!self->frame_update_connection);
+ // Optimization, taking into account the workaround in set_scale().
+ if (!self->page_scaled &&
+ (self->scale == 1 || self->scale == 0.999999999999999))
+ return;
+
// If it fails, the previous frame pointer may become invalid.
g_clear_pointer(&self->page_scaled, fiv_io_image_unref);
self->frame = self->page_scaled = closure->render(closure,
@@ -886,6 +891,10 @@ switch_page(FivView *self, FivIoImage *page)
{
g_clear_pointer(&self->page_scaled, fiv_io_image_unref);
self->frame = self->page = page;
+
+ // XXX: When self->scale_to_fit is in effect,
+ // this uses an old value that may no longer be appropriate,
+ // resulting in wasted effort.
prescale_page(self);
if (!self->page ||