Commit 9fbf76d
authored
fix(pptx): clamp the clip raster scale and surface rasterized regions (#442)
* fix(pptx): clamp the clip raster scale and surface rasterized regions
The clip raster fallback aims for a 2048-pixel long edge, but that ratio was
only capped from above. A clip region wider than 2048 pt therefore drove the
scale below 1.0 and rasterized *below* native size, while the picture stayed
anchored at the full clip size — an A0-scale composite landed near 44 DPI and
read as visibly blurry. The inner Math.max guarded the divisor, not the result.
Clamp the scale between native size and 4x, behind named constants that say what
each bound is for. Decks whose clip regions fit a normal page are unaffected:
their scale already saturated at the upper cap, which is also why no existing
test covered this branch — every other clip test uses a page a few hundred
points wide.
Also make the fallback's cost visible. Each rasterized region is a full
sub-render through the PDF backend and loses text editability inside its bounds,
yet nothing reported how often it happened. The render environment now counts
rasterized regions and their pixel volume, and emits one DEBUG line per pass on
com.demcha.compose.engine.render — silent when nothing was rasterized, so an
all-vector deck adds no noise. It is wired into the two paths that can reach the
clip fallback; the raster-slide path turns the whole page into one picture and
never gets there.
Tests: a clip box on a 3400x2400 pt page, asserting the picture is published at
no less than native resolution. The fixture asserts its own premise — that the
clip really exceeds 2048 pt — so it cannot silently stop exercising the branch.
Removing only the floor turns it red.
Verified: full reactor clean verify green (1519 tests, 0 failures). Capability
matrix updated in the same change, per the repository rule.
* docs(pptx): record the clip raster's memory ceiling alongside the clamp
The clamp removes the implicit ~17MB cap a downscaled raster used to impose, so
a very large clip region now costs transient memory proportional to its size.
That is the intended trade — blur is worse than a transient allocation, and the
floor only engages above 2048pt — but the capability matrix described the
resolution change without its resource consequence.1 parent d383513 commit 9fbf76d
6 files changed
Lines changed: 113 additions & 3 deletions
File tree
- docs/architecture
- render-pptx/src
- main/java/com/demcha/compose/document/backend/fixed/pptx
- test/java/com/demcha/compose/document/backend/fixed/pptx
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
218 | 231 | | |
219 | 232 | | |
220 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
104 | 121 | | |
105 | 122 | | |
106 | 123 | | |
| |||
377 | 394 | | |
378 | 395 | | |
379 | 396 | | |
| 397 | + | |
380 | 398 | | |
381 | 399 | | |
382 | 400 | | |
| |||
530 | 548 | | |
531 | 549 | | |
532 | 550 | | |
533 | | - | |
534 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
535 | 555 | | |
536 | 556 | | |
537 | 557 | | |
| 558 | + | |
538 | 559 | | |
539 | 560 | | |
540 | 561 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
167 | 197 | | |
168 | 198 | | |
169 | 199 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
216 | 261 | | |
0 commit comments