weston: Use float instead of GLfloat.
This commit is contained in:
parent
4b3081ae8a
commit
490d02a96d
@ -267,7 +267,7 @@ weston_surface_create(struct weston_compositor *compositor)
|
||||
|
||||
WL_EXPORT void
|
||||
weston_surface_set_color(struct weston_surface *surface,
|
||||
GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
||||
float red, float green, float blue, float alpha)
|
||||
{
|
||||
surface->color[0] = red;
|
||||
surface->color[1] = green;
|
||||
@ -278,7 +278,7 @@ weston_surface_set_color(struct weston_surface *surface,
|
||||
|
||||
WL_EXPORT void
|
||||
weston_surface_to_global_float(struct weston_surface *surface,
|
||||
GLfloat sx, GLfloat sy, GLfloat *x, GLfloat *y)
|
||||
float sx, float sy, float *x, float *y)
|
||||
{
|
||||
if (surface->transform.enabled) {
|
||||
struct weston_vector v = { { sx, sy, 0.0f, 1.0f } };
|
||||
@ -409,15 +409,15 @@ surface_compute_bbox(struct weston_surface *surface, int32_t sx, int32_t sy,
|
||||
int32_t width, int32_t height,
|
||||
pixman_region32_t *bbox)
|
||||
{
|
||||
GLfloat min_x = HUGE_VALF, min_y = HUGE_VALF;
|
||||
GLfloat max_x = -HUGE_VALF, max_y = -HUGE_VALF;
|
||||
float min_x = HUGE_VALF, min_y = HUGE_VALF;
|
||||
float max_x = -HUGE_VALF, max_y = -HUGE_VALF;
|
||||
int32_t s[4][2] = {
|
||||
{ sx, sy },
|
||||
{ sx, sy + height },
|
||||
{ sx + width, sy },
|
||||
{ sx + width, sy + height }
|
||||
};
|
||||
GLfloat int_x, int_y;
|
||||
float int_x, int_y;
|
||||
int i;
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
@ -427,7 +427,7 @@ surface_compute_bbox(struct weston_surface *surface, int32_t sx, int32_t sy,
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
GLfloat x, y;
|
||||
float x, y;
|
||||
weston_surface_to_global_float(surface,
|
||||
s[i][0], s[i][1], &x, &y);
|
||||
if (x < min_x)
|
||||
@ -541,7 +541,7 @@ weston_surface_to_global_fixed(struct weston_surface *surface,
|
||||
wl_fixed_t sx, wl_fixed_t sy,
|
||||
wl_fixed_t *x, wl_fixed_t *y)
|
||||
{
|
||||
GLfloat xf, yf;
|
||||
float xf, yf;
|
||||
|
||||
weston_surface_to_global_float(surface,
|
||||
wl_fixed_to_double(sx),
|
||||
@ -553,7 +553,7 @@ weston_surface_to_global_fixed(struct weston_surface *surface,
|
||||
|
||||
WL_EXPORT void
|
||||
weston_surface_from_global_float(struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y, GLfloat *sx, GLfloat *sy)
|
||||
float x, float y, float *sx, float *sy)
|
||||
{
|
||||
if (surface->transform.enabled) {
|
||||
struct weston_vector v = { { x, y, 0.0f, 1.0f } };
|
||||
@ -582,7 +582,7 @@ weston_surface_from_global_fixed(struct weston_surface *surface,
|
||||
wl_fixed_t x, wl_fixed_t y,
|
||||
wl_fixed_t *sx, wl_fixed_t *sy)
|
||||
{
|
||||
GLfloat sxf, syf;
|
||||
float sxf, syf;
|
||||
|
||||
weston_surface_from_global_float(surface,
|
||||
wl_fixed_to_double(x),
|
||||
@ -596,7 +596,7 @@ WL_EXPORT void
|
||||
weston_surface_from_global(struct weston_surface *surface,
|
||||
int32_t x, int32_t y, int32_t *sx, int32_t *sy)
|
||||
{
|
||||
GLfloat sxf, syf;
|
||||
float sxf, syf;
|
||||
|
||||
weston_surface_from_global_float(surface, x, y, &sxf, &syf);
|
||||
*sx = floorf(sxf);
|
||||
@ -625,7 +625,7 @@ weston_surface_damage(struct weston_surface *surface)
|
||||
|
||||
WL_EXPORT void
|
||||
weston_surface_configure(struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y, int width, int height)
|
||||
float x, float y, int width, int height)
|
||||
{
|
||||
surface->geometry.x = x;
|
||||
surface->geometry.y = y;
|
||||
@ -636,7 +636,7 @@ weston_surface_configure(struct weston_surface *surface,
|
||||
|
||||
WL_EXPORT void
|
||||
weston_surface_set_position(struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y)
|
||||
float x, float y)
|
||||
{
|
||||
surface->geometry.x = x;
|
||||
surface->geometry.y = y;
|
||||
|
@ -410,7 +410,7 @@ struct weston_surface {
|
||||
struct wl_list layer_link;
|
||||
struct weston_shader *shader;
|
||||
GLfloat color[4];
|
||||
GLfloat alpha;
|
||||
float alpha;
|
||||
struct weston_plane *plane;
|
||||
|
||||
/* Surface geometry state, mutable.
|
||||
@ -418,7 +418,7 @@ struct weston_surface {
|
||||
* That includes the transformations referenced from the list.
|
||||
*/
|
||||
struct {
|
||||
GLfloat x, y; /* surface translation on display */
|
||||
float x, y; /* surface translation on display */
|
||||
int32_t width, height;
|
||||
|
||||
/* struct weston_transform */
|
||||
@ -489,11 +489,11 @@ weston_surface_to_global_fixed(struct weston_surface *surface,
|
||||
wl_fixed_t *x, wl_fixed_t *y);
|
||||
void
|
||||
weston_surface_to_global_float(struct weston_surface *surface,
|
||||
GLfloat sx, GLfloat sy, GLfloat *x, GLfloat *y);
|
||||
float sx, float sy, float *x, float *y);
|
||||
|
||||
void
|
||||
weston_surface_from_global_float(struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y, GLfloat *sx, GLfloat *sy);
|
||||
float x, float y, float *sx, float *sy);
|
||||
void
|
||||
weston_surface_from_global(struct weston_surface *surface,
|
||||
int32_t x, int32_t y, int32_t *sx, int32_t *sy);
|
||||
@ -635,14 +635,14 @@ weston_surface_create(struct weston_compositor *compositor);
|
||||
|
||||
void
|
||||
weston_surface_configure(struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y, int width, int height);
|
||||
float x, float y, int width, int height);
|
||||
|
||||
void
|
||||
weston_surface_restack(struct weston_surface *surface, struct wl_list *below);
|
||||
|
||||
void
|
||||
weston_surface_set_position(struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y);
|
||||
float x, float y);
|
||||
|
||||
int
|
||||
weston_surface_is_mapped(struct weston_surface *surface);
|
||||
@ -775,19 +775,19 @@ struct weston_surface_animation;
|
||||
typedef void (*weston_surface_animation_done_func_t)(struct weston_surface_animation *animation, void *data);
|
||||
|
||||
struct weston_surface_animation *
|
||||
weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
|
||||
weston_zoom_run(struct weston_surface *surface, float start, float stop,
|
||||
weston_surface_animation_done_func_t done, void *data);
|
||||
|
||||
struct weston_surface_animation *
|
||||
weston_fade_run(struct weston_surface *surface,
|
||||
weston_surface_animation_done_func_t done, void *data);
|
||||
struct weston_surface_animation *
|
||||
weston_slide_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
|
||||
weston_slide_run(struct weston_surface *surface, float start, float stop,
|
||||
weston_surface_animation_done_func_t done, void *data);
|
||||
|
||||
void
|
||||
weston_surface_set_color(struct weston_surface *surface,
|
||||
GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
float red, float green, float blue, float alpha);
|
||||
|
||||
void
|
||||
weston_surface_destroy(struct weston_surface *surface);
|
||||
|
@ -53,7 +53,7 @@ WL_EXPORT void
|
||||
weston_matrix_multiply(struct weston_matrix *m, const struct weston_matrix *n)
|
||||
{
|
||||
struct weston_matrix tmp;
|
||||
const GLfloat *row, *column;
|
||||
const float *row, *column;
|
||||
div_t d;
|
||||
int i, j;
|
||||
|
||||
@ -69,7 +69,7 @@ weston_matrix_multiply(struct weston_matrix *m, const struct weston_matrix *n)
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
weston_matrix_translate(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
|
||||
weston_matrix_translate(struct weston_matrix *matrix, float x, float y, float z)
|
||||
{
|
||||
struct weston_matrix translate = {
|
||||
{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 }
|
||||
@ -79,7 +79,7 @@ weston_matrix_translate(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfl
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
weston_matrix_scale(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
|
||||
weston_matrix_scale(struct weston_matrix *matrix, float x, float y,float z)
|
||||
{
|
||||
struct weston_matrix scale = {
|
||||
{ x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1 }
|
||||
@ -180,7 +180,7 @@ matrix_invert(double *A, unsigned *p, const struct weston_matrix *matrix)
|
||||
}
|
||||
|
||||
MATRIX_TEST_EXPORT inline void
|
||||
inverse_transform(const double *LU, const unsigned *p, GLfloat *v)
|
||||
inverse_transform(const double *LU, const unsigned *p, float *v)
|
||||
{
|
||||
/* Solve A * x = v, when we have P * A = L * U.
|
||||
* P * A * x = P * v => L * U * x = P * v
|
||||
|
10
src/matrix.h
10
src/matrix.h
@ -25,11 +25,11 @@
|
||||
#define WESTON_MATRIX_H
|
||||
|
||||
struct weston_matrix {
|
||||
GLfloat d[16];
|
||||
float d[16];
|
||||
};
|
||||
|
||||
struct weston_vector {
|
||||
GLfloat f[4];
|
||||
float f[4];
|
||||
};
|
||||
|
||||
void
|
||||
@ -37,10 +37,10 @@ weston_matrix_init(struct weston_matrix *matrix);
|
||||
void
|
||||
weston_matrix_multiply(struct weston_matrix *m, const struct weston_matrix *n);
|
||||
void
|
||||
weston_matrix_scale(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat z);
|
||||
weston_matrix_scale(struct weston_matrix *matrix, float x, float y, float z);
|
||||
void
|
||||
weston_matrix_translate(struct weston_matrix *matrix,
|
||||
GLfloat x, GLfloat y, GLfloat z);
|
||||
float x, float y, float z);
|
||||
void
|
||||
weston_matrix_transform(struct weston_matrix *matrix, struct weston_vector *v);
|
||||
|
||||
@ -55,7 +55,7 @@ int
|
||||
matrix_invert(double *A, unsigned *p, const struct weston_matrix *matrix);
|
||||
|
||||
void
|
||||
inverse_transform(const double *LU, const unsigned *p, GLfloat *v);
|
||||
inverse_transform(const double *LU, const unsigned *p, float *v);
|
||||
|
||||
#else
|
||||
# define MATRIX_TEST_EXPORT static
|
||||
|
26
src/shell.c
26
src/shell.c
@ -220,8 +220,8 @@ struct rotate_grab {
|
||||
struct shell_grab base;
|
||||
struct weston_matrix rotation;
|
||||
struct {
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
float x;
|
||||
float y;
|
||||
} center;
|
||||
};
|
||||
|
||||
@ -1613,7 +1613,7 @@ black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy);
|
||||
static struct weston_surface *
|
||||
create_black_surface(struct weston_compositor *ec,
|
||||
struct weston_surface *fs_surface,
|
||||
GLfloat x, GLfloat y, int w, int h)
|
||||
float x, float y, int w, int h)
|
||||
{
|
||||
struct weston_surface *surface = NULL;
|
||||
|
||||
@ -2458,7 +2458,7 @@ rotate_grab_motion(struct wl_pointer_grab *grab,
|
||||
struct wl_pointer *pointer = grab->pointer;
|
||||
struct shell_surface *shsurf = rotate->base.shsurf;
|
||||
struct weston_surface *surface;
|
||||
GLfloat cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
|
||||
float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
|
||||
|
||||
if (!shsurf)
|
||||
return;
|
||||
@ -2552,8 +2552,8 @@ rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button,
|
||||
(struct weston_surface *) seat->pointer->focus;
|
||||
struct shell_surface *surface;
|
||||
struct rotate_grab *rotate;
|
||||
GLfloat dx, dy;
|
||||
GLfloat r;
|
||||
float dx, dy;
|
||||
float r;
|
||||
|
||||
if (base_surface == NULL)
|
||||
return;
|
||||
@ -2790,8 +2790,8 @@ hide_input_panels(struct wl_listener *listener, void *data)
|
||||
static void
|
||||
center_on_output(struct weston_surface *surface, struct weston_output *output)
|
||||
{
|
||||
GLfloat x = (output->width - surface->buffer->width) / 2;
|
||||
GLfloat y = (output->height - surface->buffer->height) / 2;
|
||||
float x = (output->width - surface->buffer->width) / 2;
|
||||
float y = (output->height - surface->buffer->height) / 2;
|
||||
|
||||
weston_surface_configure(surface, output->x + x, output->y + y,
|
||||
surface->buffer->width,
|
||||
@ -2958,7 +2958,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
|
||||
|
||||
static void
|
||||
configure(struct desktop_shell *shell, struct weston_surface *surface,
|
||||
GLfloat x, GLfloat y, int32_t width, int32_t height)
|
||||
float x, float y, int32_t width, int32_t height)
|
||||
{
|
||||
enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
|
||||
struct shell_surface *shsurf;
|
||||
@ -3017,8 +3017,8 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
|
||||
} else if (type_changed || sx != 0 || sy != 0 ||
|
||||
es->geometry.width != es->buffer->width ||
|
||||
es->geometry.height != es->buffer->height) {
|
||||
GLfloat from_x, from_y;
|
||||
GLfloat to_x, to_y;
|
||||
float from_x, from_y;
|
||||
float to_x, to_y;
|
||||
|
||||
weston_surface_to_global_float(es, 0, 0, &from_x, &from_y);
|
||||
weston_surface_to_global_float(es, sx, sy, &to_x, &to_y);
|
||||
@ -3191,8 +3191,8 @@ static void
|
||||
input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
|
||||
{
|
||||
struct weston_mode *mode = surface->output->current;
|
||||
GLfloat x = (mode->width - surface->buffer->width) / 2;
|
||||
GLfloat y = mode->height - surface->buffer->height;
|
||||
float x = (mode->width - surface->buffer->width) / 2;
|
||||
float y = mode->height - surface->buffer->height;
|
||||
|
||||
/* Don't map the input panel here, wait for
|
||||
* show_input_panels signal. */
|
||||
|
12
src/util.c
12
src/util.c
@ -104,7 +104,7 @@ struct weston_surface_animation {
|
||||
struct weston_spring spring;
|
||||
struct weston_transform transform;
|
||||
struct wl_listener listener;
|
||||
GLfloat start, stop;
|
||||
float start, stop;
|
||||
weston_surface_animation_frame_func_t frame;
|
||||
weston_surface_animation_done_func_t done;
|
||||
void *data;
|
||||
@ -159,7 +159,7 @@ weston_surface_animation_frame(struct weston_animation *base,
|
||||
|
||||
static struct weston_surface_animation *
|
||||
weston_surface_animation_run(struct weston_surface *surface,
|
||||
GLfloat start, GLfloat stop,
|
||||
float start, float stop,
|
||||
weston_surface_animation_frame_func_t frame,
|
||||
weston_surface_animation_done_func_t done,
|
||||
void *data)
|
||||
@ -199,7 +199,7 @@ static void
|
||||
zoom_frame(struct weston_surface_animation *animation)
|
||||
{
|
||||
struct weston_surface *es = animation->surface;
|
||||
GLfloat scale;
|
||||
float scale;
|
||||
|
||||
scale = animation->start +
|
||||
(animation->stop - animation->start) *
|
||||
@ -219,7 +219,7 @@ zoom_frame(struct weston_surface_animation *animation)
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_surface_animation *
|
||||
weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
|
||||
weston_zoom_run(struct weston_surface *surface, float start, float stop,
|
||||
weston_surface_animation_done_func_t done, void *data)
|
||||
{
|
||||
return weston_surface_animation_run(surface, start, stop,
|
||||
@ -248,7 +248,7 @@ weston_fade_run(struct weston_surface *surface,
|
||||
static void
|
||||
slide_frame(struct weston_surface_animation *animation)
|
||||
{
|
||||
GLfloat scale;
|
||||
float scale;
|
||||
|
||||
scale = animation->start +
|
||||
(animation->stop - animation->start) *
|
||||
@ -258,7 +258,7 @@ slide_frame(struct weston_surface_animation *animation)
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_surface_animation *
|
||||
weston_slide_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
|
||||
weston_slide_run(struct weston_surface *surface, float start, float stop,
|
||||
weston_surface_animation_done_func_t done, void *data)
|
||||
{
|
||||
struct weston_surface_animation *animation;
|
||||
|
Loading…
Reference in New Issue
Block a user