Merge branch 'master' into svg-parser-errors

This commit is contained in:
artemp 2015-07-16 12:18:25 +02:00
commit 55215a7b30
9 changed files with 80 additions and 23 deletions

View file

@ -9,6 +9,7 @@ For a complete change history, see the git log.
## Future
- Fixed parsing of GeoJSON when properties contained `{}` (#2964)
- Fixed potential hang due to invalid use of `line-geometry-transform` (6d6cb15)
## 3.0.0

View file

@ -46,6 +46,7 @@ benchmarks = [
"test_offset_converter.cpp",
"test_marker_cache.cpp",
"test_quad_tree.cpp",
"test_noop_rendering.cpp",
# "test_numeric_cast_vs_static_cast.cpp",
]
for cpp_test in benchmarks:

View file

@ -0,0 +1,53 @@
#include "bench_framework.hpp"
#include <mapnik/map.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/load_map.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <stdexcept>
#include <mapnik/layer.hpp>
#include <mapnik/memory_datasource.hpp>
#include <mapnik/feature_type_style.hpp>
#include <memory>
class test : public benchmark::test_case
{
public:
test(mapnik::parameters const& params)
: test_case(params) {}
bool validate() const
{
return true;
}
bool operator()() const
{
mapnik::Map m(256,256,"+init=epsg:3857");
mapnik::parameters params;
params["type"]="memory";
auto ds = std::make_shared<mapnik::memory_datasource>(params);
// add whitespace to trigger phony "reprojection"
mapnik::layer lay("layer",m.srs() + " ");
lay.set_datasource(ds);
lay.add_style("style");
m.add_layer(lay);
// dummy style to ensure that layer is processed
m.insert_style("style",mapnik::feature_type_style());
// dummy bbox, but "valid" because minx and miny are less
// with an invalid bbox then layer.visible() returns false
// and the initial rendering setup is not run
m.zoom_to_box(mapnik::box2d<double>(-1,-1,0,0));
for (unsigned i=0;i<iterations_;++i)
{
mapnik::image_rgba8 im(256,256);
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
ren.apply();
}
return true;
}
};
BENCHMARK(test,"rendering with reprojection")

View file

@ -38,7 +38,7 @@ namespace mapnik
{
//============================================================blender_gray
template<class ColorT> struct blender_gray
template<typename ColorT> struct blender_gray
{
using color_type = ColorT;
using value_type = typename color_type::value_type;
@ -55,7 +55,7 @@ template<class ColorT> struct blender_gray
//=====================================================apply_gamma_dir_gray
template<class ColorT, class GammaLut> class apply_gamma_dir_gray
template<typename ColorT, class GammaLut> class apply_gamma_dir_gray
{
public:
using value_type = typename ColorT::value_type;
@ -74,7 +74,7 @@ private:
//=====================================================apply_gamma_inv_gray
template<class ColorT, class GammaLut> class apply_gamma_inv_gray
template<typename ColorT, class GammaLut> class apply_gamma_inv_gray
{
public:
using value_type = typename ColorT::value_type;
@ -93,7 +93,7 @@ private:
//=================================================pixfmt_alpha_blend_gray
template<class Blender, class RenBuf, unsigned Step=1, unsigned Offset=0>
template<typename Blender, class RenBuf, unsigned Step=1, unsigned Offset=0>
class pixfmt_alpha_blend_gray
{
public:
@ -160,7 +160,7 @@ public:
void attach(rbuf_type& rb) { m_rbuf = &rb; }
//--------------------------------------------------------------------
template<class PixFmt>
template<typename PixFmt>
bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2)
{
agg::rect_i r(x1, y1, x2, y2);
@ -538,10 +538,10 @@ public:
}
//--------------------------------------------------------------------
template<class Function> void for_each_pixel(Function f)
template <typename Function>
void for_each_pixel(Function f)
{
unsigned y;
for(y = 0; y < height(); ++y)
for(unsigned y = 0; y < height(); ++y)
{
row_data r = m_rbuf->row(y);
if(r.ptr)
@ -562,19 +562,19 @@ public:
}
//--------------------------------------------------------------------
template<class GammaLut> void apply_gamma_dir(const GammaLut& g)
template<typename GammaLut> void apply_gamma_dir(const GammaLut& g)
{
for_each_pixel(apply_gamma_dir_gray<color_type, GammaLut>(g));
}
//--------------------------------------------------------------------
template<class GammaLut> void apply_gamma_inv(const GammaLut& g)
template<typename GammaLut> void apply_gamma_inv(const GammaLut& g)
{
for_each_pixel(apply_gamma_inv_gray<color_type, GammaLut>(g));
}
//--------------------------------------------------------------------
template<class RenBuf2>
template<typename RenBuf2>
void copy_from(const RenBuf2& from,
int xdst, int ydst,
int xsrc, int ysrc,
@ -590,7 +590,7 @@ public:
}
//--------------------------------------------------------------------
template<class SrcPixelFormatRenderer>
template<typename SrcPixelFormatRenderer>
void blend_from_color(const SrcPixelFormatRenderer& from,
const color_type& color,
int xdst, int ydst,
@ -617,7 +617,7 @@ public:
}
//--------------------------------------------------------------------
template<class SrcPixelFormatRenderer>
template<typename SrcPixelFormatRenderer>
void blend_from_lut(const SrcPixelFormatRenderer& from,
const color_type* color_lut,
int xdst, int ydst,

View file

@ -50,7 +50,6 @@ public:
image(image<null_t> const&) {}
image(image<null_t> &&) noexcept {}
image<null_t>& operator=(image<null_t>) { return *this; }
image<null_t>const& operator=(image<null_t> const& rhs) const { return rhs; }
bool operator==(image<null_t> const&) const { return true; }
bool operator<(image<null_t> const&) const { return false; }

View file

@ -56,8 +56,8 @@ public:
text_renderer (halo_rasterizer_e rasterizer,
composite_mode_e comp_op = src_over,
composite_mode_e halo_comp_op = src_over,
double scale_factor=1.0,
stroker_ptr stroker=stroker_ptr());
double scale_factor = 1.0,
stroker_ptr stroker = stroker_ptr());
void set_transform(agg::trans_affine const& transform);
void set_halo_transform(agg::trans_affine const& halo_transform);
protected:

View file

@ -31,8 +31,7 @@
#include <mapnik/util/variant.hpp>
// agg
#include <agg_trans_affine.h>
// boost
#include <boost/algorithm/clamp.hpp>
// stl
#include <cmath>
@ -154,14 +153,18 @@ struct transform_processor
void operator() (skewX_node const& node)
{
auto degrees = std::fmod(eval(node.angle_),90.0);
auto angle = deg2rad(boost::algorithm::clamp(degrees, -89.0, 89.0));
if (degrees < -89.0) degrees = -89.0;
else if (degrees > 89.0) degrees = 89.0;
auto angle = deg2rad(degrees);
transform_.multiply(agg::trans_affine_skewing(angle, 0.0));
}
void operator() (skewY_node const& node)
{
auto degrees = std::fmod(eval(node.angle_),90.0);
auto angle = deg2rad(boost::algorithm::clamp(degrees, -89.0, 89.0));
if (degrees < -89.0) degrees = -89.0;
else if (degrees > 89.0) degrees = 89.0;
auto angle = deg2rad(degrees);
transform_.multiply(agg::trans_affine_skewing(0.0, angle));
}

View file

@ -36,12 +36,12 @@ font_face::font_face(FT_Face face)
bool font_face::set_character_sizes(double size)
{
return !FT_Set_Char_Size(face_,0,(FT_F26Dot6)(size * (1<<6)),0,0);
return (FT_Set_Char_Size(face_,0,(FT_F26Dot6)(size * (1<<6)),0,0) == 0);
}
bool font_face::set_unscaled_character_sizes()
{
return !FT_Set_Char_Size(face_,0,face_->units_per_EM,0,0);
return (FT_Set_Char_Size(face_,0,face_->units_per_EM,0,0) == 0);
}
bool font_face::glyph_dimensions(glyph_info & glyph) const

@ -1 +1 @@
Subproject commit 7de3183129a08c835a3205f5d51c85e59494ee33
Subproject commit 80c744348de8cb03a519e451129a243610e55f52