Remove use of C-style casts
This commit is contained in:
committed by
Jonas Kvinge
parent
637772f8f0
commit
b38ad81928
@@ -377,10 +377,10 @@ float AlbumCoverFetcherSearch::ScoreImage(const QSize size) {
|
||||
if (size.width() == 0 || size.height() == 0) return 0.0;
|
||||
|
||||
// A 500x500px image scores 1.0, bigger scores higher
|
||||
const float size_score = std::sqrt(float(size.width() * size.height())) / kTargetSize;
|
||||
const float size_score = std::sqrt(static_cast<float>(size.width() * size.height())) / kTargetSize;
|
||||
|
||||
// A 1:1 image scores 1.0, anything else scores less
|
||||
const float aspect_score = float(1.0) - float(std::max(size.width(), size.height()) - std::min(size.width(), size.height())) / float(std::max(size.height(), size.width()));
|
||||
const float aspect_score = static_cast<float>(1.0) - static_cast<float>(std::max(size.width(), size.height()) - std::min(size.width(), size.height())) / static_cast<float>(std::max(size.height(), size.width()));
|
||||
|
||||
return size_score + aspect_score;
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const quint6
|
||||
int width = obj_image["width"].toInt();
|
||||
int height = obj_image["height"].toInt();
|
||||
if (width < 300 || height < 300) continue;
|
||||
const float aspect_score = float(1.0) - float(std::max(width, height) - std::min(width, height)) / float(std::max(height, width));
|
||||
const float aspect_score = static_cast<float>(1.0) - static_cast<float>(std::max(width, height) - std::min(width, height)) / static_cast<float>(std::max(height, width));
|
||||
if (aspect_score < 0.85) continue;
|
||||
CoverProviderSearchResult result;
|
||||
result.artist = artist;
|
||||
|
||||
Reference in New Issue
Block a user