mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-25 02:17:03 +00:00
Speed up Screen.draw
This commit is contained in:
parent
c2d81d67c2
commit
43fb09dc39
1 changed files with 4 additions and 4 deletions
|
|
@ -3541,10 +3541,10 @@ static PyObject*
|
|||
draw(Screen *self, PyObject *src) {
|
||||
if (!PyUnicode_Check(src)) { PyErr_SetString(PyExc_TypeError, "A unicode string is required"); return NULL; }
|
||||
if (PyUnicode_READY(src) != 0) { return PyErr_NoMemory(); }
|
||||
int kind = PyUnicode_KIND(src);
|
||||
void *buf = PyUnicode_DATA(src);
|
||||
Py_ssize_t sz = PyUnicode_GET_LENGTH(src);
|
||||
for (Py_ssize_t i = 0; i < sz; i++) draw_codepoint(self, PyUnicode_READ(kind, buf, i), true);
|
||||
Py_UCS4 *buf = PyUnicode_AsUCS4Copy(src);
|
||||
if (!buf) return NULL;
|
||||
draw_text(self, buf, PyUnicode_GetLength(src));
|
||||
PyMem_Free(buf);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue