backends/native: Update MetaBezier coding style for modern standards
Let's try to get past that pesky code-style checker. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3399>
This commit is contained in:

committed by
Marge Bot

parent
414357a70f
commit
f2ed377f48
@ -40,7 +40,7 @@
|
||||
#define CBZ_T_MUL(x,y) ((((x) >> 3) * ((y) >> 3)) >> 12)
|
||||
#define CBZ_T_POW2(x) CBZ_T_MUL (x, x)
|
||||
#define CBZ_T_POW3(x) CBZ_T_MUL (CBZ_T_POW2 (x), x)
|
||||
#define CBZ_T_DIV(x,y) ((((x) << 9)/(y)) << 9)
|
||||
#define CBZ_T_DIV(x,y) ((((x) << 9) / (y)) << 9)
|
||||
|
||||
/*
|
||||
* Constants for sampling of the bezier
|
||||
@ -64,18 +64,18 @@ struct _MetaBezier
|
||||
* bezier coefficients -- these are calculated using multiplication and
|
||||
* addition from integer input, so these are also integers
|
||||
*/
|
||||
gint ax;
|
||||
gint bx;
|
||||
gint cx;
|
||||
gint dx;
|
||||
int ax;
|
||||
int bx;
|
||||
int cx;
|
||||
int dx;
|
||||
|
||||
gint ay;
|
||||
gint by;
|
||||
gint cy;
|
||||
gint dy;
|
||||
int ay;
|
||||
int by;
|
||||
int cy;
|
||||
int dy;
|
||||
|
||||
/* length of the bezier */
|
||||
guint length;
|
||||
unsigned int length;
|
||||
};
|
||||
|
||||
MetaBezier *
|
||||
@ -93,25 +93,27 @@ meta_bezier_free (MetaBezier * b)
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
meta_bezier_t2x (const MetaBezier * b, _FixedT t)
|
||||
static int
|
||||
meta_bezier_t2x (const MetaBezier *b,
|
||||
_FixedT t)
|
||||
{
|
||||
/*
|
||||
* NB -- the int coefficients can be at most 8192 for the multiplication
|
||||
* to work in this fashion due to the limits of the 14.18 fixed.
|
||||
*/
|
||||
return ((b->ax*CBZ_T_POW3(t) + b->bx*CBZ_T_POW2(t) + b->cx*t) >> CBZ_T_Q)
|
||||
return ((b->ax * CBZ_T_POW3 (t) + b->bx * CBZ_T_POW2 (t) + b->cx * t) >> CBZ_T_Q)
|
||||
+ b->dx;
|
||||
}
|
||||
|
||||
static gint
|
||||
meta_bezier_t2y (const MetaBezier * b, _FixedT t)
|
||||
static int
|
||||
meta_bezier_t2y (const MetaBezier *b,
|
||||
_FixedT t)
|
||||
{
|
||||
/*
|
||||
* NB -- the int coefficients can be at most 8192 for the multiplication
|
||||
* to work in this fashion due to the limits of the 14.18 fixed.
|
||||
*/
|
||||
return ((b->ay*CBZ_T_POW3(t) + b->by*CBZ_T_POW2(t) + b->cy*t) >> CBZ_T_Q)
|
||||
return ((b->ay * CBZ_T_POW3 (t) + b->by * CBZ_T_POW2 (t) + b->cy * t) >> CBZ_T_Q)
|
||||
+ b->dy;
|
||||
}
|
||||
|
||||
@ -230,7 +232,7 @@ meta_bezier_init (MetaBezier *b,
|
||||
int i;
|
||||
int xp = x_0;
|
||||
int yp = y_0;
|
||||
_FixedT length [CBZ_T_SAMPLES + 1];
|
||||
_FixedT length[CBZ_T_SAMPLES + 1];
|
||||
|
||||
#if 0
|
||||
g_debug ("Initializing bezier at {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",
|
||||
@ -277,9 +279,9 @@ meta_bezier_init (MetaBezier *b,
|
||||
int x = meta_bezier_t2x (b, t);
|
||||
int y = meta_bezier_t2y (b, t);
|
||||
|
||||
guint l = sqrti ((y - yp)*(y - yp) + (x - xp)*(x - xp));
|
||||
unsigned int l = sqrti ((y - yp) * (y - yp) + (x - xp) * (x - xp));
|
||||
|
||||
l += length[i-1];
|
||||
l += length[i - 1];
|
||||
|
||||
length[i] = l;
|
||||
|
||||
|
Reference in New Issue
Block a user