MCPcopy Create free account
hub / github.com/BruceDevices/firmware / PNGDraw

Function PNGDraw

src/core/display.cpp:1781–1795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1779int16_t xpos = 0;
1780int16_t ypos = 0;
1781int PNGDraw(PNGDRAW *pDraw) {
1782 uint16_t usPixels[MAX_IMAGE_WIDTH];
1783 // static uint16_t dmaBuffer[MAX_IMAGE_WIDTH]; // static so buffer persists after fn exit
1784 uint8_t r = ((uint16_t)bruceConfig.bgColor & 0xF800) >> 8;
1785 uint8_t g = ((uint16_t)bruceConfig.bgColor & 0x07E0) >> 3;
1786 uint8_t b = ((uint16_t)bruceConfig.bgColor & 0x001F) << 3;
1787 png->getLineAsRGB565(pDraw, usPixels, PNG_RGB565_BIG_ENDIAN, b << 16 | g << 8 | r);
1788 if (!pngCacheOnly) {
1789 tft.drawPixel(0, 0, 0);
1790 tft.drawPixel(0, 0, 0);
1791 tft.pushImage(xpos, ypos + pDraw->y, pDraw->iWidth, 1, usPixels);
1792 }
1793 if (pngBinOut) { pngBinOut->write((uint8_t *)usPixels, pDraw->iWidth * sizeof(uint16_t)); }
1794 return 1;
1795}
1796
1797// Build a cache path alongside the PNG: <dir>/tmp/<basename>.bin
1798static String buildPngBinPath(const String &pngPath) {

Callers

nothing calls this directly

Calls 3

drawPixelMethod · 0.45
pushImageMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected