Files
MapLibreParticleLab/src/mbgl/tile/raster_dem_tile_worker.cpp
Bart Louwers 71f6da2722 Add clang-format (#1086)
Co-authored-by: mwilsnd <mwilsnd@gmail.com>
2023-05-01 16:57:37 +02:00

30 lines
1.0 KiB
C++

#include <mbgl/tile/raster_dem_tile_worker.hpp>
#include <mbgl/tile/raster_dem_tile.hpp>
#include <mbgl/renderer/buckets/hillshade_bucket.hpp>
#include <mbgl/actor/actor.hpp>
#include <mbgl/util/premultiply.hpp>
namespace mbgl {
RasterDEMTileWorker::RasterDEMTileWorker(const ActorRef<RasterDEMTileWorker>&, ActorRef<RasterDEMTile> parent_)
: parent(std::move(parent_)) {}
void RasterDEMTileWorker::parse(const std::shared_ptr<const std::string>& data,
uint64_t correlationID,
Tileset::DEMEncoding encoding) {
if (!data) {
parent.invoke(&RasterDEMTile::onParsed, nullptr,
correlationID); // No data; empty tile.
return;
}
try {
auto bucket = std::make_unique<HillshadeBucket>(decodeImage(*data), encoding);
parent.invoke(&RasterDEMTile::onParsed, std::move(bucket), correlationID);
} catch (...) {
parent.invoke(&RasterDEMTile::onError, std::current_exception(), correlationID);
}
}
} // namespace mbgl