mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-02 13:20:12 +00:00
Some fixes to readability-else-after-return
This commit is contained in:
parent
667335be62
commit
cfb663f820
@ -720,7 +720,6 @@ Workspace* App::workspace() const
|
||||
{
|
||||
if (m_mainWindow)
|
||||
return m_mainWindow->getWorkspace();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -728,7 +727,6 @@ ContextBar* App::contextBar() const
|
||||
{
|
||||
if (m_mainWindow)
|
||||
return m_mainWindow->getContextBar();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -736,7 +734,6 @@ Timeline* App::timeline() const
|
||||
{
|
||||
if (m_mainWindow)
|
||||
return m_mainWindow->getTimeline();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -866,7 +863,6 @@ PixelFormat app_get_current_pixel_format()
|
||||
Doc* doc = ctx->activeDocument();
|
||||
if (doc)
|
||||
return doc->sprite()->pixelFormat();
|
||||
else
|
||||
return IMAGE_RGB;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ namespace app {
|
||||
auto it = m_params.find(name);
|
||||
if (it != m_params.end())
|
||||
return it->second;
|
||||
else
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,6 @@ namespace app {
|
||||
const std::lock_guard lock(m_token_mutex);
|
||||
if (m_token)
|
||||
return m_token->canceled();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -45,7 +44,6 @@ namespace app {
|
||||
const std::lock_guard lock(m_token_mutex);
|
||||
if (m_token)
|
||||
return m_token->progress();
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,6 @@ namespace doc {
|
||||
Image* originalImage() const {
|
||||
if (m_backupImage)
|
||||
return m_backupImage.get();
|
||||
else
|
||||
return m_image.get();
|
||||
}
|
||||
|
||||
|
@ -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,12 +53,10 @@ namespace doc {
|
||||
if (rgba_geta(a) == 0) {
|
||||
if (rgba_geta(b) == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (rgba_geta(b) == 0)
|
||||
if (rgba_geta(b) == 0)
|
||||
return false;
|
||||
else
|
||||
return a == b;
|
||||
}
|
||||
};
|
||||
@ -98,12 +96,10 @@ namespace doc {
|
||||
if (graya_geta(a) == 0) {
|
||||
if (graya_geta(b) == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (graya_geta(b) == 0)
|
||||
if (graya_geta(b) == 0)
|
||||
return false;
|
||||
else
|
||||
return a == b;
|
||||
}
|
||||
};
|
||||
|
@ -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,13 +72,11 @@ namespace doc {
|
||||
T* operator*() {
|
||||
if (m_it != m_end)
|
||||
return m_it->value();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
T* operator->() {
|
||||
if (m_it != m_end)
|
||||
return m_it->value();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
private:
|
||||
@ -154,7 +152,6 @@ namespace doc {
|
||||
it->value() &&
|
||||
frame >= it->frame())
|
||||
return it->value();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -185,14 +182,12 @@ namespace doc {
|
||||
frame_t fromFrame() const {
|
||||
if (!m_keys.empty())
|
||||
return m_keys.front().frame();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
frame_t toFrame() const {
|
||||
if (!m_keys.empty())
|
||||
return m_keys.back().frame();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,6 @@ namespace doc {
|
||||
ASSERT(i >= 0);
|
||||
if (i >= 0 && i < size())
|
||||
return m_colors[i];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
color_t getEntry(int i) const {
|
||||
|
@ -54,7 +54,6 @@ namespace doc {
|
||||
//ASSERT(index >= 0 && index < size());
|
||||
if (index >= 0 && index < size())
|
||||
return m_map[index];
|
||||
else
|
||||
return index; // No remap
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,6 @@ namespace doc {
|
||||
ImageRef get(const tile_index ti) const {
|
||||
if (ti >= 0 && ti < size())
|
||||
return m_tiles[ti].image;
|
||||
else
|
||||
return ImageRef(nullptr);
|
||||
}
|
||||
void set(const tile_index ti,
|
||||
@ -93,7 +92,6 @@ namespace doc {
|
||||
UserData& getTileData(const tile_index ti) const {
|
||||
if (ti >= 0 && ti < size())
|
||||
return const_cast<UserData&>(m_tiles[ti].data);
|
||||
else
|
||||
return kNoUserData;
|
||||
}
|
||||
void setTileData(const tile_index ti,
|
||||
|
@ -38,7 +38,6 @@ namespace doc {
|
||||
Tileset* get(const tileset_index tsi) const {
|
||||
if (tsi < size())
|
||||
return m_tilesets[tsi];
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -52,18 +52,14 @@ namespace fixmath {
|
||||
errno = ERANGE;
|
||||
return -0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if ((x > 0) && (y > 0)) {
|
||||
errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
inline fixed fixsub(fixed x, fixed y) {
|
||||
fixed result = x - y;
|
||||
@ -73,18 +69,14 @@ namespace fixmath {
|
||||
errno = ERANGE;
|
||||
return -0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if ((x > 0) && (y < 0)) {
|
||||
errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
inline fixed fixmul(fixed x, fixed y) {
|
||||
return ftofix(fixtof(x) * fixtof(y));
|
||||
@ -95,7 +87,6 @@ namespace fixmath {
|
||||
errno = ERANGE;
|
||||
return (x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return ftofix(fixtof(x) / fixtof(y));
|
||||
}
|
||||
|
||||
@ -103,7 +94,6 @@ namespace fixmath {
|
||||
/* (x >> 16) is not portable */
|
||||
if (x >= 0)
|
||||
return (x >> 16);
|
||||
else
|
||||
return ~((~x) >> 16);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ 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);
|
||||
|
@ -76,7 +76,6 @@ 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);
|
||||
}
|
||||
|
||||
@ -84,7 +83,6 @@ namespace render {
|
||||
int v = x * m_den;
|
||||
if (x < 0)
|
||||
return (v / m_num);
|
||||
else
|
||||
return (v / m_num) + (v % m_num != 0);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,6 @@ namespace ui {
|
||||
gfx::Color bgColor() const {
|
||||
if (gfx::geta(m_bgColor) == 0 && m_parent)
|
||||
return m_parent->bgColor();
|
||||
else
|
||||
return m_bgColor;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user