0
Fork 0
mirror of https://github.com/emersion/grim.git synced 2026-10-22 19:11:38 +00:00
Commit graph

14 commits

Author SHA1 Message Date
Manuel Stoeckl
248210d6e8 Stop using cairo_surface_t 2022-01-20 11:19:49 +01:00
Manuel Stoeckl
c2e07e5eb8 Use alternate Wayland to Pixman format conversion on big-endian
The Wayland shm formats (almost equivalently, DRM fourcc pixel format
codes) are specified as being little endian, but Pixman's format codes
are generally native-endian. The existing conversions all assume
native=little; this commit introduces format conversions for when
native=big.

Not all DRM/wayland fourcc formats have a big endian pixman_format_code
equivalent, but the most popular (A|X)(RGB|BGR)8888 formats all do.
2022-01-18 13:23:28 +01:00
Manuel Stoeckl
66c4c3a4af render: add support for ≤ 24bpp pixel formats 2022-01-17 14:33:10 +01:00
Manuel Stoeckl
e658b13d16 render: use convolution filter when downscaling
This fixes a regression from the earlier commit switching from Cairo
to Pixman, where downscaling images inaccurately computed pixel values
in the result.

Now the code uses a convolution filter when downscaling, to get a more
accurate combined color for a downscaled pixel. The 2-lobe Lanczos
filter now used is very close to the Catmull-Rom filter applied by the
CAIRO_FILTER_BEST setting. Downscaling images now runs roughly as
slowly as the Cairo implementation did.

Bilinear filtering is still used for upscaling; while it may not give
results as nice as what Cairo had, rendering quickly becomes even more
important which the screenshot being produced is large.
2021-10-07 12:57:33 +02:00
Manuel Stoeckl
af000f9900 render: use pixman to compose output buffers
The previous code using Cairo ultimately used Pixman to draw the
transformed output buffers onto a common image; switching to use
Pixman directly makes it easier to remove the Cairo dependency in the
future, and increases the number of buffer formats which the
rendering code can directly use.

This change also sometimes speeds up the image rendering, by using
Pixman's OP_SRC composition instead of the slower OP_OVER when we
are guaranteed that an output image will not share pixels with another
output's image when drawn on the common image. Cairo sometimes did
this, but not always.

The rendered images may change very slightly due to the new way of
computing transforms, which has slightly different rounding artifacts.
2021-10-05 09:44:20 +02:00
Érico Rolim
4d94e0b135 main,render: replace assert(false) with abort(). 2021-02-03 00:39:15 +01:00
Simon Ser
2c15b09fa4 Fix 180-degree rotated buffers without Y_INVERT
When the compositor sends a buffer without the Y_INVERT flag, the
resulting image had it rotated by 180 degrees.

References: https://github.com/swaywm/sway/issues/5818
2020-11-17 22:12:04 +01:00
Daniel Playfair Cal
8f9d60885c Correct interpretation of output rotation
This fixes grim to treat the rotations as counterclockwise and applied
to the surface. This became necessary because wlroots recently corrected
its rotation similarly in https://github.com/swaywm/wlroots/pull/2023.
2020-04-21 14:16:22 +02:00
emersion
1e8dde32b6
Add support for WL_SHM_FORMAT_ABGR8888
Fixes https://github.com/emersion/grim/issues/24
2019-01-29 15:09:25 +01:00
emersion
97202f2200 Add support for WL_SHM_FORMAT_XRGB8888
The format was incorrectly set to 0 instead of what we got from the
compositor. WL_SHM_FORMAT_ARGB8888 was defined to be 0 so the bug
was hidden.

We now choose the Cairo format depending on the Wayland format.

Fixes #17
2018-10-14 18:28:59 +02:00
Ryan Dwyer
c12100917f Invert rotation
Fixes upside down screenshots when the output is rotated 90 or 270
degrees.
2018-09-24 22:36:03 +10:00
emersion
8480e3ebdb Add support for wlr-screencopy-unstable-v1
Fixes #13
2018-07-13 19:25:56 +01:00
emersion
42cc4ff48d
Clear buffer before rendering 2018-05-20 21:48:22 +01:00
emersion
4b0041bf03
Split rendering and output layout functions in separate files 2018-05-18 09:16:59 +01:00