Merge pull request #1674 from pewpew-game/bug1669

Properly calculate BPP for displayio.Bitmap
This commit is contained in:
Scott Shawcroft 2019-03-26 15:49:42 -07:00 committed by GitHub
commit 3f42a49a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 64 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -762,14 +762,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr ""
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr ""
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "GPIO16 tidak mendukung pull up"
@ -2838,6 +2834,10 @@ msgstr ""
msgid "unsupported types for %q: '%s', '%s'"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "wifi_set_ip_info() gagal"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -737,14 +737,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr ""
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr ""
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr ""
@ -2789,6 +2785,10 @@ msgstr ""
msgid "unsupported types for %q: '%s', '%s'"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@ -742,14 +742,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde"
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde"
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "GPIO16 unterstützt pull up nicht"
@ -2851,6 +2847,10 @@ msgstr "nicht unterstützter Typ für Operator"
msgid "unsupported types for %q: '%s', '%s'"
msgstr "nicht unterstützte Typen für %q: '%s', '%s'"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "wifi_set_ip_info() fehlgeschlagen"
@ -2889,5 +2889,9 @@ msgstr ""
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Kann den Attributwert nicht lesen. Status: 0x%04x"
#~ msgid "Function requires lock."
#~ msgstr ""
#~ "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde"
#~ msgid "Only Windows format, uncompressed BMP supported %d"
#~ msgstr "Nur unkomprimiertes Windows-Format (BMP) unterstützt %d"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -737,14 +737,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr ""
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr ""
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr ""
@ -2789,6 +2785,10 @@ msgstr ""
msgid "unsupported types for %q: '%s', '%s'"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@ -741,14 +741,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr ""
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr ""
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr ""
@ -2793,6 +2789,10 @@ msgstr ""
msgid "unsupported types for %q: '%s', '%s'"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -767,14 +767,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr "La función requiere lock"
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr "La función requiere lock"
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "GPIO16 no soporta pull up."
@ -2874,6 +2870,10 @@ msgstr "tipo de operador no soportado"
msgid "unsupported types for %q: '%s', '%s'"
msgstr "tipos no soportados para %q: '%s', '%s'"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "wifi_set_ip_info() ha fallado"
@ -2916,6 +2916,9 @@ msgstr "paso cero"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "No se puede leer el valor del atributo. status 0x%02x"
#~ msgid "Function requires lock."
#~ msgstr "La función requiere lock"
#~ msgid "Only Windows format, uncompressed BMP supported %d"
#~ msgstr "Solo formato Windows, BMP sin comprimir soportado %d"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -765,14 +765,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr "Function nangangailangan ng lock"
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr "Kailangan ng lock ang function."
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "Walang pull down support ang GPI016."
@ -2880,6 +2876,10 @@ msgstr "hindi sinusuportahang type para sa operator"
msgid "unsupported types for %q: '%s', '%s'"
msgstr "hindi sinusuportahang type para sa %q: '%s', '%s'"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "nabigo ang wifi_set_ip_info()"
@ -2922,6 +2922,9 @@ msgstr "zero step"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Hindi mabasa ang value ng attribute, status: 0x%08lX"
#~ msgid "Function requires lock."
#~ msgstr "Kailangan ng lock ang function."
#~ msgid "Only Windows format, uncompressed BMP supported %d"
#~ msgstr "Tanging Windows format, uncompressed BMP lamang ang supportado %d"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-12-23 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -764,14 +764,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr "La fonction nécessite un verrou"
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr "La fonction nécessite un verrou."
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "le GPIO16 ne supporte pas le tirage (pull-up)"
@ -2902,6 +2898,10 @@ msgstr "type non supporté pour l'opérateur"
msgid "unsupported types for %q: '%s', '%s'"
msgstr "type non supporté pour %q: '%s', '%s'"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "wifi_set_ip_info() a échoué"
@ -2945,6 +2945,9 @@ msgstr "'step' nul"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Impossible de lire la valeur de l'attribut. status: 0x%08lX"
#~ msgid "Function requires lock."
#~ msgstr "La fonction nécessite un verrou."
#~ msgid "Only Windows format, uncompressed BMP supported %d"
#~ msgstr "Seul les BMP non-compressé au format Windows sont supportés %d"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -764,14 +764,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr ""
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr ""
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "GPIO16 non supporta pull-up"
@ -2876,6 +2872,10 @@ msgstr "tipo non supportato per l'operando"
msgid "unsupported types for %q: '%s', '%s'"
msgstr "tipi non supportati per %q: '%s', '%s'"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "wifi_set_ip_info() faillito"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-25 14:08+0100\n"
"POT-Creation-Date: 2019-03-25 19:40+0100\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -757,14 +757,10 @@ msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/bitbangio/I2C.c
#: shared-bindings/busio/SPI.c
#: shared-bindings/busio/SPI.c shared-bindings/busio/I2C.c
msgid "Function requires lock"
msgstr ""
#: shared-bindings/busio/I2C.c
msgid "Function requires lock."
msgstr ""
#: ports/esp8266/common-hal/digitalio/DigitalInOut.c
msgid "GPIO16 does not support pull up."
msgstr "GPIO16 não suporta pull up."
@ -2826,6 +2822,10 @@ msgstr ""
msgid "unsupported types for %q: '%s', '%s'"
msgstr ""
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
#: ports/esp8266/modnetwork.c
msgid "wifi_set_ip_info() failed"
msgstr "wifi_set_ip_info() falhou"

View File

@ -58,14 +58,22 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar
uint32_t width = mp_obj_get_int(pos_args[0]);
uint32_t height = mp_obj_get_int(pos_args[1]);
uint32_t value_count = mp_obj_get_int(pos_args[2]);
uint32_t power_of_two = 1;
while (value_count > (1U << power_of_two)) {
power_of_two <<= 1;
uint32_t bits = 1;
if (value_count == 0) {
mp_raise_ValueError(translate("value_count must be > 0"));
}
while ((value_count - 1) >> bits) {
if (bits < 8) {
bits <<= 1;
} else {
bits += 8;
}
}
displayio_bitmap_t *self = m_new_obj(displayio_bitmap_t);
self->base.type = &displayio_bitmap_type;
common_hal_displayio_bitmap_construct(self, width, height, power_of_two);
common_hal_displayio_bitmap_construct(self, width, height, bits);
return MP_OBJ_FROM_PTR(self);
}