summaryrefslogtreecommitdiff
path: root/gsk/gsktransform.c
Commit message (Collapse)AuthorAgeFilesLines
* Add some missing nullable return annotationsSophie Herold2020-10-171-1/+1
|
* gsk: Normalize when transforming boundsMatthias Clasen2020-09-281-8/+10
| | | | | | | | Bounds are assumed to be normalized, and transforms with negative scales or 3d rotations can make us get negative sizes. Fix by Benjamin Otte.
* Add gsk_matrix_transform_rectMatthias Clasen2020-09-041-12/+13
| | | | | | | 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().
* Replace uses of graphene_matrix_transform_Matthias Clasen2020-09-011-2/+2
| | | | | | | | | | 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.
* gsk: Add some private transform apisMatthias Clasen2020-09-011-0/+77
| | | | | | Some of the graphene_matrix_transform apis don't work correctly with projective matrices, so add our own variants.
* *: Fix spelling mistakes found by codespellBjörn Daase2020-08-211-1/+1
|
* GskTransform: Restructure _to_affine and _to_translationTimm Bäder2020-07-281-22/+50
| | | | Make the simple cases more explicit.
* GskTransform: Remove unused function from private headerTimm Bäder2020-07-281-1/+5
| | | | We only use this in gsktransform.c
* gsk: Fix a transform leakMatthias Clasen2020-07-081-1/+2
| | | | This was found by running our testsuite under asan.
* transform: Fix docs to use "transform" instead of "matrix"Timm Bäder2020-06-191-15/+15
|
* transform: Fix equal() docsTimm Bäder2020-06-191-6/+4
| | | | This has nothing to do with matrices.
* transform: Compare 3d points directlyTimm Bäder2020-06-191-1/+3
|
* gsktransform: Make next == NULL case explicitTimm Bäder2020-06-191-0/+3
| | | | | This is handled with the is_identity() check as well but this way it's much more obvious what's happening
* transform: Don't crash for gsk_transform_transform (id, id)Benjamin Otte2020-02-211-1/+3
| | | | See attached tests
* transform: Make sure the identity transform is equal to NULLBenjamin Otte2020-02-211-2/+5
|
* transform: Add optimization for common caseBenjamin Otte2020-02-211-0/+6
| | | | | | | | | | 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.
* gsk: Fix angle normalizationAlexander Larsson2020-02-111-7/+15
| | | | | | | | | | | | 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.
* GskTransform: Remove useless fmod checkTimm Bäder2020-02-071-3/+0
| | | | All angles are in the [0; 360[ range
* GskTransform: add assertions to make normalize_angle() intentions clearTimm Bäder2020-02-071-0/+3
| | | | | 360deg should be expressed as 0deg and no angle should ever be negative.
* GskTransform: Add gsk_transform_transform_point()Timm Bäder2020-01-241-0/+56
| | | | | Equivalent of gsk_transform_transform_bounds() and graphene_matrix_transform_point() respectively.
* build: Check for sincosf()Chun-wei Fan2020-01-081-1/+9
| | | | | | | 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.
* transform: Properly compare scale transformsTimm Bäder2020-01-071-3/+3
| | | | | If the epsilon we use there is too much, we can run into rendering errors because the GPU will use the actual scale value.
* transform: Scale+translate bounds directylTimm Bäder2020-01-071-8/+8
| | | | Make these two code paths look the same.
* transform: Compare class before ->nextTimm Bäder2020-01-071-2/+2
|
* GskTransform: Compute sin/deg of 90deg rotations manuallyTimm Bäder2020-01-071-8/+36
| | | | | Otherwise we might end up with inaccuracies, e.g. when gsk_transform_transform_bounds()'ing bounds.
* GskTransform: Normalize anglesTimm Bäder2020-01-071-2/+18
| | | | Make sure all angles are in the [0..365) range
* gsktransform: Fix documentation commentTimm Bäder2019-09-091-2/+2
| | | | There is no @m.
* gsk: Add missing 'transfer full' annotations of instance parametersRico Tzschichholz2019-08-261-9/+9
| | | | Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2107
* transform: Fix identity transform fast pathsTimm Bäder2019-07-071-5/+5
| | | | Returning an extra ref will cause leaks later.
* transform: Add transform_bounds fast path for 2D_AFFINE transformsTimm Bäder2019-06-291-1/+16
| | | | | | 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.
* transform: Add skew parsingTimm Bäder2019-06-291-3/+28
|
* Merge branch 'transform-tests' into 'master'Matthias Clasen2019-06-031-2/+2
|\ | | | | | | | | Transform tests See merge request GNOME/gtk!910
| * gsk: Fix printing of identity transformsMatthias Clasen2019-06-031-1/+1
| | | | | | | | | | These need to print as "none", otherwise the parser does not accept them.
| * CosmeticsMatthias Clasen2019-06-031-1/+1
| | | | | | | | Fix up a variable name mismatch in GskTransform docs.
* | GskTransform: NULL is a valid transformTimm Bäder2019-06-031-1/+3
|/
* GskTransform: Ignore identity transformsTimm Bäder2019-06-031-3/+15
| | | | | We often end up with e.g. a scale of 1 or a translation by 0/0. Ignore those transforms since they don't do anything.
* transform: Coalesce similar transformsBenjamin Otte2019-06-021-3/+50
| | | | | | | | | | | If somebody does a transform like scale(5) scale(10) translate(1,1) translate(5,0) store it instead as scale(50) translate(6,1) This way, less memory is consumed and transforms are easier to read. In particular, this simplifies the typical transforms we do in GTK, which are just one translation after another.
* transform: Treat 0 perspective transforms as identityBenjamin Otte2019-06-021-1/+1
| | | | | This happens if you apply a perspective transform and its inverse, which is the negative version of the perspective.
* gsk: Documentation tweaksMatthias Clasen2019-05-011-1/+1
| | | | Add some missing symbols.
* Use getters for translation and scaling componentsEmmanuele Bassi2019-04-291-8/+8
| | | | Instead of accessing the matrix cells directly.
* Never compare floats for equalityEmmanuele Bassi2019-04-291-7/+7
| | | | | | Floating point values cannot ever be compared for equality. GLib has a G_APPROX_VALUE macro that lets us compare two value within a provided precision, so we should use that instead.
* Use matrix equality in GskTransformEmmanuele Bassi2019-04-291-2/+4
| | | | | Graphene has new API to check for equality, so we should use it instead of doing a byte-by-byte comparison.
* Use atomic boxing instead of manual refcountingEmmanuele Bassi2019-04-291-11/+4
| | | | | | Artisanal, homegrown, locally sourced, vegan reference counting has been replaced by the appropriate API in GLib, which does small things like saturation and type checking.
* transform: Add gsk_transform_parse()Benjamin Otte2019-04-121-2/+257
| | | | It uses the new CSS parser.
* gsk: API docs fixesBastien Nocera2019-03-071-5/+2
| | | | | | | | | gsk/gskenums.h:181: Error: Gsk: multiple "@GSK_TRANSFORM_CATEGORY_2D" parameters for identifier "GskTransformCategory": * @GSK_TRANSFORM_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent ^ gsk/gsktransform.c:1342: Warning: Gsk: gsk_transform_to_2d: unknown parameter 'm' in documentation comment, should be 'self' gsk/gsktransform.c:1368: Warning: Gsk: gsk_transform_to_2d: invalid return annotation gsk/gsktransform.c:1461: Warning: Gsk: gsk_transform_to_translate: unknown parameter 'm' in documentation comment, should be 'self'
* transform: Add perspective()Benjamin Otte2019-03-051-0/+114
| | | | | This commit adds gsk_transform_perspective(), gtk_snapshot_perspective() and support for perspective() in the CSS syntax.
* transform: Readd optimizationBenjamin Otte2019-03-041-4/+28
| | | | This is the optimization from bbd4e2f60d9e060fbe3b0c2dcebcd1d6b7335a2a
* transform: Redo querying APIBenjamin Otte2019-03-041-155/+116
| | | | | | | | | | | Make the API expect a tranform of the proper category instead of doing the check ourselves and returning TRUE/FALSE. The benefit is that the mai use case is switch (transform->category) statements and in those we know the category and don't need to check TRUE/FALSE. Using the wrong matrix will now cause a g_warning().
* transform: Store the category in the transformBenjamin Otte2019-03-041-69/+30
| | | | | | | | ... instead of computing it every time we need it. This should be faster and we want to use it a lot more prominently. Also, we have the struct memory available anyway.
* transform: Implement gsk_transform_invert()Benjamin Otte2019-03-041-1/+118
| | | | | | And use it. And test it.