diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-07-09 10:25:30 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-07-09 10:40:32 +0200 |
commit | 5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e (patch) | |
tree | ece4f8c3b7f7fc5ef2396f30cd09886c6a76ef8e | |
parent | 840e7f172ce3b805dc5c3e4889e1166159942dc3 (diff) | |
download | fiv-5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e.tar.gz fiv-5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e.tar.xz fiv-5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e.zip |
Slightly optimize SVG loading
-rw-r--r-- | fiv-view.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 || |