- unsigned gw=(fill_x ? geom.w : width);
- unsigned gh=(fill_y ? geom.h : height);
- align.apply(geom, gw, gh);
- graphic[state]->render(gw, gh);
+ if(!graphic[state] || !graphic[state]->get_texture())
+ return;
+
+ Geometry rgeom = geom;
+ align.apply(rgeom, parent, margin);
+ GL::MeshBuilder bld(cache.create_mesh(*this, *graphic[state]->get_texture()));
+ bld.transform(GL::Matrix::translation(rgeom.x, rgeom.y, 0));
+ graphic[state]->build(rgeom.w, rgeom.h, bld);