Compare commits

..

No commits in common. "5ec5f5bdbd7ba479ac43f20419dde9d7903dd86e" and "9b99de99bbe2d87ee62bb72931a22f2551fa470e" have entirely different histories.

4 changed files with 9 additions and 26 deletions

View File

@ -2310,11 +2310,11 @@ load_resvg_render_internal(FivIoRenderClosureResvg *self,
} }
static FivIoImage * static FivIoImage *
load_resvg_render( load_resvg_render(FivIoRenderClosure *closure, double scale)
FivIoRenderClosure *closure, FivIoProfile target, double scale)
{ {
FivIoRenderClosureResvg *self = (FivIoRenderClosureResvg *) closure; FivIoRenderClosureResvg *self = (FivIoRenderClosureResvg *) closure;
return load_resvg_render_internal(self, scale, target, NULL); // TODO(p): Somehow get the target colour management profile.
return load_resvg_render_internal(self, scale, NULL, NULL);
} }
static const char * static const char *
@ -2434,11 +2434,11 @@ load_librsvg_render_internal(FivIoRenderClosureLibrsvg *self, double scale,
} }
static FivIoImage * static FivIoImage *
load_librsvg_render( load_librsvg_render(FivIoRenderClosure *closure, double scale)
FivIoRenderClosure *closure, FivIoProfile target, double scale)
{ {
FivIoRenderClosureLibrsvg *self = (FivIoRenderClosureLibrsvg *) closure; FivIoRenderClosureLibrsvg *self = (FivIoRenderClosureLibrsvg *) closure;
return load_librsvg_render_internal(self, scale, target, NULL); // TODO(p): Somehow get the target colour management profile.
return load_librsvg_render_internal(self, scale, NULL, NULL);
} }
static FivIoImage * static FivIoImage *

View File

@ -56,11 +56,9 @@ enum _FivIoOrientation {
FivIoOrientation270 = 8 FivIoOrientation270 = 8
}; };
// TODO(p): Maybe make FivIoProfile a referencable type,
// then loaders could store it in their closures.
struct _FivIoRenderClosure { struct _FivIoRenderClosure {
/// The rendering is allowed to fail, returning NULL. /// The rendering is allowed to fail, returning NULL.
FivIoImage *(*render)(FivIoRenderClosure *, FivIoProfile, double scale); FivIoImage *(*render)(FivIoRenderClosure *, double scale);
void (*destroy)(FivIoRenderClosure *); void (*destroy)(FivIoRenderClosure *);
}; };

View File

@ -139,7 +139,6 @@ render(GFile *target, GBytes *data, gboolean *color_managed, GError **error)
{ {
FivIoOpenContext ctx = { FivIoOpenContext ctx = {
.uri = g_file_get_uri(target), .uri = g_file_get_uri(target),
// Remember to synchronize changes with adjust_thumbnail().
.screen_profile = fiv_io_profile_new_sRGB(), .screen_profile = fiv_io_profile_new_sRGB(),
.screen_dpi = 96, .screen_dpi = 96,
.first_frame_only = TRUE, .first_frame_only = TRUE,
@ -181,12 +180,8 @@ adjust_thumbnail(FivIoImage *thumbnail, double row_height)
// Vector images should not have orientation, this should handle them all. // Vector images should not have orientation, this should handle them all.
FivIoRenderClosure *closure = thumbnail->render; FivIoRenderClosure *closure = thumbnail->render;
if (closure && orientation <= FivIoOrientation0) { if (closure && orientation <= FivIoOrientation0) {
// Remember to synchronize changes with render().
FivIoProfile screen_profile = fiv_io_profile_new_sRGB();
// This API doesn't accept non-uniform scaling; prefer a vertical fit. // This API doesn't accept non-uniform scaling; prefer a vertical fit.
FivIoImage *scaled = closure->render(closure, screen_profile, scale_y); FivIoImage *scaled = closure->render(closure, scale_y);
if (screen_profile)
fiv_io_profile_free(screen_profile);
if (scaled) if (scaled)
return scaled; return scaled;
} }

View File

@ -407,15 +407,9 @@ prescale_page(FivView *self)
// TODO(p): Restart the animation. No vector formats currently animate. // TODO(p): Restart the animation. No vector formats currently animate.
g_return_if_fail(!self->frame_update_connection); 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. // If it fails, the previous frame pointer may become invalid.
g_clear_pointer(&self->page_scaled, fiv_io_image_unref); g_clear_pointer(&self->page_scaled, fiv_io_image_unref);
self->frame = self->page_scaled = closure->render(closure, self->frame = self->page_scaled = closure->render(closure, self->scale);
self->enable_cms ? self->screen_cms_profile : NULL, self->scale);
if (!self->page_scaled) if (!self->page_scaled)
self->frame = self->page; self->frame = self->page;
} }
@ -891,10 +885,6 @@ switch_page(FivView *self, FivIoImage *page)
{ {
g_clear_pointer(&self->page_scaled, fiv_io_image_unref); g_clear_pointer(&self->page_scaled, fiv_io_image_unref);
self->frame = self->page = page; 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); prescale_page(self);
if (!self->page || if (!self->page ||