mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Fix misalignment of Sixel image slices (#17724)
When we have a series of image slices of differing widths, which also don't align with the cell boundaries, we can get rounding errors in the scaling which makes the different slices appear misaligned. This PR fixes the issue by removing the 4 pixel width alignment that was enforced in the `ImageSlice` class, since that's not actually necessary when the pixels themselves are already 4 bytes in size. And without that, the widths should be correctly aligned with the cell boundaries. ## References and Relevant Issues The initial Sixel implementation was added in PR #17421. ## Validation Steps Performed I've confirmed that this fixes the rendering glitches reported in #17711, and all my existing Sixel tests still work as expected. Closes #17711
This commit is contained in:
parent
bf44b6c360
commit
65219d40ce
@ -65,7 +65,6 @@ RGBQUAD* ImageSlice::MutablePixels(const til::CoordType columnBegin, const til::
|
||||
_columnBegin = existingData ? std::min(_columnBegin, columnBegin) : columnBegin;
|
||||
_columnEnd = existingData ? std::max(_columnEnd, columnEnd) : columnEnd;
|
||||
_pixelWidth = (_columnEnd - _columnBegin) * _cellSize.width;
|
||||
_pixelWidth = (_pixelWidth + 3) & ~3; // Renderer needs this as a multiple of 4
|
||||
const auto bufferSize = _pixelWidth * _cellSize.height;
|
||||
if (existingData)
|
||||
{
|
||||
|
||||
@ -685,7 +685,7 @@ try
|
||||
const auto srcWidth = imageSlice.PixelWidth();
|
||||
const auto srcHeight = srcCellSize.height;
|
||||
const auto dstWidth = srcWidth * dstCellSize.width / srcCellSize.width;
|
||||
const auto dstHeight = srcHeight * dstCellSize.height / srcCellSize.height;
|
||||
const auto dstHeight = dstCellSize.height;
|
||||
const auto x = (imageSlice.ColumnOffset() - viewportLeft) * dstCellSize.width;
|
||||
const auto y = targetRow * dstCellSize.height;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user