mapnik/benchmark/test_png_encoding2.cpp
Blake Thompson badb0c9a97 This is a complete removal of code that utilizes image_32 in the library. It is a sweeping change that does some of the following:
* Changes all agg_renderers to use a image_data_any variant (only image_data_rgba8 is implemented currently)
* Changes the marker and marker_cache to use image_data_any images
* Changes the symbolizers so that they must be aware of the source data type they are attempting to render and the render type that is expected to be rendered into.
* Moves many utilities into image_utils, that were previously in image_32.

The kicker is that this still isn't working perfectly yet, but I am commiting so I don't have tears in case everything is lost on my computer.

Ref #2633
2015-01-20 18:30:10 -06:00

37 lines
1.2 KiB
C++

#include "bench_framework.hpp"
#include "compare_images.hpp"
class test : public benchmark::test_case
{
std::shared_ptr<image_data_rgba8> im_;
public:
test(mapnik::parameters const& params)
: test_case(params) {
std::string filename("./benchmark/data/multicolor.png");
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"png"));
if (!reader.get())
{
throw mapnik::image_reader_exception("Failed to load: " + filename);
}
im_ = std::make_shared<image_rgba8>(reader->width(),reader->height());
reader->read(0,0,*im_);
}
bool validate() const
{
std::string expected("./benchmark/data/multicolor-hextree-expected.png");
std::string actual("./benchmark/data/multicolor-hextree-actual.png");
mapnik::save_to_file(*im_,actual, "png8:m=h:z=1");
return benchmark::compare_images(actual,expected);
}
bool operator()() const
{
std::string out;
for (std::size_t i=0;i<iterations_;++i) {
out.clear();
out = mapnik::save_to_string(*im_,"png8:m=h:z=1");
}
}
return true;
};
BENCHMARK(test,"encoding multicolor png")