Skip to content

fix(ImageBuf): Copy ctor of IC-backed ImageBuf zeroed bufspan strides#5244

Open
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-ibctr
Open

fix(ImageBuf): Copy ctor of IC-backed ImageBuf zeroed bufspan strides#5244
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-ibctr

Conversation

@lgritz

@lgritz lgritz commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

When copy-constructing an ImageCache-backed ImageBuf, the "cache-based or deep" branch set m_bufspan = {}, a default-constructed image_span whose strides are all zero. retile() addresses a pixel within a cache tile as offset = pixelindex * m_bufspan.xstride(), so a zero xstride made every pixel resolve to tile offset 0 -- the whole copied image read back as a constant color (the value of pixel 0,0).

Fixes #5243

Added a regression test (test_copy_of_imagecache_backed) that copies a cache-backed buffer with distinct per-pixel values and verifies the copy does not read back a constant.

Assisted-by: Claude Code / Claude Opus 4.8

When copy-constructing an ImageCache-backed ImageBuf, the "cache-based or
deep" branch set `m_bufspan = {}`, a default-constructed image_span whose
strides are all zero. retile() addresses a pixel within a cache tile as
`offset = pixelindex * m_bufspan.xstride()`, so a zero xstride made every
pixel resolve to tile offset 0 -- the whole copied image read back as a
constant color (the value of pixel 0,0).

Fixes 5243

Added a regression test (test_copy_of_imagecache_backed) that copies a
cache-backed buffer with distinct per-pixel values and verifies the copy
does not read back a constant.

Assisted-by: Claude Code / Claude Opus 4.8

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: oiiotool -otex incorrectly detects any image as constant color

1 participant