summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadomir Dopieralski <openstack@sheep.art.pl>2019-03-20 19:29:20 +0100
committerRadomir Dopieralski <openstack@sheep.art.pl>2019-03-25 19:40:40 +0100
commit81fe8060d76d54a20701e6944dd29cdfab9fed4f (patch)
tree36de8da8c4a3fb17b91007ead73a6e4f93b5c35f
parent7bac10ab6e441c83c509661b6bd5bdde280bf196 (diff)
Properly calculate BPP for displayio.Bitmap
Fix #1669
-rw-r--r--locale/ID.po12
-rw-r--r--locale/circuitpython.pot12
-rw-r--r--locale/de_DE.po16
-rw-r--r--locale/en_US.po12
-rw-r--r--locale/en_x_pirate.po12
-rw-r--r--locale/es.po15
-rw-r--r--locale/fil.po15
-rw-r--r--locale/fr.po15
-rw-r--r--locale/it_IT.po12
-rw-r--r--locale/pt_BR.po12
-rw-r--r--shared-bindings/displayio/Bitmap.c16
11 files changed, 85 insertions, 64 deletions
diff --git a/locale/ID.po b/locale/ID.po
index 694b2964f..1df86a7d2 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -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"
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 735459a47..645b2e4ad 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -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 ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 21fe860eb..87e965914 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -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"
diff --git a/locale/en_US.po b/locale/en_US.po
index 2f29498b9..da189c661 100644
--- a/locale/en_US.po
+++ b/locale/en_US.po
@@ -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 ""
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index 0bcef8066..f9bb0f0ff 100644
--- a/locale/en_x_pirate.po
+++ b/locale/en_x_pirate.po
@@ -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 ""
diff --git a/locale/es.po b/locale/es.po
index efae8c368..9f71ac160 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -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"
diff --git a/locale/fil.po b/locale/fil.po
index 42a1c9e26..230a09597 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -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"
diff --git a/locale/fr.po b/locale/fr.po
index 1710a5ae9..f9c007825 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -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"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 758307ff3..693f8a03c 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -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"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 5d00b4e03..587ed00ba 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -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"
diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c
index 3612b8d63..91c17f2d1 100644
--- a/shared-bindings/displayio/Bitmap.c
+++ b/shared-bindings/displayio/Bitmap.c
@@ -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);
}