Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
28 lines
908 B
C++
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
|