Skip to content

Commit

Permalink
Bugfix - Fix pallete size calculation (#87)
Browse files Browse the repository at this point in the history
* Create cmake-multi-platform.yml

tryout1

* Update cmake-multi-platform.yml

* Update cmake-multi-platform.yml

* Update cmake-multi-platform.yml

* Update cmake-multi-platform.yml

* Update cmake-multi-platform.yml

* edited and renamed github action workflow file

* updated build definition

* fixing build definition

* Fixed calculation of palette size for most palletized bitmaps. 2^bitDepth instead of bitDepth*bitDepth. Calculation is needed because paletteSize in the DIB header is not filled correctly by the most image libs/tools, so 0 is read and calculation was wrong.
  • Loading branch information
Martinius79 authored Sep 19, 2024
1 parent 9bbfb00 commit 4b23b15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EleksTubeHAX_pio/src/TFTs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ bool TFTs::LoadImageIntoBuffer(uint8_t file_index) {
{
read32(bmpFS); read32(bmpFS); read32(bmpFS); // size, w resolution, h resolution
paletteSize = read32(bmpFS);
if (paletteSize == 0) paletteSize = bitDepth * bitDepth; // if 0, size is 2^bitDepth
if (paletteSize == 0) paletteSize = pow(2, bitDepth); // if 0, size is 2^bitDepth
bmpFS.seek(14 + headerSize); // start of color palette
for (uint16_t i = 0; i < paletteSize; i++) {
palette[i] = read32(bmpFS);
Expand Down

0 comments on commit 4b23b15

Please sign in to comment.