Add first wlr_surface example implementation

This commit is contained in:
nyorain 2017-08-09 15:33:30 +02:00
parent 6345d6deed
commit 8473c3955c
5 changed files with 155 additions and 90 deletions

View file

@ -14,6 +14,7 @@
#include <wlr/util/log.h>
#include "shared.h"
#include "compositor.h"
#include "wlr_surface.h"
struct sample_state {
struct wlr_renderer *renderer;
@ -32,11 +33,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_texture *texture = wl_resource_get_user_data(_res);
if (texture->valid) {
wlr_texture_get_matrix(texture, &matrix,
struct wlr_surface *surface = wl_resource_get_user_data(_res);
if (surface->texture->valid) {
wlr_texture_get_matrix(surface->texture, &matrix,
&wlr_output->transform_matrix, 200, 200);
wlr_render_with_matrix(sample->renderer, texture, &matrix);
wlr_render_with_matrix(sample->renderer, surface->texture, &matrix);
}
}