From 2a3a402f5db9c8bf14fcc5ddd2e1d6fed2928bdc Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 12 Sep 2012 13:25:40 -0700 Subject: [PATCH] finish fixing pixel alignment for raster rendering in cairo - closes #1471 --- src/agg/process_raster_symbolizer.cpp | 6 +++--- src/cairo_renderer.cpp | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/agg/process_raster_symbolizer.cpp b/src/agg/process_raster_symbolizer.cpp index 9d9e56bbd..dbdcc88b7 100644 --- a/src/agg/process_raster_symbolizer.cpp +++ b/src/agg/process_raster_symbolizer.cpp @@ -68,10 +68,10 @@ void agg_renderer::process(raster_symbolizer const& sym, raster target(target_ext, target_data); scaling_method_e scaling_method = sym.get_scaling_method(); double filter_radius = sym.calculate_filter_factor(); - double offset_x = ext.minx() - start_x; - double offset_y = ext.miny() - start_y; if (!prj_trans.equal()) { + double offset_x = ext.minx() - start_x; + double offset_y = ext.miny() - start_y; reproject_and_scale_raster(target, *source, prj_trans, offset_x, offset_y, sym.get_mesh_size(), @@ -82,7 +82,7 @@ void agg_renderer::process(raster_symbolizer const& sym, { if (scaling_method == SCALING_BILINEAR8) { - scale_image_bilinear8(target.data_,source->data_, offset_x, offset_y); + scale_image_bilinear8(target.data_,source->data_, 0.0, 0.0); } else { double scaling_ratio = ext.width() / source->data_.width(); diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index 190e8fd3d..614a2583b 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -1434,10 +1434,10 @@ void cairo_renderer_base::process(raster_symbolizer const& sym, raster target(target_ext, target_data); scaling_method_e scaling_method = sym.get_scaling_method(); double filter_radius = sym.calculate_filter_factor(); - double offset_x = ext.minx() - start_x; - double offset_y = ext.miny() - start_y; if (!prj_trans.equal()) { + double offset_x = ext.minx() - start_x; + double offset_y = ext.miny() - start_y; reproject_and_scale_raster(target, *source, prj_trans, offset_x, offset_y, sym.get_mesh_size(), @@ -1446,16 +1446,18 @@ void cairo_renderer_base::process(raster_symbolizer const& sym, } else { - if (scaling_method == SCALING_BILINEAR8){ - scale_image_bilinear8(target.data_,source->data_, offset_x, offset_y); - } else { + if (scaling_method == SCALING_BILINEAR8) + { + scale_image_bilinear8(target.data_,source->data_, 0.0, 0.0); + } else + { double scaling_ratio = ext.width() / source->data_.width(); scale_image_agg(target.data_, source->data_, scaling_method, scaling_ratio, - offset_x, - offset_y, + 0.0, + 0.0, filter_radius); } }