Add some const for functions taking ColorProfile

This commit is contained in:
Kovid Goyal 2023-12-25 12:21:30 +05:30
parent 182b0aac98
commit 6c2ef90033
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 6 additions and 6 deletions

View File

@ -177,7 +177,7 @@ patch_color_profiles(PyObject *module UNUSED, PyObject *args) {
}
DynamicColor
colorprofile_to_color(ColorProfile *self, DynamicColor entry, DynamicColor defval) {
colorprofile_to_color(const ColorProfile *self, DynamicColor entry, DynamicColor defval) {
switch(entry.type) {
case COLOR_NOT_SET:
return defval;

View File

@ -403,7 +403,7 @@ bool schedule_write_to_child(unsigned long id, unsigned int num, ...);
bool schedule_write_to_child_python(unsigned long id, const char *prefix, PyObject* tuple_of_str_or_bytes, const char *suffix);
bool set_iutf8(int, bool);
DynamicColor colorprofile_to_color(ColorProfile *self, DynamicColor entry, DynamicColor defval);
DynamicColor colorprofile_to_color(const ColorProfile *self, DynamicColor entry, DynamicColor defval);
color_type
colorprofile_to_color_with_fallback(ColorProfile *self, DynamicColor entry, DynamicColor defval, DynamicColor fallback, DynamicColor falback_defval);
void copy_color_table_to_buffer(ColorProfile *self, color_type *address, int offset, size_t stride);

View File

@ -614,7 +614,7 @@ left_shift(Line *self, PyObject *args) {
}
static color_type
resolve_color(ColorProfile *cp, color_type val, color_type defval) {
resolve_color(const ColorProfile *cp, color_type val, color_type defval) {
switch(val & 0xff) {
case 1:
return cp->color_table[(val >> 8) & 0xff];
@ -626,7 +626,7 @@ resolve_color(ColorProfile *cp, color_type val, color_type defval) {
}
bool
colors_for_cell(Line *self, ColorProfile *cp, index_type *x, color_type *fg, color_type *bg, bool *reversed) {
colors_for_cell(Line *self, const ColorProfile *cp, index_type *x, color_type *fg, color_type *bg, bool *reversed) {
if (*x >= self->xnum) return false;
if (*x > 0 && !self->gpu_cells[*x].attrs.width && self->gpu_cells[*x-1].attrs.width == 2) (*x)--;
*fg = resolve_color(cp, self->gpu_cells[*x].fg, *fg);

View File

@ -132,4 +132,4 @@ void historybuf_clear(HistoryBuf *self);
void mark_text_in_line(PyObject *marker, Line *line);
bool line_has_mark(Line *, uint16_t mark);
PyObject* as_text_generic(PyObject *args, void *container, get_line_func get_line, index_type lines, ANSIBuf *ansibuf, bool add_trailing_newline);
bool colors_for_cell(Line *self, ColorProfile *cp, index_type *x, color_type *fg, color_type *bg, bool *reversed);
bool colors_for_cell(Line *self, const ColorProfile *cp, index_type *x, color_type *fg, color_type *bg, bool *reversed);

View File

@ -275,7 +275,7 @@ create_graphics_vao(void) {
#define IS_SPECIAL_COLOR(name) (screen->color_profile->overridden.name.type == COLOR_IS_SPECIAL || (screen->color_profile->overridden.name.type == COLOR_NOT_SET && screen->color_profile->configured.name.type == COLOR_IS_SPECIAL))
static void
pick_cursor_color(Line *line, ColorProfile *color_profile, color_type cell_fg, color_type cell_bg, index_type cell_color_x, color_type *cursor_fg, color_type *cursor_bg, color_type default_fg, color_type default_bg) {
pick_cursor_color(Line *line, const ColorProfile *color_profile, color_type cell_fg, color_type cell_bg, index_type cell_color_x, color_type *cursor_fg, color_type *cursor_bg, color_type default_fg, color_type default_bg) {
ARGB32 fg, bg, dfg, dbg;
(void) line; (void) color_profile; (void) cell_color_x;
fg.rgb = cell_fg; bg.rgb = cell_bg;