From: jucablues Date: Thu, 7 Feb 2008 12:12:54 +0000 (+0000) Subject: feDisplacementMap resolution independence fix sent by JF Barraud X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8a165492e0e7b108b9dc5ed48b220864bd121072;p=inkscape.git feDisplacementMap resolution independence fix sent by JF Barraud --- diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index afc2df8e7..838db0fdf 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -26,7 +26,7 @@ FilterPrimitive * FilterDisplacementMap::create() { FilterDisplacementMap::~FilterDisplacementMap() {} -int FilterDisplacementMap::render(FilterSlot &slot, FilterUnits const &/*units*/) { +int FilterDisplacementMap::render(FilterSlot &slot, FilterUnits const &units) { NRPixBlock *texture = slot.get(_input); NRPixBlock *map = slot.get(_input2); @@ -67,7 +67,11 @@ int FilterDisplacementMap::render(FilterSlot &slot, FilterUnits const &/*units*/ int in_w = map->area.x1 - map->area.x0; int in_h = map->area.y1 - map->area.y0; double coordx, coordy; - + + Matrix trans = units.get_matrix_primitiveunits2pb(); + double scalex = scale*trans.expansionX(); + double scaley = scale*trans.expansionY(); + for (x=0; x < out_w; x++){ for (y=0; y < out_h; y++){ if (x+out_x0-map->area.x0 >= 0 && @@ -75,8 +79,8 @@ int FilterDisplacementMap::render(FilterSlot &slot, FilterUnits const &/*units*/ y+out_y0-map->area.y0 >= 0 && y+out_y0-map->area.y0 < in_h){ - coordx = out_x0 - map->area.x0 + x + scale * ( double(map_data[4*((x+out_x0-map->area.x0) + in_w*(y+out_y0-map->area.y0)) + Xchannel])/255 - 0.5); - coordy = out_y0 - map->area.y0 + y + scale * ( double(map_data[4*((x+out_x0-map->area.x0) + in_w*(y+out_y0-map->area.y0)) + Ychannel])/255 - 0.5); + coordx = out_x0 - map->area.x0 + x + scalex * ( double(map_data[4*((x+out_x0-map->area.x0) + in_w*(y+out_y0-map->area.y0)) + Xchannel])/255 - 0.5); + coordy = out_y0 - map->area.y0 + y + scaley * ( double(map_data[4*((x+out_x0-map->area.x0) + in_w*(y+out_y0-map->area.y0)) + Ychannel])/255 - 0.5); if (coordx>=0 && coordx=0 && coordy