From a8885105e9f5a2dbd41d6ef58231396c0d857c61 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 28 Nov 2023 09:55:47 -0300 Subject: [PATCH] Move rows array back to the beginning of ImageImpl buffer We are not sure, but due to new bug reports about a lagging mouse movement (#4174), it might be because some memory cache issues: having the rows array at the end of the pixels data might not be the best decision. It was moved at the end because we didn't need that rows array to be aligned, only the pixels data. But with this patch we're trying to see if this fixes the issue. So now we moved back the rows array at the beginning of the image buffer as it was before aeeef8e255c2d83a1b3e3cb2858939233d5a5d0b --- src/doc/image_impl.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/doc/image_impl.h b/src/doc/image_impl.h index 5f12b1430..87f8ead87 100644 --- a/src/doc/image_impl.h +++ b/src/doc/image_impl.h @@ -32,8 +32,8 @@ namespace doc { private: ImageBufferPtr m_buffer; - address_t m_bits; address_t* m_rows; + address_t m_bits; inline address_t getLineAddress(int y) { ASSERT(y >= 0 && y < height()); @@ -64,7 +64,7 @@ namespace doc { m_rowBytes = Traits::rowstride_bytes(width()); - const std::size_t for_rows = sizeof(address_t) * height(); + const std::size_t for_rows = doc_align_size(sizeof(address_t) * height()); const std::size_t for_pixels = m_rowBytes * height(); const std::size_t required_size = for_pixels + for_rows; @@ -76,13 +76,13 @@ namespace doc { std::fill(m_buffer->buffer(), m_buffer->buffer()+required_size, 0); - m_bits = (address_t)m_buffer->buffer(); - m_rows = (address_t*)(m_buffer->buffer() + for_pixels); + m_rows = (address_t*)m_buffer->buffer(); + m_bits = (address_t)(m_buffer->buffer() + for_rows); - address_t addr = m_bits; + auto addr = (uint8_t*)m_bits; for (int y=0; y