Fix missing min frame border

* Previously only considered min border if the current border is smaller
* Need to consider as long as min size is enabled
This commit is contained in:
Daniel Gao 2024-12-06 22:16:27 -05:00
parent a54aacca3f
commit f8cde10662

View File

@ -442,13 +442,9 @@ Dimensions Framing::computeRelativeImageBBoxInFrame(const Dimensions& imgSize,
double minBorderOther = static_cast<double>( double minBorderOther = static_cast<double>(
side == Side::WIDTH ? framing.minHeight : framing.minWidth); side == Side::WIDTH ? framing.minHeight : framing.minWidth);
if (borderOther < minBorderOther) {
maxImageOther = std::floor(frameOther - 2.0 * minBorderOther); maxImageOther = std::floor(frameOther - 2.0 * minBorderOther);
}
if (borderBasis < minBorderBasis) {
maxImageBasis = std::floor(frameBasis - 2.0 * minBorderBasis); maxImageBasis = std::floor(frameBasis - 2.0 * minBorderBasis);
} }
}
// Image is too large to satisfy requirements: // Image is too large to satisfy requirements:
// a. Min border size limit not satisfied // a. Min border size limit not satisfied
@ -524,11 +520,9 @@ Dimensions Framing::computeUniformRelativeImageBBox(const Dimensions& imgSize,
double minBorder = static_cast<double>( double minBorder = static_cast<double>(
side == Side::WIDTH ? framing.minWidth : framing.minHeight); side == Side::WIDTH ? framing.minWidth : framing.minHeight);
if (border < minBorder) {
maxImageBasis = std::floor(frameBasis - 2.0 * minBorder); maxImageBasis = std::floor(frameBasis - 2.0 * minBorder);
maxImageOther = std::floor(frameOther - 2.0 * minBorder); maxImageOther = std::floor(frameOther - 2.0 * minBorder);
} }
}
if (imgOther > maxImageOther) { if (imgOther > maxImageOther) {
imgOther = maxImageOther; imgOther = maxImageOther;