diff --git a/src/app/app.cpp b/src/app/app.cpp index 9979fc6a9..e5b6d6ff8 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -720,24 +720,21 @@ Workspace* App::workspace() const { if (m_mainWindow) return m_mainWindow->getWorkspace(); - else - return nullptr; + return nullptr; } ContextBar* App::contextBar() const { if (m_mainWindow) return m_mainWindow->getContextBar(); - else - return nullptr; + return nullptr; } Timeline* App::timeline() const { if (m_mainWindow) return m_mainWindow->getTimeline(); - else - return nullptr; + return nullptr; } Preferences& App::preferences() const @@ -866,8 +863,7 @@ PixelFormat app_get_current_pixel_format() Doc* doc = ctx->activeDocument(); if (doc) return doc->sprite()->pixelFormat(); - else - return IMAGE_RGB; + return IMAGE_RGB; } int app_get_color_to_clear_layer(Layer* layer) diff --git a/src/app/commands/params.h b/src/app/commands/params.h index 8a4a6452d..fe6600441 100644 --- a/src/app/commands/params.h +++ b/src/app/commands/params.h @@ -48,8 +48,7 @@ namespace app { auto it = m_params.find(name); if (it != m_params.end()) return it->second; - else - return std::string(); + return std::string(); } void operator|=(const Params& params) { diff --git a/src/app/task.h b/src/app/task.h index e762f0a62..46d65abcf 100644 --- a/src/app/task.h +++ b/src/app/task.h @@ -37,16 +37,14 @@ namespace app { const std::lock_guard lock(m_token_mutex); if (m_token) return m_token->canceled(); - else - return false; + return false; } float progress() const { const std::lock_guard lock(m_token_mutex); if (m_token) return m_token->progress(); - else - return 0.0f; + return 0.0f; } void cancel() { diff --git a/src/doc/brush.h b/src/doc/brush.h index 1a2d0e0aa..47d94de2a 100644 --- a/src/doc/brush.h +++ b/src/doc/brush.h @@ -75,8 +75,7 @@ namespace doc { Image* originalImage() const { if (m_backupImage) return m_backupImage.get(); - else - return m_image.get(); + return m_image.get(); } private: diff --git a/src/doc/image_traits.h b/src/doc/image_traits.h index 1691337fd..cdc546f7e 100644 --- a/src/doc/image_traits.h +++ b/src/doc/image_traits.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2018-2023 Igara Studio S.A. +// Copyright (c) 2018-2024 Igara Studio S.A. // Copyright (c) 2001-2015 David Capello // // This file is released under the terms of the MIT license. @@ -53,13 +53,11 @@ namespace doc { if (rgba_geta(a) == 0) { if (rgba_geta(b) == 0) return true; - else - return false; - } - else if (rgba_geta(b) == 0) return false; - else - return a == b; + } + if (rgba_geta(b) == 0) + return false; + return a == b; } }; @@ -98,13 +96,11 @@ namespace doc { if (graya_geta(a) == 0) { if (graya_geta(b) == 0) return true; - else - return false; - } - else if (graya_geta(b) == 0) return false; - else - return a == b; + } + if (graya_geta(b) == 0) + return false; + return a == b; } }; diff --git a/src/doc/keyframes.h b/src/doc/keyframes.h index 8196c3d93..0dcc39166 100644 --- a/src/doc/keyframes.h +++ b/src/doc/keyframes.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2022 Igara Studio S.A. +// Copyright (c) 2022-2024 Igara Studio S.A. // Copyright (c) 2017 David Capello // // This file is released under the terms of the MIT license. @@ -72,14 +72,12 @@ namespace doc { T* operator*() { if (m_it != m_end) return m_it->value(); - else - return nullptr; + return nullptr; } T* operator->() { if (m_it != m_end) return m_it->value(); - else - return nullptr; + return nullptr; } private: iterator m_it, m_next; @@ -154,8 +152,7 @@ namespace doc { it->value() && frame >= it->frame()) return it->value(); - else - return nullptr; + return nullptr; } iterator begin() { return m_keys.begin(); } @@ -185,15 +182,13 @@ namespace doc { frame_t fromFrame() const { if (!m_keys.empty()) return m_keys.front().frame(); - else - return -1; + return -1; } frame_t toFrame() const { if (!m_keys.empty()) return m_keys.back().frame(); - else - return -1; + return -1; } Range range(const frame_t from, diff --git a/src/doc/palette.h b/src/doc/palette.h index 0cfbc94f5..1ca5579e3 100644 --- a/src/doc/palette.h +++ b/src/doc/palette.h @@ -73,8 +73,7 @@ namespace doc { ASSERT(i >= 0); if (i >= 0 && i < size()) return m_colors[i]; - else - return 0; + return 0; } color_t getEntry(int i) const { return entry(i); diff --git a/src/doc/remap.h b/src/doc/remap.h index feb484b66..b5a8cc824 100644 --- a/src/doc/remap.h +++ b/src/doc/remap.h @@ -54,8 +54,7 @@ namespace doc { //ASSERT(index >= 0 && index < size()); if (index >= 0 && index < size()) return m_map[index]; - else - return index; // No remap + return index; // No remap } void merge(const Remap& other); diff --git a/src/doc/tileset.h b/src/doc/tileset.h index 865a3e232..85235f480 100644 --- a/src/doc/tileset.h +++ b/src/doc/tileset.h @@ -84,8 +84,7 @@ namespace doc { ImageRef get(const tile_index ti) const { if (ti >= 0 && ti < size()) return m_tiles[ti].image; - else - return ImageRef(nullptr); + return ImageRef(nullptr); } void set(const tile_index ti, const ImageRef& image); @@ -93,8 +92,7 @@ namespace doc { UserData& getTileData(const tile_index ti) const { if (ti >= 0 && ti < size()) return const_cast(m_tiles[ti].data); - else - return kNoUserData; + return kNoUserData; } void setTileData(const tile_index ti, const UserData& userData); diff --git a/src/doc/tilesets.h b/src/doc/tilesets.h index a93fd5023..558d64a0b 100644 --- a/src/doc/tilesets.h +++ b/src/doc/tilesets.h @@ -38,8 +38,7 @@ namespace doc { Tileset* get(const tileset_index tsi) const { if (tsi < size()) return m_tilesets[tsi]; - else - return nullptr; + return nullptr; } tileset_index getIndex(const Tileset *tileset) { diff --git a/src/fixmath/fixmath.h b/src/fixmath/fixmath.h index 664906973..20509bd8e 100644 --- a/src/fixmath/fixmath.h +++ b/src/fixmath/fixmath.h @@ -52,17 +52,13 @@ namespace fixmath { errno = ERANGE; return -0x7FFFFFFF; } - else - return result; + return result; } - else { - if ((x > 0) && (y > 0)) { - errno = ERANGE; - return 0x7FFFFFFF; - } - else - return result; + if ((x > 0) && (y > 0)) { + errno = ERANGE; + return 0x7FFFFFFF; } + return result; } inline fixed fixsub(fixed x, fixed y) { @@ -73,17 +69,13 @@ namespace fixmath { errno = ERANGE; return -0x7FFFFFFF; } - else - return result; + return result; } - else { - if ((x > 0) && (y < 0)) { - errno = ERANGE; - return 0x7FFFFFFF; - } - else - return result; + if ((x > 0) && (y < 0)) { + errno = ERANGE; + return 0x7FFFFFFF; } + return result; } inline fixed fixmul(fixed x, fixed y) { @@ -95,16 +87,14 @@ namespace fixmath { errno = ERANGE; return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF; } - else - return ftofix(fixtof(x) / fixtof(y)); + return ftofix(fixtof(x) / fixtof(y)); } inline int fixfloor(fixed x) { /* (x >> 16) is not portable */ if (x >= 0) return (x >> 16); - else - return ~((~x) >> 16); + return ~((~x) >> 16); } inline int fixceil(fixed x) { diff --git a/src/render/dithering_matrix.h b/src/render/dithering_matrix.h index 4730ea0ef..dfbabdade 100644 --- a/src/render/dithering_matrix.h +++ b/src/render/dithering_matrix.h @@ -72,10 +72,9 @@ namespace render { if (n == 2) return D2[i*2 + j]; - else - return - + 4*Dn(i%(n/2), j%(n/2), n/2) - + Dn(i/(n/2), j/(n/2), 2); + return + + 4*Dn(i%(n/2), j%(n/2), n/2) + + Dn(i/(n/2), j/(n/2), 2); } }; diff --git a/src/render/zoom.h b/src/render/zoom.h index 1cac0b65b..b55e91dc9 100644 --- a/src/render/zoom.h +++ b/src/render/zoom.h @@ -76,16 +76,14 @@ namespace render { inline int Zoom::remove(int x) const { if (x < 0) return (x * m_den / m_num) - 1; - else - return (x * m_den / m_num); + return (x * m_den / m_num); } inline int Zoom::removeCeiling(int x) const { int v = x * m_den; if (x < 0) return (v / m_num); - else - return (v / m_num) + (v % m_num != 0); + return (v / m_num) + (v % m_num != 0); } inline gfx::Rect Zoom::apply(const gfx::Rect& r) const { diff --git a/src/ui/widget.h b/src/ui/widget.h index d20fa3ed9..ba5ff9080 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -142,8 +142,7 @@ namespace ui { gfx::Color bgColor() const { if (gfx::geta(m_bgColor) == 0 && m_parent) return m_parent->bgColor(); - else - return m_bgColor; + return m_bgColor; } // Sets the background color of the widget