add first render test

This commit is contained in:
Konstantin Käfer
2015-02-04 20:09:02 +01:00
parent c4c45a5ff8
commit 66ca191ab2
8 changed files with 102 additions and 30 deletions

View File

@@ -16,7 +16,6 @@ NodeMap::RenderWorker::~RenderWorker() {
}
void NodeMap::RenderWorker::Execute() {
fprintf(stderr, "executing render worker\n");
try {
nodeMap->view.resize(options->width, options->height, options->ratio);
nodeMap->map.setAccessToken(options->accessToken);
@@ -28,12 +27,11 @@ void NodeMap::RenderWorker::Execute() {
// Run the loop. It will terminate when we don't have any further listeners.
nodeMap->map.run();
fprintf(stderr, "run completed\n");
const unsigned int width = options->width * options->ratio;
const unsigned int height = options->height * options->ratio;
image = mbgl::util::compress_png(width, height, nodeMap->view.readPixels().get());
fprintf(stderr, "png compressed\n");
} catch (const std::exception &ex) {
auto pixels = nodeMap->view.readPixels();
image = mbgl::util::compress_png(width, height, pixels.get());
} catch (mbgl::exception &ex) {
SetErrorMessage(ex.what());
}
}