diff options
author | emersion <contact@emersion.fr> | 2018-03-15 11:10:56 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-03-15 11:10:56 +0100 |
commit | d26b67cb06509fb39d9ed473a5d27b1f241ff635 (patch) | |
tree | 704c2732b6a3ce247dce8510eed9e629a35ce828 /include | |
parent | b6a3f240c7621d1ebb5774fcdf7784d976500ee1 (diff) |
matrix: unify API, don't use array pointers
Diffstat (limited to 'include')
-rw-r--r-- | include/wlr/render.h | 12 | ||||
-rw-r--r-- | include/wlr/render/interface.h | 13 | ||||
-rw-r--r-- | include/wlr/types/wlr_matrix.h | 21 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 7 |
4 files changed, 28 insertions, 25 deletions
diff --git a/include/wlr/render.h b/include/wlr/render.h index 747603da..50c2dd13 100644 --- a/include/wlr/render.h +++ b/include/wlr/render.h @@ -13,7 +13,7 @@ struct wlr_renderer; void wlr_renderer_begin(struct wlr_renderer *r, struct wlr_output *output); void wlr_renderer_end(struct wlr_renderer *r); -void wlr_renderer_clear(struct wlr_renderer *r, const float (*color)[4]); +void wlr_renderer_clear(struct wlr_renderer *r, const float color[static 4]); /** * Defines a scissor box. Only pixels that lie within the scissor box can be * modified by drawing functions. Providing a NULL `box` disables the scissor @@ -38,18 +38,18 @@ struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r); * This will render the texture at <123, 321> with an alpha channel of 0.5. */ bool wlr_render_with_matrix(struct wlr_renderer *r, - struct wlr_texture *texture, const float (*matrix)[16], float alpha); + struct wlr_texture *texture, const float matrix[static 16], float alpha); /** * Renders a solid quad in the specified color. */ void wlr_render_colored_quad(struct wlr_renderer *r, - const float (*color)[4], const float (*matrix)[16]); + const float color[static 4], const float matrix[static 16]); /** * Renders a solid ellipse in the specified color. */ void wlr_render_colored_ellipse(struct wlr_renderer *r, - const float (*color)[4], const float (*matrix)[16]); + const float color[static 4], const float matrix[static 16]); /** * Returns a list of pixel formats supported by this renderer. */ @@ -139,8 +139,8 @@ bool wlr_texture_update_shm(struct wlr_texture *surf, uint32_t format, * width) and [0, height], and the x and y coordinates provided are used as * such. */ -void wlr_texture_get_matrix(struct wlr_texture *texture, - float (*matrix)[16], const float (*projection)[16], int x, int y); +void wlr_texture_get_matrix(struct wlr_texture *texture, float mat[static 16], + const float projection[static 16], int x, int y); /** * Destroys this wlr_texture. */ diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index eda5af1c..4d81bdf9 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -18,15 +18,16 @@ struct wlr_renderer { struct wlr_renderer_impl { void (*begin)(struct wlr_renderer *renderer, struct wlr_output *output); void (*end)(struct wlr_renderer *renderer); - void (*clear)(struct wlr_renderer *renderer, const float (*color)[4]); + void (*clear)(struct wlr_renderer *renderer, const float color[static 4]); void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box); struct wlr_texture *(*texture_create)(struct wlr_renderer *renderer); bool (*render_with_matrix)(struct wlr_renderer *renderer, - struct wlr_texture *texture, const float (*matrix)[16], float alpha); + struct wlr_texture *texture, const float matrix[static 16], + float alpha); void (*render_quad)(struct wlr_renderer *renderer, - const float (*color)[4], const float (*matrix)[16]); + const float color[static 4], const float matrix[static 16]); void (*render_ellipse)(struct wlr_renderer *renderer, - const float (*color)[4], const float (*matrix)[16]); + const float color[static 4], const float matrix[static 16]); const enum wl_shm_format *(*formats)( struct wlr_renderer *renderer, size_t *len); bool (*buffer_is_drm)(struct wlr_renderer *renderer, @@ -58,8 +59,8 @@ struct wlr_texture_impl { struct wl_resource *drm_buf); bool (*upload_eglimage)(struct wlr_texture *texture, EGLImageKHR image, uint32_t width, uint32_t height); - void (*get_matrix)(struct wlr_texture *state, - float (*matrix)[16], const float (*projection)[16], int x, int y); + void (*get_matrix)(struct wlr_texture *state, float mat[static 16], + const float projection[static 16], int x, int y); void (*get_buffer_size)(struct wlr_texture *texture, struct wl_resource *resource, int *width, int *height); void (*bind)(struct wlr_texture *texture); diff --git a/include/wlr/types/wlr_matrix.h b/include/wlr/types/wlr_matrix.h index 498b643c..cf5ad20d 100644 --- a/include/wlr/types/wlr_matrix.h +++ b/include/wlr/types/wlr_matrix.h @@ -4,19 +4,20 @@ #include <stdint.h> #include <wlr/types/wlr_box.h> -void wlr_matrix_identity(float (*output)[16]); -void wlr_matrix_translate(float (*output)[16], float x, float y, float z); -void wlr_matrix_scale(float (*output)[16], float x, float y, float z); -void wlr_matrix_rotate(float (*output)[16], float radians); -void wlr_matrix_mul(const float (*x)[16], const float (*y)[16], float (*product)[16]); +void wlr_matrix_identity(float mat[static 16]); +void wlr_matrix_translate(float mat[static 16], float x, float y, float z); +void wlr_matrix_scale(float mat[static 16], float x, float y, float z); +void wlr_matrix_rotate(float mat[static 16], float radians); +void wlr_matrix_mul(float mat[static 16], const float x[static 16], + const float y[static 16]); enum wl_output_transform; void wlr_matrix_transform(float mat[static 16], - enum wl_output_transform transform); + enum wl_output_transform transform); void wlr_matrix_texture(float mat[static 16], int32_t width, int32_t height, - enum wl_output_transform transform); -void wlr_matrix_project_box(float (*mat)[16], struct wlr_box *box, - enum wl_output_transform transform, float rotation, float - (*projection)[16]); + enum wl_output_transform transform); +void wlr_matrix_project_box(float mat[static 16], const struct wlr_box *box, + enum wl_output_transform transform, float rotation, + const float projection[static 16]); #endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 203345bd..1d4c1f01 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -99,6 +99,7 @@ struct wlr_surface { struct wlr_renderer; struct wlr_surface *wlr_surface_create(struct wl_resource *res, struct wlr_renderer *renderer); + /** * Gets a matrix you can pass into wlr_render_with_matrix to display this * surface. `matrix` is the output matrix, `projection` is the wlr_output @@ -108,9 +109,9 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res, * from 0 to 1 in both dimensions. */ void wlr_surface_get_matrix(struct wlr_surface *surface, - float (*matrix)[16], - const float (*projection)[16], - const float (*transform)[16]); + float mat[static 16], + const float projection[static 16], + const float transform[static 16]); /** |