void PadConfiguration::drawPicture() { if(_picture == nullptr) { drawMapping(); return; } uint8_t* pointer = _picture; uint16_t current(0); #define READ_8 current = *pointer; ++pointer; #define READ_16 current = *((uint16_t*)pointer); ++pointer; ++pointer; READ_16; TFTscreen.fillScreen(current); READ_8; uint16_t numColors(current); for(uint16_t currentColor = 0; currentColor < numColors; ++currentColor) { READ_16; uint16_t color = current; READ_16; uint32_t numRects(current); for(uint16_t currentRect = 0; currentRect < numRects; ++currentRect) { READ_8; int16_t x(current); READ_8; int16_t y(current); READ_8; int16_t w(current); READ_8; int16_t h(current); TFTscreen.fillRect(x, y, w, h, color); } READ_16; uint16_t numVLines(current); for(uint16_t currentVLine = 0; currentVLine < numVLines; ++currentVLine) { READ_8; int16_t x(current); READ_8; int16_t y(current); READ_8; int16_t l(current); TFTscreen.drawFastVLine(x, y, l, color); } READ_16; uint16_t numHLines(current); for(uint16_t currentHLine = 0; currentHLine < numHLines; ++currentHLine) { READ_8; int16_t x(current); READ_8; int16_t y(current); READ_8; int16_t l(current); TFTscreen.drawFastHLine(x, y, l, color); } READ_16; uint16_t numPix(current); for(uint16_t currentPix = 0; currentPix < numPix; ++currentPix) { READ_8; int16_t x(current); READ_8; int16_t y(current); TFTscreen.drawPixel(x, y, color); } } #undef READ_8 #undef READ_16 }