02a30f2a22
At this point, we are still only changing CoglMatrix APIs internally, and it should still produce the same output as before. To achieve this, using graphens matrix implementation, we need to exploit some knowledge about conventions used in Cogl and graphene respectively. In Cogl, transformation matrices are equivalent to those of affine transformation matrices. The convention used by graphene, however, is to operate on matrices that are transposed compared to their affine counterparts. So for example, let's say we want to multiply the affine matrices A and B, to get C. A × B = C The first step is to convert A and B to graphene matrices. We do this by importing the floating point array, importing it directly using graphene. Cogl exports its matrix to a column major floating point array. When we import this in graphene, being row major, we end up with the same matrix, only transposed. Cogl Graphene A <===> Aᵀ B <===> Bᵀ We then multiply these imported matrices in reverse Bᵀ × Aᵀ which in turn, due to ABᵀ = BᵀAᵀ, gives us Bᵀ × Aᵀ = (A × B)ᵀ Our original goal was to find C, thus we know that A × B = C That means we can shuffle things around a bit. A × B = C Bᵀ × Aᵀ = (A × B)ᵀ Bᵀ × Aᵀ = Cᵀ With the same conversion as done when going from Cogl to graphene, only the other way around, we still end up effectively transposing the matrix during the conversion. Graphene Cogl Cᵀ <===> C Thus when converting Cᵀ to Cogl, we in fact end up with C. (Explanation authored by Jonas Ådahl) https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439 |
||
---|---|---|
.. | ||
cogl | ||
cogl-pango | ||
test-fixtures | ||
tests | ||
.gitignore | ||
cogl-config.h.meson | ||
cogl-mutter-config.h.in | ||
config-custom.h | ||
meson.build |