Minor change: use more "auto" before dynamic_cast()

This commit is contained in:
David Capello 2020-09-25 09:48:56 -03:00
parent d843866746
commit 44f65ad305
3 changed files with 7 additions and 7 deletions

View File

@ -2519,7 +2519,7 @@ void Editor::startSelectionTransformation(const gfx::Point& move, double angle)
if (std::fabs(angle) > 1e-5)
movingPixels->rotate(angle);
}
else if (StandbyState* standby = dynamic_cast<StandbyState*>(m_state.get())) {
else if (auto standby = dynamic_cast<StandbyState*>(m_state.get())) {
standby->startSelectionTransformation(this, move, angle);
}
}
@ -2843,7 +2843,7 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
// tool to show automatic guides.
if (m_showAutoCelGuides &&
m_state->requireBrushPreview()) {
ui::MouseMessage* mouseMsg = dynamic_cast<ui::MouseMessage*>(msg);
auto mouseMsg = dynamic_cast<ui::MouseMessage*>(msg);
ColorPicker picker;
picker.pickColor(getSite(),

View File

@ -584,7 +584,7 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
}
// We don't need to drop the pixels if a MoveMaskCommand of Content is executed.
if (MoveMaskCommand* moveMaskCmd = dynamic_cast<MoveMaskCommand*>(command)) {
if (auto moveMaskCmd = dynamic_cast<MoveMaskCommand*>(command)) {
if (moveMaskCmd->getTarget() == MoveMaskCommand::Content) {
if (layer_is_locked(m_editor)) {
ev.cancel();
@ -656,7 +656,7 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
// Flip Horizontally/Vertically commands are handled manually to
// avoid dropping the floating region of pixels.
else if (command->id() == CommandId::Flip()) {
if (FlipCommand* flipCommand = dynamic_cast<FlipCommand*>(command)) {
if (auto flipCommand = dynamic_cast<FlipCommand*>(command)) {
this->flip(flipCommand->getFlipType());
ev.cancel();
@ -665,7 +665,7 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
}
// Rotate is quite simple, we can add the angle to the current transformation.
else if (command->id() == CommandId::Rotate()) {
if (RotateCommand* rotate = dynamic_cast<RotateCommand*>(command)) {
if (auto rotate = dynamic_cast<RotateCommand*>(command)) {
if (rotate->flipMask()) {
this->rotate(rotate->angle());

View File

@ -704,7 +704,7 @@ void StandbyState::startSelectionTransformation(Editor* editor,
{
transformSelection(editor, NULL, NoHandle);
if (MovingPixelsState* movingPixels = dynamic_cast<MovingPixelsState*>(editor->getState().get())) {
if (auto movingPixels = dynamic_cast<MovingPixelsState*>(editor->getState().get())) {
movingPixels->translate(gfx::PointF(move));
if (std::fabs(angle) > 1e-5)
movingPixels->rotate(angle);
@ -715,7 +715,7 @@ void StandbyState::startFlipTransformation(Editor* editor, doc::algorithm::FlipT
{
transformSelection(editor, NULL, NoHandle);
if (MovingPixelsState* movingPixels = dynamic_cast<MovingPixelsState*>(editor->getState().get()))
if (auto movingPixels = dynamic_cast<MovingPixelsState*>(editor->getState().get()))
movingPixels->flip(flipType);
}