draw a checkerboard stencil clipping mask initially

This commit is contained in:
Konstantin Käfer
2014-02-26 12:24:17 +01:00
parent 70ec13e302
commit 8d68bd73e7
5 changed files with 90 additions and 78 deletions

View File

@@ -414,10 +414,26 @@ bool Map::render() {
painter.clear();
painter.changeMatrix();
// First, update all tile matrices with the new transform and render into
// the stencil buffer.
uint8_t i = 1;
painter.prepareClippingMask();
for (Tile::Ptr& tile : tiles) {
assert(tile);
if (tile->state == Tile::ready) {
painter.changeMatrix(tile->id);
// The position matrix.
transform.matrixFor(tile->matrix, tile->id);
matrix::multiply(tile->matrix, painter.projMatrix, tile->matrix);
tile->clip_id = i++;
painter.drawClippingMask(tile->matrix, tile->clip_id);
}
}
painter.finishClippingMask();
for (Tile::Ptr& tile : tiles) {
if (tile->state == Tile::ready) {
painter.render(tile);
}
}