Merge pull request #722 from emersion/matrix-redesign

Matrix redesign
This commit is contained in:
Drew DeVault 2018-03-17 15:22:00 -04:00 committed by GitHub
commit 1956d3cedb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 334 additions and 468 deletions

View file

@ -3,7 +3,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <wlr/render/matrix.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_wl_shell.h>
@ -287,17 +287,17 @@ static void render_surface(struct wlr_surface *surface, double lx, double ly,
goto damage_finish;
}
float matrix[16];
float matrix[9];
enum wl_output_transform transform =
wlr_output_transform_invert(surface->current->transform);
wlr_matrix_project_box(&matrix, &box, transform, rotation,
&output->wlr_output->transform_matrix);
wlr_matrix_project_box(matrix, &box, transform, rotation,
output->wlr_output->transform_matrix);
int nrects;
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects);
for (int i = 0; i < nrects; ++i) {
scissor_output(output, &rects[i]);
wlr_render_with_matrix(renderer, surface->texture, &matrix, data->alpha);
wlr_render_texture_with_matrix(renderer, surface->texture, matrix, data->alpha);
}
damage_finish:
@ -353,9 +353,9 @@ static void render_decorations(struct roots_view *view,
goto damage_finish;
}
float matrix[16];
wlr_matrix_project_box(&matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL,
view->rotation, &output->wlr_output->transform_matrix);
float matrix[9];
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL,
view->rotation, output->wlr_output->transform_matrix);
float color[] = { 0.2, 0.2, 0.2, view->alpha };
int nrects;
@ -363,7 +363,7 @@ static void render_decorations(struct roots_view *view,
pixman_region32_rectangles(&damage, &nrects);
for (int i = 0; i < nrects; ++i) {
scissor_output(output, &rects[i]);
wlr_render_colored_quad(renderer, &color, &matrix);
wlr_render_colored_quad(renderer, color, matrix);
}
damage_finish:
@ -490,7 +490,7 @@ static void render_output(struct roots_output *output) {
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects);
for (int i = 0; i < nrects; ++i) {
scissor_output(output, &rects[i]);
wlr_renderer_clear(renderer, &clear_color);
wlr_renderer_clear(renderer, clear_color);
}
// If a view is fullscreen on this output, render it