- if(!have_selection){
- /* selection consists only of mask */
- selection_test=0.;
- for(j = 0; j < todo; j++)
- selection_test += selection[j] = Avec[j];
- have_selection=1;
- }else{
- if(invert_selection){
- if(selection_test < SELECT_THRESH){
- /* fully selected after invert, clip to mask */
- selection_test=0.f;
- for(j = 0; j < todo; j++)
- selection_test += selection[j] = Avec[j];
- }else if (selection_test >= todo-SELECT_THRESH){
- /* fully deselected after invert */
- selection_test=0.;
+ if(!op){
+ if(!have_selection){
+ /* selection consists only of mask */
+ selection_test=0.;
+ for(j = 0; j < todo; j++)
+ selection_test += selection[j] = Avec[j];
+ have_selection=1;
+ }else{
+ if(invert_selection){
+ if(selection_test < SELECT_THRESH){
+ /* fully selected after invert, clip to mask */
+ selection_test=0.f;
+ for(j = 0; j < todo; j++)
+ selection_test += selection[j] = Avec[j];
+ }else{
+ /* partial selection after invert, clip to mask */
+ selection_test=0.f;
+ for(j = 0; j < todo; j++)
+ selection_test += selection[j] = Avec[j]*(1.f-selection[j]);
+ }