@@ -240,23 +240,27 @@ def do_tool_operation(self, operation):
240240 else :
241241 source_pixbuf = self .get_main_pixbuf ()
242242 self .get_image ().set_temp_pixbuf (source_pixbuf .copy ())
243- self .crop_temp_pixbuf (x , y , width , height , is_selection , rgba )
243+ self ._crop_temp_pixbuf (x , y , width , height , is_selection , rgba )
244244 self .common_end_operation (operation )
245245
246- def crop_temp_pixbuf (self , x , y , width , height , is_selection , rgba ):
247- new_pixbuf = GdkPixbuf .Pixbuf .new (GdkPixbuf .Colorspace .RGB , True , 8 , width , height )
248- new_pixbuf .fill (rgba )
246+ def _crop_temp_pixbuf (self , x , y , width , height , is_selection , rgba ):
249247 src_x = max (x , 0 )
250248 src_y = max (y , 0 )
249+
251250 if is_selection :
252251 dest_x = 0
253252 dest_y = 0
254253 else :
255254 dest_x = max (- 1 * x , 0 )
256255 dest_y = max (- 1 * y , 0 )
256+
257+ new_pixbuf = GdkPixbuf .Pixbuf .new (GdkPixbuf .Colorspace .RGB , True , 8 , width , height )
258+ new_pixbuf .fill (rgba )
259+
257260 temp_p = self .get_image ().temp_pixbuf
258- min_w = min (width , temp_p .get_width () - src_x )
259- min_h = min (height , temp_p .get_height () - src_y )
261+ min_w = min (width - dest_x , temp_p .get_width () - src_x )
262+ min_h = min (height - dest_y , temp_p .get_height () - src_y )
263+
260264 temp_p .copy_area (src_x , src_y , min_w , min_h , new_pixbuf , dest_x , dest_y )
261265 self .get_image ().set_temp_pixbuf (new_pixbuf )
262266
0 commit comments