Simplify 90/270 orient-before-resize logic (#3762)

This commit is contained in:
Kleis Auke Wolthuizen
2023-08-15 08:56:07 +02:00
committed by GitHub
parent 5c19f6dd9b
commit a2cac61209
4 changed files with 29 additions and 20 deletions

View File

@@ -964,15 +964,7 @@ namespace sharp {
}
std::pair<double, double> ResolveShrink(int width, int height, int targetWidth, int targetHeight,
Canvas canvas, bool swap, bool withoutEnlargement, bool withoutReduction) {
if (swap && canvas != Canvas::IGNORE_ASPECT) {
// Swap input width and height when requested.
std::swap(width, height);
if (canvas == Canvas::MAX) {
std::swap(targetWidth, targetHeight);
}
}
Canvas canvas, bool withoutEnlargement, bool withoutReduction) {
double hshrink = 1.0;
double vshrink = 1.0;