diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-05-09 18:10:28 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-05-09 18:10:28 +0200 |
commit | 0bfd7b0f430d51dd5661d69876ac5294616d128f (patch) | |
tree | 0a1b706049246a4152dec605b8193b223b81d170 /src/map/raster_tile_data.cpp | |
parent | 70a7ba81f33d88991d21534b68600d470ad2b798 (diff) | |
download | qtlocation-mapboxgl-0bfd7b0f430d51dd5661d69876ac5294616d128f.tar.gz |
Calculate clip IDs with a huffman prefix tree
This changes the clip IDs from sequential to a huffman prefix tree, meaning that
parent tiles share the same prefix with child tiles (but are shorter). This allows
us to use the same checkerboard pattern to draw all tiles.
TODO:
- make sure we're not overflowing the 8 bit limit of the stencil buffer
- draw all checkerboard fields at the same time, with one draw call
- fix raster drawing (fading, clipping)
refs #132
Diffstat (limited to 'src/map/raster_tile_data.cpp')
-rw-r--r-- | src/map/raster_tile_data.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/map/raster_tile_data.cpp b/src/map/raster_tile_data.cpp new file mode 100644 index 0000000000..bf3999637a --- /dev/null +++ b/src/map/raster_tile_data.cpp @@ -0,0 +1,30 @@ +#include <llmr/map/map.hpp> +#include <llmr/map/raster_tile_data.hpp> +#include <llmr/style/layer_description.hpp> + +using namespace llmr; + + +RasterTileData::RasterTileData(Tile::ID id, Map &map, const std::string url) + : TileData(id, map, url), + bucket(map.getTexturepool()) { +} + +RasterTileData::~RasterTileData() { +} + +void RasterTileData::parse() { + if (state != State::loaded) { + return; + } + + if (bucket.setImage(data)) { + state = State::parsed; + } else { + state = State::invalid; + } +} + +void RasterTileData::render(Painter &painter, const LayerDescription& layer_desc) { + bucket.render(painter, layer_desc.name, id); +} |