Skip to content

Commit 3d1d9f4

Browse files
committed
Fix Sprite color error when using drawBitmap
1 parent 026dbb7 commit 3d1d9f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/M5Display.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,38 @@ void M5Display::setBrightness(uint8_t brightness) {
3232
}
3333

3434
void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data) {
35+
bool swap = getSwapBytes();
3536
setSwapBytes(true);
3637
pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data);
38+
setSwapBytes(swap);
3739
}
3840

3941
void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, uint16_t *data) {
42+
bool swap = getSwapBytes();
4043
setSwapBytes(true);
4144
pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data);
45+
setSwapBytes(swap);
4246
}
4347

4448
void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data, uint16_t transparent) {
49+
bool swap = getSwapBytes();
4550
setSwapBytes(true);
4651
pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data, transparent);
52+
setSwapBytes(swap);
4753
}
4854

4955
void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint8_t *data) {
56+
bool swap = getSwapBytes();
5057
setSwapBytes(true);
5158
pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, (const uint16_t*)data);
59+
setSwapBytes(swap);
5260
}
5361

5462
void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, uint8_t *data) {
63+
bool swap = getSwapBytes();
5564
setSwapBytes(true);
5665
pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, (uint16_t*)data);
66+
setSwapBytes(swap);
5767
}
5868

5969
void M5Display::progressBar(int x, int y, int w, int h, uint8_t val) {

0 commit comments

Comments
 (0)