From d9911e35635ded433ed1e56bb88dbba2726aac1b Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Fri, 23 Jun 2017 14:27:55 +0200 Subject: [PATCH] main: Reset layout on stratup; bottom and top layer layout * When started, layout is cleared, that is layers will be removed and screen render order reset * Layers 100 and 1000 are created, layer 1000 s the top layer. * Add layers to screen * C++-ification of some cumbersome direct-pointer accesses. Signed-off-by: Marcus Fritzsch --- src/main.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c575615..d49c0cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,26 +71,33 @@ int check_events(struct wl::display *d, struct conn *c, int fd) { } void init_layout(struct conn &c) { - struct wl::output &o = *c.outputs.begin()->get(); - struct genivi::screen &s = *c.c->screens.begin()->second; + auto &o = c.outputs.front(); + auto &s = c.c->screens.begin()->second; auto &layers = c.c->layers; // XXX: Write output dimensions to ivi controller... - c.c->output_size = genivi::size{uint32_t(o.width), uint32_t(o.height)}; + c.c->output_size = genivi::size{uint32_t(o->width), uint32_t(o->height)}; + + // Clear scene + layers.clear(); + + // Clear screen + s->clear(); // Setup our dummy scene... - if (layers.find(100) == layers.end()) { - logdebug("Creating layer 100 with output dimensions (%ux%u)", o.width, o.height); - c.c->layer_create(100, o.width, o.height); - } + c.c->layer_create(100, 0, 0); // bottom layer, anything else + c.c->layer_create(1000, 0, 0); // top layer, mandelbrot - struct genivi::layer &l = *c.c->layers[100].get(); + auto &l100 = c.c->layers[100]; + auto &l1k = c.c->layers[1000]; - l.set_destination_rectangle(0, 0, o.width, o.height); - s.clear(); + // Set layers fullscreen + l100->set_destination_rectangle(0, 0, o->width, o->height); + l1k->set_destination_rectangle(0, 0, o->width, o->height); - logdebug("Add layer 100 to screen %u", s.id); - s.add_layer(&l); + // Add layers to screen + s->add_layer(l100.get()); + s->add_layer(l1k.get()); c.c->commit_changes(); // Note: this does not flush the display! -- 2.16.6