Files
MapLibreParticleLab/src/mln/tile/raster_tile_worker.cpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

28 lines
908 B
C++

#include <mln/tile/raster_tile_worker.hpp>
#include <mln/tile/raster_tile.hpp>
#include <mln/renderer/buckets/raster_bucket.hpp>
#include <mln/actor/actor.hpp>
#include <mln/util/premultiply.hpp>
namespace mln {
RasterTileWorker::RasterTileWorker(const ActorRef<RasterTileWorker>&, ActorRef<RasterTile> parent_)
: parent(std::move(parent_)) {}
void RasterTileWorker::parse(const std::shared_ptr<const std::string>& data, uint64_t correlationID) {
if (!data) {
parent.invoke(&RasterTile::onParsed, nullptr,
correlationID); // No data; empty tile.
return;
}
try {
auto bucket = std::make_unique<RasterBucket>(decodeImage(*data));
parent.invoke(&RasterTile::onParsed, std::move(bucket), correlationID);
} catch (...) {
parent.invoke(&RasterTile::onError, std::current_exception(), correlationID);
}
}
} // namespace mln