Commit 007426f
Fix stack overflow in DPIUtil.autoScaleImageData #2353
Recently, a strict check was introduced that ImageData should be
linearly scaled for other zoom levels. ImageDataProviders inside SWT
not following this strict checks were modified (e.g., to return only
image data at 100%).
However, this change broke DPIUtil.autoScaleImageData. That function
creates an Image using the system zoom level, draws it on a GC at scaled
dimensions, and then requests ImageData at 100% zoom from the image.
Since the ImageDataProvider was now restricted to 100% zoom only,
requesting imageData at other zoom levels while creating an image at
system zoom level triggered recursive calls, causing a stack overflow
error.
This commit reverts the behavior of the ImageDataProvider used in
DPIUtil.autoScaleImageData to return the same ImageData at all zoom
levels.
We also disable the strict zoom check in this specific case, because the
scaling is done by GC.drawImage() and the ImageData used to create the
is expected to be same.
Fixes #23531 parent 7f19dc5 commit 007426f
File tree
5 files changed
+47
-15
lines changed- bundles/org.eclipse.swt
- Eclipse SWT Tests/win32/org/eclipse/swt/widgets
- Eclipse SWT
- cocoa/org/eclipse/swt/graphics
- common/org/eclipse/swt/internal
- gtk/org/eclipse/swt/graphics
- win32/org/eclipse/swt/graphics
5 files changed
+47
-15
lines changedLines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
110 | 135 | | |
111 | 136 | | |
112 | 137 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1811 | 1811 | | |
1812 | 1812 | | |
1813 | 1813 | | |
1814 | | - | |
| 1814 | + | |
1815 | 1815 | | |
1816 | 1816 | | |
1817 | | - | |
| 1817 | + | |
1818 | 1818 | | |
1819 | 1819 | | |
1820 | 1820 | | |
1821 | 1821 | | |
1822 | 1822 | | |
1823 | 1823 | | |
1824 | | - | |
1825 | | - | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
1826 | 1827 | | |
1827 | 1828 | | |
1828 | 1829 | | |
1829 | 1830 | | |
| 1831 | + | |
1830 | 1832 | | |
1831 | 1833 | | |
1832 | 1834 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
161 | | - | |
| 160 | + | |
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| |||
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
171 | | - | |
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1572 | 1572 | | |
1573 | 1573 | | |
1574 | 1574 | | |
1575 | | - | |
| 1575 | + | |
1576 | 1576 | | |
1577 | 1577 | | |
1578 | | - | |
| 1578 | + | |
1579 | 1579 | | |
1580 | 1580 | | |
1581 | 1581 | | |
1582 | 1582 | | |
1583 | 1583 | | |
1584 | 1584 | | |
1585 | | - | |
1586 | | - | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1587 | 1588 | | |
1588 | 1589 | | |
1589 | 1590 | | |
1590 | 1591 | | |
| 1592 | + | |
1591 | 1593 | | |
1592 | 1594 | | |
1593 | 1595 | | |
| |||
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
839 | 839 | | |
840 | 840 | | |
841 | 841 | | |
842 | | - | |
| 842 | + | |
843 | 843 | | |
844 | 844 | | |
845 | | - | |
| 845 | + | |
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
852 | | - | |
853 | | - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
854 | 857 | | |
| 858 | + | |
| 859 | + | |
855 | 860 | | |
856 | 861 | | |
857 | 862 | | |
| |||
0 commit comments