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());
}
}

View File

@@ -61,11 +61,11 @@ bool FilterComparison::Instance::compare(const std::forward_list<Value> &propert
switch (op) {
case Operator::Equal:
for (const Value &property_value : property_values) {
if (!includes(property_value, util::relaxed_equal)) {
return false;
if (includes(property_value, util::relaxed_equal)) {
return true;
}
}
return true;
return false;
case Operator::NotEqual:
for (const Value &property_value : property_values) {
if (includes(property_value, util::relaxed_equal)) {

View File

@@ -15,7 +15,7 @@ void write_file(const std::string &filename, const std::string &data) {
fwrite(data.data(), sizeof(std::string::value_type), data.size(), fd);
fclose(fd);
} else {
fprintf(stderr, "Failed to open file\n");
throw std::runtime_error(std::string("Failed to open file ") + filename);
}
}
@@ -26,7 +26,7 @@ std::string read_file(const std::string &filename) {
data << file.rdbuf();
return data.str();
} else {
throw std::runtime_error("Cannot read file " + filename);
throw std::runtime_error(std::string("Cannot read file ") + filename);
}
}