Skip to content

Commit

Permalink
misc: fix incorrect lengths for AdjustRGB24Depth calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jsm174 committed Mar 2, 2024
1 parent aa9891b commit 6d13922
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ void DMD::ZeDMDThread()
// ZeDMD HD supports 256 * 64 pixels.
uint8_t rgb24Data[256 * 64 * 3];

AdjustRGB24Depth(m_updateBuffer[bufferPosition]->data, rgb24Data, width * height * 3, palette,
AdjustRGB24Depth(m_updateBuffer[bufferPosition]->data, rgb24Data, width * height, palette,
m_updateBuffer[bufferPosition]->depth);
m_pZeDMD->RenderRgb24(rgb24Data);
}
Expand Down Expand Up @@ -648,7 +648,7 @@ void DMD::PixelcadeDMDThread()
if (m_updateBuffer[bufferPosition]->mode == DMDMode::RGB24)
{
uint8_t rgb24Data[128 * 32 * 3];
AdjustRGB24Depth(m_updateBuffer[bufferPosition]->data, rgb24Data, length * 3, palette,
AdjustRGB24Depth(m_updateBuffer[bufferPosition]->data, rgb24Data, length, palette,
m_updateBuffer[bufferPosition]->depth);
for (int i = 0; i < length; i++)
{
Expand Down Expand Up @@ -807,7 +807,7 @@ void DMD::RGB24DMDThread()
m_updateBuffer[bufferPosition]->g, m_updateBuffer[bufferPosition]->b);
}

AdjustRGB24Depth(m_updateBuffer[bufferPosition]->data, rgb24Data, length * 3, palette,
AdjustRGB24Depth(m_updateBuffer[bufferPosition]->data, rgb24Data, length, palette,
m_updateBuffer[bufferPosition]->depth);

for (RGB24DMD* pRGB24DMD : m_rgb24DMDs)
Expand Down Expand Up @@ -972,7 +972,7 @@ void DMD::AdjustRGB24Depth(uint8_t* pData, uint8_t* pDstData, int length, uint8_
}
else
{
memcpy(pDstData, pData, length);
memcpy(pDstData, pData, length * 3);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ int main(int argc, const char* argv[])
snprintf(filename, 28, "test/rgb565_%dx%d/%04d.raw", width, height, i);
printf("Render raw: %s\n", filename);
fileptr = fopen(filename, "rb");
if (!fileptr) continue;
fread(buffer, size, 1, fileptr);
fclose(fileptr);

Expand Down

0 comments on commit 6d13922

Please sign in to comment.