summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2008-02-19 14:48:10 +0000
committerjucablues <jucablues@users.sourceforge.net>2008-02-19 14:48:10 +0000
commit7be1336d0b3a5fb073c93a8fb8b190f6f36c9526 (patch)
tree86b51b7f91313e4406ed90b9332690239f70b998 /src
parentUpdate translator (diff)
downloadinkscape-7be1336d0b3a5fb073c93a8fb8b190f6f36c9526.tar.gz
inkscape-7be1336d0b3a5fb073c93a8fb8b190f6f36c9526.zip
* convolve matrix code refactoring
* filter effects dialog warning cleanup (bzr r4776)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-filter-convolve-matrix.cpp25
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp2
2 files changed, 17 insertions, 10 deletions
diff --git a/src/display/nr-filter-convolve-matrix.cpp b/src/display/nr-filter-convolve-matrix.cpp
index 360ff6567..e23a8b32f 100644
--- a/src/display/nr-filter-convolve-matrix.cpp
+++ b/src/display/nr-filter-convolve-matrix.cpp
@@ -55,6 +55,9 @@ int FilterConvolveMatrix::render(FilterSlot &slot, FilterUnits const &/*units*/)
int width = in->area.x1 - in->area.x0;
int height = in->area.y1 - in->area.y0;
+ unsigned int index;
+ unsigned int kernel_index;
+
for (x=targetX; x < width - (orderX - targetX); x++){
for (y=targetY; y < height - (orderY - targetY); y++){
result_R = 0;
@@ -64,20 +67,24 @@ int FilterConvolveMatrix::render(FilterSlot &slot, FilterUnits const &/*units*/)
for (i=0; i < orderY; i++){
for (j=0; j < orderX; j++){
if (inside_area(x - targetX + j, y - targetY + i, width, height)){
- result_R += ( (double) in_data[4*( x - targetX + j + width*(y - targetY + i) )] * kernelMatrix[orderX-j-1 + orderX*(orderY-i-1)] );
- result_G += ( (double) in_data[4*( x - targetX + j + width*(y - targetY + i) )+1] * kernelMatrix[orderX-j-1 + orderX*(orderY-i-1)] );
- result_B += ( (double) in_data[4*( x - targetX + j + width*(y - targetY + i) )+2] * kernelMatrix[orderX-j-1 + orderX*(orderY-i-1)] );
- result_A += ( (double) in_data[4*( x - targetX + j + width*(y - targetY + i) )+3] * kernelMatrix[orderX-j-1 + orderX*(orderY-i-1)] );
+ index = 4*( x - targetX + j + width*(y - targetY + i) );
+ kernel_index = orderX-j-1 + orderX*(orderY-i-1);
+ result_R += ( (double) in_data[index++] * kernelMatrix[kernel_index] );
+ result_G += ( (double) in_data[index++] * kernelMatrix[kernel_index] );
+ result_B += ( (double) in_data[index++] * kernelMatrix[kernel_index] );
+ result_A += ( (double) in_data[index] * kernelMatrix[kernel_index] );
}
}
}
+ unsigned int out_index = 4*( x + width*y );
+ out_data[out_index++] = CLAMP_D_TO_U8(result_R / divisor + bias);
+ out_data[out_index++] = CLAMP_D_TO_U8(result_G / divisor + bias);
+ out_data[out_index++] = CLAMP_D_TO_U8(result_B / divisor + bias);
- out_data[4*( x + width*y )] = CLAMP_D_TO_U8(result_R / divisor + bias);
- out_data[4*( x + width*y )+1] = CLAMP_D_TO_U8(result_G / divisor + bias);
- out_data[4*( x + width*y )+2] = CLAMP_D_TO_U8(result_B / divisor + bias);
- out_data[4*( x + width*y )+3] = CLAMP_D_TO_U8(result_A / divisor + bias);
if( preserveAlpha ) {
- out_data[4*( x + width*y )+3] = in_data[4*( x + width*y )+3];
+ out_data[out_index] = in_data[out_index];
+ } else {
+ out_data[out_index] = CLAMP_D_TO_U8(result_A / divisor + bias);
}
}
}
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 595c8612b..30b6ac4cf 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -2409,7 +2409,7 @@ void FilterEffectsDialog::update_settings_view()
//First Tab
std::vector<Gtk::Widget*> vect1 = _settings_tab1.get_children();
- for(int i=0; i<vect1.size(); i++) vect1[i]->hide_all();
+ for(unsigned int i=0; i<vect1.size(); i++) vect1[i]->hide_all();
_empty_settings.show();
if (prefs_get_int_attribute ("options.showfiltersinfobox", "value", 1)){