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

Method pushToSprite

lib/TFT_eSPI/Extensions/Sprite.cpp:718–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716// 1bpp -> 1bpp (note: color translation depends on the 2 sprites bitmap colors)
717
718bool TFT_eSprite::pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y)
719{
720 if (!_created) return false;
721 if (!dspr->created()) return false;
722
723 // Check destination sprite compatibility
724 int8_t ds_bpp = dspr->getColorDepth();
725 if (_bpp == 16 && ds_bpp != 16 && ds_bpp != 8) return false;
726 if (_bpp == 8 && ds_bpp != 8) return false;
727 if (_bpp == 4 && ds_bpp != 4) return false;
728 if (_bpp == 1 && ds_bpp != 1) return false;
729
730 bool oldSwapBytes = dspr->getSwapBytes();
731 dspr->setSwapBytes(false);
732 dspr->pushImage(x, y, _dwidth, _dheight, _img, _bpp);
733 dspr->setSwapBytes(oldSwapBytes);
734
735 return true;
736}
737
738
739/***************************************************************************************

Callers

nothing calls this directly

Calls 5

createdMethod · 0.80
getColorDepthMethod · 0.80
getSwapBytesMethod · 0.45
setSwapBytesMethod · 0.45
pushImageMethod · 0.45

Tested by

no test coverage detected