Merge pull request #2888 from WarriorOfWire/vectorio-polygon-speed

vectorio: speed up polygon
This commit is contained in:
Scott Shawcroft 2020-05-18 14:37:05 -07:00 committed by GitHub
commit 2e950a059c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 197 additions and 187 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "buffers harus mempunyai panjang yang sama" msgstr "buffers harus mempunyai panjang yang sama"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1269,6 +1269,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Tambahkan module apapun pada filesystem\n" msgstr "Tambahkan module apapun pada filesystem\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2137,10 +2141,6 @@ msgstr ""
msgid "empty" msgid "empty"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "heap kosong" msgstr "heap kosong"
@ -3158,8 +3158,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "" msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -81,7 +81,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1257,6 +1257,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2113,10 +2117,6 @@ msgstr ""
msgid "empty" msgid "empty"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "" msgstr ""
@ -3132,8 +3132,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "" msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -81,7 +81,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1257,6 +1257,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2113,10 +2117,6 @@ msgstr ""
msgid "empty" msgid "empty"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "" msgstr ""
@ -3132,8 +3132,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "" msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-05-18 02:48+0000\n" "PO-Revision-Date: 2020-05-18 02:48+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n" "Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: German <https://later.unpythonic.net/projects/circuitpython/" "Language-Team: German <https://later.unpythonic.net/projects/circuitpython/"
@ -90,7 +90,7 @@ msgstr "%q Liste muss eine Liste sein"
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q muss >= 1 sein" msgstr "%q muss >= 1 sein"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "%q muss ein Tupel der Länge 2 sein" msgstr "%q muss ein Tupel der Länge 2 sein"
@ -1279,6 +1279,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "und alle Module im Dateisystem \n" msgstr "und alle Module im Dateisystem \n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2149,10 +2153,6 @@ msgstr "Division durch Null"
msgid "empty" msgid "empty"
msgstr "leer" msgstr "leer"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "leerer heap" msgstr "leerer heap"
@ -3184,8 +3184,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "nicht lesbares Attribut" msgstr "nicht lesbares Attribut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "Nicht unterstützter %q-Typ" msgstr "Nicht unterstützter %q-Typ"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -81,7 +81,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1257,6 +1257,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2113,10 +2117,6 @@ msgstr ""
msgid "empty" msgid "empty"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "" msgstr ""
@ -3132,8 +3132,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "" msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-03-30 22:11+0000\n" "PO-Revision-Date: 2020-03-30 22:11+0000\n"
"Last-Translator: Tannewt <devnull@unpythonic.net>\n" "Last-Translator: Tannewt <devnull@unpythonic.net>\n"
"Language-Team: English <https://later.unpythonic.net/projects/circuitpython/" "Language-Team: English <https://later.unpythonic.net/projects/circuitpython/"
@ -88,7 +88,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1266,6 +1266,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2122,10 +2126,6 @@ msgstr ""
msgid "empty" msgid "empty"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "" msgstr ""
@ -3141,8 +3141,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "" msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-05-17 20:56+0000\n" "PO-Revision-Date: 2020-05-17 20:56+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n" "Last-Translator: Jeff Epler <jepler@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -84,7 +84,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q debe ser >= 1" msgstr "%q debe ser >= 1"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1273,6 +1273,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Incapaz de montar de nuevo el sistema de archivos" msgstr "Incapaz de montar de nuevo el sistema de archivos"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "Pop de un buffer Ps2 vacio" msgstr "Pop de un buffer Ps2 vacio"
@ -2146,10 +2150,6 @@ msgstr "división por cero"
msgid "empty" msgid "empty"
msgstr "vacío" msgstr "vacío"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "heap vacío" msgstr "heap vacío"
@ -3175,8 +3175,8 @@ msgstr "No coinciden '{' en format"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "atributo no legible" msgstr "atributo no legible"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "tipo de %q no soportado" msgstr "tipo de %q no soportado"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n" "Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n" "Language-Team: fil\n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "aarehas na haba dapat ang buffer slices" msgstr "aarehas na haba dapat ang buffer slices"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1277,6 +1277,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Kasama ang kung ano pang modules na sa filesystem\n" msgstr "Kasama ang kung ano pang modules na sa filesystem\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2157,10 +2161,6 @@ msgstr "dibisyon ng zero"
msgid "empty" msgid "empty"
msgstr "walang laman" msgstr "walang laman"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "walang laman ang heap" msgstr "walang laman ang heap"
@ -3188,8 +3188,8 @@ msgstr "hindi tugma ang '{' sa format"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "hindi mabasa ang attribute" msgstr "hindi mabasa ang attribute"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "Hindi supportadong tipo ng %q" msgstr "Hindi supportadong tipo ng %q"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 0.1\n" "Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-05-17 20:56+0000\n" "PO-Revision-Date: 2020-05-17 20:56+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n" "Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: French <https://later.unpythonic.net/projects/circuitpython/" "Language-Team: French <https://later.unpythonic.net/projects/circuitpython/"
@ -94,7 +94,7 @@ msgstr "La liste %q doit être une liste"
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q doit être >=1" msgstr "%q doit être >=1"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "%q doit être un tuple de longueur 2" msgstr "%q doit être un tuple de longueur 2"
@ -534,7 +534,8 @@ msgstr "Impossible d'obtenir la taille du scalaire sans ambigüité"
#: ports/stm/common-hal/pulseio/PWMOut.c #: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use" msgid "Cannot vary frequency on a timer that is already in use"
msgstr "Impossible de faire varier la fréquence sur une minuterie déjà utilisée" msgstr ""
"Impossible de faire varier la fréquence sur une minuterie déjà utilisée"
#: shared-module/bitbangio/SPI.c #: shared-module/bitbangio/SPI.c
msgid "Cannot write without MOSI pin." msgid "Cannot write without MOSI pin."
@ -1293,13 +1294,17 @@ msgid ""
"constructor" "constructor"
msgstr "" msgstr ""
"Le brochage utilise %d octets par élément, ce qui consomme plus que le %d " "Le brochage utilise %d octets par élément, ce qui consomme plus que le %d "
"octets idéal. Si cela ne peut pas être évité, transmettez allow_inefficient =" "octets idéal. Si cela ne peut pas être évité, transmettez allow_inefficient "
" True au constructeur" "= True au constructeur"
#: py/builtinhelp.c #: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Ainsi que tout autre module présent sur le système de fichiers\n" msgstr "Ainsi que tout autre module présent sur le système de fichiers\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "Pop à partir d'un tampon Ps2 vide" msgstr "Pop à partir d'un tampon Ps2 vide"
@ -2063,7 +2068,8 @@ msgstr "ne peut pas réaliser un import relatif"
#: extmod/ulab/code/ndarray.c #: extmod/ulab/code/ndarray.c
msgid "cannot reshape array (incompatible input/output shape)" msgid "cannot reshape array (incompatible input/output shape)"
msgstr "ne peut pas remodeler le tableau (forme d'entrée / sortie incompatible)" msgstr ""
"ne peut pas remodeler le tableau (forme d'entrée / sortie incompatible)"
#: py/emitnative.c #: py/emitnative.c
msgid "casting" msgid "casting"
@ -2191,10 +2197,6 @@ msgstr "division par zéro"
msgid "empty" msgid "empty"
msgstr "vide" msgstr "vide"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr "liste %q vide"
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "tas vide" msgstr "tas vide"
@ -3226,8 +3228,8 @@ msgstr "'{' sans correspondance dans le format"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "attribut illisible" msgstr "attribut illisible"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "type %q non pris on charge" msgstr "type %q non pris on charge"
@ -3701,6 +3703,9 @@ msgstr "'step' nul"
#~ msgid "either pos or kw args are allowed" #~ msgid "either pos or kw args are allowed"
#~ msgstr "soit 'pos', soit 'kw' est permis en argument" #~ msgstr "soit 'pos', soit 'kw' est permis en argument"
#~ msgid "empty %q list"
#~ msgstr "liste %q vide"
#~ msgid "expected a DigitalInOut" #~ msgid "expected a DigitalInOut"
#~ msgstr "objet DigitalInOut attendu" #~ msgstr "objet DigitalInOut attendu"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n" "Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "slice del buffer devono essere della stessa lunghezza" msgstr "slice del buffer devono essere della stessa lunghezza"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1287,6 +1287,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Imposssibile rimontare il filesystem" msgstr "Imposssibile rimontare il filesystem"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2158,10 +2162,6 @@ msgstr "divisione per zero"
msgid "empty" msgid "empty"
msgstr "vuoto" msgstr "vuoto"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "heap vuoto" msgstr "heap vuoto"
@ -3195,8 +3195,8 @@ msgstr "'{' spaiato nella stringa di formattazione"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "attributo non leggibile" msgstr "attributo non leggibile"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "tipo di %q non supportato" msgstr "tipo di %q non supportato"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -83,7 +83,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q 는 >=1이어야합니다" msgstr "%q 는 >=1이어야합니다"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1261,6 +1261,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2118,10 +2122,6 @@ msgstr ""
msgid "empty" msgid "empty"
msgstr "" msgstr ""
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "" msgstr ""
@ -3137,8 +3137,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "" msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n" "Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n" "Language-Team: pl\n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q musi być >= 1" msgstr "%q musi być >= 1"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1262,6 +1262,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Oraz moduły w systemie plików\n" msgstr "Oraz moduły w systemie plików\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "" msgstr ""
@ -2122,10 +2126,6 @@ msgstr "dzielenie przez zero"
msgid "empty" msgid "empty"
msgstr "puste" msgstr "puste"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "pusta sterta" msgstr "pusta sterta"
@ -3143,8 +3143,8 @@ msgstr "niepasujące '{' for formacie"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "nieczytelny atrybut" msgstr "nieczytelny atrybut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "zły typ %q" msgstr "zły typ %q"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -82,7 +82,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "buffers devem ser o mesmo tamanho" msgstr "buffers devem ser o mesmo tamanho"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1273,6 +1273,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Não é possível remontar o sistema de arquivos" msgstr "Não é possível remontar o sistema de arquivos"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "Buffer Ps2 vazio" msgstr "Buffer Ps2 vazio"
@ -2134,10 +2138,6 @@ msgstr "divisão por zero"
msgid "empty" msgid "empty"
msgstr "vazio" msgstr "vazio"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "heap vazia" msgstr "heap vazia"
@ -3156,8 +3156,8 @@ msgstr ""
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "atributo ilegível" msgstr "atributo ilegível"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2020-05-17 20:56+0000\n" "PO-Revision-Date: 2020-05-17 20:56+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n" "Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -89,7 +89,7 @@ msgstr "%q-listan måste vara en lista"
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q måste vara >= 1" msgstr "%q måste vara >= 1"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "%q måste vara en tuple av längd 2" msgstr "%q måste vara en tuple av längd 2"
@ -1067,7 +1067,8 @@ msgstr "MicroPython fatalt fel."
#: shared-bindings/audiobusio/PDMIn.c #: shared-bindings/audiobusio/PDMIn.c
msgid "Microphone startup delay must be in range 0.0 to 1.0" msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr "Startfördröjningen för mikrofonen måste vara i intervallet 0,0 till 1,0" msgstr ""
"Startfördröjningen för mikrofonen måste vara i intervallet 0,0 till 1,0"
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin" msgid "Missing MISO or MOSI Pin"
@ -1278,14 +1279,18 @@ msgid ""
"bytes. If this cannot be avoided, pass allow_inefficient=True to the " "bytes. If this cannot be avoided, pass allow_inefficient=True to the "
"constructor" "constructor"
msgstr "" msgstr ""
"Pinout använder %d byte per element, vilket förbrukar mer än det idealiska %" "Pinout använder %d byte per element, vilket förbrukar mer än det idealiska "
"d byte. Om detta inte kan undvikas, skicka allow_inefficient=True till " "%d byte. Om detta inte kan undvikas, skicka allow_inefficient=True till "
"konstruktorn" "konstruktorn"
#: py/builtinhelp.c #: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Plus eventuella moduler i filsystemet\n" msgstr "Plus eventuella moduler i filsystemet\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "Pop från en tom Ps2-buffert" msgstr "Pop från en tom Ps2-buffert"
@ -2163,10 +2168,6 @@ msgstr "division med noll"
msgid "empty" msgid "empty"
msgstr "tom" msgstr "tom"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr "tom %q-lista"
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "tom heap" msgstr "tom heap"
@ -3188,8 +3189,8 @@ msgstr "omatchad '{' i format"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "attribut kan inte läsas" msgstr "attribut kan inte läsas"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "typ %q stöds inte" msgstr "typ %q stöds inte"
@ -3268,3 +3269,6 @@ msgstr "y-värde utanför intervall"
#: py/objrange.c #: py/objrange.c
msgid "zero step" msgid "zero step"
msgstr "noll steg" msgstr "noll steg"
#~ msgid "empty %q list"
#~ msgstr "tom %q-lista"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: circuitpython-cn\n" "Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-12 14:37+1000\n" "POT-Creation-Date: 2020-05-18 13:32-0700\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n" "Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n" "Language-Team: Chinese Hanyu Pinyin\n"
@ -88,7 +88,7 @@ msgstr ""
msgid "%q must be >= 1" msgid "%q must be >= 1"
msgstr "%q bìxū dàyú huò děngyú 1" msgstr "%q bìxū dàyú huò děngyú 1"
#: shared-bindings/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
msgstr "" msgstr ""
@ -1276,6 +1276,10 @@ msgstr ""
msgid "Plus any modules on the filesystem\n" msgid "Plus any modules on the filesystem\n"
msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n" msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n"
#: shared-module/vectorio/Polygon.c
msgid "Polygon needs at least 3 points"
msgstr ""
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
msgid "Pop from an empty Ps2 buffer" msgid "Pop from an empty Ps2 buffer"
msgstr "Cóng kōng de Ps2 huǎnchōng qū dànchū" msgstr "Cóng kōng de Ps2 huǎnchōng qū dànchū"
@ -2150,10 +2154,6 @@ msgstr "bèi líng chú"
msgid "empty" msgid "empty"
msgstr "kòngxián" msgstr "kòngxián"
#: shared-bindings/vectorio/Polygon.c
msgid "empty %q list"
msgstr ""
#: extmod/moduheapq.c extmod/modutimeq.c #: extmod/moduheapq.c extmod/modutimeq.c
msgid "empty heap" msgid "empty heap"
msgstr "kōng yīn yīnxiào" msgstr "kōng yīn yīnxiào"
@ -3173,8 +3173,8 @@ msgstr "géshì wèi pǐpèi '{'"
msgid "unreadable attribute" msgid "unreadable attribute"
msgstr "bùkě dú shǔxìng" msgstr "bùkě dú shǔxìng"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/Polygon.c #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-bindings/vectorio/VectorShape.c #: shared-module/vectorio/Polygon.c
msgid "unsupported %q type" msgid "unsupported %q type"
msgstr "bù zhīchí %q lèixíng" msgstr "bù zhīchí %q lèixíng"

View File

@ -15,40 +15,6 @@
// #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) // #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
// Converts a list of points tuples to a flat list of ints for speedier internal use.
// Also validates the points.
static mp_obj_t _to_points_list(mp_obj_t points_tuple_list) {
size_t len = 0;
mp_obj_t *items;
mp_obj_list_get(points_tuple_list, &len, &items);
VECTORIO_POLYGON_DEBUG("polygon_points_list len: %d\n", len);
if ( len == 0 ) {
mp_raise_TypeError_varg(translate("empty %q list"), MP_QSTR_point);
}
mp_obj_t points_list = mp_obj_new_list(0, NULL);
for ( size_t i = 0; i < len; ++i) {
size_t tuple_len = 0;
mp_obj_t *tuple_items;
mp_obj_tuple_get(items[i], &tuple_len, &tuple_items);
if (tuple_len != 2) {
mp_raise_ValueError_varg(translate("%q must be a tuple of length 2"), MP_QSTR_point);
}
int value;
if (!mp_obj_get_int_maybe(tuple_items[0], &value)) {
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
}
mp_obj_list_append(points_list, MP_OBJ_NEW_SMALL_INT(value));
if (!mp_obj_get_int_maybe(tuple_items[1], &value)) {
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
}
mp_obj_list_append(points_list, MP_OBJ_NEW_SMALL_INT(value));
}
return points_list;
}
//| from typing import List, Tuple //| from typing import List, Tuple
//| //|
//| class Polygon: //| class Polygon:
@ -68,12 +34,11 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar
if (!MP_OBJ_IS_TYPE(args[ARG_points_list].u_obj, &mp_type_list)) { if (!MP_OBJ_IS_TYPE(args[ARG_points_list].u_obj, &mp_type_list)) {
mp_raise_TypeError_varg(translate("%q list must be a list"), MP_QSTR_point); mp_raise_TypeError_varg(translate("%q list must be a list"), MP_QSTR_point);
} }
mp_obj_t points_list = _to_points_list(args[ARG_points_list].u_obj);
vectorio_polygon_t *self = m_new_obj(vectorio_polygon_t); vectorio_polygon_t *self = m_new_obj(vectorio_polygon_t);
self->base.type = &vectorio_polygon_type; self->base.type = &vectorio_polygon_type;
common_hal_vectorio_polygon_construct(self, points_list); common_hal_vectorio_polygon_construct(self, args[ARG_points_list].u_obj);
return MP_OBJ_FROM_PTR(self); return MP_OBJ_FROM_PTR(self);
} }
@ -104,9 +69,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(vectorio_polygon_get_points_obj, vectorio_polygon_obj_
STATIC mp_obj_t vectorio_polygon_obj_set_points(mp_obj_t self_in, mp_obj_t points) { STATIC mp_obj_t vectorio_polygon_obj_set_points(mp_obj_t self_in, mp_obj_t points) {
vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in); vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t points_list = _to_points_list(points); common_hal_vectorio_polygon_set_points(self, points);
common_hal_vectorio_polygon_set_points(self, points_list);
return mp_const_none; return mp_const_none;
} }
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_polygon_set_points_obj, vectorio_polygon_obj_set_points); MP_DEFINE_CONST_FUN_OBJ_2(vectorio_polygon_set_points_obj, vectorio_polygon_obj_set_points);

View File

@ -4,6 +4,8 @@
#include "shared-module/displayio/area.h" #include "shared-module/displayio/area.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/gc.h"
#include "stdlib.h" #include "stdlib.h"
#include <stdio.h> #include <stdio.h>
@ -12,10 +14,53 @@
// #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) // #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
// Converts a list of points tuples to a flat list of ints for speedier internal use.
// Also validates the points.
static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple_list) {
size_t len = 0;
mp_obj_t *items;
mp_obj_list_get(points_tuple_list, &len, &items);
VECTORIO_POLYGON_DEBUG("polygon_points_list len: %d\n", len);
if ( len < 3 ) {
mp_raise_TypeError_varg(translate("Polygon needs at least 3 points"));
}
if ( self->len < 2*len ) {
if ( self->points_list != NULL ) {
gc_free( self->points_list );
}
self->points_list = gc_alloc( 2 * len * sizeof(int), false, false );
}
self->len = 2*len;
for ( size_t i = 0; i < len; ++i) {
size_t tuple_len = 0;
mp_obj_t *tuple_items;
mp_obj_tuple_get(items[i], &tuple_len, &tuple_items);
if (tuple_len != 2) {
mp_raise_ValueError_varg(translate("%q must be a tuple of length 2"), MP_QSTR_point);
}
if ( !mp_obj_get_int_maybe(tuple_items[ 0 ], &self->points_list[2*i ])
|| !mp_obj_get_int_maybe(tuple_items[ 1 ], &self->points_list[2*i + 1])
) {
self->len = 0;
gc_free( self->points_list );
self->points_list = NULL;
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
}
}
}
void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list) { void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t points_list) {
VECTORIO_POLYGON_DEBUG("%p polygon_construct\n", self); VECTORIO_POLYGON_DEBUG("%p polygon_construct\n", self);
self->points_list = points_list; self->points_list = NULL;
self->len = 0;
self->on_dirty.obj = NULL; self->on_dirty.obj = NULL;
_clobber_points_list( self, points_list );
} }
@ -23,7 +68,7 @@ mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self) {
return self->points_list; return self->points_list;
} }
void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t points_list) { void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t points_list) {
self->points_list = points_list; _clobber_points_list( self, points_list );
if (self->on_dirty.obj != NULL) { if (self->on_dirty.obj != NULL) {
self->on_dirty.event(self->on_dirty.obj); self->on_dirty.event(self->on_dirty.obj);
} }
@ -38,21 +83,16 @@ void common_hal_vectorio_polygon_set_on_dirty(vectorio_polygon_t *self, vectorio
void common_hal_vectorio_polygon_get_area(void *polygon, displayio_area_t *area) { void common_hal_vectorio_polygon_get_area(void *polygon, displayio_area_t *area) {
VECTORIO_POLYGON_DEBUG("%p polygon get_area", polygon);
vectorio_polygon_t *self = polygon; vectorio_polygon_t *self = polygon;
size_t len;
mp_obj_t *points;
mp_obj_list_get(self->points_list, &len, &points);
VECTORIO_POLYGON_DEBUG(" len: %2d, points: %d\n", len, len/2);
area->x1 = SHRT_MAX; area->x1 = SHRT_MAX;
area->y1 = SHRT_MAX; area->y1 = SHRT_MAX;
area->x2 = SHRT_MIN; area->x2 = SHRT_MIN;
area->y2 = SHRT_MIN; area->y2 = SHRT_MIN;
for (size_t i=0; i < len; ++i) { for (size_t i=0; i < self->len; ++i) {
mp_int_t x = mp_obj_get_int(points[i]); int x = self->points_list[i];
++i; ++i;
mp_int_t y = mp_obj_get_int(points[i]); int y = self->points_list[i];
if (x <= area->x1) area->x1 = x-1; if (x <= area->x1) area->x1 = x-1;
if (y <= area->y1) area->y1 = y-1; if (y <= area->y1) area->y1 = y-1;
if (x >= area->x2) area->x2 = x+1; if (x >= area->x2) area->x2 = x+1;
@ -73,22 +113,19 @@ __attribute__((always_inline)) static inline int line_side( mp_int_t x1, mp_int_
uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y) { uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y) {
VECTORIO_POLYGON_DEBUG("%p polygon get_pixel %d, %d\n", obj, x, y); VECTORIO_POLYGON_DEBUG("%p polygon get_pixel %d, %d\n", obj, x, y);
vectorio_polygon_t *self = obj; vectorio_polygon_t *self = obj;
size_t len;
mp_obj_t *points;
mp_obj_list_get(self->points_list, &len, &points);
if (len == 0) { if (self->len == 0) {
return 0; return 0;
} }
int winding_number = 0; int winding_number = 0;
mp_int_t x1 = mp_obj_get_int(points[0]); int x1 = self->points_list[0];
mp_int_t y1 = mp_obj_get_int(points[1]); int y1 = self->points_list[1];
for (size_t i=2; i <= len + 1; ++i) { for (size_t i=2; i <= self->len + 1; ++i) {
VECTORIO_POLYGON_DEBUG(" {(%3d, %3d),", x1, y1); VECTORIO_POLYGON_DEBUG(" {(%3d, %3d),", x1, y1);
mp_int_t x2 = mp_obj_get_int(points[i % len]); int x2 = self->points_list[i % self->len];
++i; ++i;
mp_int_t y2 = mp_obj_get_int(points[i % len]); int y2 = self->points_list[i % self->len];
VECTORIO_POLYGON_DEBUG(" (%3d, %3d)}\n", x2, y2); VECTORIO_POLYGON_DEBUG(" (%3d, %3d)}\n", x2, y2);
if ( y1 <= y ) { if ( y1 <= y ) {
if ( y2 > y && line_side(x1, y1, x2, y2, x, y) > 0 ) { if ( y2 > y && line_side(x1, y1, x2, y2, x, y) > 0 ) {

View File

@ -8,8 +8,9 @@
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;
// A micropython List[ x, y, ... ] // An int array[ x, y, ... ]
mp_obj_t points_list; int *points_list;
size_t len;
vectorio_event_t on_dirty; vectorio_event_t on_dirty;
} vectorio_polygon_t; } vectorio_polygon_t;