2013-11-19 20:23:37 +00:00
|
|
|
#include "bench_framework.hpp"
|
|
|
|
#include <mapnik/map.hpp>
|
|
|
|
#include <mapnik/load_map.hpp>
|
|
|
|
#include <mapnik/agg_renderer.hpp>
|
|
|
|
#include <mapnik/datasource_cache.hpp>
|
|
|
|
|
|
|
|
class test : public benchmark::test_case
|
|
|
|
{
|
|
|
|
std::string xml_;
|
|
|
|
mapnik::box2d<double> extent_;
|
|
|
|
public:
|
|
|
|
test(mapnik::parameters const& params,
|
|
|
|
std::string const& xml,
|
|
|
|
mapnik::box2d<double> const& extent)
|
|
|
|
: test_case(params),
|
|
|
|
xml_(xml),
|
|
|
|
extent_(extent)
|
|
|
|
{}
|
|
|
|
bool validate() const
|
|
|
|
{
|
|
|
|
mapnik::Map m(256,256);
|
|
|
|
mapnik::load_map(m,xml_);
|
|
|
|
m.zoom_to_box(extent_);
|
2015-01-22 02:31:02 +00:00
|
|
|
mapnik::image_rgba8 im(m.width(),m.height());
|
|
|
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
2013-11-19 20:23:37 +00:00
|
|
|
ren.apply();
|
2015-01-08 21:54:43 +00:00
|
|
|
//mapnik::save_to_file(im.data(),"test.png");
|
2013-11-19 20:23:37 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-12-12 16:59:45 +00:00
|
|
|
bool operator()() const
|
2013-11-19 20:23:37 +00:00
|
|
|
{
|
|
|
|
mapnik::Map m(256,256);
|
|
|
|
mapnik::load_map(m,xml_);
|
|
|
|
m.zoom_to_box(extent_);
|
|
|
|
for (unsigned i=0;i<iterations_;++i)
|
|
|
|
{
|
2015-01-22 02:31:02 +00:00
|
|
|
mapnik::image_rgba8 im(m.width(),m.height());
|
|
|
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
2013-11-19 20:23:37 +00:00
|
|
|
ren.apply();
|
|
|
|
}
|
2014-12-12 16:59:45 +00:00
|
|
|
return true;
|
2013-11-19 20:23:37 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
mapnik::parameters params;
|
|
|
|
benchmark::handle_args(argc,argv,params);
|
|
|
|
mapnik::datasource_cache::instance().register_datasources("./plugins/input/");
|
|
|
|
mapnik::box2d<double> z1(-20037508.3428,-8317435.0606,20037508.3428,18399242.7298);
|
|
|
|
// bbox for 16/10491/22911.png
|
|
|
|
mapnik::box2d<double> z16(-13622912.929097254,6026906.8062295765,-13621689.93664469,6028129.79868214);
|
2016-02-16 18:53:03 +00:00
|
|
|
return benchmark::sequencer(argc, argv)
|
|
|
|
.run<test>("polygon clip render z1", "benchmark/data/polygon_rendering_clip.xml", z1)
|
|
|
|
.run<test>("polygon noclip render z1", "benchmark/data/polygon_rendering_no_clip.xml", z1)
|
|
|
|
.run<test>("polygon clip render z16", "benchmark/data/polygon_rendering_clip.xml", z16)
|
|
|
|
.run<test>("polygon noclip render z16", "benchmark/data/polygon_rendering_no_clip.xml", z16)
|
|
|
|
.done();
|
2013-11-19 20:23:37 +00:00
|
|
|
}
|