From 8de584acad5099833bb026e8edb12e5717074e0f Mon Sep 17 00:00:00 2001 From: Paul Norman Date: Mon, 21 Mar 2016 13:56:27 -0700 Subject: [PATCH 01/15] Use relative path for INSTALL.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5ebf6a3e..1b677c84e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ For further information see [http://mapnik.org](http://mapnik.org) and also our # Installation -See [INSTALL.md](https://github.com/mapnik/mapnik/blob/master/INSTALL.md) for installation instructions and the [Install](https://github.com/mapnik/mapnik/wiki/Mapnik-Installation) page on the wiki for guides. +See [INSTALL.md](INSTALL.md) for installation instructions and the [Install](https://github.com/mapnik/mapnik/wiki/Mapnik-Installation) page on the wiki for guides. # Code of Conduct From 2a46e4517a0ec32b9aad4580814e9dbcaf1221b3 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 20 Apr 2016 12:19:07 -0700 Subject: [PATCH 02/15] Add minimum recommended GDAL version to INSTALL.md - refs #3339 [skip ci] --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index d27004dbd..8992144b1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -98,7 +98,7 @@ Additional optional dependencies: * PostgreSQL (for PostGIS plugin support) - libpq - PostreSQL libraries - pg_config - PostgreSQL installation capabilities - * libgdal - GDAL/OGR input (For gdal and ogr plugin support) + * libgdal - GDAL/OGR input (For gdal and ogr plugin support) (>= GDAL 2.0.2 for thread safety - https://github.com/mapnik/mapnik/issues/3339) * libsqlite3 - SQLite input (needs RTree support builtin) (sqlite plugin support) Instructions for installing many of these dependencies on From e5fafd31d1fc479d847b0e588cfce02037137f52 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 21 Apr 2016 09:04:38 -0700 Subject: [PATCH 03/15] skip boost check when cross compiling [skip ci] --- SConstruct | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index dacc950f8..a4c4fda74 100644 --- a/SConstruct +++ b/SConstruct @@ -1451,12 +1451,13 @@ if not preconfigured: # just turn it off like this, but seems the only available work- # around. See https://svn.boost.org/trac/boost/ticket/6779 for more # details. - boost_version = [int(x) for x in env.get('BOOST_LIB_VERSION_FROM_HEADER').split('_')] - if not conf.CheckBoostScopedEnum(): - if boost_version < [1, 51]: - env.Append(CXXFLAGS = '-DBOOST_NO_SCOPED_ENUMS') - elif boost_version < [1, 57]: - env.Append(CXXFLAGS = '-DBOOST_NO_CXX11_SCOPED_ENUMS') + if not env['HOST']: + boost_version = [int(x) for x in env.get('BOOST_LIB_VERSION_FROM_HEADER').split('_')] + if not conf.CheckBoostScopedEnum(): + if boost_version < [1, 51]: + env.Append(CXXFLAGS = '-DBOOST_NO_SCOPED_ENUMS') + elif boost_version < [1, 57]: + env.Append(CXXFLAGS = '-DBOOST_NO_CXX11_SCOPED_ENUMS') if not env['HOST'] and env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: # http://lists.boost.org/Archives/boost/2009/03/150076.php From 4611d8cad1bf73d8375bb6e41ac529682a2b143f Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 22 Apr 2016 12:50:32 +0200 Subject: [PATCH 04/15] c++ style : prefix increment --- src/text/symbolizer_helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/symbolizer_helpers.cpp b/src/text/symbolizer_helpers.cpp index 1d0fe48d2..c20f51c86 100644 --- a/src/text/symbolizer_helpers.cpp +++ b/src/text/symbolizer_helpers.cpp @@ -389,7 +389,7 @@ bool text_symbolizer_helper::next_point_placement() const return true; } //No placement for this point. Keep it in points_ for next try. - point_itr_++; + ++point_itr_; } return false; } From ed87cd288317c4ec64697d2583275b3b1f4c7068 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 22 Apr 2016 12:51:20 +0200 Subject: [PATCH 05/15] c++ - make bbox standalone method --- include/mapnik/text/placement_finder.hpp | 1 - src/text/placement_finder.cpp | 68 ++++++++++++------------ 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/include/mapnik/text/placement_finder.hpp b/include/mapnik/text/placement_finder.hpp index f35a5d50b..3b02d8924 100644 --- a/include/mapnik/text/placement_finder.hpp +++ b/include/mapnik/text/placement_finder.hpp @@ -78,7 +78,6 @@ private: // Maps upright==auto, left-only and right-only to left,right to simplify processing. // angle = angle of at start of line (to estimate best option for upright==auto) text_upright_e simplify_upright(text_upright_e upright, double angle) const; - box2d get_bbox(text_layout const& layout, glyph_info const& glyph, pixel_position const& pos, rotation const& rot); feature_impl const& feature_; attributes const& attr_; DetectorType & detector_; diff --git a/src/text/placement_finder.cpp b/src/text/placement_finder.cpp index 04a290757..e4adddf3e 100644 --- a/src/text/placement_finder.cpp +++ b/src/text/placement_finder.cpp @@ -39,6 +39,41 @@ namespace mapnik { +namespace { +box2d get_bbox(text_layout const& layout, glyph_info const& glyph, pixel_position const& pos, rotation const& rot) +{ + /* + + (0/ymax) (width/ymax) + *************** + * * + (0/0)* * + * * + *************** + (0/ymin) (width/ymin) + Add glyph offset in y direction, but not in x direction (as we use the full cluster width anyways)! + */ + double width = layout.cluster_width(glyph.char_index); + if (glyph.advance() <= 0) width = -width; + pixel_position tmp, tmp2; + tmp.set(0, glyph.ymax()); + tmp = tmp.rotate(rot); + tmp2.set(width, glyph.ymax()); + tmp2 = tmp2.rotate(rot); + box2d bbox(tmp.x, -tmp.y, + tmp2.x, -tmp2.y); + tmp.set(width, glyph.ymin()); + tmp = tmp.rotate(rot); + bbox.expand_to_include(tmp.x, -tmp.y); + tmp.set(0, glyph.ymin()); + tmp = tmp.rotate(rot); + bbox.expand_to_include(tmp.x, -tmp.y); + pixel_position pos2 = pos + pixel_position(0, glyph.offset.y).rotate(rot); + bbox.move(pos2.x , -pos2.y); + return bbox; +} +} // anonymous namespace + placement_finder::placement_finder(feature_impl const& feature, attributes const& attr, DetectorType &detector, @@ -432,37 +467,4 @@ bool placement_finder::add_marker(glyph_positions_ptr & glyphs, pixel_position c return true; } -box2d placement_finder::get_bbox(text_layout const& layout, glyph_info const& glyph, pixel_position const& pos, rotation const& rot) -{ - /* - - (0/ymax) (width/ymax) - *************** - * * - (0/0)* * - * * - *************** - (0/ymin) (width/ymin) - Add glyph offset in y direction, but not in x direction (as we use the full cluster width anyways)! - */ - double width = layout.cluster_width(glyph.char_index); - if (glyph.advance() <= 0) width = -width; - pixel_position tmp, tmp2; - tmp.set(0, glyph.ymax()); - tmp = tmp.rotate(rot); - tmp2.set(width, glyph.ymax()); - tmp2 = tmp2.rotate(rot); - box2d bbox(tmp.x, -tmp.y, - tmp2.x, -tmp2.y); - tmp.set(width, glyph.ymin()); - tmp = tmp.rotate(rot); - bbox.expand_to_include(tmp.x, -tmp.y); - tmp.set(0, glyph.ymin()); - tmp = tmp.rotate(rot); - bbox.expand_to_include(tmp.x, -tmp.y); - pixel_position pos2 = pos + pixel_position(0, glyph.offset.y).rotate(rot); - bbox.move(pos2.x , -pos2.y); - return bbox; -} - }// ns mapnik From 1871e5f62d8bd311e1ecf0a9ae996beb2ef5022c Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 10:11:55 +0200 Subject: [PATCH 06/15] return EXIT_FAILURE on invalid input ref #3410 --- utils/mapnik-index/mapnik-index.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/mapnik-index/mapnik-index.cpp b/utils/mapnik-index/mapnik-index.cpp index 3e1b8bb06..9b1859bf2 100644 --- a/utils/mapnik-index/mapnik-index.cpp +++ b/utils/mapnik-index/mapnik-index.cpp @@ -180,7 +180,11 @@ int main (int argc, char** argv) { std::clog << "processing '" << filename << "' as CSV\n"; auto result = mapnik::detail::process_csv_file(boxes, filename, manual_headers, separator, quote); - if (!result.first) continue; + if (!result.first) + { + std::clog << "Error: failed to process " << filename << std::endl; + return EXIT_FAILURE; + } extent = result.second; } else if (mapnik::detail::is_geojson(filename)) @@ -190,7 +194,7 @@ int main (int argc, char** argv) if (!result.first) { std::clog << "Error: failed to process " << filename << std::endl; - continue; + return EXIT_FAILURE; } extent = result.second; } @@ -224,6 +228,11 @@ int main (int argc, char** argv) file.close(); } } + else + { + std::clog << "Invalid extent " << extent << std::endl; + return EXIT_FAILURE; + } } std::clog << "done!" << std::endl; return EXIT_SUCCESS; From be06a2d3013716749513b4f1c35f834efa73cd4c Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 11:20:23 +0200 Subject: [PATCH 07/15] require boost >= 1.58 for `spatially_equal(geom_0, geom_1)` test ref #3380 --- test/unit/serialization/wkb_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/unit/serialization/wkb_test.cpp b/test/unit/serialization/wkb_test.cpp index f82c4f32f..9a3bc1e86 100644 --- a/test/unit/serialization/wkb_test.cpp +++ b/test/unit/serialization/wkb_test.cpp @@ -106,7 +106,9 @@ TEST_CASE("Well-known-geometries") { REQUIRE(wkt0 == wkt1); // compare spatially (NOTE: GeometryCollection comparison also enforces strict order) +#if BOOST_VERSION >= 105800 REQUIRE(spatially_equal(geom_0, geom_1)); +#endif } } } From 988aa3ea43aa63e7541d68022513d230df1cb2d7 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 11:49:10 +0200 Subject: [PATCH 08/15] add guard to `get_object_severity` ref #3322 --- include/mapnik/debug.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mapnik/debug.hpp b/include/mapnik/debug.hpp index cf5e5b9c9..84290958b 100644 --- a/include/mapnik/debug.hpp +++ b/include/mapnik/debug.hpp @@ -69,15 +69,15 @@ public: static void set_severity(severity_type severity_level) { -//#ifdef MAPNIK_THREADSAFE -// std::lock_guard lock(severity_mutex_); -//#endif severity_level_ = severity_level; } // per object security levels static severity_type get_object_severity(std::string const& object_name) { +#ifdef MAPNIK_THREADSAFE + std::lock_guard lock(severity_mutex_); +#endif severity_map::iterator it = object_severity_level_.find(object_name); if (object_name.empty() || it == object_severity_level_.end()) { From 49b23622db8d87f63ed6cb2e4cb593966aaff1e2 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 14:58:46 +0200 Subject: [PATCH 09/15] Don't compile visitor ref #3380 (thanks @lightmare) --- test/unit/serialization/wkb_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/unit/serialization/wkb_test.cpp b/test/unit/serialization/wkb_test.cpp index 9a3bc1e86..8a617df26 100644 --- a/test/unit/serialization/wkb_test.cpp +++ b/test/unit/serialization/wkb_test.cpp @@ -16,6 +16,7 @@ #include #include +#if BOOST_VERSION >= 105800 namespace { struct spatially_equal_visitor @@ -79,6 +80,7 @@ bool spatially_equal(mapnik::geometry::geometry const& g0, mapnik::geometry:: } } +#endif TEST_CASE("Well-known-geometries") { From 9833bfb9ad16291d430d66028f16ce07f2dcc842 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 16:38:29 +0200 Subject: [PATCH 10/15] make opening rendered image an optional op ( ref #3374) --- utils/mapnik-render/mapnik-render.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mapnik-render/mapnik-render.cpp b/utils/mapnik-render/mapnik-render.cpp index c39922639..4a67131d7 100644 --- a/utils/mapnik-render/mapnik-render.cpp +++ b/utils/mapnik-render/mapnik-render.cpp @@ -21,7 +21,7 @@ int main (int argc,char** argv) namespace po = boost::program_options; bool verbose = false; - bool auto_open = true; + bool auto_open = false; int return_value = 0; std::string xml_file; std::string img_file; From fca1075fec9a8430ccacdd5d5f78bd34cc46b828 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Apr 2016 09:56:40 -0700 Subject: [PATCH 11/15] fix documentation for mapnik-render --open command - refs #3375 [skip ci] --- utils/mapnik-render/mapnik-render.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mapnik-render/mapnik-render.cpp b/utils/mapnik-render/mapnik-render.cpp index 4a67131d7..c172995c7 100644 --- a/utils/mapnik-render/mapnik-render.cpp +++ b/utils/mapnik-render/mapnik-render.cpp @@ -37,7 +37,7 @@ int main (int argc,char** argv) ("help,h", "produce usage message") ("version,V","print version string") ("verbose,v","verbose output") - ("open","automatically open the file after rendering (os x only)") + ("open","automatically open the file after rendering") ("xml",po::value(),"xml map to read") ("img",po::value(),"image to render") ("scale-factor",po::value(),"scale factor for rendering") From 650e8eea8a7bd357932fb8740a78af10552867b6 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 20:42:24 +0200 Subject: [PATCH 12/15] bump up version to 3.0.12 in preparation to release --- include/mapnik/version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mapnik/version.hpp b/include/mapnik/version.hpp index e1a367b68..deba4287c 100644 --- a/include/mapnik/version.hpp +++ b/include/mapnik/version.hpp @@ -27,7 +27,7 @@ #define MAPNIK_MAJOR_VERSION 3 #define MAPNIK_MINOR_VERSION 0 -#define MAPNIK_PATCH_VERSION 11 +#define MAPNIK_PATCH_VERSION 12 #define MAPNIK_VERSION (MAPNIK_MAJOR_VERSION*100000) + (MAPNIK_MINOR_VERSION*100) + (MAPNIK_PATCH_VERSION) From 4b3b62a40ceb886f0f8fe686a83d17d3de7d19a3 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 25 Apr 2016 20:43:32 +0200 Subject: [PATCH 13/15] minor formatting --- include/mapnik/value_hash.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mapnik/value_hash.hpp b/include/mapnik/value_hash.hpp index b050e370e..9924bff5b 100644 --- a/include/mapnik/value_hash.hpp +++ b/include/mapnik/value_hash.hpp @@ -41,7 +41,7 @@ template inline void hash_combine(std::size_t & seed, T const& v) { std::hash hasher; - seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); + seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } struct value_hasher From 31e8cfc65969095b860aa45f472c2fbc9556ac6b Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 26 Apr 2016 15:29:27 +0200 Subject: [PATCH 14/15] improve hash calc ref #3406 --- include/mapnik/value_hash.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/mapnik/value_hash.hpp b/include/mapnik/value_hash.hpp index 9924bff5b..80e10d855 100644 --- a/include/mapnik/value_hash.hpp +++ b/include/mapnik/value_hash.hpp @@ -26,22 +26,20 @@ // mapnik #include #include - // stl #include #pragma GCC diagnostic push #include #include + #pragma GCC diagnostic pop namespace mapnik { namespace detail { -template -inline void hash_combine(std::size_t & seed, T const& v) +inline void hash_combine(std::size_t & seed, std::size_t val) { - std::hash hasher; - seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= val + 0x9e3779b9 + (seed << 6) + (seed >> 2); } struct value_hasher @@ -56,6 +54,11 @@ struct value_hasher return static_cast(val.hashCode()); } + std::size_t operator()(value_integer val) const + { + return static_cast(val); + } + template std::size_t operator()(T const& val) const { @@ -69,7 +72,8 @@ struct value_hasher template std::size_t mapnik_hash_value(T const& val) { - std::size_t seed = util::apply_visitor(detail::value_hasher(), val); + std::size_t seed = 0; + detail::hash_combine(seed, util::apply_visitor(detail::value_hasher(), val)); detail::hash_combine(seed, val.which()); return seed; } From f5d6af4bb86240b7e41b60e3d910aae5bf40af88 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 26 Apr 2016 15:30:50 +0200 Subject: [PATCH 15/15] agg - make cover `unsigned` to avoid left shift of negative values ref #3406 --- deps/agg/include/agg_rasterizer_scanline_aa.h | 173 +++++++++--------- 1 file changed, 86 insertions(+), 87 deletions(-) diff --git a/deps/agg/include/agg_rasterizer_scanline_aa.h b/deps/agg/include/agg_rasterizer_scanline_aa.h index 77bc41bc7..b2d4e3e12 100644 --- a/deps/agg/include/agg_rasterizer_scanline_aa.h +++ b/deps/agg/include/agg_rasterizer_scanline_aa.h @@ -2,15 +2,15 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // -// The author gratefully acknowleges the support of David Turner, -// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType +// The author gratefully acknowleges the support of David Turner, +// Robert Wilhelm, and Werner Lemberg - the authors of the FreeType // libray - in producing this work. See http://www.freetype.org for details. // //---------------------------------------------------------------------------- @@ -19,12 +19,12 @@ // http://www.antigrain.com //---------------------------------------------------------------------------- // -// Adaptation for 32-bit screen coordinates has been sponsored by +// Adaptation for 32-bit screen coordinates has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// //---------------------------------------------------------------------------- #ifndef AGG_RASTERIZER_SCANLINE_AA_INCLUDED #define AGG_RASTERIZER_SCANLINE_AA_INCLUDED @@ -39,8 +39,8 @@ namespace agg //-----------------------------------------------------------------cell_aa - // A pixel cell. There're no constructors defined and it was done - // intentionally in order to avoid extra overhead when allocating an + // A pixel cell. There're no constructors defined and it was done + // intentionally in order to avoid extra overhead when allocating an // array of cells. struct cell_aa { @@ -67,10 +67,10 @@ namespace agg //==================================================rasterizer_scanline_aa - // Polygon rasterizer that is used to render filled polygons with - // high-quality Anti-Aliasing. Internally, by default, the class uses - // integer coordinates in format 24.8, i.e. 24 bits for integer part - // and 8 bits for fractional - see poly_subpixel_shift. This class can be + // Polygon rasterizer that is used to render filled polygons with + // high-quality Anti-Aliasing. Internally, by default, the class uses + // integer coordinates in format 24.8, i.e. 24 bits for integer part + // and 8 bits for fractional - see poly_subpixel_shift. This class can be // used in the following way: // // 1. filling_rule(filling_rule_e ft) - optional. @@ -79,20 +79,20 @@ namespace agg // // 3. reset() // - // 4. move_to(x, y) / line_to(x, y) - make the polygon. One can create + // 4. move_to(x, y) / line_to(x, y) - make the polygon. One can create // more than one contour, but each contour must consist of at least 3 // vertices, i.e. move_to(x1, y1); line_to(x2, y2); line_to(x3, y3); // is the absolute minimum of vertices that define a triangle. // The algorithm does not check either the number of vertices nor - // coincidence of their coordinates, but in the worst case it just + // coincidence of their coordinates, but in the worst case it just // won't draw anything. - // The orger of the vertices (clockwise or counterclockwise) + // The orger of the vertices (clockwise or counterclockwise) // is important when using the non-zero filling rule (fill_non_zero). // In this case the vertex order of all the contours must be the same // if you want your intersecting polygons to be without "holes". - // You actually can use different vertices order. If the contours do not - // intersect each other the order is not important anyway. If they do, - // contours with the same vertex order will be rendered without "holes" + // You actually can use different vertices order. If the contours do not + // intersect each other the order is not important anyway. If they do, + // contours with the same vertex order will be rendered without "holes" // while the intersecting contours with different orders will have "holes". // // filling_rule() and gamma() can be called anytime before "sweeping". @@ -122,7 +122,7 @@ namespace agg }; //-------------------------------------------------------------------- - rasterizer_scanline_aa() : + rasterizer_scanline_aa() : m_outline(), m_clipper(), m_filling_rule(fill_non_zero), @@ -136,8 +136,8 @@ namespace agg } //-------------------------------------------------------------------- - template - rasterizer_scanline_aa(const GammaF& gamma_function) : + template + rasterizer_scanline_aa(const GammaF& gamma_function) : m_outline(), m_clipper(m_outline), m_filling_rule(fill_non_zero), @@ -150,7 +150,7 @@ namespace agg } //-------------------------------------------------------------------- - void reset(); + void reset(); void reset_clipping(); void clip_box(double x1, double y1, double x2, double y2); void filling_rule(filling_rule_e filling_rule); @@ -158,7 +158,7 @@ namespace agg //-------------------------------------------------------------------- template void gamma(const GammaF& gamma_function) - { + { int i; for(i = 0; i < aa_scale; i++) { @@ -167,9 +167,9 @@ namespace agg } //-------------------------------------------------------------------- - unsigned apply_gamma(unsigned cover) const - { - return m_gamma[cover]; + unsigned apply_gamma(unsigned cover) const + { + return m_gamma[cover]; } //-------------------------------------------------------------------- @@ -198,7 +198,7 @@ namespace agg add_vertex(x, y, cmd); } } - + //-------------------------------------------------------------------- int min_x() const { return m_outline.min_x(); } int min_y() const { return m_outline.min_y(); } @@ -237,7 +237,7 @@ namespace agg sl.reset_spans(); unsigned num_cells = m_outline.scanline_num_cells(m_scan_y); const cell_aa* const* cells = m_outline.scanline_cells(m_scan_y); - int cover = 0; + unsigned cover = 0; while(num_cells) { @@ -276,7 +276,7 @@ namespace agg } } } - + if(sl.num_spans()) break; ++m_scan_y; } @@ -294,7 +294,7 @@ namespace agg //-------------------------------------------------------------------- // Disable copying rasterizer_scanline_aa(const rasterizer_scanline_aa&); - const rasterizer_scanline_aa& + const rasterizer_scanline_aa& operator = (const rasterizer_scanline_aa&); private: @@ -321,32 +321,32 @@ namespace agg //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::reset() - { - m_outline.reset(); + template + void rasterizer_scanline_aa::reset() + { + m_outline.reset(); m_status = status_initial; } //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::filling_rule(filling_rule_e filling_rule) - { - m_filling_rule = filling_rule; + template + void rasterizer_scanline_aa::filling_rule(filling_rule_e filling_rule) + { + m_filling_rule = filling_rule; } //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::clip_box(double x1, double y1, + template + void rasterizer_scanline_aa::clip_box(double x1, double y1, double x2, double y2) { reset(); - m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), + m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), conv_type::upscale(x2), conv_type::upscale(y2)); } //------------------------------------------------------------------------ - template + template void rasterizer_scanline_aa::reset_clipping() { reset(); @@ -354,7 +354,7 @@ namespace agg } //------------------------------------------------------------------------ - template + template void rasterizer_scanline_aa::close_polygon() { if(m_status == status_line_to) @@ -365,56 +365,56 @@ namespace agg } //------------------------------------------------------------------------ - template + template void rasterizer_scanline_aa::move_to(int x, int y) { if(m_outline.sorted()) reset(); if(m_auto_close) close_polygon(); - m_clipper.move_to(m_start_x = conv_type::downscale(x), + m_clipper.move_to(m_start_x = conv_type::downscale(x), m_start_y = conv_type::downscale(y)); m_status = status_move_to; } //------------------------------------------------------------------------ - template + template void rasterizer_scanline_aa::line_to(int x, int y) { - m_clipper.line_to(m_outline, - conv_type::downscale(x), + m_clipper.line_to(m_outline, + conv_type::downscale(x), conv_type::downscale(y)); m_status = status_line_to; } //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::move_to_d(double x, double y) - { + template + void rasterizer_scanline_aa::move_to_d(double x, double y) + { if(m_outline.sorted()) reset(); if(m_auto_close) close_polygon(); - m_clipper.move_to(m_start_x = conv_type::upscale(x), - m_start_y = conv_type::upscale(y)); + m_clipper.move_to(m_start_x = conv_type::upscale(x), + m_start_y = conv_type::upscale(y)); m_status = status_move_to; } //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::line_to_d(double x, double y) - { - m_clipper.line_to(m_outline, - conv_type::upscale(x), - conv_type::upscale(y)); + template + void rasterizer_scanline_aa::line_to_d(double x, double y) + { + m_clipper.line_to(m_outline, + conv_type::upscale(x), + conv_type::upscale(y)); m_status = status_line_to; } //------------------------------------------------------------------------ - template + template void rasterizer_scanline_aa::add_vertex(double x, double y, unsigned cmd) { - if(is_move_to(cmd)) + if(is_move_to(cmd)) { move_to_d(x, y); } - else + else if(is_vertex(cmd)) { line_to_d(x, y); @@ -427,32 +427,32 @@ namespace agg } //------------------------------------------------------------------------ - template + template void rasterizer_scanline_aa::edge(int x1, int y1, int x2, int y2) { if(m_outline.sorted()) reset(); m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1)); - m_clipper.line_to(m_outline, - conv_type::downscale(x2), + m_clipper.line_to(m_outline, + conv_type::downscale(x2), conv_type::downscale(y2)); m_status = status_move_to; } - - //------------------------------------------------------------------------ - template - void rasterizer_scanline_aa::edge_d(double x1, double y1, - double x2, double y2) - { - if(m_outline.sorted()) reset(); - m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); - m_clipper.line_to(m_outline, - conv_type::upscale(x2), - conv_type::upscale(y2)); - m_status = status_move_to; - } //------------------------------------------------------------------------ - template + template + void rasterizer_scanline_aa::edge_d(double x1, double y1, + double x2, double y2) + { + if(m_outline.sorted()) reset(); + m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); + m_clipper.line_to(m_outline, + conv_type::upscale(x2), + conv_type::upscale(y2)); + m_status = status_move_to; + } + + //------------------------------------------------------------------------ + template void rasterizer_scanline_aa::sort() { if(m_auto_close) close_polygon(); @@ -460,12 +460,12 @@ namespace agg } //------------------------------------------------------------------------ - template + template AGG_INLINE bool rasterizer_scanline_aa::rewind_scanlines() { if(m_auto_close) close_polygon(); m_outline.sort_cells(); - if(m_outline.total_cells() == 0) + if(m_outline.total_cells() == 0) { return false; } @@ -475,14 +475,14 @@ namespace agg //------------------------------------------------------------------------ - template + template AGG_INLINE bool rasterizer_scanline_aa::navigate_scanline(int y) { if(m_auto_close) close_polygon(); m_outline.sort_cells(); - if(m_outline.total_cells() == 0 || - y < m_outline.min_y() || - y > m_outline.max_y()) + if(m_outline.total_cells() == 0 || + y < m_outline.min_y() || + y > m_outline.max_y()) { return false; } @@ -491,7 +491,7 @@ namespace agg } //------------------------------------------------------------------------ - template + template bool rasterizer_scanline_aa::hit_test(int tx, int ty) { if(!navigate_scanline(ty)) return false; @@ -507,4 +507,3 @@ namespace agg #endif -