@@ -147,6 +147,7 @@ TransparencyTool::UseTool(ImageView* view, uint32 buttons, BPoint point, BPoint)
147147 y_sqr = (int32)(point.y - rc.top - y);
148148 y_sqr *= y_sqr;
149149 int32 real_y = (int32)(rc.top + y);
150+ int32 real_y_times_bpr = real_y * bpr;
150151 int32 real_x;
151152 for (int32 x = 0 ; x < width + 1 ; x++) {
152153 x_dist = (int32)(point.x - rc.left - x);
@@ -155,26 +156,26 @@ TransparencyTool::UseTool(ImageView* view, uint32 buttons, BPoint point, BPoint)
155156 if (fToolSettings .use_current_brush == true ) {
156157 union color_conversion brush_color;
157158 brush_color.word = *(brush_bits + x + y * brush_bpr);
158- brush_val = brush_color.bytes [3 ];
159+ brush_val = brush_color.bytes [3 ] / 255 . ;
159160 }
160161 if ((fToolSettings .use_current_brush == true && brush_val > 0.0 )
161162 || (fToolSettings .use_current_brush == false
162163 && sqrt_table[x_dist * x_dist + y_sqr] <= half_width)) {
163- color.word = *(bits_origin + real_y * bpr + real_x);
164+ color.word = *(bits_origin + real_y_times_bpr + real_x);
164165 if (selection == NULL || selection->IsEmpty () == true
165166 || selection->ContainsPoint (real_x, real_y)) {
166167
167168 uint8 diff = fabs (color.bytes [3 ] - transparency_value);
168- uint8 step = (uint8)(ceil (diff * pressure * brush_val / 2 ));
169+ uint8 step = (uint8)(ceil (diff * pressure * brush_val));
169170
170171 if (color.bytes [3 ] < transparency_value) {
171172 color.bytes [3 ]
172173 = (uint8)min_c (color.bytes [3 ] + step, transparency_value);
173- *(bits_origin + real_y * bpr + real_x) = color.word ;
174+ *(bits_origin + real_y_times_bpr + real_x) = color.word ;
174175 } else if (color.bytes [3 ] > transparency_value) {
175176 color.bytes [3 ]
176177 = (uint8)max_c (color.bytes [3 ] - step, transparency_value);
177- *(bits_origin + real_y * bpr + real_x) = color.word ;
178+ *(bits_origin + real_y_times_bpr + real_x) = color.word ;
178179 }
179180 }
180181 }
@@ -184,7 +185,7 @@ TransparencyTool::UseTool(ImageView* view, uint32 buttons, BPoint point, BPoint)
184185 imageUpdater->AddRect (rc);
185186
186187 SetLastUpdatedRect (LastUpdatedRect () | rc);
187- snooze (20 * 1000 );
188+ snooze (500 );
188189 }
189190 }
190191
0 commit comments