Skip to content

Commit 46a0bfc

Browse files
committed
fix ColorPalette problem for M5GFX v0.1.1
1 parent e4e07b1 commit 46a0bfc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Face.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ Drawable *Face::getRightEye() { return eyeR; }
9595
BoundingRect *Face::getBoundingRect() { return boundingRect; }
9696

9797
void Face::draw(DrawContext *ctx) {
98+
sprite->createSprite(boundingRect->getWidth(), boundingRect->getHeight());
9899
sprite->setColorDepth(ctx->getColorDepth());
99100
// NOTE: setting below for 1-bit color depth
100101
sprite->setBitmapColor(ctx->getColorPalette()->get(COLOR_PRIMARY),
101102
ctx->getColorPalette()->get(COLOR_BACKGROUND));
102-
sprite->createSprite(boundingRect->getWidth(), boundingRect->getHeight());
103103
if (ctx->getColorDepth() != 1) {
104104
sprite->fillSprite(ctx->getColorPalette()->get(COLOR_BACKGROUND));
105105
}
@@ -141,10 +141,10 @@ void Face::draw(DrawContext *ctx) {
141141
uint16_t h = boundingRect->getHeight();
142142
uint16_t tmpSprWidth = _min(w * scale, 320);
143143
uint16_t tmpSprHeight = _min(h * scale, 240);
144+
tmpSpr->createSprite(tmpSprWidth, tmpSprHeight);
144145
tmpSpr->setColorDepth(ctx->getColorDepth());
145146
tmpSpr->setBitmapColor(ctx->getColorPalette()->get(COLOR_PRIMARY),
146147
ctx->getColorPalette()->get(COLOR_BACKGROUND));
147-
tmpSpr->createSprite(tmpSprWidth, tmpSprHeight);
148148
if (ctx->getColorDepth() != 1) {
149149
sprite->fillSprite(ctx->getColorPalette()->get(COLOR_BACKGROUND));
150150
}

0 commit comments

Comments
 (0)