mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-22 07:02:28 +00:00
wlr_texture: Expose owning renderer
This commit is contained in:
parent
f103dc74d8
commit
db0e962368
@ -59,7 +59,7 @@ struct wlr_texture_impl {
|
||||
void (*destroy)(struct wlr_texture *texture);
|
||||
};
|
||||
|
||||
void wlr_texture_init(struct wlr_texture *texture,
|
||||
void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *rendener,
|
||||
const struct wlr_texture_impl *impl, uint32_t width, uint32_t height);
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,8 @@ struct wlr_texture_impl;
|
||||
struct wlr_texture {
|
||||
const struct wlr_texture_impl *impl;
|
||||
uint32_t width, height;
|
||||
|
||||
struct wlr_renderer *renderer;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,8 @@ static struct wlr_gles2_texture *gles2_texture_create(
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
|
||||
wlr_texture_init(&texture->wlr_texture, &renderer->wlr_renderer,
|
||||
&texture_impl, width, height);
|
||||
texture->renderer = renderer;
|
||||
wl_list_insert(&renderer->textures, &texture->link);
|
||||
return texture;
|
||||
|
@ -354,8 +354,8 @@ static struct wlr_pixman_texture *pixman_texture_create(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
|
||||
texture->renderer = renderer;
|
||||
wlr_texture_init(&texture->wlr_texture, &renderer->wlr_renderer,
|
||||
&texture_impl, width, height);
|
||||
|
||||
texture->format_info = drm_get_pixel_format_info(drm_format);
|
||||
if (!texture->format_info) {
|
||||
|
@ -252,7 +252,8 @@ static struct wlr_vk_texture *vulkan_texture_create(
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
|
||||
wlr_texture_init(&texture->wlr_texture, &renderer->wlr_renderer,
|
||||
&texture_impl, width, height);
|
||||
texture->renderer = renderer;
|
||||
wl_list_insert(&renderer->textures, &texture->link);
|
||||
return texture;
|
||||
|
@ -153,6 +153,7 @@ 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);
|
||||
}
|
||||
|
@ -6,9 +6,12 @@
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
#include "types/wlr_buffer.h"
|
||||
|
||||
void wlr_texture_init(struct wlr_texture *texture,
|
||||
void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *renderer,
|
||||
const struct wlr_texture_impl *impl, uint32_t width, uint32_t height) {
|
||||
assert(renderer);
|
||||
|
||||
memset(texture, 0, sizeof(*texture));
|
||||
texture->renderer = renderer;
|
||||
texture->impl = impl;
|
||||
texture->width = width;
|
||||
texture->height = height;
|
||||
|
Loading…
Reference in New Issue
Block a user