Hello community, here is the log from the commit of package graphene for openSUSE:Factory checked in at 2020-06-29 21:15:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/graphene (Old) and /work/SRC/openSUSE:Factory/.graphene.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "graphene" Mon Jun 29 21:15:03 2020 rev:12 rq:817301 version:1.10.2 Changes: -------- --- /work/SRC/openSUSE:Factory/graphene/graphene.changes 2020-05-08 23:03:56.117688646 +0200 +++ /work/SRC/openSUSE:Factory/.graphene.new.3060/graphene.changes 2020-06-29 21:15:10.837192749 +0200 @@ -1,0 +2,10 @@ +Tue Jun 23 19:20:50 UTC 2020 - Bjørn Lie <[email protected]> + +- Update to version 1.10.2: + + Disable SSE on 32bit builds on Windows with MSVC + + Add more documentation on the conventions used by matrix + operations + + Fix Euler angles/matrix conversion + + Various bugs fixed. + +------------------------------------------------------------------- Old: ---- graphene-1.10.0.tar.xz New: ---- graphene-1.10.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ graphene.spec ++++++ --- /var/tmp/diff_new_pack.P0w2NH/_old 2020-06-29 21:15:11.525194877 +0200 +++ /var/tmp/diff_new_pack.P0w2NH/_new 2020-06-29 21:15:11.525194877 +0200 @@ -17,7 +17,7 @@ Name: graphene -Version: 1.10.0 +Version: 1.10.2 Release: 0 Summary: Thin type layer for graphic libraries License: MIT ++++++ graphene-1.10.0.tar.xz -> graphene-1.10.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/include/graphene-config.h.meson new/graphene-1.10.2/include/graphene-config.h.meson --- old/graphene-1.10.0/include/graphene-config.h.meson 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/include/graphene-config.h.meson 2020-06-22 16:54:30.858413200 +0200 @@ -14,8 +14,7 @@ #ifndef GRAPHENE_SIMD_BENCHMARK # if defined(__SSE__) || \ - (defined(_M_X64) && (_M_X64 > 0)) || \ - (defined(_MSC_VER) && (_MSC_VER >= 1910)) + (defined(_M_X64) && (_M_X64 > 0)) #mesondefine GRAPHENE_HAS_SSE # endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/include/graphene-macros.h new/graphene-1.10.2/include/graphene-macros.h --- old/graphene-1.10.0/include/graphene-macros.h 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/include/graphene-macros.h 2020-06-22 16:54:30.858413200 +0200 @@ -73,9 +73,11 @@ #endif #if defined(_MSC_VER) && !defined(__bool_true_false_are_defined) && (_MSC_VER < 1800) +# ifndef __GI_SCANNER__ typedef int bool; -# define false 0 -# define true 1 +# define false 0 +# define true 1 +# endif #else # include <stdbool.h> #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/include/graphene-simd4x4f.h new/graphene-1.10.2/include/graphene-simd4x4f.h --- old/graphene-1.10.0/include/graphene-simd4x4f.h 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/include/graphene-simd4x4f.h 2020-06-22 16:54:30.859413100 +0200 @@ -443,7 +443,23 @@ * @b: a #graphene_simd4x4f_t * @res: (out): return location for the result * - * Multiplies the two matrices. + * Multiplies the two matrices, following the convention: + * + * |[<!-- language="plain" --> + * res = A × B + * + * = ⎡ A.x × B ⎤ + * ⎜ A.y × B ⎟ + * ⎜ A.z × B ⎟ + * ⎣ A.w × B ⎦ + * + * = ⎡ res.x ⎤ + * ⎜ res.y ⎟ + * ⎜ res.z ⎟ + * ⎣ res.w ⎦ + * ]| + * + * See also: graphene_simd4x4f_vec4_mul() * * Since: 1.0 */ @@ -601,11 +617,38 @@ graphene_simd4f_t center, graphene_simd4f_t up) { - const graphene_simd4f_t z_axis = graphene_simd4f_normalize3 (graphene_simd4f_sub (center, eye)); - const graphene_simd4f_t x_axis = graphene_simd4f_normalize3 (graphene_simd4f_cross3 (z_axis, up)); - const graphene_simd4f_t y_axis = graphene_simd4f_cross3 (x_axis, z_axis); + const graphene_simd4f_t direction = graphene_simd4f_sub (center, eye); + graphene_simd4f_t cross; + graphene_simd4f_t z_axis; + graphene_simd4f_t x_axis; + graphene_simd4f_t y_axis; float eye_v[4]; + if (graphene_simd4f_get_x (graphene_simd4f_dot3 (direction, direction)) < FLT_EPSILON) + /* eye and center are in the same position */ + z_axis = graphene_simd4f_init (0, 0, 1, 0); + else + z_axis = graphene_simd4f_normalize3 (direction); + + cross = graphene_simd4f_cross3 (z_axis, up); + if (graphene_simd4f_get_x (graphene_simd4f_dot3 (cross, cross)) < FLT_EPSILON) + { + graphene_simd4f_t tweak_z; + + /* up and z_axis are parallel */ + if (fabs (graphene_simd4f_get_z (up) - 1.0) < FLT_EPSILON) + tweak_z = graphene_simd4f_init (0.0001f, 0, 0, 0); + else + tweak_z = graphene_simd4f_init (0, 0, 0.0001f, 0); + + z_axis = graphene_simd4f_add (z_axis, tweak_z); + z_axis = graphene_simd4f_normalize3 (z_axis); + cross = graphene_simd4f_cross3 (z_axis, up); + } + + x_axis = graphene_simd4f_normalize3 (cross); + y_axis = graphene_simd4f_cross3 (x_axis, z_axis); + graphene_simd4f_dup_4f (eye, eye_v); m->x = x_axis; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/include/graphene-version.h.in new/graphene-1.10.2/include/graphene-version.h.in --- old/graphene-1.10.0/include/graphene-version.h.in 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/include/graphene-version.h.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,69 +0,0 @@ -/* graphene-version.h: Version info - * - * SPDX-License-Identifier: MIT - * - * Copyright 2014 Emmanuele Bassi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/** - * SECTION:graphene-version - * @title: Versioning information - * @short_description: Detemining the version of Graphene in use - * - * Graphene provides symbols to know the version of the library at compile - * time. - */ - -#pragma once - -#if !defined(GRAPHENE_H_INSIDE) && !defined(GRAPHENE_COMPILATION) -#error "Only graphene.h can be included directly." -#endif - -/** - * GRAPHENE_MAJOR_VERSION: - * - * Evaluates to the major version number of the library version, - * e.g. 1 in 1.2.3. - * - * Since: 1.0 - */ -#define GRAPHENE_MAJOR_VERSION (@GRAPHENE_MAJOR_VERSION@) - -/** - * GRAPHENE_MINOR_VERSION: - * - * Evaluates to the minor version number of the library version, - * e.g. 2 in 1.2.3. - * - * Since: 1.0 - */ -#define GRAPHENE_MINOR_VERSION (@GRAPHENE_MINOR_VERSION@) - -/** - * GRAPHENE_MICRO_VERSION: - * - * Evaluates to the micro version number of the library version, - * e.g. 3 in 1.2.3. - * - * Since: 1.0 - */ -#define GRAPHENE_MICRO_VERSION (@GRAPHENE_MICRO_VERSION@) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/include/graphene-version.h.meson new/graphene-1.10.2/include/graphene-version.h.meson --- old/graphene-1.10.0/include/graphene-version.h.meson 1970-01-01 01:00:00.000000000 +0100 +++ new/graphene-1.10.2/include/graphene-version.h.meson 2020-06-22 16:54:30.860413300 +0200 @@ -0,0 +1,69 @@ +/* graphene-version.h: Version info + * + * SPDX-License-Identifier: MIT + * + * Copyright 2014 Emmanuele Bassi + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * SECTION:graphene-version + * @title: Versioning information + * @short_description: Detemining the version of Graphene in use + * + * Graphene provides symbols to know the version of the library at compile + * time. + */ + +#pragma once + +#if !defined(GRAPHENE_H_INSIDE) && !defined(GRAPHENE_COMPILATION) +#error "Only graphene.h can be included directly." +#endif + +/** + * GRAPHENE_MAJOR_VERSION: + * + * Evaluates to the major version number of the library version, + * e.g. 1 in 1.2.3. + * + * Since: 1.0 + */ +#define GRAPHENE_MAJOR_VERSION (@GRAPHENE_MAJOR_VERSION@) + +/** + * GRAPHENE_MINOR_VERSION: + * + * Evaluates to the minor version number of the library version, + * e.g. 2 in 1.2.3. + * + * Since: 1.0 + */ +#define GRAPHENE_MINOR_VERSION (@GRAPHENE_MINOR_VERSION@) + +/** + * GRAPHENE_MICRO_VERSION: + * + * Evaluates to the micro version number of the library version, + * e.g. 3 in 1.2.3. + * + * Since: 1.0 + */ +#define GRAPHENE_MICRO_VERSION (@GRAPHENE_MICRO_VERSION@) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/include/meson.build new/graphene-1.10.2/include/meson.build --- old/graphene-1.10.0/include/meson.build 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/include/meson.build 2020-06-22 16:54:30.860413300 +0200 @@ -46,7 +46,7 @@ version_conf.set('GRAPHENE_MICRO_VERSION', graphene_micro_version) configure_file( - input: 'graphene-version.h.in', + input: 'graphene-version.h.meson', output: 'graphene-version.h', configuration: version_conf, install_dir: join_paths(graphene_includedir, graphene_api_path), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/meson.build new/graphene-1.10.2/meson.build --- old/graphene-1.10.0/meson.build 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/meson.build 2020-06-22 16:54:30.860413300 +0200 @@ -1,5 +1,5 @@ project('graphene', 'c', - version: '1.10.0', + version: '1.10.2', license: 'MIT', meson_version: '>= 0.50.1', default_options: [ @@ -79,7 +79,7 @@ '-we4071', '-we4244', '-we4150', - '-we4819' + '-utf-8' ] else test_cflags = [ @@ -116,6 +116,13 @@ common_cflags = cc.get_supported_arguments(test_cflags) +# MSVC: Let C4819 error out if we do not have the -utf-8 compiler flag +if cc.get_id() == 'msvc' + if not common_cflags.contains('-utf-8') + common_cflags += cc.get_supported_arguments('-we4819') + endif +endif + common_ldflags = [] if host_system == 'linux' ldflags = [ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,-z,now', ] @@ -181,11 +188,12 @@ # Debugging debug_flags = [] -buildtype = get_option('buildtype') -if buildtype == 'release' - debug_flags += [ '-DG_DISABLE_ASSERT' ] -elif buildtype.startswith('debug') +if get_option('debug') debug_flags += [ '-DGRAPHENE_ENABLE_DEBUG' ] + message('Enabling various debug infrastructure') +elif get_option('optimization') in ['2', '3', 's'] + debug_flags += [ '-DG_DISABLE_ASSERT' ] + message('Disabling assertions') endif extra_args = [] @@ -208,7 +216,14 @@ gobject_req_version = '>= 2.30.0' if get_option('gobject_types') graphene_gobject_api_path = '@0@-gobject-@1@'.format(meson.project_name(), graphene_api_version) - gobject = dependency('gobject-2.0', version: gobject_req_version, required: false) + # fallback allows us to pick up GObject in case we're a subproject of another + # project that uses GObject and where GObject comes from a GLib subproject + # (e.g. when building GStreamer or GTK on Windows). + gobject = dependency('gobject-2.0', + version: gobject_req_version, + required: false, + fallback: ['glib', 'libgobject_dep'] + ) build_gobject = gobject.found() if build_gobject if cc.get_id() == 'msvc' @@ -253,12 +268,10 @@ # if !defined(__amd64__) && !defined(__x86_64__) # error "Need GCC >= 4.9 for SSE2 intrinsics on x86" # endif -#elif defined (_MSC_VER) && (_MSC_VER < 1910) -# if !defined (_M_X64) && !defined (_M_AMD64) -# error "Need MSVC 2017 or later for SSE2 intrinsics on x86" -# endif +#elif defined (_MSC_VER) && !defined (_M_X64) && !defined (_M_AMD64) +# error "SSE2 intrinsics not supported on x86 MSVC builds" #endif -#if defined(__SSE__) || (_M_X64 > 0) || (_MSC_VER >= 1910) +#if defined(__SSE__) || (_M_X64 > 0) # include <mmintrin.h> # include <xmmintrin.h> # include <emmintrin.h> @@ -363,6 +376,10 @@ subdir('src') if get_option('tests') + if cc.get_id() == 'msvc' and cc.version().version_compare('<19') + warning('Tests, specifically the mutest library, cannot be built for pre-2015 Visual Studio builds.') + warning('Use \'meson configure -Dtests=false\' if you are sure you want to proceed.') + endif subdir('tests') endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/src/graphene-euler.c new/graphene-1.10.2/src/graphene-euler.c --- old/graphene-1.10.0/src/graphene-euler.c 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/src/graphene-euler.c 2020-06-22 16:54:30.860413300 +0200 @@ -102,9 +102,9 @@ #define EULER_DEFAULT_ORDER GRAPHENE_EULER_ORDER_SXYZ -#define LAST_DEPRECATED GRAPHENE_EULER_ORDER_ZYX + 1 +#define LAST_DEPRECATED GRAPHENE_EULER_ORDER_ZYX -#define ORDER_OFFSET(o) ((o) - LAST_DEPRECATED) +#define ORDER_OFFSET(o) ((o) - (LAST_DEPRECATED + 1)) /* The orders of rotation we support, minus the deprecated aliases */ enum { @@ -237,8 +237,10 @@ float m[16]; -/* Our matrices are row major */ -#define M(m, r, c) (m)[((r) << 2) + (c)] +/* Our matrices are row major, however the code below is based on code + that assumes matrixes apply from the left, and we apply on the + right, so need to flip row/column. */ +#define M(m, r, c) (m)[((c) << 2) + (r)] /* We need to construct the matrix from float values instead * of SIMD vectors because the access is parametrised on the @@ -299,8 +301,10 @@ graphene_matrix_to_float (matrix, m); -/* Our matrices are row major */ -#define M(m, r, c) (m)[((r) << 2) + (c)] +/* Our matrices are row major, however the code below is based on code + that assumes matrixes apply from the left, and we apply on the + right, so need to flip row/column. */ +#define M(m, r, c) (m)[((c) << 2) + (r)] float ax, ay, az; if (params->repetition) @@ -543,6 +547,7 @@ if (m == NULL || graphene_matrix_is_identity (m)) return graphene_euler_init_with_order (e, 0.f, 0.f, 0.f, order); + order = graphene_euler_get_real_order (order); matrix_to_euler (m, &order_parameters[ORDER_OFFSET (order)], &x, &y, &z); graphene_euler_init_internal (e, x, y, z, order); @@ -576,7 +581,7 @@ graphene_quaternion_to_matrix (q, &m); - return graphene_euler_init_from_matrix (e, &m, order); + return graphene_euler_init_from_matrix (e, &m, graphene_euler_get_real_order (order)); } /** @@ -606,7 +611,7 @@ else graphene_vec3_init_from_vec3 (&e->angles, graphene_vec3_zero ()); - e->order = order; + e->order = graphene_euler_get_real_order (order); return e; } @@ -1067,5 +1072,5 @@ graphene_quaternion_t q; graphene_quaternion_init_from_euler (&q, e); - graphene_euler_init_from_quaternion (res, &q, order); + graphene_euler_init_from_quaternion (res, &q, graphene_euler_get_real_order (order)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/src/graphene-matrix.c new/graphene-1.10.2/src/graphene-matrix.c --- old/graphene-1.10.0/src/graphene-matrix.c 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/src/graphene-matrix.c 2020-06-22 16:54:30.861413200 +0200 @@ -47,6 +47,42 @@ * The contents of a #graphene_matrix_t are private, and direct access is not * possible. You can modify and read the contents of a #graphene_matrix_t * only through the provided API. + * + * # Conventions # {#conventions} + * + * Graphene uses left-multiplication for all its operations on vectors and + * matrices; in other words, given a matrix `A` and a vector `b`, the result + * of a multiplication is going to be: + * + * |[ + * res = b × A + * ]| + * + * Multiplying two matrices, on the other hand, will use right-multiplication; + * given two matrices `A` and `B`, the result of the multiplication is going + * to be + * + * |[ + * res = A × B + * ]| + * + * as the implementation will multiply each row vector of matrix `A` with the + * matrix `B` to obtain the new row vectors of the result matrix: + * + * |[ + * res = ⎡ A.x × B ⎤ + * ⎜ A.y × B ⎟ + * ⎜ A.z × B ⎟ + * ⎣ A.w × B ⎦ + * ]| + * + * For more information, see the documentation for #graphene_simd4x4f_t, + * especially the following functions: + * + * - graphene_simd4x4f_vec4_mul() + * - graphene_simd4x4f_vec3_mul() + * - graphene_simd4x4f_point3_mul() + * - graphene_simd4x4f_matrix_mul() */ #include "graphene-private.h" @@ -285,6 +321,18 @@ * coordinates. The top of the camera is aligned to the direction * of the @up vector. * + * Before the transform, the camera is assumed to be placed at the + * origin, looking towards the negative Z axis, with the top side of + * the camera facing in the direction of the Y axis and the right + * side in the direction of the X axis. + * + * In theory, one could use @m to transform a model of such a camera + * into world-space. However, it is more common to use the inverse of + * @m to transform another object from world coordinates to the view + * coordinates of the camera. Typically you would then apply the + * camera projection transform to get from view to screen + * coordinates. + * * Returns: (transfer none): the initialized matrix * * Since: 1.0 @@ -889,6 +937,8 @@ * account the fourth row vector of the #graphene_matrix_t when computing * the dot product of each row vector of the matrix. * + * See also: graphene_simd4x4f_point3_mul() + * * Since: 1.2 */ void @@ -917,6 +967,8 @@ * * The result is a coplanar quadrilateral. * + * See also: graphene_matrix_transform_point() + * * Since: 1.0 */ void @@ -925,6 +977,9 @@ graphene_quad_t *res) { graphene_point_t ret[4]; + graphene_rect_t rr; + + graphene_rect_normalize_r (r, &rr); #define TRANSFORM_POINT(matrix, rect, corner, out_p) do {\ graphene_simd4f_t __s; \ @@ -935,10 +990,10 @@ out_p.x = graphene_simd4f_get_x (__s); \ out_p.y = graphene_simd4f_get_y (__s); } while (0) - TRANSFORM_POINT (m, r, top_left, ret[0]); - TRANSFORM_POINT (m, r, top_right, ret[1]); - TRANSFORM_POINT (m, r, bottom_right, ret[2]); - TRANSFORM_POINT (m, r, bottom_left, ret[3]); + TRANSFORM_POINT (m, &rr, top_left, ret[0]); + TRANSFORM_POINT (m, &rr, top_right, ret[1]); + TRANSFORM_POINT (m, &rr, bottom_right, ret[2]); + TRANSFORM_POINT (m, &rr, bottom_left, ret[3]); #undef TRANSFORM_POINT @@ -957,6 +1012,8 @@ * The result is the axis aligned bounding rectangle containing the coplanar * quadrilateral. * + * See also: graphene_matrix_transform_point() + * * Since: 1.0 */ void @@ -968,6 +1025,10 @@ float min_x, min_y; float max_x, max_y; + graphene_rect_t rr; + + graphene_rect_normalize_r (r, &rr); + #define TRANSFORM_POINT(matrix, rect, corner, out_p) do {\ graphene_simd4f_t __s; \ graphene_point_t __p; \ @@ -977,10 +1038,10 @@ out_p.x = graphene_simd4f_get_x (__s); \ out_p.y = graphene_simd4f_get_y (__s); } while (0) - TRANSFORM_POINT (m, r, top_left, ret[0]); - TRANSFORM_POINT (m, r, top_right, ret[1]); - TRANSFORM_POINT (m, r, bottom_right, ret[2]); - TRANSFORM_POINT (m, r, bottom_left, ret[3]); + TRANSFORM_POINT (m, &rr, top_left, ret[0]); + TRANSFORM_POINT (m, &rr, top_right, ret[1]); + TRANSFORM_POINT (m, &rr, bottom_right, ret[2]); + TRANSFORM_POINT (m, &rr, bottom_left, ret[3]); #undef TRANSFORM_POINT @@ -1145,7 +1206,7 @@ * Projects a #graphene_rect_t using the given matrix. * * The resulting rectangle is the axis aligned bounding rectangle capable - * of containing fully the projected rectangle. + * of fully containing the projected rectangle. * * Since: 1.0 */ @@ -1156,11 +1217,14 @@ { graphene_point_t points[4]; graphene_point_t ret[4]; + graphene_rect_t rr; + + graphene_rect_normalize_r (r, &rr); - graphene_rect_get_top_left (r, &points[0]); - graphene_rect_get_top_right (r, &points[1]); - graphene_rect_get_bottom_left (r, &points[2]); - graphene_rect_get_bottom_right (r, &points[3]); + graphene_rect_get_top_left (&rr, &points[0]); + graphene_rect_get_top_right (&rr, &points[1]); + graphene_rect_get_bottom_left (&rr, &points[2]); + graphene_rect_get_bottom_right (&rr, &points[3]); graphene_matrix_project_point (m, &points[0], &ret[0]); graphene_matrix_project_point (m, &points[1], &ret[1]); @@ -1185,7 +1249,9 @@ * @res: (out caller-allocates): return location for the projected * rectangle * - * Projects a #graphene_rect_t using the given matrix. + * Projects all corners of a #graphene_rect_t using the given matrix. + * + * See also: graphene_matrix_project_point() * * Since: 1.2 */ @@ -1195,17 +1261,20 @@ graphene_quad_t *res) { graphene_point_t p[4]; + graphene_rect_t rr; + + graphene_rect_normalize_r (r, &rr); - graphene_rect_get_top_left (r, &p[0]); + graphene_rect_get_top_left (&rr, &p[0]); graphene_matrix_project_point (m, &p[0], &p[0]); - graphene_rect_get_top_right (r, &p[1]); + graphene_rect_get_top_right (&rr, &p[1]); graphene_matrix_project_point (m, &p[1], &p[1]); - graphene_rect_get_bottom_left (r, &p[2]); + graphene_rect_get_bottom_left (&rr, &p[2]); graphene_matrix_project_point (m, &p[2], &p[2]); - graphene_rect_get_bottom_right (r, &p[3]); + graphene_rect_get_bottom_right (&rr, &p[3]); graphene_matrix_project_point (m, &p[3], &p[3]); graphene_quad_init_from_points (res, p); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/src/graphene-ray.c new/graphene-1.10.2/src/graphene-ray.c --- old/graphene-1.10.0/src/graphene-ray.c 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/src/graphene-ray.c 2020-06-22 16:54:30.862413200 +0200 @@ -52,6 +52,11 @@ #include <math.h> #include <float.h> +#if defined(_WIN64) && ! defined(isnanf) +# define isnanf(x) _isnanf(x) +# define HAVE_ISNANF +#endif + /** * graphene_ray_alloc: (constructor) * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/src/meson.build new/graphene-1.10.2/src/meson.build --- old/graphene-1.10.0/src/meson.build 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/src/meson.build 2020-06-22 16:54:30.863413300 +0200 @@ -131,3 +131,14 @@ include_directories: [ graphene_inc ], dependencies: [ mathlib, threadlib ] + platform_deps, ) + +# In case of subproject usage expose a separate variable for graphene-gobject +# support, so the superproject and sibling subprojects can check for this +# directly as part of the dependency() fallback logic instead of having to +# poke at the build_gobject subproject variable. This mirrors the pkg-config +# lookup logic where we have a dedicated .pc file for graphene-gobject as well. +if build_gobject + graphene_gobject_dep = graphene_dep +else + graphene_gobject_dep = dependency('', required: false) +endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/.travis-ci/Dockerfile new/graphene-1.10.2/subprojects/mutest/.travis-ci/Dockerfile --- old/graphene-1.10.0/subprojects/mutest/.travis-ci/Dockerfile 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/.travis-ci/Dockerfile 2020-06-22 16:54:32.183425200 +0200 @@ -1,11 +1,14 @@ -FROM debian:stretch-slim +FROM debian:buster-slim MAINTAINER Emmanuele Bassi <[email protected]> RUN apt-get update -qq \ && apt-get install --no-install-recommends -qq -y \ clang \ + clang-tools \ gcc \ git \ + libasan5 \ + libubsan1 \ locales \ ninja-build \ pkg-config \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-ci.sh new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-ci.sh --- old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-ci.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-ci.sh 2020-06-22 16:54:32.183425200 +0200 @@ -0,0 +1,17 @@ +#!/bin/bash + +set -x + +export LSAN_OPTIONS=verbosity=1:log_threads=1 + +builddir="_build" +srcdir=`pwd` + +meson --prefix /usr "$@" $builddir $srcdir || exit $? + +ninja -C $builddir || exit $? +meson test -C $builddir || { + res=$? + cat $builddir/meson-logs/testlog.txt + exit $res +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-coverage.sh new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-coverage.sh --- old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-coverage.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-coverage.sh 2020-06-22 16:54:32.183425200 +0200 @@ -0,0 +1,21 @@ +#!/bin/bash + +set -x + +builddir="_build" +srcdir=`pwd` + +export COVERALLS_REPO_TOKEN=YJi21gyXWjx2BsvS8HRvfwjgXTJaQTqw1 +export CFLAGS='-coverage -ftest-coverage -fprofile-arcs' + +meson --prefix /usr $builddir $srcdir || exit $? + +ninja -C $builddir || exit $? +meson test -C $builddir || exit $? + +cpp-coveralls \ + -r . \ + -b $builddir \ + -i src -i ../src \ + -e tests -e ../tests \ + --gcov-options='\-lp' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-static.sh new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-static.sh --- old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-static.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-static.sh 2020-06-22 16:54:32.184425000 +0200 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -x + +builddir="_build" +srcdir=`pwd` + +meson --prefix /usr "$@" $builddir $srcdir || exit $? + +ninja -C $builddir scan-build || exit $? +meson test -C $builddir || exit $? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-tests.sh new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-tests.sh --- old/graphene-1.10.0/subprojects/mutest/.travis-ci/run-tests.sh 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/.travis-ci/run-tests.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -#!/bin/bash - -set -x - -builddir="_build" -srcdir=`pwd` - -export CFLAGS='-coverage -ftest-coverage -fprofile-arcs' - -meson --prefix /usr "$@" $builddir $srcdir || exit $? - -ninja -C $builddir || exit $? -meson test -C $builddir || exit $? - -cpp-coveralls -r . -b $builddir -i src -i ../src -e tests -e ../tests --gcov-options='\-lp' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/.travis.yml new/graphene-1.10.2/subprojects/mutest/.travis.yml --- old/graphene-1.10.0/subprojects/mutest/.travis.yml 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/.travis.yml 2020-06-22 16:54:32.184425000 +0200 @@ -6,10 +6,6 @@ services: - docker -compiler: - - gcc - - clang - language: - c @@ -22,5 +18,20 @@ - echo WORKDIR /home/user/app >> Dockerfile - docker build -t withgit . -script: - - docker run withgit /bin/sh -c "CC=$CC sh -x .travis-ci/run-tests.sh" +jobs: + include: + - stage: "Tests" + name: "Build" + script: docker run withgit /bin/sh -c "sh -x .travis-ci/run-ci.sh ${BUILD_OPTS}" + env: + - BUILD_OPTS="" +# - BUILD_OPTS="-Db_sanitize=address -Db_lundef=false" + - script: docker run withgit /bin/sh -c "sh -x .travis-ci/run-ci.sh ${BUILD_OPTS}" + name: "UBSan" + env: + - BUILD_OPTS="-Db_sanitize=undefined -Db_lundef=false" + - stage: "Analysis" + script: docker run withgit /bin/sh -c "sh -x .travis-ci/run-static.sh" + name: "Code scan" + - script: docker run withgit /bin/sh -c "sh -x .travis-ci/run-coverage.sh" + name: "Coverage" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/src/mutest-main.c new/graphene-1.10.2/subprojects/mutest/src/mutest-main.c --- old/graphene-1.10.0/subprojects/mutest/src/mutest-main.c 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/src/mutest-main.c 2020-06-22 16:54:32.188425300 +0200 @@ -139,26 +139,20 @@ global_state.is_tty = isatty (STDOUT_FILENO); #endif + global_state.use_colors = false; + if (!global_state.is_tty) - { - global_state.use_colors = false; - return; - } + return; char *env = mutest_getenv ("MUTEST_NO_COLOR"); if (env != NULL && env[0] != '\0') - { - global_state.use_colors = false; - free (env); - return; - } + goto out; env = mutest_getenv ("FORCE_COLOR"); if (env != NULL && env[0] != '\0') { global_state.use_colors = true; - free (env); - return; + goto out; } env = mutest_getenv ("TERM"); @@ -174,19 +168,18 @@ global_state.use_colors = true; } - free (env); - return; + goto out; } env = mutest_getenv ("COLORTERM"); if (env != NULL) { global_state.use_colors = true; - free (env); - return; + goto out; } - global_state.use_colors = false; +out: + free (env); } static void @@ -200,10 +193,34 @@ if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &ws) != 0) perror ("ioctl"); - - global_state.term_width = ws.ws_col; - global_state.term_height = ws.ws_row; + else + { + global_state.term_width = ws.ws_col; + global_state.term_height = ws.ws_row; + return; + } #endif + + char *env = mutest_getenv ("COLUMNS"); + + if (env == NULL || *env == '\0') + { + free (env); + return; + } + + int saved_errno = errno; + int columns = strtol (env, NULL, 10); + if (errno == ERANGE) + { + free (env); + return; + } + + global_state.term_width = columns; + free (env); + + errno = saved_errno; } static void @@ -228,6 +245,7 @@ { // Default global_state.output_format = available_formats[0].format; + free (env); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/src/mutest-matchers.c new/graphene-1.10.2/subprojects/mutest/src/mutest-matchers.c --- old/graphene-1.10.0/subprojects/mutest/src/mutest-matchers.c 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/src/mutest-matchers.c 2020-06-22 16:54:32.188425300 +0200 @@ -228,7 +228,7 @@ mutest_expect_res_t *value = e->value; if (value->expect_type == MUTEST_EXPECT_FLOAT) - return isinf (value->expect.v_float.value) == 1; + return isinf (value->expect.v_float.value) != 0 && signbit (value->expect.v_float.value) == 0; return false; } @@ -240,7 +240,7 @@ mutest_expect_res_t *value = e->value; if (value->expect_type == MUTEST_EXPECT_FLOAT) - return isinf (value->expect.v_float.value) == -1; + return isinf (value->expect.v_float.value) != 0 && signbit (value->expect.v_float.value) != 0; return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/src/mutest-utils.c new/graphene-1.10.2/subprojects/mutest/src/mutest-utils.c --- old/graphene-1.10.0/subprojects/mutest/src/mutest-utils.c 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/src/mutest-utils.c 2020-06-22 16:54:32.188425300 +0200 @@ -297,6 +297,9 @@ size_t indent_len, size_t max_width) { + if (indent_len >= max_width) + mutest_assert_if_reached ("invalid indentation length"); + const size_t max_len = max_width - indent_len; size_t n_lines = 0; @@ -347,6 +350,9 @@ n_lines += 1; } + if (n_lines == 0) + mutest_assert_if_reached ("invalid line length"); + size_t len = strlen (lines[0]) + 1; size_t i; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/subprojects/mutest/src/mutest-wrappers.c new/graphene-1.10.2/subprojects/mutest/src/mutest-wrappers.c --- old/graphene-1.10.0/subprojects/mutest/src/mutest-wrappers.c 2019-09-08 18:29:26.000000000 +0200 +++ new/graphene-1.10.2/subprojects/mutest/src/mutest-wrappers.c 2020-06-22 16:54:32.188425300 +0200 @@ -80,11 +80,11 @@ { snprintf (buf, len, "%s", "NaN"); } - else if (isinf (res->expect.v_float.value) == 1) + else if (isinf (res->expect.v_float.value) && signbit (res->expect.v_float.value) == 0) { snprintf (buf, len, "%s", "+∞"); } - else if (isinf (res->expect.v_float.value) == -1) + else if (isinf (res->expect.v_float.value) && signbit (res->expect.v_float.value) != 0) { snprintf (buf, len, "%s", "-∞"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/tests/euler.c new/graphene-1.10.2/tests/euler.c --- old/graphene-1.10.0/tests/euler.c 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/tests/euler.c 2020-06-22 16:54:30.864413300 +0200 @@ -10,21 +10,21 @@ graphene_vec3_t v; e = graphene_euler_init (graphene_euler_alloc (), 0.f, 0.f, 0.f); - mutest_expect ("graphene_euler_init() sets the x component", + mutest_expect ("graphene_euler_init() to set the x component", mutest_float_value (graphene_euler_get_x (e)), mutest_to_be_close_to, 0.0, 0.0001, NULL); - mutest_expect ("graphene_euler_init() sets the y component", + mutest_expect ("graphene_euler_init() to set the y component", mutest_float_value (graphene_euler_get_y (e)), mutest_to_be_close_to, 0.0, 0.0001, NULL); - mutest_expect ("graphene_euler_init() sets the z component", + mutest_expect ("graphene_euler_init() to set the z component", mutest_float_value (graphene_euler_get_z (e)), mutest_to_be_close_to, 0.0, 0.0001, NULL); graphene_euler_to_vec3 (e, &v); - mutest_expect ("graphene_euler_to_vec3() returns a zero vector", + mutest_expect ("graphene_euler_to_vec3() to return a zero vector", mutest_bool_value (graphene_vec3_equal (&v, graphene_vec3_zero ())), mutest_to_be_true, NULL); @@ -52,7 +52,7 @@ graphene_euler_init_from_quaternion (&e, &q, graphene_euler_get_order (&values[i])); graphene_quaternion_init_from_euler (&check, &e); - mutest_expect ("quaternion → euler → quaternion", + mutest_expect ("roundtrip: quaternion → euler → quaternion", mutest_bool_value (graphene_quaternion_equal (&q, &check)), mutest_to_be_true, NULL); @@ -79,7 +79,7 @@ graphene_euler_to_matrix (&e, &check); - mutest_expect ("matrix → euler → matrix", + mutest_expect ("roundtrip: matrix → euler → matrix", mutest_bool_value (graphene_matrix_near (&m, &check, 0.01f)), mutest_to_be_true, NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.0/tests/gen-installed-test.py new/graphene-1.10.2/tests/gen-installed-test.py --- old/graphene-1.10.0/tests/gen-installed-test.py 2019-09-08 18:29:25.000000000 +0200 +++ new/graphene-1.10.2/tests/gen-installed-test.py 2020-06-22 16:54:30.865413200 +0200 @@ -29,7 +29,11 @@ f.write(data) def build_template(testdir, testname): - return "[Test]\nType=session\nExec={}\n".format(os.path.join(testdir, testname)) + return """[Test] +Type=session +Exec={} +TestEnvironment=MUTEST_OUTPUT=tap; +""".format(os.path.join(testdir, testname)) argparser = argparse.ArgumentParser(description='Generate installed-test data.') argparser.add_argument('--testdir', metavar='dir', required=True, help='Installed test directory')
