Commit Graph

12 Commits

Author SHA1 Message Date
David Turner
34201b0e7f render/pixman: Fix non-uniform scale with rotation
e08d52bb introduced a bug when rotating by 90 or 270 degrees and doing
non-uniform scaling (different scale factor on X and Y axes).  The scale
factor was calculated as the ratio between the src box and the rotated
dst box.  But scaling is applied after rotation, so the scale factor
should instead be the ratio between rotated src box and dst box.
2024-05-23 11:56:59 +00:00
David Turner
d7f63ab76c render/pixman: Remove half-pixel shift
Reverts 77006e5565.  It turns out this
change really breaks the labwc drop-shadow implementation (which relies
on scaling up single-pixel-wide buffers).

After reverting this there's still something subtley wrong with scaling
pixel locations (shown by `weston-scaler -b`) but I can't see an obvious
way to make both weston-scaler and labwc drop-shadows work in the same
way with pixman and gles2. I'll have a harder look at this but in the
mean time reverting this patch seems to make things less broken on
average.
2024-05-23 11:56:59 +00:00
David Turner
77006e5565 render/pixman: half-pixel shift to match GPUs
Add a half-pixel shift in the pixman renderer to match the results given
by GPU-based renderers when scaling.
2024-04-30 14:02:21 +00:00
David Turner
e08d52bbc6 render/pixman: Improve transform performance
The old code to render transformed textures with pixman would run
composite over the whole output regardless of the texture size.  When
rendering something small this caused a huge performance hit.

Rewrite the transform branch of render_pass_add_texture to:
- Only composite over the rectangle we're drawing to
- Generally try to make things a lot clearer and some comments

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3832
2024-04-30 14:02:21 +00:00
David Turner
ee0007c0f2 render/pixman: Fix source crop
Fix source crop in the pixman render backend.  It was being applied by
using a source offset as arguments to pixman_image_composite32().  But
this is wrong because the source crop should get applied before all the
other transforms, not after them (or at least this is how it works in
the other wlroots render backends).  Instead, apply the source crop as
yet another matrix transform when we're doing transforms (Or keep it the
same as previously if there's no other transforming going on).

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3830
2024-04-26 16:12:38 +00:00
David Turner
061b996768 render/pixman: fix flipped transforms
The translations for flipped offsets were set the same as non-flipped
ones which was totally wrong and meant that any textures with
flipped-transforms rendered entirely outside the viewport and were
basically invisible.
2024-04-26 16:12:38 +00:00
Alexander Orzechowski
e9706e62f5 renderer: Use wlr_render_rect_options_get_box
Fixes: #3697
2023-09-21 02:25:34 -04:00
Alexander Orzechowski
2044cc2311 render: Introduce wlr_render_texture_options.blend_mode 2023-06-19 13:16:34 -04:00
Alexander Orzechowski
6bd44c4fcd renderer: Introduce wlr_scale_filter_mode 2023-06-19 12:25:38 -04:00
Simon Ser
a93fc8afd6 render: introduce blend mode
Allow callers to pick the blend mode when rendering a rect. The
"none" mode can be used to disable blending and clear rects.
2023-05-02 21:32:51 +02:00
Simon Ser
6b7d1d732a render/pixman: fix scaling in render_pass_add_texture()
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3642
Fixes: 6830bfc17f ("render/pixman: implement render pass API")
2023-05-02 15:49:17 +00:00
Simon Ser
6830bfc17f render/pixman: implement render pass API 2023-04-25 17:26:35 +02:00