}
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!