Skip to content

Commit 65219d4

Browse files
authored
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
1 parent bf44b6c commit 65219d4

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/buffer/out/ImageSlice.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ RGBQUAD* ImageSlice::MutablePixels(const til::CoordType columnBegin, const til::
6565
_columnBegin = existingData ? std::min(_columnBegin, columnBegin) : columnBegin;
6666
_columnEnd = existingData ? std::max(_columnEnd, columnEnd) : columnEnd;
6767
_pixelWidth = (_columnEnd - _columnBegin) * _cellSize.width;
68-
_pixelWidth = (_pixelWidth + 3) & ~3; // Renderer needs this as a multiple of 4
6968
const auto bufferSize = _pixelWidth * _cellSize.height;
7069
if (existingData)
7170
{

src/renderer/gdi/paint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ try
685685
const auto srcWidth = imageSlice.PixelWidth();
686686
const auto srcHeight = srcCellSize.height;
687687
const auto dstWidth = srcWidth * dstCellSize.width / srcCellSize.width;
688-
const auto dstHeight = srcHeight * dstCellSize.height / srcCellSize.height;
688+
const auto dstHeight = dstCellSize.height;
689689
const auto x = (imageSlice.ColumnOffset() - viewportLeft) * dstCellSize.width;
690690
const auto y = targetRow * dstCellSize.height;
691691

0 commit comments

Comments
 (0)