Compare commits

...

2 Commits

Author SHA1 Message Date
9045898fb6
Don't rescale thumbnails in sRGB
pixman is too slow at this, maybe do it later, and optionally.
2021-11-04 19:52:14 +01:00
45df774cc9
Fix scaling in the view, as in the browser
The source pattern needs to be padded.
2021-11-04 19:42:22 +01:00
2 changed files with 9 additions and 5 deletions

View File

@ -225,12 +225,14 @@ rescale_thumbnail(cairo_surface_t *thumbnail)
struct pixman_f_transform xform_floating;
struct pixman_transform xform;
pixman_image_t *src = pixman_image_create_bits(
PIXMAN_a8r8g8b8_sRGB, width, height,
// PIXMAN_a8r8g8b8_sRGB can be used for gamma-correct results,
// but it's an incredibly slow transformation
pixman_format_code_t format = PIXMAN_a8r8g8b8;
pixman_image_t *src = pixman_image_create_bits(format, width, height,
(uint32_t *) cairo_image_surface_get_data(thumbnail),
cairo_image_surface_get_stride(thumbnail));
pixman_image_t *dest = pixman_image_create_bits(
PIXMAN_a8r8g8b8_sRGB,
pixman_image_t *dest = pixman_image_create_bits(format,
cairo_image_surface_get_width(scaled),
cairo_image_surface_get_height(scaled),
(uint32_t *) cairo_image_surface_get_data(scaled),

View File

@ -135,8 +135,10 @@ fastiv_view_draw(GtkWidget *widget, cairo_t *cr)
cairo_set_source_surface(
cr, self->surface, x / self->scale, y / self->scale);
cairo_pattern_t *pattern = cairo_get_source(cr);
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD);
// TODO(p): Prescale it ourselves to an off-screen bitmap, gamma-correctly.
cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_GOOD);
cairo_pattern_set_filter(pattern, CAIRO_FILTER_GOOD);
cairo_paint(cr);
return TRUE;