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

Show brush preview for custom brushes when using Paint Bucket tool #4060

Merged
merged 1 commit into from Sep 26, 2023

Conversation

martincapello
Copy link
Member

Fix #4052

@Gasparoken
Copy link
Member

Gasparoken commented Sep 25, 2023

It works great and LGTM.

@martincapello martincapello assigned dacap and unassigned Gasparoken Sep 25, 2023
Comment on lines 976 to 981
if (m_tilesMode)
m_pointShape = App::instance()->toolBox()->getPointShapeById(tools::WellKnownPointShapes::Tile);
else if (m_brush->type() == BrushType::kImageBrushType)
m_pointShape = App::instance()->toolBox()->getPointShapeById(tools::WellKnownPointShapes::Brush);
else
m_pointShape = App::instance()->toolBox()->getPointShapeById(tools::WellKnownPointShapes::Pixel);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of calling App::instance()->toolBox()->getPointShapeById() you can assign the id into a variable and use it as argument in one call site

Suggested change
if (m_tilesMode)
m_pointShape = App::instance()->toolBox()->getPointShapeById(tools::WellKnownPointShapes::Tile);
else if (m_brush->type() == BrushType::kImageBrushType)
m_pointShape = App::instance()->toolBox()->getPointShapeById(tools::WellKnownPointShapes::Brush);
else
m_pointShape = App::instance()->toolBox()->getPointShapeById(tools::WellKnownPointShapes::Pixel);
const char* id;
if (m_tilesMode)
id = tools::WellKnownPointShapes::Tile;
else if (m_brush->type() == BrushType::kImageBrushType)
id = tools::WellKnownPointShapes::Brush;
else
id = tools::WellKnownPointShapes::Pixel;
m_pointShape = App::instance()->toolBox()->getPointShapeById(id);

This is just to avoid writing App::instance()->toolBox()->getPointShapeById 3 times.

@dacap dacap assigned martincapello and unassigned dacap Sep 25, 2023
@martincapello martincapello assigned dacap and unassigned martincapello Sep 26, 2023
@dacap dacap merged commit 8b747b4 into aseprite:main Sep 26, 2023
7 checks passed
@martincapello martincapello deleted the fix-brushpreview-for-paintbucket branch September 26, 2023 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show brush preview of custom brushes correctly with Paint Bucket tool
3 participants