Skip to content

Commit 3f14bb7

Browse files
committed
Fixed no-quality-loss-when-scaling-images patch for Qt 6.2.12 on macOS.
1 parent f4f4286 commit 3f14bb7

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
11
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
2-
index c1eb41a65d..be52c7adf1 100644
2+
index c0a8947e71e..6653484c931 100644
33
--- a/src/gui/image/qimage.cpp
44
+++ b/src/gui/image/qimage.cpp
5-
@@ -4837,13 +4837,13 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
5+
@@ -4834,25 +4834,26 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
6+
|| (ws * hs) >= (1<<20)
67
#endif
78
) {
9+
- QImage scaledImage;
10+
+ // Patch: no quality loss when scaling images.
11+
+ // QImage scaledImage;
812
if (mat.m11() < 0.0F && mat.m22() < 0.0F) { // horizontal/vertical flip
9-
- return smoothScaled(wd, hd).mirrored(true, true).convertToFormat(format());
13+
- scaledImage = smoothScaled(wd, hd).mirrored(true, true);
1014
+ return smoothScaled(wd, hd).mirrored(true, true);
1115
} else if (mat.m11() < 0.0F) { // horizontal flip
12-
- return smoothScaled(wd, hd).mirrored(true, false).convertToFormat(format());
16+
- scaledImage = smoothScaled(wd, hd).mirrored(true, false);
1317
+ return smoothScaled(wd, hd).mirrored(true, false);
1418
} else if (mat.m22() < 0.0F) { // vertical flip
15-
- return smoothScaled(wd, hd).mirrored(false, true).convertToFormat(format());
19+
- scaledImage = smoothScaled(wd, hd).mirrored(false, true);
1620
+ return smoothScaled(wd, hd).mirrored(false, true);
1721
} else { // no flipping
18-
- return smoothScaled(wd, hd).convertToFormat(format());
22+
- scaledImage = smoothScaled(wd, hd);
1923
+ return smoothScaled(wd, hd);
2024
}
25+
26+
- switch (format()) {
27+
- case QImage::Format_Mono:
28+
- case QImage::Format_MonoLSB:
29+
- case QImage::Format_Indexed8:
30+
- return scaledImage;
31+
- default:
32+
- return scaledImage.convertToFormat(format());
33+
- }
34+
+ // switch (format()) {
35+
+ // case QImage::Format_Mono:
36+
+ // case QImage::Format_MonoLSB:
37+
+ // case QImage::Format_Indexed8:
38+
+ // return scaledImage;
39+
+ // default:
40+
+ // return scaledImage.convertToFormat(format());
41+
+ // }
2142
}
2243
}
44+

0 commit comments

Comments
 (0)