mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-09 23:54:20 +02:00
Another mypy 0.920 fix
This commit is contained in:
@@ -953,7 +953,7 @@ def set_font_data(
|
||||
Tuple[int, Union[bytearray, bytes, Array[c_ubyte]]]],
|
||||
prerender_func: Callable[
|
||||
[int, int, int, int, int, int, int, float, float, float, float],
|
||||
Tuple[Union[Array[c_ubyte], int], ...]],
|
||||
Tuple[Tuple[int, ...], Tuple[Array[c_ubyte], ...]]],
|
||||
descriptor_for_idx: Callable[[int], Tuple[FontObject, bool, bool]],
|
||||
bold: int, italic: int, bold_italic: int, num_symbol_fonts: int,
|
||||
symbol_maps: Tuple[Tuple[int, int, int], ...], font_sz_in_pts: float,
|
||||
|
||||
@@ -1345,12 +1345,13 @@ send_prerendered_sprites(FontGroup *fg) {
|
||||
if (error != 0) { sprite_map_set_error(error); PyErr_Print(); fatal("Failed"); }
|
||||
PyObject *args = PyObject_CallFunction(prerender_function, "IIIIIIIffdd", fg->cell_width, fg->cell_height, fg->baseline, fg->underline_position, fg->underline_thickness, fg->strikethrough_position, fg->strikethrough_thickness, OPT(cursor_beam_thickness), OPT(cursor_underline_thickness), fg->logical_dpi_x, fg->logical_dpi_y);
|
||||
if (args == NULL) { PyErr_Print(); fatal("Failed to pre-render cells"); }
|
||||
for (ssize_t i = 0; i < PyTuple_GET_SIZE(args) - 1; i++) {
|
||||
PyObject *cell_addresses = PyTuple_GET_ITEM(args, 0);
|
||||
for (ssize_t i = 0; i < PyTuple_GET_SIZE(cell_addresses); i++) {
|
||||
x = fg->sprite_tracker.x; y = fg->sprite_tracker.y; z = fg->sprite_tracker.z;
|
||||
if (y > 0) { fatal("Too many pre-rendered sprites for your GPU or the font size is too large"); }
|
||||
do_increment(fg, &error);
|
||||
if (error != 0) { sprite_map_set_error(error); PyErr_Print(); fatal("Failed"); }
|
||||
uint8_t *alpha_mask = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, i));
|
||||
uint8_t *alpha_mask = PyLong_AsVoidPtr(PyTuple_GET_ITEM(cell_addresses, i));
|
||||
ensure_canvas_can_fit(fg, 1); // clear canvas
|
||||
Region r = { .right = fg->cell_width, .bottom = fg->cell_height };
|
||||
render_alpha_mask(alpha_mask, fg->canvas.buf, &r, &r, fg->cell_width, fg->cell_width);
|
||||
|
||||
@@ -372,7 +372,7 @@ def prerender_function(
|
||||
cursor_underline_thickness: float,
|
||||
dpi_x: float,
|
||||
dpi_y: float
|
||||
) -> Tuple[Union[int, CBufType], ...]:
|
||||
) -> Tuple[Tuple[int, ...], Tuple[CBufType, ...]]:
|
||||
# Pre-render the special underline, strikethrough and missing and cursor cells
|
||||
f = partial(
|
||||
render_special, cell_width=cell_width, cell_height=cell_height, baseline=baseline,
|
||||
@@ -385,7 +385,7 @@ def prerender_function(
|
||||
cursor_underline_thickness=cursor_underline_thickness, cell_width=cell_width,
|
||||
cell_height=cell_height, dpi_x=dpi_x, dpi_y=dpi_y)
|
||||
cells = f(1), f(2), f(3), f(0, True), f(missing=True), c(1), c(2), c(3)
|
||||
return tuple(map(ctypes.addressof, cells)) + (cells,)
|
||||
return tuple(map(ctypes.addressof, cells)), cells
|
||||
|
||||
|
||||
def render_box_drawing(codepoint: int, cell_width: int, cell_height: int, dpi: float) -> Tuple[int, CBufType]:
|
||||
|
||||
Reference in New Issue
Block a user