aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authornyorain <nyorain@gmail.com>2017-08-08 18:02:14 +0200
committernyorain <nyorain@gmail.com>2017-08-08 18:25:16 +0200
commite167f41fde7532ca453a9a70ad1e3f27d7177071 (patch)
treefb4f62dc4fcd4017db8695fc99a0e7ade8d6d80b /examples
parentafd058b754e568728fbc7e2e34651dab9a8a827f (diff)
Rename wlr_surface -> wlr_texture; attach -> upload
Diffstat (limited to 'examples')
-rw-r--r--examples/compositor/main.c8
-rw-r--r--examples/compositor/wl_compositor.c20
-rw-r--r--examples/rotation.c10
-rw-r--r--examples/touch.c10
4 files changed, 24 insertions, 24 deletions
diff --git a/examples/compositor/main.c b/examples/compositor/main.c
index c618961d..6afdb391 100644
--- a/examples/compositor/main.c
+++ b/examples/compositor/main.c
@@ -32,11 +32,11 @@ void handle_output_frame(struct output_state *output, struct timespec *ts) {
struct wl_resource *_res;
float matrix[16];
wl_list_for_each(_res, &sample->compositor.surfaces, link) {
- struct wlr_surface *surface = wl_resource_get_user_data(_res);
- if (surface->valid) {
- wlr_surface_get_matrix(surface, &matrix,
+ struct wlr_texture *texture = wl_resource_get_user_data(_res);
+ if (texture->valid) {
+ wlr_texture_get_matrix(texture, &matrix,
&wlr_output->transform_matrix, 200, 200);
- wlr_render_with_matrix(sample->renderer, surface, &matrix);
+ wlr_render_with_matrix(sample->renderer, texture, &matrix);
}
}
diff --git a/examples/compositor/wl_compositor.c b/examples/compositor/wl_compositor.c
index 52fc0e00..03a1aa7e 100644
--- a/examples/compositor/wl_compositor.c
+++ b/examples/compositor/wl_compositor.c
@@ -10,10 +10,10 @@ static void surface_destroy(struct wl_client *client, struct wl_resource *resour
static void surface_attach(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *buffer_resource, int32_t sx, int32_t sy) {
- struct wlr_surface *surface = wl_resource_get_user_data(resource);
+ struct wlr_texture *texture = wl_resource_get_user_data(resource);
struct wl_shm_buffer *buffer = wl_shm_buffer_get(buffer_resource);
uint32_t format = wl_shm_buffer_get_format(buffer);
- wlr_surface_attach_shm(surface, format, buffer);
+ wlr_texture_upload_shm(texture, format, buffer);
}
static void surface_damage(struct wl_client *client,
@@ -78,13 +78,13 @@ struct wl_surface_interface surface_interface = {
};
static void destroy_surface(struct wl_resource *resource) {
- struct wlr_surface *surface = wl_resource_get_user_data(resource);
- wlr_surface_destroy(surface);
+ struct wlr_texture *surface = wl_resource_get_user_data(resource);
+ wlr_texture_destroy(surface);
}
static void destroy_surface_listener(struct wl_listener *listener, void *data) {
struct wl_compositor_state *state;
- struct wlr_surface *surface = data;
+ struct wlr_texture *surface = data;
state = wl_container_of(listener, state, destroy_surface_listener);
struct wl_resource *res = NULL;
@@ -101,13 +101,13 @@ static void wl_compositor_create_surface(struct wl_client *client,
struct wl_compositor_state *state = wl_resource_get_user_data(resource);
struct wl_resource *surface_resource = wl_resource_create(client,
&wl_surface_interface, wl_resource_get_version(resource), id);
- struct wlr_surface *surface = wlr_render_surface_init(state->renderer);
- surface->resource = surface_resource;
+ struct wlr_texture *texture = wlr_render_texture_init(state->renderer);
+ texture->resource = surface_resource;
wl_resource_set_implementation(surface_resource, &surface_interface,
- surface, destroy_surface);
- wl_resource_set_user_data(surface_resource, surface);
+ texture, destroy_surface);
+ wl_resource_set_user_data(surface_resource, texture);
wl_list_insert(&state->surfaces, wl_resource_get_link(surface_resource));
- wl_signal_add(&surface->destroy_signal, &state->destroy_surface_listener);
+ wl_signal_add(&texture->destroy_signal, &state->destroy_surface_listener);
}
static void wl_compositor_create_region(struct wl_client *client,
diff --git a/examples/rotation.c b/examples/rotation.c
index bcf855d9..34994e04 100644
--- a/examples/rotation.c
+++ b/examples/rotation.c
@@ -23,7 +23,7 @@
struct sample_state {
struct wl_list config;
struct wlr_renderer *renderer;
- struct wlr_surface *cat_texture;
+ struct wlr_texture *cat_texture;
};
struct output_data {
@@ -52,7 +52,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
float matrix[16];
for (int y = -128 + (int)odata->y_offs; y < height; y += 128) {
for (int x = -128 + (int)odata->x_offs; x < width; x += 128) {
- wlr_surface_get_matrix(sample->cat_texture, &matrix,
+ wlr_texture_get_matrix(sample->cat_texture, &matrix,
&wlr_output->transform_matrix, x, y);
wlr_render_with_matrix(sample->renderer,
sample->cat_texture, &matrix);
@@ -205,13 +205,13 @@ int main(int argc, char *argv[]) {
compositor_init(&compositor);
state.renderer = wlr_gles2_renderer_init();
- state.cat_texture = wlr_render_surface_init(state.renderer);
- wlr_surface_attach_pixels(state.cat_texture, WL_SHM_FORMAT_ABGR8888,
+ state.cat_texture = wlr_render_texture_init(state.renderer);
+ wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ABGR8888,
cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
compositor_run(&compositor);
- wlr_surface_destroy(state.cat_texture);
+ wlr_texture_destroy(state.cat_texture);
wlr_renderer_destroy(state.renderer);
struct output_config *ptr, *tmp;
diff --git a/examples/touch.c b/examples/touch.c
index 15ad9d49..76b92ad2 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -22,7 +22,7 @@
struct sample_state {
struct wlr_renderer *renderer;
- struct wlr_surface *cat_texture;
+ struct wlr_texture *cat_texture;
list_t *touch_points;
};
@@ -45,7 +45,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
float matrix[16];
for (size_t i = 0; i < sample->touch_points->length; ++i) {
struct touch_point *p = sample->touch_points->items[i];
- wlr_surface_get_matrix(sample->cat_texture, &matrix,
+ wlr_texture_get_matrix(sample->cat_texture, &matrix,
&wlr_output->transform_matrix,
(int)(p->x * width) - sample->cat_texture->width / 2,
(int)(p->y * height) - sample->cat_texture->height / 2);
@@ -105,12 +105,12 @@ int main(int argc, char *argv[]) {
compositor_init(&compositor);
state.renderer = wlr_gles2_renderer_init();
- state.cat_texture = wlr_render_surface_init(state.renderer);
- wlr_surface_attach_pixels(state.cat_texture, WL_SHM_FORMAT_ARGB8888,
+ state.cat_texture = wlr_render_texture_init(state.renderer);
+ wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ARGB8888,
cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
compositor_run(&compositor);
- wlr_surface_destroy(state.cat_texture);
+ wlr_texture_destroy(state.cat_texture);
wlr_renderer_destroy(state.renderer);
}