Remove unused code
This commit is contained in:
parent
f396fe59ca
commit
f9b52249d1
@ -25,19 +25,15 @@
|
|||||||
static bool send_to_gpu = true;
|
static bool send_to_gpu = true;
|
||||||
|
|
||||||
GraphicsManager*
|
GraphicsManager*
|
||||||
grman_realloc(GraphicsManager *old, index_type lines, index_type columns) {
|
grman_alloc() {
|
||||||
GraphicsManager *self = (GraphicsManager *)GraphicsManager_Type.tp_alloc(&GraphicsManager_Type, 0);
|
GraphicsManager *self = (GraphicsManager *)GraphicsManager_Type.tp_alloc(&GraphicsManager_Type, 0);
|
||||||
self->lines = lines; self->columns = columns;
|
self->images_capacity = 64;
|
||||||
if (old == NULL) {
|
self->images = calloc(self->images_capacity, sizeof(Image));
|
||||||
self->images_capacity = 64;
|
self->capacity = 64;
|
||||||
self->images = calloc(self->images_capacity, sizeof(Image));
|
self->render_data = calloc(self->capacity, sizeof(ImageRenderData));
|
||||||
if (self->images == NULL) {
|
if (self->images == NULL || self->render_data == NULL) {
|
||||||
Py_CLEAR(self); return NULL;
|
PyErr_NoMemory();
|
||||||
}
|
Py_CLEAR(self); return NULL;
|
||||||
} else {
|
|
||||||
self->images_capacity = old->images_capacity; self->images = old->images; self->image_count = old->image_count;
|
|
||||||
old->images = NULL;
|
|
||||||
Py_DECREF(old);
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -858,10 +854,8 @@ grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint
|
|||||||
|
|
||||||
// Boilerplate {{{
|
// Boilerplate {{{
|
||||||
static PyObject *
|
static PyObject *
|
||||||
new(PyTypeObject UNUSED *type, PyObject *args, PyObject UNUSED *kwds) {
|
new(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||||
unsigned int lines, columns;
|
PyObject *ans = (PyObject*)grman_alloc();
|
||||||
if (!PyArg_ParseTuple(args, "II", &lines, &columns)) return NULL;
|
|
||||||
PyObject *ans = (PyObject*)grman_realloc(NULL, lines, columns);
|
|
||||||
if (ans == NULL) PyErr_NoMemory();
|
if (ans == NULL) PyErr_NoMemory();
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,11 +64,10 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
|
|
||||||
index_type lines, columns;
|
|
||||||
size_t image_count, images_capacity, loading_image;
|
size_t image_count, images_capacity, loading_image;
|
||||||
GraphicsCommand last_init_graphics_command;
|
GraphicsCommand last_init_graphics_command;
|
||||||
Image *images;
|
Image *images;
|
||||||
size_t count, capacity, rp_capacity;
|
size_t count, capacity;
|
||||||
ImageRenderData *render_data;
|
ImageRenderData *render_data;
|
||||||
bool layers_dirty;
|
bool layers_dirty;
|
||||||
size_t num_of_negative_refs, num_of_positive_refs;
|
size_t num_of_negative_refs, num_of_positive_refs;
|
||||||
@ -84,7 +83,7 @@ typedef struct {
|
|||||||
bool has_margins;
|
bool has_margins;
|
||||||
} ScrollData;
|
} ScrollData;
|
||||||
|
|
||||||
GraphicsManager* grman_realloc(GraphicsManager *, index_type lines, index_type columns);
|
GraphicsManager* grman_alloc();
|
||||||
void grman_clear(GraphicsManager*);
|
void grman_clear(GraphicsManager*);
|
||||||
const char* grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty);
|
const char* grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty);
|
||||||
bool grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows);
|
bool grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows);
|
||||||
|
|||||||
@ -81,7 +81,7 @@ new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
|||||||
self->main_linebuf = alloc_linebuf(lines, columns); self->alt_linebuf = alloc_linebuf(lines, columns);
|
self->main_linebuf = alloc_linebuf(lines, columns); self->alt_linebuf = alloc_linebuf(lines, columns);
|
||||||
self->linebuf = self->main_linebuf;
|
self->linebuf = self->main_linebuf;
|
||||||
self->historybuf = alloc_historybuf(MAX(scrollback, lines), columns);
|
self->historybuf = alloc_historybuf(MAX(scrollback, lines), columns);
|
||||||
self->main_grman = grman_realloc(NULL, lines, columns); self->alt_grman = grman_realloc(NULL, lines, columns);
|
self->main_grman = grman_alloc(); self->alt_grman = grman_alloc();
|
||||||
self->grman = self->main_grman;
|
self->grman = self->main_grman;
|
||||||
self->main_tabstops = PyMem_Calloc(2 * self->columns, sizeof(bool));
|
self->main_tabstops = PyMem_Calloc(2 * self->columns, sizeof(bool));
|
||||||
if (self->cursor == NULL || self->main_linebuf == NULL || self->alt_linebuf == NULL || self->main_tabstops == NULL || self->historybuf == NULL || self->main_grman == NULL || self->alt_grman == NULL || self->color_profile == NULL) {
|
if (self->cursor == NULL || self->main_linebuf == NULL || self->alt_linebuf == NULL || self->main_tabstops == NULL || self->historybuf == NULL || self->main_grman == NULL || self->alt_grman == NULL || self->color_profile == NULL) {
|
||||||
@ -152,17 +152,10 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
|
|||||||
n = realloc_lb(self->alt_linebuf, lines, columns, &num_content_lines_before, &num_content_lines_after, NULL);
|
n = realloc_lb(self->alt_linebuf, lines, columns, &num_content_lines_before, &num_content_lines_after, NULL);
|
||||||
if (n == NULL) return false;
|
if (n == NULL) return false;
|
||||||
Py_CLEAR(self->alt_linebuf); self->alt_linebuf = n;
|
Py_CLEAR(self->alt_linebuf); self->alt_linebuf = n;
|
||||||
GraphicsManager *g = grman_realloc(self->main_grman, lines, columns);
|
|
||||||
if (g == NULL) return false;
|
|
||||||
self->main_grman = g;
|
|
||||||
|
|
||||||
// Resize alt linebuf
|
// Resize alt linebuf
|
||||||
g = grman_realloc(self->alt_grman, lines, columns);
|
|
||||||
if (g == NULL) return false;
|
|
||||||
self->alt_grman = g;
|
|
||||||
if (!is_main) num_content_lines = num_content_lines_after;
|
if (!is_main) num_content_lines = num_content_lines_after;
|
||||||
self->linebuf = is_main ? self->main_linebuf : self->alt_linebuf;
|
self->linebuf = is_main ? self->main_linebuf : self->alt_linebuf;
|
||||||
self->grman = is_main ? self->main_grman : self->alt_grman;
|
|
||||||
|
|
||||||
self->lines = lines; self->columns = columns;
|
self->lines = lines; self->columns = columns;
|
||||||
self->margin_top = 0; self->margin_bottom = self->lines - 1;
|
self->margin_top = 0; self->margin_bottom = self->lines - 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user