Commit fb9a36a
authored
ImageBuf:
Add a new ImageBuf method: `contiguous_scanline()`, which reveals if
each scanline is contiguous in the ImageBuf's internal memory (no
padding or unusual spacing between channels or pixels). It's analogous
to the existing `contiguous()`, but the latter also tests contiguity in
y and z.
Additional internal fixes:
* Always and only set m_bufspan via calls to `set_bufspan()`, so it's
consistent. In particular, it ensures that we correctly set the channel
size, which some call sites previously did not do correctly for untyped
"byte" buffers.
* Re-evaluate the contiguous flags whenever resetting m_bufspan.
* contiguous() calls need to call validate_pixels().
An IB from a file that hasn't been read yet into memory yet isn't
considered contiguous. But once it's read, it will be (if it's got the
strides right, etc.). So when somebody asks if it's contiguous, what
does that mean? They are asking because they are about to do something
that requires memory contiguity (meaning, it needs to be IN memory),
just like if they call localpixels(). So just like localpixels(), we
need to call validate_pixels() to assure that if the pixels are destined
for the local buffer, it's done now if not yet.
Signed-off-by: Larry Gritz <lg@larrygritz.com>contiguous_scanline() + fixes to internal span (#5135)1 parent 84e04ac commit fb9a36a
2 files changed
Lines changed: 43 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1386 | 1386 | | |
1387 | 1387 | | |
1388 | 1388 | | |
1389 | | - | |
| 1389 | + | |
| 1390 | + | |
1390 | 1391 | | |
1391 | 1392 | | |
1392 | 1393 | | |
1393 | 1394 | | |
1394 | 1395 | | |
1395 | 1396 | | |
1396 | 1397 | | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1397 | 1406 | | |
1398 | 1407 | | |
1399 | 1408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| |||
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
356 | | - | |
| 358 | + | |
| 359 | + | |
357 | 360 | | |
358 | 361 | | |
359 | 362 | | |
| |||
461 | 464 | | |
462 | 465 | | |
463 | 466 | | |
464 | | - | |
465 | 467 | | |
466 | 468 | | |
467 | 469 | | |
| |||
514 | 516 | | |
515 | 517 | | |
516 | 518 | | |
| 519 | + | |
517 | 520 | | |
518 | 521 | | |
519 | 522 | | |
| |||
774 | 777 | | |
775 | 778 | | |
776 | 779 | | |
777 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
778 | 783 | | |
779 | 784 | | |
780 | 785 | | |
| |||
861 | 866 | | |
862 | 867 | | |
863 | 868 | | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
871 | 877 | | |
872 | 878 | | |
873 | 879 | | |
| |||
1179 | 1185 | | |
1180 | 1186 | | |
1181 | 1187 | | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
| 1188 | + | |
1185 | 1189 | | |
1186 | 1190 | | |
1187 | 1191 | | |
| |||
1263 | 1267 | | |
1264 | 1268 | | |
1265 | 1269 | | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
| 1270 | + | |
1269 | 1271 | | |
1270 | 1272 | | |
1271 | 1273 | | |
| |||
1381 | 1383 | | |
1382 | 1384 | | |
1383 | 1385 | | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
| 1386 | + | |
1388 | 1387 | | |
1389 | 1388 | | |
1390 | 1389 | | |
| |||
2197 | 2196 | | |
2198 | 2197 | | |
2199 | 2198 | | |
| 2199 | + | |
2200 | 2200 | | |
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | 2204 | | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
2205 | 2214 | | |
2206 | 2215 | | |
2207 | 2216 | | |
| |||
0 commit comments