add icon render test

This commit is contained in:
Konstantin Käfer
2014-07-15 18:08:14 -07:00
parent 7810548409
commit 682eaec87c
10 changed files with 72 additions and 13 deletions

View File

@@ -97,6 +97,7 @@ void Map::run() {
// If the map rendering wasn't started asynchronously, we perform one render
// *after* all events have been processed.
if (!async) {
prepare();
render();
}
}

View File

@@ -1,6 +1,7 @@
#include <llmr/map/sprite.hpp>
#include <llmr/map/map.hpp>
#include <llmr/util/raster.hpp>
#include <llmr/platform/log.hpp>
#include <string>
#include <llmr/platform/platform.hpp>
@@ -27,6 +28,8 @@ Sprite::Sprite(Map &map, float pixelRatio)
}
void Sprite::load(const std::string& base_url) {
loaded = false;
url = base_url;
std::shared_ptr<Sprite> sprite = shared_from_this();
std::string suffix = (pixelRatio > 1 ? "@2x" : "");
@@ -53,12 +56,12 @@ void Sprite::load(const std::string& base_url) {
}
void Sprite::complete(std::shared_ptr<Sprite> &sprite) {
if (sprite->raster && sprite->pos.size()) {
const bool raster = bool(sprite->raster);
const bool json = bool(sprite->pos.size());
if (raster && json && !sprite->loaded) {
sprite->loaded = true;
sprite->map.update();
#if defined(DEBUG)
fprintf(stderr, "sprite loaded\n");
#endif
Log::Info(Event::Sprite, "loaded %s", sprite->url.c_str());
}
}