Merge commit 'e16567fecb3fd11960697663a955e5cf82225110' into harfbuzz
Conflicts: src/cairo_context.cpp src/font_engine_freetype.cpp src/placement_finder.cpp
This commit is contained in:
commit
ea0daad8fc
19 changed files with 67 additions and 66 deletions
|
@ -439,7 +439,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
|
|||
|
||||
if (count == 0) // one vertex
|
||||
{
|
||||
return distance(x, y, x0, y0) <= fabs(tol);
|
||||
return distance(x, y, x0, y0) <= std::fabs(tol);
|
||||
}
|
||||
return inside;
|
||||
}
|
||||
|
|
|
@ -155,14 +155,14 @@ inline void read_double_xdr(const char* data, double & val)
|
|||
|
||||
#ifdef _WINDOWS
|
||||
// msvc doesn't have rint in <cmath>
|
||||
inline int rint( double val)
|
||||
inline int rint(double val)
|
||||
{
|
||||
return int(floor(val + 0.5));
|
||||
return int(std::floor(val + 0.5));
|
||||
}
|
||||
|
||||
inline double round (double val)
|
||||
inline double round(double val)
|
||||
{
|
||||
return floor(val);
|
||||
return std::floor(val);
|
||||
}
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include "agg_scanline_u.h"
|
||||
#include "agg_blur.h"
|
||||
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
// 8-bit YUV
|
||||
//Y = ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
// boost
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
|
@ -213,8 +216,8 @@ private:
|
|||
*/
|
||||
static void displace(vertex2d & v, double dx, double dy, double a)
|
||||
{
|
||||
v.x += dx * cos(a) - dy * sin(a);
|
||||
v.y += dx * sin(a) + dy * cos(a);
|
||||
v.x += dx * std::cos(a) - dy * std::sin(a);
|
||||
v.y += dx * std::sin(a) + dy * std::cos(a);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,8 +225,8 @@ private:
|
|||
*/
|
||||
void displace(vertex2d & v, double a) const
|
||||
{
|
||||
v.x += offset_ * sin(a);
|
||||
v.y -= offset_ * cos(a);
|
||||
v.x += offset_ * std::sin(a);
|
||||
v.y -= offset_ * std::cos(a);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,16 +234,16 @@ private:
|
|||
*/
|
||||
void displace(vertex2d & v, vertex2d const& u, double a) const
|
||||
{
|
||||
v.x = u.x + offset_ * sin(a);
|
||||
v.y = u.y - offset_ * cos(a);
|
||||
v.x = u.x + offset_ * std::sin(a);
|
||||
v.y = u.y - offset_ * std::cos(a);
|
||||
v.cmd = u.cmd;
|
||||
}
|
||||
|
||||
void displace2(vertex2d & v, double a, double b) const
|
||||
{
|
||||
double sa = offset_ * sin(a);
|
||||
double ca = offset_ * cos(a);
|
||||
double h = tan(0.5 * (b - a));
|
||||
double sa = offset_ * std::sin(a);
|
||||
double ca = offset_ * std::cos(a);
|
||||
double h = std::tan(0.5 * (b - a));
|
||||
v.x = v.x + sa + h * ca;
|
||||
v.y = v.y - ca + h * sa;
|
||||
}
|
||||
|
@ -261,7 +264,7 @@ private:
|
|||
return status_ = process;
|
||||
|
||||
double angle_a = 0;
|
||||
double angle_b = atan2((v2.y - v1.y), (v2.x - v1.x));
|
||||
double angle_b = std::atan2((v2.y - v1.y), (v2.x - v1.x));
|
||||
double joint_angle;
|
||||
|
||||
// first vertex
|
||||
|
@ -273,15 +276,15 @@ private:
|
|||
// a fake vertex two offset-lengths before the first, and expect
|
||||
// intersection detection smoothes it out.
|
||||
pre_first_ = v1;
|
||||
displace(pre_first_, -2 * fabs(offset_), 0, angle_b);
|
||||
displace(pre_first_, -2 * std::fabs(offset_), 0, angle_b);
|
||||
|
||||
while ((v1 = v2, v2.cmd = geom_.vertex(&v2.x, &v2.y)) != SEG_END)
|
||||
{
|
||||
angle_a = angle_b;
|
||||
angle_b = atan2((v2.y - v1.y), (v2.x - v1.x));
|
||||
angle_b = std::atan2((v2.y - v1.y), (v2.x - v1.x));
|
||||
joint_angle = explement_reflex_angle(angle_b - angle_a);
|
||||
|
||||
double half_turns = half_turn_segments_ * fabs(joint_angle);
|
||||
double half_turns = half_turn_segments_ * std::fabs(joint_angle);
|
||||
int bulge_steps = 0;
|
||||
|
||||
if (offset_ < 0.0)
|
||||
|
@ -289,7 +292,7 @@ private:
|
|||
if (joint_angle > 0.0)
|
||||
joint_angle = joint_angle - 2 * pi;
|
||||
else
|
||||
bulge_steps = 1 + int(floor(half_turns / pi));
|
||||
bulge_steps = 1 + int(std::floor(half_turns / pi));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <cmath>
|
||||
// Boost
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
@ -57,9 +58,9 @@ struct sleeve
|
|||
|
||||
sleeve(vertex2d const& v0, vertex2d const& v1, double offset)
|
||||
{
|
||||
double a = atan2((v1.y - v0.y), (v1.x - v0.x));
|
||||
double dx = offset * cos(a);
|
||||
double dy = offset * sin(a);
|
||||
double a = std::atan2((v1.y - v0.y), (v1.x - v0.x));
|
||||
double dx = offset * std::cos(a);
|
||||
double dy = offset * std::sin(a);
|
||||
v[0].x = v0.x + dy;
|
||||
v[0].y = v0.y - dx;
|
||||
v[1].x = v0.x - dy;
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
using std::pair;
|
||||
using std::vector;
|
||||
typedef vector<pair<double,double> > dash_array;
|
||||
typedef std::vector<std::pair<double,double> > dash_array;
|
||||
|
||||
// if you add new tokens, don't forget to add them to the corresponding
|
||||
// string array in the cpp file.
|
||||
|
|
|
@ -369,8 +369,8 @@ void path_adapter<VC>::arc_to(double rx, double ry,
|
|||
double y0 = 0.0;
|
||||
vertices_.last_vertex(&x0, &y0);
|
||||
|
||||
rx = fabs(rx);
|
||||
ry = fabs(ry);
|
||||
rx = std::fabs(rx);
|
||||
ry = std::fabs(ry);
|
||||
|
||||
// Ensure radii are valid
|
||||
//-------------------------
|
||||
|
|
|
@ -278,7 +278,7 @@ public:
|
|||
ras.reset();
|
||||
|
||||
// https://github.com/mapnik/mapnik/issues/1129
|
||||
if(fabs(curved_trans_contour.width()) <= 1)
|
||||
if(std::fabs(curved_trans_contour.width()) <= 1)
|
||||
{
|
||||
ras.add_path(curved_trans, attr.index);
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ public:
|
|||
{
|
||||
ras.reset();
|
||||
|
||||
if(fabs(curved_trans_contour.width()) <= 1)
|
||||
if(std::fabs(curved_trans_contour.width()) <= 1)
|
||||
{
|
||||
ras.add_path(curved_trans, attr.index);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include <boost/format.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
#include "gdal_featureset.hpp"
|
||||
#include <gdal_priv.h>
|
||||
|
||||
|
@ -137,8 +140,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
|||
box2d<double> box = t.forward(intersect);
|
||||
|
||||
//size of resized output pixel in source image domain
|
||||
double margin_x = 1.0 / (fabs(dx_) * boost::get<0>(q.resolution()));
|
||||
double margin_y = 1.0 / (fabs(dy_) * boost::get<1>(q.resolution()));
|
||||
double margin_x = 1.0 / (std::fabs(dx_) * boost::get<0>(q.resolution()));
|
||||
double margin_y = 1.0 / (std::fabs(dy_) * boost::get<1>(q.resolution()));
|
||||
if (margin_x < 1)
|
||||
{
|
||||
margin_x = 1.0;
|
||||
|
|
|
@ -89,10 +89,10 @@ feature_ptr raster_featureset<LookupPolicy>::next()
|
|||
if (ext.width() > 0.5 && ext.height() > 0.5 )
|
||||
{
|
||||
// select minimum raster containing whole ext
|
||||
int x_off = static_cast<int>(floor(ext.minx()));
|
||||
int y_off = static_cast<int>(floor(ext.miny()));
|
||||
int end_x = static_cast<int>(ceil(ext.maxx()));
|
||||
int end_y = static_cast<int>(ceil(ext.maxy()));
|
||||
int x_off = static_cast<int>(std::floor(ext.minx()));
|
||||
int y_off = static_cast<int>(std::floor(ext.miny()));
|
||||
int end_x = static_cast<int>(std::ceil(ext.maxx()));
|
||||
int end_y = static_cast<int>(std::ceil(ext.maxy()));
|
||||
|
||||
// clip to available data
|
||||
if (x_off < 0)
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
// stl
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
@ -93,8 +94,8 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
|||
double half_stroke = stroke_.get_width()/2.0;
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
if (fabs(sym.offset()) > 0)
|
||||
padding *= fabs(sym.offset()) * 1.2;
|
||||
if (std::fabs(sym.offset()) > 0)
|
||||
padding *= std::fabs(sym.offset()) * 1.2;
|
||||
clipping_extent.pad(padding);
|
||||
// debugging
|
||||
//box2d<double> inverse(x0 + padding, y0 + padding, x1 - padding , y1 - padding);
|
||||
|
@ -116,7 +117,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
|||
converter(clipping_extent,ras,sym,t_,prj_trans,tr,scale_factor_);
|
||||
if (sym.clip()) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
if (fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
if (std::fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
@ -137,7 +138,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
|||
|
||||
if (sym.clip()) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
if (fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
if (std::fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
|
|
@ -65,8 +65,8 @@ void agg_renderer<T>::process(raster_symbolizer const& sym,
|
|||
box2d<double> ext = t_.forward(target_ext);
|
||||
int start_x = static_cast<int>(ext.minx());
|
||||
int start_y = static_cast<int>(ext.miny());
|
||||
int end_x = static_cast<int>(ceil(ext.maxx()));
|
||||
int end_y = static_cast<int>(ceil(ext.maxy()));
|
||||
int end_x = static_cast<int>(std::ceil(ext.maxx()));
|
||||
int end_y = static_cast<int>(std::ceil(ext.maxy()));
|
||||
int raster_width = end_x - start_x;
|
||||
int raster_height = end_y - start_y;
|
||||
if (raster_width > 0 && raster_height > 0)
|
||||
|
|
|
@ -403,8 +403,8 @@ void cairo_renderer_base::process(line_symbolizer const& sym,
|
|||
double half_stroke = stroke_.get_width()/2.0;
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
if (fabs(sym.offset()) > 0)
|
||||
padding *= fabs(sym.offset()) * 1.2;
|
||||
if (std::fabs(sym.offset()) > 0)
|
||||
padding *= std::fabs(sym.offset()) * 1.2;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
vertex_converter<box2d<double>, cairo_context, line_symbolizer,
|
||||
|
@ -413,7 +413,7 @@ void cairo_renderer_base::process(line_symbolizer const& sym,
|
|||
|
||||
if (sym.clip()) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
if (fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
if (std::fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
@ -817,8 +817,8 @@ void cairo_renderer_base::process(raster_symbolizer const& sym,
|
|||
box2d<double> ext = t_.forward(target_ext);
|
||||
int start_x = static_cast<int>(ext.minx());
|
||||
int start_y = static_cast<int>(ext.miny());
|
||||
int end_x = static_cast<int>(ceil(ext.maxx()));
|
||||
int end_y = static_cast<int>(ceil(ext.maxy()));
|
||||
int end_x = static_cast<int>(std::ceil(ext.maxx()));
|
||||
int end_y = static_cast<int>(std::ceil(ext.maxy()));
|
||||
int raster_width = end_x - start_x;
|
||||
int raster_height = end_y - start_y;
|
||||
if (raster_width > 0 && raster_height > 0)
|
||||
|
|
|
@ -29,12 +29,6 @@
|
|||
|
||||
namespace mapnik {
|
||||
|
||||
using std::atan2;
|
||||
using std::cos;
|
||||
using std::pow;
|
||||
using std::sin;
|
||||
using std::sqrt;
|
||||
|
||||
static const double deg2rad = 0.0174532925199432958;
|
||||
static const double R = 6372795.0; // average great-circle radius of the earth
|
||||
|
||||
|
@ -49,11 +43,11 @@ double great_circle_distance::operator() (coord2d const& pt0,
|
|||
double dlat = lat1 - lat0;
|
||||
double dlon = lon1 - lon0;
|
||||
|
||||
double sin_dlat = sin(0.5 * dlat);
|
||||
double sin_dlon = sin(0.5 * dlon);
|
||||
double sin_dlat = std::sin(0.5 * dlat);
|
||||
double sin_dlon = std::sin(0.5 * dlon);
|
||||
|
||||
double a = pow(sin_dlat,2.0) + cos(lat0)*cos(lat1)*pow(sin_dlon,2.0);
|
||||
double c = 2 * atan2(sqrt(a),sqrt(1 - a));
|
||||
double a = std::pow(sin_dlat,2.0) + std::cos(lat0)*std::cos(lat1)*std::pow(sin_dlon,2.0);
|
||||
double c = 2 * std::atan2(std::sqrt(a),std::sqrt(1 - a));
|
||||
return R * c;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
|
|||
double half_stroke = stroke_.get_width()/2.0;
|
||||
if (half_stroke > 1)
|
||||
padding *= half_stroke;
|
||||
if (fabs(sym.offset()) > 0)
|
||||
padding *= fabs(sym.offset()) * 1.2;
|
||||
if (std::fabs(sym.offset()) > 0)
|
||||
padding *= std::fabs(sym.offset()) * 1.2;
|
||||
clipping_extent.pad(padding);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
|
|||
converter(clipping_extent,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_);
|
||||
if (sym.clip()) converter.set<clip_line_tag>(); // optional clip (default: true)
|
||||
converter.set<transform_tag>(); // always transform
|
||||
if (fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
if (std::fabs(sym.offset()) > 0.0) converter.set<offset_transform_tag>(); // parallel offset
|
||||
converter.set<affine_transform_tag>(); // optional affine transform
|
||||
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
|
||||
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
|
||||
|
|
|
@ -66,8 +66,6 @@
|
|||
|
||||
using boost::tokenizer;
|
||||
|
||||
using std::endl;
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
using boost::optional;
|
||||
|
@ -510,7 +508,7 @@ void map_parser::parse_fontset(Map & map, xml_node const& fset)
|
|||
|
||||
// XXX Hack because map object isn't accessible by text_symbolizer
|
||||
// when it's parsed
|
||||
fontsets_.insert(pair<std::string, font_set>(name, fontset));
|
||||
fontsets_.insert(std::pair<std::string, font_set>(name, fontset));
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
{
|
||||
|
|
|
@ -226,7 +226,7 @@ void envelope_points(std::vector< coord<double,2> > & coords, box2d<double>& env
|
|||
if (points <= 4) {
|
||||
steps = 0;
|
||||
} else {
|
||||
steps = static_cast<int>(ceil((points - 4) / 4.0));
|
||||
steps = static_cast<int>(std::ceil((points - 4) / 4.0));
|
||||
}
|
||||
|
||||
steps += 1;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
// stl
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -258,7 +259,7 @@ color raster_colorizer::get_color(float value) const
|
|||
case COLORIZER_EXACT:
|
||||
default:
|
||||
//approximately equal (within epsilon)
|
||||
if(fabs(value - stopValue) < epsilon_)
|
||||
if(std::fabs(value - stopValue) < epsilon_)
|
||||
{
|
||||
outputColor = stopColor;
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ void reproject_and_scale_raster(raster & target, raster const& source,
|
|||
CoordTransform tt(target.data_.width(), target.data_.height(),
|
||||
target.ext_, offset_x, offset_y);
|
||||
unsigned i, j;
|
||||
unsigned mesh_nx = ceil(source.data_.width()/double(mesh_size) + 1);
|
||||
unsigned mesh_ny = ceil(source.data_.height()/double(mesh_size) + 1);
|
||||
unsigned mesh_nx = std::ceil(source.data_.width()/double(mesh_size) + 1);
|
||||
unsigned mesh_ny = std::ceil(source.data_.height()/double(mesh_size) + 1);
|
||||
|
||||
ImageData<double> xs(mesh_nx, mesh_ny);
|
||||
ImageData<double> ys(mesh_nx, mesh_ny);
|
||||
|
|
Loading…
Reference in a new issue