Repository navigation
fix(render): advance destination pointer in convertToRgba8 for RGBA8/BGRA8 - #97
Merged
Merged
Conversation
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(render): advance destination pointer in convertToRgba8 for RGBA8/BGRA8
问题
core::render::ImageStream提交一个宽度 > 1 的ImageFrame(ImagePixelFormat::BGRA8或RGBA8,例如width=256, height=256, stride=width*4),经ImageFrame::convertToRgba8()转换后上传为纹理,再通过ui.image().stream()渲染。ImageFrame::convertToRgba8()的 RGBA8/BGRA8 分支中,内层x循环里source指针随x前进(source + x*4),但destination指针从不前进。每轮循环都向同一行的前 4 字节写入,循环结束后每行只剩最后一个像素的转换值;其余像素因output.resize()预分配的零值(alpha=0)被 alpha 混合“擦掉”,最终纹理只有最左一列不透明。tests/unit/image_stream.cpp:39),1 像素循环只执行一次,指针是否前进无差别,因此该 bug 未被发现。修改
destination += 4;(单行最小修改),使写指针随x逐像素前进,与source的推进保持一致。YUV 分支本就使用output.data() + (y*width + x)*4的绝对偏移写法,不受影响。影响
core/render/image_stream.cpp)本机环境
验证
tests/unit/image_stream.cpp),修复前失败、修复后通过。image_stream单元测试通过;实际应用(ui.image().stream()提交 256×256 BGRA 帧)验证画面完整显示,非竖线。convertToRgba8),不涉及窗口/渲染后端代码路径,由 CI 覆盖。