ImpulseAdventure / GUIslice

GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
https://www.impulseadventure.com/elec/guislice-gui.html
MIT License
1.12k stars 206 forks source link

fixes for drawing monochromic bmp images #456

Closed Pconti31 closed 4 months ago

Pconti31 commented 2 years ago

Testing of gslc_DrvDrawMonoFromMem shows it been broken for while. Debugging I found that after nCol.r = (bProgMem)? pgm_read_byte(bmap_base++) : (bmap_base++); nCol.g = (bProgMem)? pgm_read_byte(bmap_base++) : (bmap_base++); nCol.b = (bProgMem)? pgm_read_byte(bmap_base++) : *(bmap_base++); bmap_base++; <-- we are moving one byte ahead in our image I larger image might show up correctly or seemly so. Testing with 24x24 image has the last 1/3 of image display first followed by the beginning 2/3. Deleting bmap_base++; fixed the problem.

ImpulseAdventure commented 2 years ago

Thank you Paul! I am unable to test while away. If you’re reasonably happy with the testing you’ve done, I’ll tentatively proceed with the merge but back it out later if we encounter an issue.

Pconti31 commented 2 years ago

Yes, I have tested this on the hardware I have. It works fine. I think you noticed that originally you were simply bumping bmap_base twice in a row one byte past the actual start of the image.

  nCol.b  =   (bProgMem)? pgm_read_byte(bmap_base++) : *(bmap_base++);
//  bmap_base++; <-- already done above when you incremented past the blue color.

I have assumed you will do the merge and closed this issue. Paul--