Commit 378e466
committed
fix(wallpapercache): use QImageReader scaled decoding to avoid OOM on large images
1. Replace QImage::load() with QImageReader in pixmix effect processing,
cap decoded resolution at 8K (7680px) to prevent excessive memory usage
2. Use QImageReader::setScaledSize() for scaleImage thread so decoding
outputs directly at target size instead of full-size then downscale
3. Use QImageReader::imageFormat() static method for format detection to
avoid instantiating a full reader when only the format is needed
4. Add proper error handling with canRead/isEmpty checks and error strings
Log: Optimize wallpaper image decoding to use scaled reading and prevent OOM on large images
fix(wallpapercache): 使用 QImageReader 缩放解码避免大图内存溢出
1. 将 pixmix 特效处理中的 QImage::load() 替换为 QImageReader,
限制解码分辨率上限为 8K (7680px),防止内存占用过大
2. 缩放线程使用 QImageReader::setScaledSize() 在解码时直接输出目标尺寸,
避免先全尺寸加载再缩放带来的额外内存开销
3. 格式检测改用 QImageReader::imageFormat() 静态方法,
避免实例化完整 reader 造成不必要的图片加载
4. 增加完善的错误检查,包含 canRead/isEmpty 校验及错误信息输出
Log: 优化壁纸图片解码流程,采用缩放读取方式防止超大图片导致内存溢出
PMS: BUG-3593411 parent b0c5491 commit 378e466
3 files changed
Lines changed: 53 additions & 18 deletions
File tree
- src/plugin-qt/wallpapercache
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
73 | 90 | | |
74 | 91 | | |
75 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
145 | | - | |
146 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
147 | 164 | | |
148 | | - | |
| 165 | + | |
149 | 166 | | |
150 | 167 | | |
151 | 168 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
160 | 174 | | |
161 | 175 | | |
162 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
| |||
0 commit comments