mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
render: drop legacy rendering API
This commit is contained in:
parent
b2aac3390d
commit
41494244df
3 changed files with 2 additions and 117 deletions
|
@ -25,13 +25,6 @@ struct wlr_renderer_impl {
|
|||
bool (*begin)(struct wlr_renderer *renderer, uint32_t width,
|
||||
uint32_t height);
|
||||
void (*end)(struct wlr_renderer *renderer);
|
||||
void (*clear)(struct wlr_renderer *renderer, const float color[static 4]);
|
||||
void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box);
|
||||
bool (*render_subtexture_with_matrix)(struct wlr_renderer *renderer,
|
||||
struct wlr_texture *texture, const struct wlr_fbox *box,
|
||||
const float matrix[static 9], float alpha);
|
||||
void (*render_quad_with_matrix)(struct wlr_renderer *renderer,
|
||||
const float color[static 4], const float matrix[static 9]);
|
||||
const uint32_t *(*get_shm_texture_formats)(
|
||||
struct wlr_renderer *renderer, size_t *len);
|
||||
const struct wlr_drm_format_set *(*get_dmabuf_texture_formats)(
|
||||
|
|
|
@ -72,43 +72,7 @@ bool wlr_renderer_begin_with_buffer(struct wlr_renderer *r,
|
|||
* End a render pass.
|
||||
*/
|
||||
void wlr_renderer_end(struct wlr_renderer *r);
|
||||
/**
|
||||
* Clear the viewport with the provided color.
|
||||
*/
|
||||
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
|
||||
* box.
|
||||
*/
|
||||
void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box);
|
||||
/**
|
||||
* Renders the requested texture.
|
||||
*/
|
||||
bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
|
||||
const float projection[static 9], int x, int y, float alpha);
|
||||
/**
|
||||
* Renders the requested texture using the provided matrix.
|
||||
*/
|
||||
bool wlr_render_texture_with_matrix(struct wlr_renderer *r,
|
||||
struct wlr_texture *texture, const float matrix[static 9], float alpha);
|
||||
/**
|
||||
* Renders the requested texture using the provided matrix, after cropping it
|
||||
* to the provided rectangle.
|
||||
*/
|
||||
bool wlr_render_subtexture_with_matrix(struct wlr_renderer *r,
|
||||
struct wlr_texture *texture, const struct wlr_fbox *box,
|
||||
const float matrix[static 9], float alpha);
|
||||
/**
|
||||
* Renders a solid rectangle in the specified color.
|
||||
*/
|
||||
void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,
|
||||
const float color[static 4], const float projection[static 9]);
|
||||
/**
|
||||
* Renders a solid quadrangle in the specified color with the specified matrix.
|
||||
*/
|
||||
void wlr_render_quad_with_matrix(struct wlr_renderer *r,
|
||||
const float color[static 4], const float matrix[static 9]);
|
||||
|
||||
/**
|
||||
* Get the shared-memory formats supporting import usage. Buffers allocated
|
||||
* with a format from this list may be imported via wlr_texture_from_pixels().
|
||||
|
|
|
@ -33,13 +33,7 @@
|
|||
|
||||
void wlr_renderer_init(struct wlr_renderer *renderer,
|
||||
const struct wlr_renderer_impl *impl) {
|
||||
if (!impl->begin_buffer_pass) {
|
||||
assert(impl->begin);
|
||||
assert(impl->clear);
|
||||
assert(impl->scissor);
|
||||
assert(impl->render_subtexture_with_matrix);
|
||||
assert(impl->render_quad_with_matrix);
|
||||
}
|
||||
assert(impl->begin_buffer_pass);
|
||||
assert(impl->get_shm_texture_formats);
|
||||
assert(impl->get_render_buffer_caps);
|
||||
|
||||
|
@ -114,72 +108,6 @@ void wlr_renderer_end(struct wlr_renderer *r) {
|
|||
}
|
||||
}
|
||||
|
||||
void wlr_renderer_clear(struct wlr_renderer *r, const float color[static 4]) {
|
||||
assert(r->rendering);
|
||||
r->impl->clear(r, color);
|
||||
}
|
||||
|
||||
void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box) {
|
||||
assert(r->rendering);
|
||||
r->impl->scissor(r, box);
|
||||
}
|
||||
|
||||
bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
|
||||
const float projection[static 9], int x, int y, float alpha) {
|
||||
struct wlr_box box = {
|
||||
.x = x,
|
||||
.y = y,
|
||||
.width = texture->width,
|
||||
.height = texture->height,
|
||||
};
|
||||
|
||||
float matrix[9];
|
||||
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
|
||||
projection);
|
||||
|
||||
return wlr_render_texture_with_matrix(r, texture, matrix, alpha);
|
||||
}
|
||||
|
||||
bool wlr_render_texture_with_matrix(struct wlr_renderer *r,
|
||||
struct wlr_texture *texture, const float matrix[static 9],
|
||||
float alpha) {
|
||||
struct wlr_fbox box = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = texture->width,
|
||||
.height = texture->height,
|
||||
};
|
||||
return wlr_render_subtexture_with_matrix(r, texture, &box, matrix, alpha);
|
||||
}
|
||||
|
||||
bool wlr_render_subtexture_with_matrix(struct wlr_renderer *r,
|
||||
struct wlr_texture *texture, const struct wlr_fbox *box,
|
||||
const float matrix[static 9], float alpha) {
|
||||
assert(r->rendering);
|
||||
assert(texture->renderer == r);
|
||||
return r->impl->render_subtexture_with_matrix(r, texture,
|
||||
box, matrix, alpha);
|
||||
}
|
||||
|
||||
void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,
|
||||
const float color[static 4], const float projection[static 9]) {
|
||||
if (box->width == 0 || box->height == 0) {
|
||||
return;
|
||||
}
|
||||
assert(box->width > 0 && box->height > 0);
|
||||
float matrix[9];
|
||||
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
|
||||
projection);
|
||||
|
||||
wlr_render_quad_with_matrix(r, color, matrix);
|
||||
}
|
||||
|
||||
void wlr_render_quad_with_matrix(struct wlr_renderer *r,
|
||||
const float color[static 4], const float matrix[static 9]) {
|
||||
assert(r->rendering);
|
||||
r->impl->render_quad_with_matrix(r, color, matrix);
|
||||
}
|
||||
|
||||
const uint32_t *wlr_renderer_get_shm_texture_formats(struct wlr_renderer *r,
|
||||
size_t *len) {
|
||||
return r->impl->get_shm_texture_formats(r, len);
|
||||
|
|
Loading…
Reference in a new issue