Swap X/y in images (#528)

* Swap X/Y in image encoding

* Fix PNG decoder

* Now really fix png

* reducing deps

* moving png.cpp into ev3

* bumped pxt

* updated shims

* fixing c++ compilation

* updated shims

* Fix pixel order

* update pxt

* Fix C++ image decoding

* Add expanded PNG images

* Generate E1 format images (in libs/ev3 run 'pxt buildsprites images')

* Go back to white background

* Remove PNG support
This commit is contained in:
Michał Moskal
2018-04-19 12:08:16 -07:00
committed by Peli de Halleux
parent 95ab3be26e
commit 8ed79e7133
130 changed files with 363 additions and 945 deletions

View File

@ -16,6 +16,36 @@ namespace pxt {
static const uint8_t pixmap[] = {0x00, 0x03, 0x1C, 0x1F, 0xE0, 0xE3, 0xFC, 0xFF};
static void bitBufferToFrameBufferSwap(uint8_t *bitBuffer, uint8_t *fb) {
int mask = 0x01;
uint8_t *currLine = bitBuffer;
for (int line = 0; line < LCD_HEIGHT; line++) {
uint8_t *ptr = currLine;
int n = 60;
while (n--) {
uint8_t v = 0;
if (*ptr & mask)
v |= 0xE0;
ptr += LCD_HEIGHT / 8;
if (*ptr & mask)
v |= 0x1C;
ptr += LCD_HEIGHT / 8;
if (*ptr & mask)
v |= 0x03;
ptr += LCD_HEIGHT / 8;
*fb++ = v;
}
mask <<= 1;
if (mask == 0x100) {
mask = 0x01;
currLine++;
}
}
}
static void bitBufferToFrameBuffer(uint8_t *bitBuffer, uint8_t *fb) {
uint32_t pixels;
@ -59,7 +89,7 @@ void updateScreen(Image_ img) {
if (lastImg->bpp() != 1 || lastImg->width() != LCD_WIDTH || lastImg->height() != LCD_HEIGHT)
target_panic(906);
lastImg->clearDirty();
bitBufferToFrameBuffer(lastImg->pix(), mappedFrameBuffer);
bitBufferToFrameBufferSwap(lastImg->pix(), mappedFrameBuffer);
}
}