Commit 9076ab24 authored by dmMaze's avatar dmMaze
Browse files

fix result mask for rect tool

parent 7372bdb0
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class StrokeItemUndoCommand(QUndoCommand):


class InpaintUndoCommand(QUndoCommand):
    def __init__(self, canvas: Canvas, inpainted: np.ndarray, mask: np.ndarray, inpaint_rect: List[int]):
    def __init__(self, canvas: Canvas, inpainted: np.ndarray, mask: np.ndarray, inpaint_rect: List[int], merge_existing_mask=False):
        super().__init__()
        self.canvas = canvas
        img_array = self.canvas.imgtrans_proj.inpainted_array
@@ -49,6 +49,9 @@ class InpaintUndoCommand(QUndoCommand):
        self.undo_img = np.copy(img_view)
        self.undo_mask = np.copy(mask_view)
        self.redo_img = inpainted
        if merge_existing_mask:
            self.redo_mask = np.bitwise_or(mask, mask_view)
        else:
            self.redo_mask = mask
        self.inpaint_rect = inpaint_rect

+1 −1
Original line number Diff line number Diff line
@@ -800,7 +800,7 @@ class DrawingPanel(Widget):
        ballon_mask = inpaint_dict['ballon_mask']
        if not need_inpaint and pcfg.module.check_need_inpaint:
            img[np.where(ballon_mask > 0)] = bground_bgr
            self.canvas.push_undo_command(InpaintUndoCommand(self.canvas, img, mask, inpaint_dict['inpaint_rect']))
            self.canvas.push_undo_command(InpaintUndoCommand(self.canvas, img, mask, inpaint_dict['inpaint_rect'], merge_existing_mask=True))
            self.clearInpaintItems()
        else:
            self.runInpaint(inpaint_dict=inpaint_dict)