Sebastian Dröge
c44badd26a
Mark various GskTransform functions as nullable in their return value
...
Various transforms are normalized with their next transform, and if they
end up being the identity transform will return NULL.
For example a translation by (x,y,z) and followed by (-x,-y,-z) will
result in NULL.
2022-01-14 11:57:23 +02:00
Benjamin Otte
c97a758aa7
cssparser: Remove unused argument
...
The base_directory argument is never used. So don't have it.
2021-10-28 03:19:08 +02:00
Matthias Clasen
41b810da7f
Add gsk_transform_to_2d_components
...
This function decomposes a general 2D transform
into skew, scale, rotation and translation.
Tests included.
2021-09-18 02:06:51 -04:00
Matthias Clasen
1289e68931
gsk: Add skew transforms
...
Add gsk_transform_skew() to make our transform
api more complete wrt to what you would expect
for a graphics api.
2021-09-17 22:07:26 -04:00
Matthias Clasen
9e6adaa913
transform: Add sections
...
This makes the code easier to navigate (for me).
2021-09-17 22:07:26 -04:00
Matthias Clasen
bef54a382d
transform: Improve docs
...
Add an example for reconstructing transforms.
2021-09-17 10:28:49 -04:00
Matthias Clasen
0ef12193f9
gsk: Optimize gsk_transform_to...
...
Optimize these functions for the common cases.
2021-07-24 18:48:10 -04:00
Matthias Clasen
2d266d107b
gsk: Clean up docs syntax
...
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
4a0d3d7acc
docs: Reduce redundancy
...
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.
This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68
introspection: Stop using allow-none
...
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1
Documentation fixes
...
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Matthias Clasen
7450427757
gsktransform: Convert docs
2021-03-11 16:37:32 +00:00
Matthias Clasen
ca3120919f
docs: Improve gsk docs
...
Convert link formats, add summaries, and make
a few missing things show up in the docs.
2021-03-11 16:37:31 +00:00
Christian Hergert
6fab195643
gsk: move transform structure to private.h
...
This allows using the category without having to call a function from the
hot paths of the renderer.
2021-02-10 16:14:59 -08:00
Timm Bäder
fdda4e4e99
GskTransform: Add nullable annotations to _equals()
...
Both can be NULL here.
2020-12-21 10:26:03 +01:00
Timm Bäder
186287ecfb
GskTransform: Fix identity transform class name
2020-12-21 10:26:02 +01:00
Timm Bäder
bd5d1615ac
GskTransform: Avoid a ref+unref pair
...
If gsk_transform_is_identity() returned FALSE for the next transform,
the previous code did a ref + unref pair, even though it was unneeded.
2020-12-21 10:26:02 +01:00
Sophie Herold
cd0bef9390
Add some missing nullable return annotations
2020-10-17 15:32:36 +02:00
Matthias Clasen
431f144f37
gsk: Normalize when transforming bounds
...
Bounds are assumed to be normalized, and transforms
with negative scales or 3d rotations can make us get
negative sizes.
Fix by Benjamin Otte.
2020-09-28 11:34:16 -04:00
Matthias Clasen
41497aeb8b
Add gsk_matrix_transform_rect
...
This is a projecting version of the corresponding
graphene api. While we are at it, rewrite
gsk_matrix_transform_bounds() to use
gsk_matrix_transform_rect().
2020-09-04 13:15:21 -04:00
Matthias Clasen
e36b594867
Replace uses of graphene_matrix_transform_
...
Replace our uses of graphene_matrix_transform_point,
_point3d and _bounds by our own versions that handle
projective transforms correctly.
This fixes render node bounds being incorrect for widgets
involving projective transforms (e.g. testrevealer swing
transformations), and also fixes picking on such widgets.
2020-09-01 09:18:38 -04:00
Matthias Clasen
99a7a2188a
gsk: Add some private transform apis
...
Some of the graphene_matrix_transform apis don't work
correctly with projective matrices, so add our own
variants.
2020-09-01 09:18:38 -04:00
Björn Daase
6315cd977c
*: Fix spelling mistakes found by codespell
2020-08-21 15:29:34 +02:00
Timm Bäder
fa85ec5cf5
GskTransform: Restructure _to_affine and _to_translation
...
Make the simple cases more explicit.
2020-07-28 05:34:12 +02:00
Timm Bäder
756b84033a
GskTransform: Remove unused function from private header
...
We only use this in gsktransform.c
2020-07-28 05:34:12 +02:00
Matthias Clasen
13b37b0ba4
gsk: Fix a transform leak
...
This was found by running our testsuite under asan.
2020-07-08 17:44:08 -04:00
Timm Bäder
da85815399
transform: Fix docs to use "transform" instead of "matrix"
2020-06-19 05:26:25 +02:00
Timm Bäder
5dde4c0a39
transform: Fix equal() docs
...
This has nothing to do with matrices.
2020-06-19 05:26:25 +02:00
Timm Bäder
0c1cfbbad1
transform: Compare 3d points directly
2020-06-19 05:26:24 +02:00
Timm Bäder
a974c83423
gsktransform: Make next == NULL case explicit
...
This is handled with the is_identity() check as well but this way it's
much more obvious what's happening
2020-06-19 05:26:24 +02:00
Benjamin Otte
7597f6b594
transform: Don't crash for gsk_transform_transform (id, id)
...
See attached tests
2020-02-21 18:30:13 +01:00
Benjamin Otte
b50093d044
transform: Make sure the identity transform is equal to NULL
2020-02-21 18:25:05 +01:00
Benjamin Otte
41ef6e9fa5
transform: Add optimization for common case
...
Transforming identity by an other transform does not mean we need to
painstakingly apply the individual steps of other to construct a new
transform, it means we can just return other.
Or in math terms:
I * B = B
so just return B.
2020-02-21 18:19:16 +01:00
Alexander Larsson
1f0438e7fe
gsk: Fix angle normalization
...
I was getting assertions that normalize_angle() failed the
result < 260 check. Doing some research on this it turns out
to be a precision issue. If the incomming angle is very slightly
below zero, then adding 360 to it may end up with exactly 360.
I simplified the code a bit to avoid division and rounding, because in
practice most angles will be "just outside" the 0-360 degree anyway.
And i also added a workaround for the "result is 360" case by just
setting it to 0.
2020-02-11 13:51:06 +01:00
Timm Bäder
8388791f87
GskTransform: Remove useless fmod check
...
All angles are in the [0; 360[ range
2020-02-07 13:16:32 -05:00
Timm Bäder
cbb05a3eab
GskTransform: add assertions to make normalize_angle() intentions clear
...
360deg should be expressed as 0deg and no angle should ever be
negative.
2020-02-07 13:16:32 -05:00
Timm Bäder
cff8304133
GskTransform: Add gsk_transform_transform_point()
...
Equivalent of gsk_transform_transform_bounds() and
graphene_matrix_transform_point() respectively.
2020-01-24 06:19:12 +01:00
Chun-wei Fan
a9b1d4a389
build: Check for sincosf()
...
sincosf() is really a GCC-specific function that may more may not be
supported on non-GCC compilers, so we want to check for it, otherwise we
use a fallback implementation, not unlike the one in
demos/gtk-demo/gtkgears.c.
2020-01-08 17:15:29 +08:00
Timm Bäder
7669e6e42e
transform: Properly compare scale transforms
...
If the epsilon we use there is too much, we can run into rendering
errors because the GPU will use the actual scale value.
2020-01-07 17:27:19 +01:00
Timm Bäder
7a27122dab
transform: Scale+translate bounds directyl
...
Make these two code paths look the same.
2020-01-07 17:27:18 +01:00
Timm Bäder
ca4ae81170
transform: Compare class before ->next
2020-01-07 17:27:18 +01:00
Timm Bäder
766d4dff76
GskTransform: Compute sin/deg of 90deg rotations manually
...
Otherwise we might end up with inaccuracies, e.g. when
gsk_transform_transform_bounds()'ing bounds.
2020-01-07 17:27:17 +01:00
Timm Bäder
e62f135c6a
GskTransform: Normalize angles
...
Make sure all angles are in the [0..365) range
2020-01-07 17:27:17 +01:00
Timm Bäder
6c90d3a1b6
gsktransform: Fix documentation comment
...
There is no @m.
2019-09-09 17:36:23 +02:00
Rico Tzschichholz
5504c62af9
gsk: Add missing 'transfer full' annotations of instance parameters
...
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2107
2019-08-26 18:05:17 +02:00
Timm Bäder
dbc49e7742
transform: Fix identity transform fast paths
...
Returning an extra ref will cause leaks later.
2019-07-07 07:24:00 +02:00
Timm Bäder
3bc3e140dd
transform: Add transform_bounds fast path for 2D_AFFINE transforms
...
E.g. anything involving a scale. This is important when e.g. scrolling
in the node list in the recorder, which scales every recorded node down
to fit in the list.
2019-06-29 09:49:38 +02:00
Timm Bäder
8dd74eac2e
transform: Add skew parsing
2019-06-29 07:15:43 +02:00
Matthias Clasen
206970c1e8
Merge branch 'transform-tests' into 'master'
...
Transform tests
See merge request GNOME/gtk!910
2019-06-03 16:41:17 +00:00
Matthias Clasen
4ed57449ba
gsk: Fix printing of identity transforms
...
These need to print as "none", otherwise
the parser does not accept them.
2019-06-03 16:20:38 +00:00