Skip to content
Myr

render: use the larger value of width/height when scaling too large PNGs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Before this patch, we only checked if a PNGs height was too large, not its width. Which meant that too wide PNGs bled into the text. This is different from how SVGs have been handled, where we scale them using the largest of the width/height values. Update PNG rendering to match SVGs. Also, since PNGs may not be the exact correct size, center them. Closes #313

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 56526e8 · Browse files · 2 files+8 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−3 removed

  • other:+8 added−3 removed

2 files+8 added−3 removed

modified:CHANGELOG.md+2 added
63 unmodified lines
64* Keyboard modifiers not being reset on keyboard leave events.65* `--with-nth`: non-selected columns still being matched.66* Match highlighting being offset when `--with-nth` is used67 ([#551][551]).68* Too wide PNGs bleeding into the text ([#313][313]).6970[507]: https://codeberg.org/dnkl/fuzzel/issues/50771[551]: https://codeberg.org/dnkl/fuzzel/issues/55172[313]: https://codeberg.org/dnkl/fuzzel/issues/313737475### Security76### Contributors
910 unmodified lines
modified:render.c+6 added-3 removed
886 unmodified lines
887 pixman_format_code_t fmt = pixman_image_get_format(png);888 int height = pixman_image_get_height(png);889 int width = pixman_image_get_width(png);890891 if (height > size) {892 double scale = (double)size / height;891 if (height > size || width > size) {892 double scale = (double)size / (height > width ? height : width);893894 pixman_f_transform_t _scale_transform;895 pixman_f_transform_init_scale(&_scale_transform, 1. / scale, 1. / scale);896
49 unmodified lines
946 icon->png = png;947 }948949 pixman_image_composite32(950 PIXMAN_OP_OVER, png, NULL, pix, 0, 0, 0, 0, x, y, width, height);950 PIXMAN_OP_OVER, png, NULL, pix, 0, 0, 0, 0,951 x + (size - width) / 2,952 y + (size - height) / 2,953 width, height);954955#if defined(FUZZEL_ENABLE_CAIRO)956 cairo_surface_mark_dirty(cairo_get_target(cairo));957#endif
559 unmodified lines