2013-11-19 21:23:37 +01: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 03:31:02 +01:00
|
|
|
mapnik::image_rgba8 im(m.width(),m.height());
|
|
|
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
2013-11-19 21:23:37 +01:00
|
|
|
ren.apply();
|
2015-01-08 22:54:43 +01:00
|
|
|
//mapnik::save_to_file(im.data(),"test.png");
|
2013-11-19 21:23:37 +01:00
|
|
|
return true;
|
|
|
|
}
|
2014-12-12 17:59:45 +01:00
|
|
|
bool operator()() const
|
2013-11-19 21:23:37 +01: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 03:31:02 +01:00
|
|
|
mapnik::image_rgba8 im(m.width(),m.height());
|
|
|
|
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
|
2013-11-19 21:23:37 +01:00
|
|
|
ren.apply();
|
|
|
|
}
|
2014-12-12 17:59:45 +01:00
|
|
|
return true;
|
2013-11-19 21:23:37 +01: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);
|
2015-09-14 15:01:32 +02:00
|
|
|
int retVal = 0;
|
2013-11-19 21:23:37 +01:00
|
|
|
{
|
|
|
|
test test_runner(params,
|
|
|
|
"benchmark/data/polygon_rendering_clip.xml",
|
|
|
|
z1);
|
2015-09-14 15:01:32 +02:00
|
|
|
retVal = retVal | run(test_runner,"polygon clip render z1");
|
2013-11-19 21:23:37 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
test test_runner(params,
|
|
|
|
"benchmark/data/polygon_rendering_no_clip.xml",
|
|
|
|
z1);
|
2015-09-14 15:01:32 +02:00
|
|
|
retVal = retVal | run(test_runner,"polygon noclip render z1");
|
2013-11-19 21:23:37 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
test test_runner(params,
|
|
|
|
"benchmark/data/polygon_rendering_clip.xml",
|
|
|
|
z16);
|
2015-09-14 15:01:32 +02:00
|
|
|
retVal = retVal | run(test_runner,"polygon clip render z16");
|
2013-11-19 21:23:37 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
test test_runner(params,
|
|
|
|
"benchmark/data/polygon_rendering_no_clip.xml",
|
|
|
|
z16);
|
2015-09-14 15:01:32 +02:00
|
|
|
retVal = retVal | run(test_runner,"polygon noclip render z16");
|
2013-11-19 21:23:37 +01:00
|
|
|
}
|
2015-09-14 15:01:32 +02:00
|
|
|
return retVal;
|
2013-11-19 21:23:37 +01:00
|
|
|
}
|