1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Convert C-style casts to the more verbose C++ style

This commit is contained in:
Alexander Wilms
2024-01-10 00:30:35 +00:00
parent 5e9f98b15c
commit 781328f282
2 changed files with 4 additions and 4 deletions

View File

@@ -664,8 +664,8 @@ void CSDL_Ext::convertToGrayscale( SDL_Surface * surf, const Rect & rect )
template<int bpp> template<int bpp>
void scaleSurfaceFastInternal(SDL_Surface *surf, SDL_Surface *ret) void scaleSurfaceFastInternal(SDL_Surface *surf, SDL_Surface *ret)
{ {
const float factorX = float(surf->w) / float(ret->w); const float factorX = static_cast<float>(surf->w) / static_cast<float>(ret->w);
const float factorY = float(surf->h) / float(ret->h); const float factorY = static_cast<float>(surf->h) / static_cast<float>(ret->h);
for(int y = 0; y < ret->h; y++) for(int y = 0; y < ret->h; y++)
{ {

View File

@@ -538,8 +538,8 @@ void MainWindow::addGroupIntoCatalog(const std::string & groupName, bool useCust
auto picture = animation.getImage(0); auto picture = animation.getImage(0);
if(picture && picture->width() && picture->height()) if(picture && picture->width() && picture->height())
{ {
qreal xscale = qreal(128) / qreal(picture->width()); qreal xscale = static_cast<qreal>(128) / static_cast<qreal>(picture->width());
qreal yscale = qreal(128) / qreal(picture->height()); qreal yscale = static_cast<qreal>(128) / static_cast<qreal>(picture->height());
qreal scale = std::min(xscale, yscale); qreal scale = std::min(xscale, yscale);
painter.scale(scale, scale); painter.scale(scale, scale);
painter.drawImage(QPoint(0, 0), *picture); painter.drawImage(QPoint(0, 0), *picture);