From 9b72dd868f1aed2de1811a734656934ae67836f9 Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Fri, 4 Mar 2016 15:14:01 +0000 Subject: [PATCH] raster scaling: a bit of optimization --- include/mapnik/span_image_filter.hpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/include/mapnik/span_image_filter.hpp b/include/mapnik/span_image_filter.hpp index 14ef7eb75..ccfd0c347 100644 --- a/include/mapnik/span_image_filter.hpp +++ b/include/mapnik/span_image_filter.hpp @@ -79,16 +79,19 @@ public: { base_type::interpolator().coordinates(&x, &y); - int src_x = x >> agg::image_subpixel_shift; - int src_y = y >> agg::image_subpixel_shift; - const value_type* pix = reinterpret_cast(base_type::source().span(src_x, src_y, 1)); - if (nodata_value_ && *nodata_value_ == *pix) + if (nodata_value_) { - span->v = *nodata_value_; - span->a = base_mask; - ++span; - ++base_type::interpolator(); - continue; + int src_x = x >> agg::image_subpixel_shift; + int src_y = y >> agg::image_subpixel_shift; + const value_type* pix = reinterpret_cast(base_type::source().span(src_x, src_y, 1)); + if (*nodata_value_ == *pix) + { + span->v = *nodata_value_; + span->a = base_mask; + ++span; + ++base_type::interpolator(); + continue; + } } x += base_type::filter_dx_int() - radius_x;