Fix "clang-tidy" suggestions about variables that can be declared 'constants'

This commit is contained in:
Gaspar Capello 2024-05-03 17:31:03 -03:00
parent 533ad50432
commit 344f2c9606
2 changed files with 20 additions and 20 deletions

View File

@ -822,13 +822,13 @@ void PixelsMovement::alignMasksAndTransformData(
// Raw grid alignment of currentData can result in unintentional scaling. // Raw grid alignment of currentData can result in unintentional scaling.
// That's why we need to know if the artist's intention was just to move // That's why we need to know if the artist's intention was just to move
// the selection and/or scaling via 'initialDeltaA' and 'initialDeltaB'. // the selection and/or scaling via 'initialDeltaA' and 'initialDeltaB'.
gfx::Point currentDataAlignedOrigin = const gfx::Point currentDataAlignedOrigin =
grid.alignBounds(gfx::Rect(m_initialData.bounds().x + deltaA.w, grid.alignBounds(gfx::Rect(m_initialData.bounds().x + deltaA.w,
m_initialData.bounds().y + deltaA.h, m_initialData.bounds().y + deltaA.h,
1, 1)).origin(); 1, 1)).origin();
int deltaH = deltaB.w - deltaA.w; int deltaH = deltaB.w - deltaA.w;
int deltaV = deltaB.h - deltaA.h; int deltaV = deltaB.h - deltaA.h;
gfx::RectF currentDataBounds( const gfx::RectF currentDataBounds(
currentDataAlignedOrigin.x, currentDataAlignedOrigin.x,
currentDataAlignedOrigin.y, currentDataAlignedOrigin.y,
m_initialData.bounds().w + (deltaH == 0 ? 0 : deltaH), m_initialData.bounds().w + (deltaH == 0 ? 0 : deltaH),
@ -873,13 +873,13 @@ void PixelsMovement::stampImage(bool finalStamp)
// 'reproduceAllTransformationsWithInnerCmds' function for restoring later. // 'reproduceAllTransformationsWithInnerCmds' function for restoring later.
// All values of m_initialXX, m_currentXX will be recalculated // All values of m_initialXX, m_currentXX will be recalculated
// to align their original selection bounds with each cel's grid. // to align their original selection bounds with each cel's grid.
TilemapMode originalSiteTilemapMode = ( const TilemapMode originalSiteTilemapMode = (
m_site.tilemapMode() == TilemapMode::Tiles && m_site.tilemapMode() == TilemapMode::Tiles &&
m_site.layer()->isTilemap()? TilemapMode::Tiles : TilemapMode::Pixels); m_site.layer()->isTilemap()? TilemapMode::Tiles : TilemapMode::Pixels);
TilesetMode originalSiteTilesetMode = m_site.tilesetMode(); const TilesetMode originalSiteTilesetMode = m_site.tilesetMode();
Mask initialMask0(*m_initialMask0); const Mask initialMask0(*m_initialMask0);
Mask initialMask(*m_initialMask); const Mask initialMask(*m_initialMask);
Mask currentMask(*m_currentMask); const Mask currentMask(*m_currentMask);
auto initialData = m_initialData; auto initialData = m_initialData;
auto currentData = m_currentData; auto currentData = m_currentData;
@ -892,18 +892,18 @@ void PixelsMovement::stampImage(bool finalStamp)
// | | // | |
// | | // | |
// ---- b // ---- b
gfx::Rect currentAlignedBounds( const gfx::Rect currentAlignedBounds(
m_site.grid().alignBounds(currentData.bounds())); m_site.grid().alignBounds(currentData.bounds()));
gfx::Rect initialAlignedBounds( const gfx::Rect initialAlignedBounds(
m_site.grid().alignBounds(initialMask.bounds())); m_site.grid().alignBounds(initialMask.bounds()));
gfx::Size deltaA(currentAlignedBounds.origin().x - const gfx::Size deltaA(currentAlignedBounds.origin().x -
initialAlignedBounds.origin().x, initialAlignedBounds.origin().x,
currentAlignedBounds.origin().y - currentAlignedBounds.origin().y -
initialAlignedBounds.origin().y); initialAlignedBounds.origin().y);
gfx::Size deltaB(currentAlignedBounds.x2() - const gfx::Size deltaB(currentAlignedBounds.x2() -
initialAlignedBounds.x2(), initialAlignedBounds.x2(),
currentAlignedBounds.y2() - currentAlignedBounds.y2() -
initialAlignedBounds.y2()); initialAlignedBounds.y2());
for (Cel* target : cels) { for (Cel* target : cels) {
// We'll re-create the transformation for the other cels // We'll re-create the transformation for the other cels

View File

@ -62,8 +62,8 @@ Mask make_aligned_mask(
ASSERT(false); ASSERT(false);
return maskOutput; return maskOutput;
} }
gfx::Rect oldBounds = mask->bounds(); const gfx::Rect oldBounds = mask->bounds();
gfx::Rect newBounds = grid->alignBounds(mask->bounds()); const gfx::Rect newBounds = grid->alignBounds(mask->bounds());
ASSERT(newBounds.w > 0 && newBounds.h > 0); ASSERT(newBounds.w > 0 && newBounds.h > 0);
ImageRef newBitmap; ImageRef newBitmap;
if (!mask->bitmap()) { if (!mask->bitmap()) {
@ -84,7 +84,7 @@ Mask make_aligned_mask(
for (int x=0; x < oldBounds.w; ++x, ++it) { for (int x=0; x < oldBounds.w; ++x, ++it) {
ASSERT(it != bits.end()); ASSERT(it != bits.end());
if (*it) { if (*it) {
gfx::Rect newBoundsTile = const gfx::Rect newBoundsTile =
grid->alignBounds(gfx::Rect(oldBounds.x + x, oldBounds.y + y, 1, 1)); grid->alignBounds(gfx::Rect(oldBounds.x + x, oldBounds.y + y, 1, 1));
if (previousPoint != newBoundsTile.origin()) { if (previousPoint != newBoundsTile.origin()) {
// Fill a tile region in the newBitmap // Fill a tile region in the newBitmap