MAP_HEIGHT & renderJPEG problem
reaper7 opened this issue · 3 comments
I have a problem with drawing map on display.
As You see, display show additional 320x8 block below map as a 20 copies of last read block from jpeg (marked with a red block):
The same map (link from serial terminal) downloaded on pc do not contain "boxboxbox..." block.
For me, MAP_HEIGHT = 200 is a not good choice, because when You add a litle debug to renderJPEG:
Serial.print("Width :"); Serial.println(JpegDec.width);
Serial.print("Height :"); Serial.println(JpegDec.height);
Serial.print("Components:"); Serial.println(JpegDec.comps);
Serial.print("MCU / row :"); Serial.println(JpegDec.MCUSPerRow);
Serial.print("MCU / col :"); Serial.println(JpegDec.MCUSPerCol);
Serial.print("Scan type :"); Serial.println(JpegDec.scanType);
Serial.print("MCU width :"); Serial.println(JpegDec.MCUWidth);
Serial.print("MCU height:"); Serial.println(JpegDec.MCUHeight);
then You see that MCUWidth & MCUHeight are a square blocks 16x16.
When with width, in this case, everything is fine, because 320 / 16 = 20,
with map height we have problem because 200 / 16 = 12.5
...so, renderJPEG still draw inside:
while (count--) {tft_->pushColor(*pImg++);}
last reading from jpeg block on display (320x8) for completion to 16, although jpeg ends.
Best choice for map height is 192 or 208
and/or some mod a renderJPEG procedure...
Thank you for the analysis! I have seen this as well but didn't have time to look into it. We'll have to see if 204 still have enough space for the detail information...
192 or 208 :)
map height 192 is ok and more place for infos
The simple rendering method assumed an integer number of MCU blocks for width and height of image.
For arbitrary sizes you can use the example code here.