Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix don't paint transparent color via Eraser tool in Background layers (fix #4370) #4420

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/app/tools/inks.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
Expand Down Expand Up @@ -366,7 +366,8 @@ class EraserInk : public BaseInk {
}
case ReplaceFgWithBg:
loop->setPrimaryColor(loop->getFgColor());
loop->setSecondaryColor(loop->getBgColor());
loop->setSecondaryColor(loop->getBgColor() |
(loop->getLayer()->isBackground() ? ColorAMask : 0));
Comment on lines +369 to +370
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works only for RGB images, but here getBgColor() and setSecondaryColor() could be handling an index or a grayscale color (the bug is reproducible in a grayscale image even with this patch).

setProc(get_ink_proc2<ReplaceInkProcessing>(loop));
break;

Expand Down Expand Up @@ -516,7 +517,7 @@ class SelectionInk : public BaseInk {
m_mask.unfreeze();

loop->setMask(&m_mask);
double cornerThick = (loop->isTilemapMode()) ?
double cornerThick = (loop->isTilemapMode()) ?
CORNER_THICK_FOR_TILEMAP_MODE :
CORNER_THICK_FOR_PIXELS_MODE;
loop->getDocument()->setTransformation(
Expand Down