Skip to content

Commit f54859a

Browse files
committed
Code style simplification in Surface class
[ci skip]
1 parent eb084d9 commit f54859a

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/video/surface.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,11 @@ Surface::from_file(const std::string& filename, const std::optional<Rect>& rect)
7474
}
7575
else
7676
{
77-
if (rect)
78-
{
79-
TexturePtr texture = TextureManager::current()->get(filename, *rect);
80-
return SurfacePtr(new Surface(texture, TexturePtr(), NO_FLIP, filename));
81-
}
82-
else
83-
{
84-
TexturePtr texture = TextureManager::current()->get(filename);
85-
return SurfacePtr(new Surface(texture, TexturePtr(), NO_FLIP, filename));
86-
}
77+
auto textureManager = TextureManager::current();
78+
TexturePtr texture = rect ?
79+
textureManager->get(filename, *rect) : textureManager->get(filename);
80+
81+
return SurfacePtr(new Surface(texture, TexturePtr(), NO_FLIP, filename));
8782
}
8883
}
8984

0 commit comments

Comments
 (0)