Files
MapLibreParticleLab/src/mbgl/map/raster_tile_data.cpp
Thiago Marcos P. Santos 41d619771e Make the state attribute private
Also add a virtual setState() method to give subclasses a chance
to intercept the change of state. This will be used by VectorTileData
to release resources when the TileData becomes immutable.
2015-05-13 09:58:19 +02:00

32 lines
759 B
C++

#include <mbgl/map/raster_tile_data.hpp>
#include <mbgl/style/style.hpp>
using namespace mbgl;
RasterTileData::RasterTileData(const TileID& id_, TexturePool &texturePool,
const SourceInfo &source_)
: TileData(id_, source_), bucket(texturePool, layout) {
}
RasterTileData::~RasterTileData() {
// Cancel in most derived class destructor so that worker tasks are joined before
// any member data goes away.
cancel();
}
void RasterTileData::parse() {
if (getState() != State::loaded) {
return;
}
if (bucket.setImage(data)) {
setState(State::parsed);
} else {
setState(State::invalid);
}
}
Bucket* RasterTileData::getBucket(StyleLayer const&) {
return &bucket;
}