fix raster resampling bug - closes #1489 and fixes mapbox/tilemill#1888

This commit is contained in:
Dane Springmeyer 2013-01-31 18:43:06 -05:00
parent 523f00c34f
commit 4c66d6dda0
4 changed files with 8 additions and 7 deletions

View file

@ -40,7 +40,7 @@ public:
virtual ~memory_datasource(); virtual ~memory_datasource();
void push(feature_ptr feature); void push(feature_ptr feature);
datasource::datasource_t type() const; datasource::datasource_t type() const;
featureset_ptr features(const query& q) const; featureset_ptr features(query const& q) const;
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
box2d<double> envelope() const; box2d<double> envelope() const;
boost::optional<geometry_t> get_geometry_type() const; boost::optional<geometry_t> get_geometry_type() const;

View file

@ -23,7 +23,8 @@
// mapnik // mapnik
#include <mapnik/image_data.hpp> #include <mapnik/image_data.hpp>
#include <mapnik/image_scaling.hpp> #include <mapnik/image_scaling.hpp>
#include <mapnik/span_image_filter.hpp> // does not handle alpha correctly
//#include <mapnik/span_image_filter.hpp>
// boost // boost
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
@ -352,15 +353,16 @@ void scale_image_agg(Image & target,
// http://old.nabble.com/Re%3A-Newbie---texture-p5057255.html // http://old.nabble.com/Re%3A-Newbie---texture-p5057255.html
// high quality resampler // high quality resampler
//typedef agg::span_image_resample_rgba_affine<img_src_type> span_gen_type; typedef agg::span_image_resample_rgba_affine<img_src_type> span_gen_type;
// faster, lower quality // faster, lower quality
//typedef agg::span_image_filter_rgba<img_src_type,interpolator_type> span_gen_type; //typedef agg::span_image_filter_rgba<img_src_type,interpolator_type> span_gen_type;
// local, modified agg::span_image_resample_rgba_affine // local, modified agg::span_image_resample_rgba_affine
// not convinced we need this // dating back to when we were not handling alpha correctly
// and this file helped work around symptoms
// https://github.com/mapnik/mapnik/issues/1489 // https://github.com/mapnik/mapnik/issues/1489
typedef mapnik::span_image_resample_rgba_affine<img_src_type> span_gen_type; //typedef mapnik::span_image_resample_rgba_affine<img_src_type> span_gen_type;
span_gen_type sg(img_src, interpolator, filter); span_gen_type sg(img_src, interpolator, filter);
agg::render_scanlines_aa(ras, sl, rb_dst_pre, sa, sg); agg::render_scanlines_aa(ras, sl, rb_dst_pre, sa, sg);
} }

View file

@ -27,7 +27,6 @@
#include <mapnik/image_util.hpp> #include <mapnik/image_util.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/ctrans.hpp> #include <mapnik/ctrans.hpp>
#include <mapnik/span_image_filter.hpp>
#include <mapnik/raster.hpp> #include <mapnik/raster.hpp>
#include <mapnik/proj_transform.hpp> #include <mapnik/proj_transform.hpp>
@ -188,7 +187,7 @@ void reproject_and_scale_raster(raster & target, raster const& source,
agg::render_scanlines_aa(rasterizer, scanline, rb_pre, agg::render_scanlines_aa(rasterizer, scanline, rb_pre,
sa, sg); sa, sg);
} else { } else {
typedef mapnik::span_image_resample_rgba_affine typedef agg::span_image_resample_rgba_affine
<img_accessor_type> span_gen_type; <img_accessor_type> span_gen_type;
span_gen_type sg(ia, interpolator, filter); span_gen_type sg(ia, interpolator, filter);
agg::render_scanlines_aa(rasterizer, scanline, rb_pre, agg::render_scanlines_aa(rasterizer, scanline, rb_pre,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB