Lines Matching refs:gc

61 grid_store_cell(struct grid_cell_entry *gce, const struct grid_cell *gc,
64 gce->flags = (gc->flags & ~GRID_FLAG_CLEARED);
66 gce->data.fg = gc->fg & 0xff;
67 if (gc->fg & COLOUR_FLAG_256)
70 gce->data.bg = gc->bg & 0xff;
71 if (gc->bg & COLOUR_FLAG_256)
74 gce->data.attr = gc->attr;
81 const struct grid_cell *gc)
85 if (gc->attr > 0xff)
87 if (gc->data.size != 1 || gc->data.width != 1)
89 if ((gc->fg & COLOUR_FLAG_RGB) || (gc->bg & COLOUR_FLAG_RGB))
91 if (gc->us != 8) /* only supports 256 or RGB */
93 if (gc->link != 0)
115 const struct grid_cell *gc)
118 int flags = (gc->flags & ~GRID_FLAG_CLEARED);
127 utf8_from_data(&gc->data, &uc);
131 gee->attr = gc->attr;
133 gee->fg = gc->fg;
134 gee->bg = gc->bg;
135 gee->us = gc->us;
136 gee->link = gc->link;
502 grid_get_cell1(struct grid_line *gl, u_int px, struct grid_cell *gc)
509 memcpy(gc, &grid_default_cell, sizeof *gc);
512 gc->flags = gee->flags;
513 gc->attr = gee->attr;
514 gc->fg = gee->fg;
515 gc->bg = gee->bg;
516 gc->us = gee->us;
517 gc->link = gee->link;
518 utf8_to_data(gee->data, &gc->data);
523 gc->flags = gce->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
524 gc->attr = gce->data.attr;
525 gc->fg = gce->data.fg;
527 gc->fg |= COLOUR_FLAG_256;
528 gc->bg = gce->data.bg;
530 gc->bg |= COLOUR_FLAG_256;
531 gc->us = 8;
532 utf8_set(&gc->data, gce->data.data);
533 gc->link = 0;
538 grid_get_cell(struct grid *gd, u_int px, u_int py, struct grid_cell *gc)
542 memcpy(gc, &grid_default_cell, sizeof *gc);
544 grid_get_cell1(&gd->linedata[py], px, gc);
549 grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
564 if (grid_need_extended_cell(gce, gc))
565 grid_extended_cell(gl, gce, gc);
567 grid_store_cell(gce, gc, gc->data.data[0]);
579 grid_set_cells(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc,
598 if (grid_need_extended_cell(gce, gc)) {
599 gee = grid_extended_cell(gl, gce, gc);
602 grid_store_cell(gce, gc, s[i]);
742 grid_string_cells_fg(const struct grid_cell *gc, int *values)
748 if (gc->fg & COLOUR_FLAG_256) {
751 values[n++] = gc->fg & 0xff;
752 } else if (gc->fg & COLOUR_FLAG_RGB) {
755 colour_split_rgb(gc->fg, &r, &g, &b);
760 switch (gc->fg) {
769 values[n++] = gc->fg + 30;
782 values[n++] = gc->fg;
791 grid_string_cells_bg(const struct grid_cell *gc, int *values)
797 if (gc->bg & COLOUR_FLAG_256) {
800 values[n++] = gc->bg & 0xff;
801 } else if (gc->bg & COLOUR_FLAG_RGB) {
804 colour_split_rgb(gc->bg, &r, &g, &b);
809 switch (gc->bg) {
818 values[n++] = gc->bg + 40;
831 values[n++] = gc->bg + 10;
840 grid_string_cells_us(const struct grid_cell *gc, int *values)
846 if (gc->us & COLOUR_FLAG_256) {
849 values[n++] = gc->us & 0xff;
850 } else if (gc->us & COLOUR_FLAG_RGB) {
853 colour_split_rgb(gc->us, &r, &g, &b);
926 const struct grid_cell *gc, char *buf, size_t len, int flags,
931 u_int attr = gc->attr, lastattr = lastgc->attr;
959 (lastgc->us != 8 && gc->us == 8)) {
993 nnewc = grid_string_cells_fg(gc, newc);
999 nnewc = grid_string_cells_bg(gc, newc);
1005 nnewc = grid_string_cells_us(gc, newc);
1025 if (sc != NULL && sc->hyperlinks != NULL && lastgc->link != gc->link) {
1026 if (hyperlinks_get(sc->hyperlinks, gc->link, &uri, &id, NULL)) {
1042 struct grid_cell gc;
1068 grid_get_cell(gd, xx, py, &gc);
1069 if (gc.flags & GRID_FLAG_PADDING)
1073 grid_string_cells_code(*lastgc, &gc, code, sizeof code,
1076 memcpy(*lastgc, &gc, sizeof **lastgc);
1080 data = gc.data.data;
1081 size = gc.data.size;
1206 struct grid_cell gc;
1251 grid_get_cell1(&gd->linedata[line], 0, &gc);
1252 if (width + gc.data.width > sx)
1254 width += gc.data.width;
1255 grid_set_cell(target, at, to, &gc);
1261 grid_get_cell1(from, want, &gc);
1262 if (width + gc.data.width > sx)
1264 width += gc.data.width;
1266 grid_set_cell(target, at, to, &gc);
1314 struct grid_cell gc;
1326 grid_get_cell1(gl, i, &gc);
1327 if (width + gc.data.width > sx) {
1331 width += gc.data.width;
1343 grid_get_cell1(gl, i, &gc);
1344 if (width + gc.data.width > sx) {
1351 width += gc.data.width;
1352 grid_set_cell(target, xx, line, &gc);
1382 struct grid_cell gc;
1413 grid_get_cell1(gl, i, &gc);
1414 if (at == 0 && width + gc.data.width > sx)
1416 width += gc.data.width;
1520 struct grid_cell gc;
1527 grid_get_cell(gd, px - 1, py, &gc);
1528 if ((gc.flags & GRID_FLAG_PADDING) ||
1529 gc.data.size != 1 ||
1530 *gc.data.data != ' ')