mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 10:12:17 +02:00
Remove unused code
This commit is contained in:
@@ -16,16 +16,13 @@ from .fast_data_types import (
|
|||||||
glBlendFunc, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, glClear,
|
glBlendFunc, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, glClear,
|
||||||
GL_COLOR_BUFFER_BIT, glClearColor, glViewport, glUniform2ui, glUniform4f,
|
GL_COLOR_BUFFER_BIT, glClearColor, glViewport, glUniform2ui, glUniform4f,
|
||||||
glUniform1i, glUniform2f, glDrawArraysInstanced, GL_TRIANGLE_FAN,
|
glUniform1i, glUniform2f, glDrawArraysInstanced, GL_TRIANGLE_FAN,
|
||||||
glEnable, glDisable, GL_BLEND, glDrawArrays, ColorProfile, REVERSE,
|
glEnable, glDisable, GL_BLEND, glDrawArrays, ColorProfile,
|
||||||
CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||||
)
|
)
|
||||||
|
|
||||||
Size = namedtuple('Size', 'width height')
|
Size = namedtuple('Size', 'width height')
|
||||||
Cursor = namedtuple('Cursor', 'x y hidden shape color blink')
|
Cursor = namedtuple('Cursor', 'x y hidden shape color blink')
|
||||||
ScreenGeometry = namedtuple('ScreenGeometry', 'xstart ystart xnum ynum dx dy')
|
ScreenGeometry = namedtuple('ScreenGeometry', 'xstart ystart xnum ynum dx dy')
|
||||||
COL_MASK = 0xFFFFFFFF
|
|
||||||
COL_SHIFT = 32
|
|
||||||
REVERSE_MASK = 1 << REVERSE
|
|
||||||
|
|
||||||
# cell shader {{{
|
# cell shader {{{
|
||||||
|
|
||||||
@@ -112,7 +109,7 @@ void main() {
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
def calculate_vertices(cell_width, cell_height, screen_width, screen_height):
|
def calculate_screen_geometry(cell_width, cell_height, screen_width, screen_height):
|
||||||
xnum = screen_width // cell_width
|
xnum = screen_width // cell_width
|
||||||
ynum = screen_height // cell_height
|
ynum = screen_height // cell_height
|
||||||
dx, dy = 2 * cell_width / screen_width, 2 * cell_height / screen_height
|
dx, dy = 2 * cell_width / screen_width, 2 * cell_height / screen_height
|
||||||
@@ -139,8 +136,6 @@ class RenderData:
|
|||||||
if val is not None:
|
if val is not None:
|
||||||
setattr(self, k, val)
|
setattr(self, k, val)
|
||||||
|
|
||||||
empty_cell = (' ', 0)
|
|
||||||
|
|
||||||
|
|
||||||
def color_as_int(val):
|
def color_as_int(val):
|
||||||
return val[0] << 16 | val[1] << 8 | val[2]
|
return val[0] << 16 | val[1] << 8 | val[2]
|
||||||
@@ -198,7 +193,7 @@ class CharGrid:
|
|||||||
|
|
||||||
def do_layout(self, w, h):
|
def do_layout(self, w, h):
|
||||||
self.width, self.height = w, h
|
self.width, self.height = w, h
|
||||||
self.screen_geometry = sg = calculate_vertices(self.cell_width, self.cell_height, self.width, self.height)
|
self.screen_geometry = sg = calculate_screen_geometry(self.cell_width, self.cell_height, self.width, self.height)
|
||||||
self.screen.resize(sg.ynum, sg.xnum)
|
self.screen.resize(sg.ynum, sg.xnum)
|
||||||
self.sprite_map = (c_uint * (sg.ynum * sg.xnum * 9))()
|
self.sprite_map = (c_uint * (sg.ynum * sg.xnum * 9))()
|
||||||
self.update_cell_data(add_viewport_data=True)
|
self.update_cell_data(add_viewport_data=True)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import ctypes
|
|||||||
|
|
||||||
from kitty.shaders import ShaderProgram, GL_VERSION, Sprites
|
from kitty.shaders import ShaderProgram, GL_VERSION, Sprites
|
||||||
from kitty.fonts import set_font_family, cell_size
|
from kitty.fonts import set_font_family, cell_size
|
||||||
from kitty.char_grid import calculate_vertices, cell_shader
|
from kitty.char_grid import calculate_screen_geometry, cell_shader
|
||||||
from kitty.fast_data_types import (
|
from kitty.fast_data_types import (
|
||||||
glViewport, enable_automatic_opengl_error_checking, glClearColor,
|
glViewport, enable_automatic_opengl_error_checking, glClearColor,
|
||||||
glUniform2f, glUniform4f, glUniform2ui, glUniform1i, glewInit, glGetString,
|
glUniform2f, glUniform4f, glUniform2ui, glUniform1i, glewInit, glGetString,
|
||||||
@@ -54,7 +54,7 @@ class Renderer:
|
|||||||
cell_width, cell_height = cell_size()
|
cell_width, cell_height = cell_size()
|
||||||
self.sprites.do_layout(cell_width, cell_height)
|
self.sprites.do_layout(cell_width, cell_height)
|
||||||
self.sprites.ensure_state()
|
self.sprites.ensure_state()
|
||||||
self.screen_geometry = sg = calculate_vertices(cell_width, cell_height, self.w, self.h)
|
self.screen_geometry = sg = calculate_screen_geometry(cell_width, cell_height, self.w, self.h)
|
||||||
data = (ctypes.c_uint * (sg.xnum * sg.ynum * 9))()
|
data = (ctypes.c_uint * (sg.xnum * sg.ynum * 9))()
|
||||||
lb = LineBuf(sg.ynum, sg.xnum)
|
lb = LineBuf(sg.ynum, sg.xnum)
|
||||||
i = -1
|
i = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user