Move layer_is_visible to layer.c

This commit is contained in:
Simon Ser 2021-02-24 11:40:01 +01:00
parent 470af77869
commit c4ef21af35
3 changed files with 17 additions and 16 deletions

16
alloc.c
View file

@ -344,22 +344,6 @@ bool check_alloc_valid(struct alloc_result *result, struct alloc_step *step)
return true;
}
static bool layer_is_visible(struct liftoff_layer *layer)
{
struct liftoff_layer_property *alpha_prop;
alpha_prop = layer_get_property(layer, "alpha");
if (alpha_prop != NULL && alpha_prop->value == 0) {
return false; /* fully transparent */
}
if (layer->force_composition) {
return true;
} else {
return layer_has_fb(layer);
}
}
bool output_choose_layers(struct liftoff_output *output,
struct alloc_result *result, struct alloc_step *step)
{

View file

@ -91,6 +91,7 @@ bool layer_intersects(struct liftoff_layer *a, struct liftoff_layer *b);
void layer_mark_clean(struct liftoff_layer *layer);
void layer_update_priority(struct liftoff_layer *layer, bool make_current);
bool layer_has_fb(struct liftoff_layer *layer);
bool layer_is_visible(struct liftoff_layer *layer);
struct liftoff_plane *plane_create(struct liftoff_device *device, uint32_t id);
void plane_destroy(struct liftoff_plane *plane);

16
layer.c
View file

@ -177,3 +177,19 @@ bool layer_has_fb(struct liftoff_layer *layer) {
fb_id_prop = layer_get_property(layer, "FB_ID");
return fb_id_prop != NULL && fb_id_prop->value != 0;
}
bool layer_is_visible(struct liftoff_layer *layer)
{
struct liftoff_layer_property *alpha_prop;
alpha_prop = layer_get_property(layer, "alpha");
if (alpha_prop != NULL && alpha_prop->value == 0) {
return false; /* fully transparent */
}
if (layer->force_composition) {
return true;
} else {
return layer_has_fb(layer);
}
}