diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index cb7f21e89..1d5665f8c 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -264,7 +264,6 @@ SCROLL_LINE: int SCROLL_PAGE: int STRIKETHROUGH: int TINT_PROGRAM: int -SEVEN_SEGMENT_PROGRAM: int FC_MONO: int = 100 FC_DUAL: int FC_WEIGHT_REGULAR: int diff --git a/kitty/seven_segment_fragment.glsl b/kitty/seven_segment_fragment.glsl deleted file mode 100644 index 0b2d1f0f5..000000000 --- a/kitty/seven_segment_fragment.glsl +++ /dev/null @@ -1,39 +0,0 @@ -#version GLSL_VERSION -uniform vec4 area_bounds; -uniform vec4 digit_color; -uniform int digit; -layout(origin_upper_left) in vec4 gl_FragCoord; - -const float PI = 3.1415926535897932384626433832795; -const int s_map[] = int[10](182, 150, 78, 47, 104, 85, 16, 212, 15, 142); - -mat2 rotate2D(in float a) { - return mat2(cos(a), sin(a), -sin(a), cos(a)); -} - -float draw_number(int num, vec2 p) { - // return 1 if this position should be colored and 0 if not - int s = s_map[max(0, min(num, 9))]; - float scale = 0.3; - float n = fract(sin(dot(ceil(p * rotate2D(PI / 4.) / sqrt(2.) / scale + 0.5 + float(s)), vec2(3., 5.))) * 50.); - - p.y = abs(p.y); - p.y -= scale; - p = abs(p); - p = vec2(max(p.x, p.y), min(p.x, p.y)); - p.x -= scale; - p.x = abs(p.x); - float d = max(p.x + p.y - scale * 0.667, p.x); - return step(d, scale * 0.267) * step(n, 0.5); -} - -out vec4 color; - -void main() { - float left = area_bounds[0], top = area_bounds[1]; - vec2 resolution = vec2(area_bounds[2], area_bounds[3]); - vec2 shifted_frag_pos = vec2(gl_FragCoord.x - left, gl_FragCoord.y - top); - vec2 pos = (shifted_frag_pos * 2 - resolution) / min(resolution.x, resolution.y); - pos.y *= -1; - color = digit_color * draw_number(digit, pos); -} diff --git a/kitty/shaders.c b/kitty/shaders.c index e18f0565f..da4bc268c 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -10,7 +10,7 @@ #include "colors.h" #include -enum { CELL_PROGRAM, CELL_BG_PROGRAM, CELL_SPECIAL_PROGRAM, CELL_FG_PROGRAM, BORDERS_PROGRAM, GRAPHICS_PROGRAM, GRAPHICS_PREMULT_PROGRAM, GRAPHICS_ALPHA_MASK_PROGRAM, BLIT_PROGRAM, BGIMAGE_PROGRAM, TINT_PROGRAM, SEVEN_SEGMENT_PROGRAM, NUM_PROGRAMS }; +enum { CELL_PROGRAM, CELL_BG_PROGRAM, CELL_SPECIAL_PROGRAM, CELL_FG_PROGRAM, BORDERS_PROGRAM, GRAPHICS_PROGRAM, GRAPHICS_PREMULT_PROGRAM, GRAPHICS_ALPHA_MASK_PROGRAM, BLIT_PROGRAM, BGIMAGE_PROGRAM, TINT_PROGRAM, NUM_PROGRAMS }; enum { SPRITE_MAP_UNIT, GRAPHICS_UNIT, BLIT_UNIT, BGIMAGE_UNIT }; // Sprites {{{ @@ -173,10 +173,6 @@ typedef struct { GLint tint_color_location, edges_location; } TintProgramLayout; static TintProgramLayout tint_program_layout = {0}; -typedef struct { - GLint edges_location, area_bounds_location, digit_color_location, digit_location; -} SevenSegmentProgramLayout; -static SevenSegmentProgramLayout seven_segment_program_layout = {0}; static void init_cell_program(void) { @@ -203,10 +199,6 @@ init_cell_program(void) { bgimage_program_layout.premult_location = get_uniform_location(BGIMAGE_PROGRAM, "premult"); tint_program_layout.tint_color_location = get_uniform_location(TINT_PROGRAM, "tint_color"); tint_program_layout.edges_location = get_uniform_location(TINT_PROGRAM, "edges"); - seven_segment_program_layout.edges_location = get_uniform_location(SEVEN_SEGMENT_PROGRAM, "edges"); - seven_segment_program_layout.area_bounds_location = get_uniform_location(SEVEN_SEGMENT_PROGRAM, "area_bounds"); - seven_segment_program_layout.digit_color_location = get_uniform_location(SEVEN_SEGMENT_PROGRAM, "digit_color"); - seven_segment_program_layout.digit_location = get_uniform_location(SEVEN_SEGMENT_PROGRAM, "digit"); } #define CELL_BUFFERS enum { cell_data_buffer, selection_buffer, uniform_buffer }; @@ -1020,7 +1012,7 @@ static PyMethodDef module_methods[] = { bool init_shaders(PyObject *module) { #define C(x) if (PyModule_AddIntConstant(module, #x, x) != 0) { PyErr_NoMemory(); return false; } - C(CELL_PROGRAM); C(CELL_BG_PROGRAM); C(CELL_SPECIAL_PROGRAM); C(CELL_FG_PROGRAM); C(BORDERS_PROGRAM); C(GRAPHICS_PROGRAM); C(GRAPHICS_PREMULT_PROGRAM); C(GRAPHICS_ALPHA_MASK_PROGRAM); C(BLIT_PROGRAM); C(BGIMAGE_PROGRAM); C(TINT_PROGRAM); C(SEVEN_SEGMENT_PROGRAM); + C(CELL_PROGRAM); C(CELL_BG_PROGRAM); C(CELL_SPECIAL_PROGRAM); C(CELL_FG_PROGRAM); C(BORDERS_PROGRAM); C(GRAPHICS_PROGRAM); C(GRAPHICS_PREMULT_PROGRAM); C(GRAPHICS_ALPHA_MASK_PROGRAM); C(BLIT_PROGRAM); C(BGIMAGE_PROGRAM); C(TINT_PROGRAM); C(GLSL_VERSION); C(GL_VERSION); C(GL_VENDOR); diff --git a/kitty/window.py b/kitty/window.py index e5f7c292f..3bbd5d365 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -22,11 +22,11 @@ from .constants import appname, is_macos, wakeup from .fast_data_types import ( BGIMAGE_PROGRAM, BLIT_PROGRAM, CELL_BG_PROGRAM, CELL_FG_PROGRAM, CELL_PROGRAM, CELL_SPECIAL_PROGRAM, CURSOR_BEAM, CURSOR_BLOCK, - CURSOR_UNDERLINE, DCS, DECORATION, DIM, GLFW_MOD_CONTROL, Color, + CURSOR_UNDERLINE, DCS, DECORATION, DIM, GLFW_MOD_CONTROL, GRAPHICS_ALPHA_MASK_PROGRAM, GRAPHICS_PREMULT_PROGRAM, GRAPHICS_PROGRAM, MARK, MARK_MASK, NO_CURSOR_SHAPE, OSC, REVERSE, SCROLL_FULL, SCROLL_LINE, - SCROLL_PAGE, SEVEN_SEGMENT_PROGRAM, STRIKETHROUGH, TINT_PROGRAM, KeyEvent, - Screen, add_timer, add_window, cell_size_for_window, click_mouse_url, + SCROLL_PAGE, STRIKETHROUGH, TINT_PROGRAM, Color, KeyEvent, Screen, + add_timer, add_window, cell_size_for_window, click_mouse_url, compile_program, encode_key_for_tty, get_boss, get_clipboard_string, get_options, init_cell_program, mark_os_window_dirty, mouse_selection, move_cursor_to_mouse_if_in_prompt, pt_to_px, set_clipboard_string, @@ -254,8 +254,6 @@ class LoadShaderPrograms: compile_program(BGIMAGE_PROGRAM, v, f) v, f = load_shaders('tint') compile_program(TINT_PROGRAM, v, f) - v, f = load_shaders('seven_segment', vertex_name='tint') - compile_program(SEVEN_SEGMENT_PROGRAM, v, f) init_cell_program()