rootston: Add alpha channel to views
This commit is contained in:
parent
d08792bfff
commit
e2ea1ebe48
|
@ -83,6 +83,7 @@ struct roots_view {
|
||||||
double x, y;
|
double x, y;
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
float rotation;
|
float rotation;
|
||||||
|
float alpha;
|
||||||
|
|
||||||
bool decorated;
|
bool decorated;
|
||||||
int border_width;
|
int border_width;
|
||||||
|
@ -94,6 +95,7 @@ struct roots_view {
|
||||||
double x, y;
|
double x, y;
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
float rotation;
|
float rotation;
|
||||||
|
float alpha;
|
||||||
} saved;
|
} saved;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -191,6 +193,7 @@ void view_maximize(struct roots_view *view, bool maximized);
|
||||||
void view_set_fullscreen(struct roots_view *view, bool fullscreen,
|
void view_set_fullscreen(struct roots_view *view, bool fullscreen,
|
||||||
struct wlr_output *output);
|
struct wlr_output *output);
|
||||||
void view_rotate(struct roots_view *view, float rotation);
|
void view_rotate(struct roots_view *view, float rotation);
|
||||||
|
void view_cycle_alpha(struct roots_view *view);
|
||||||
void view_close(struct roots_view *view);
|
void view_close(struct roots_view *view);
|
||||||
bool view_center(struct roots_view *view);
|
bool view_center(struct roots_view *view);
|
||||||
void view_setup(struct roots_view *view);
|
void view_setup(struct roots_view *view);
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
|
|
||||||
struct roots_view *view_create() {
|
struct roots_view *view_create() {
|
||||||
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
||||||
|
if (!view) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
view->alpha = 1.0f;
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,7 @@ struct render_data {
|
||||||
struct roots_output *output;
|
struct roots_output *output;
|
||||||
struct timespec *when;
|
struct timespec *when;
|
||||||
pixman_region32_t *damage;
|
pixman_region32_t *damage;
|
||||||
|
float alpha;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -296,7 +297,7 @@ static void render_surface(struct wlr_surface *surface, double lx, double ly,
|
||||||
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects);
|
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects);
|
||||||
for (int i = 0; i < nrects; ++i) {
|
for (int i = 0; i < nrects; ++i) {
|
||||||
scissor_output(output, &rects[i]);
|
scissor_output(output, &rects[i]);
|
||||||
wlr_render_with_matrix(renderer, surface->texture, &matrix, 1.0f);
|
wlr_render_with_matrix(renderer, surface->texture, &matrix, data->alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
damage_finish:
|
damage_finish:
|
||||||
|
@ -376,6 +377,7 @@ static void render_view(struct roots_view *view, struct render_data *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->alpha = view->alpha;
|
||||||
render_decorations(view, data);
|
render_decorations(view, data);
|
||||||
view_for_each_surface(view, render_surface, data);
|
view_for_each_surface(view, render_surface, data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue