#include <stdexcept>
#include <msp/gl/matrix.h>
-#include <msp/gl/transform.h>
+#include <msp/gl/meshbuilder.h>
#include "part.h"
#include "style.h"
#include "table.h"
data[r*columns+c] = t;
}
-void Table::render_special(const Part &part) const
+void Table::rebuild_special(const Part &part, CachedPart &cache)
{
if(part.get_name()=="cells")
{
cgeom.h = geom.h/rows;
cgeom.y = geom.h-cgeom.h;
+ cache.texture = &font.get_texture();
+ cache.clear_mesh();
+
+ GL::MeshBuilder bld(*cache.mesh);
for(unsigned i=0; i<rows; ++i)
{
cgeom.x = 0;
part.get_alignment().apply(rgeom, cgeom, part.get_margin());
- GL::push_matrix();
- GL::translate(rgeom.x, rgeom.y, 0);
- GL::scale_uniform(font_size);
+ GL::MatrixStack::Push _push(bld.matrix());
+ bld.matrix() *= GL::Matrix::translation(rgeom.x, rgeom.y, 0);
+ bld.matrix() *= GL::Matrix::scaling(font_size);
font.draw_string(text);
- GL::pop_matrix();
cgeom.x += cgeom.w;
}