mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Fixed an issue where using the cropSize property could lead to a crash under very rare circumstances
This commit is contained in:
parent
b1f73a57f1
commit
6cfa888b4d
|
@ -222,13 +222,13 @@ void ImageComponent::coverFitCrop()
|
|||
mBottomRightCrop = {1.0f, 1.0f};
|
||||
|
||||
if (std::round(mSize.y) > std::round(mTargetSize.y)) {
|
||||
const float cropSize {1.0f - (mTargetSize.y / std::round(mSize.y))};
|
||||
const float cropSize {1.0f - (std::round(mTargetSize.y) / std::round(mSize.y))};
|
||||
cropTop(cropSize / 2.0f);
|
||||
cropBottom(cropSize / 2.0f);
|
||||
mSize.y = mSize.y - (mSize.y * cropSize);
|
||||
}
|
||||
else {
|
||||
const float cropSize {1.0f - (mTargetSize.x / std::round(mSize.x))};
|
||||
const float cropSize {1.0f - (std::round(mTargetSize.x) / std::round(mSize.x))};
|
||||
cropLeft(cropSize / 2.0f);
|
||||
cropRight(cropSize / 2.0f);
|
||||
mSize.x = mSize.x - (mSize.x * cropSize);
|
||||
|
|
Loading…
Reference in a new issue