~zsombi/ubuntu-ui-toolkit/50-custom-delegates

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp

prereq sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
            scaledSize = realSize * scaleFactor;
55
55
        }
56
56
        if (requestedSize.isValid() && (requestedSize.width() < realSize.width() || requestedSize.height() < realSize.height())) {
57
 
            constrainedSize = scaledSize.scaled(requestedSize, Qt::KeepAspectRatio);
 
57
            if (requestedSize.width() > 0 && requestedSize.height() == 0 && scaledSize.width() > 0) {
 
58
                constrainedSize.setWidth(requestedSize.width());
 
59
                constrainedSize.setHeight(scaledSize.height() * requestedSize.width() / scaledSize.width());
 
60
            } else if (requestedSize.height() > 0 && requestedSize.width() == 0 && scaledSize.height() > 0) {
 
61
                constrainedSize.setHeight(requestedSize.height());
 
62
                constrainedSize.setWidth(scaledSize.width() * requestedSize.height() / scaledSize.height());
 
63
            } else {
 
64
                constrainedSize = scaledSize.scaled(requestedSize, Qt::KeepAspectRatio);
 
65
            }
58
66
        }
59
67
 
60
68
        if (constrainedSize.isValid()) {