Commit 405d3f78 authored by Christian Persch's avatar Christian Persch

draw: Move struct _vte_draw_text_request into DrawingContext

parent 012131e9
......@@ -8152,7 +8152,7 @@ Terminal::text_blink_timer_callback()
/* Draw a string of characters with similar attributes. */
void
Terminal::draw_cells(struct _vte_draw_text_request *items,
Terminal::draw_cells(vte::view::DrawingContext::TextRequest* items,
gssize n,
uint32_t fore,
uint32_t back,
......@@ -8578,7 +8578,7 @@ Terminal::translate_pango_cells(PangoAttrList *attrs,
* attribute string is indexed by byte in the UTF-8 representation of the string
* of characters. Because we draw a character at a time, this is slower. */
void
Terminal::draw_cells_with_attributes(struct _vte_draw_text_request *items,
Terminal::draw_cells_with_attributes(vte::view::DrawingContext::TextRequest* items,
gssize n,
PangoAttrList *attrs,
bool draw_default_bg,
......@@ -8644,7 +8644,6 @@ Terminal::draw_rows(VteScreen *screen_,
gint column_width,
gint row_height)
{
struct _vte_draw_text_request *items;
vte::grid::row_t row;
vte::grid::column_t i, j, lcol, vcol;
int y;
......@@ -8665,7 +8664,7 @@ Terminal::draw_rows(VteScreen *screen_,
/* Need to ensure the ringview is updated. */
ringview_update();
items = g_newa (struct _vte_draw_text_request, column_count);
auto items = g_newa(vte::view::DrawingContext::TextRequest, column_count);
/* Paint the background.
* Do it first for all the cells we're about to paint, before drawing the glyphs,
......@@ -8929,7 +8928,7 @@ Terminal::draw_rows(VteScreen *screen_,
void
Terminal::paint_cursor()
{
struct _vte_draw_text_request item;
vte::view::DrawingContext::TextRequest item;
vte::grid::row_t drow;
vte::grid::column_t lcol, vcol;
int width, height, cursor_width;
......@@ -9143,11 +9142,10 @@ Terminal::paint_im_preedit_string()
/* Draw the preedit string, boxed. */
if (len > 0) {
struct _vte_draw_text_request *items;
const char *preedit = m_im_preedit.c_str();
int preedit_cursor;
items = g_new0(struct _vte_draw_text_request, len);
auto items = g_new0(vte::view::DrawingContext::TextRequest, len);
for (i = columns = 0; i < len; i++) {
items[i].c = g_utf8_get_char(preedit);
items[i].columns = _vte_unichar_width(items[i].c,
......
......@@ -2074,7 +2074,7 @@ DrawingContext::draw_graphic(vteunistr c,
}
void
DrawingContext::draw_text_internal(struct _vte_draw_text_request *requests,
DrawingContext::draw_text_internal(TextRequest* requests,
gsize n_requests,
uint32_t attr,
vte::color::rgb const* color,
......@@ -2163,7 +2163,7 @@ DrawingContext::draw_text_internal(struct _vte_draw_text_request *requests,
}
void
DrawingContext::draw_text(struct _vte_draw_text_request *requests,
DrawingContext::draw_text(TextRequest* requests,
gsize n_requests,
uint32_t attr,
vte::color::rgb const* color,
......@@ -2208,7 +2208,7 @@ DrawingContext::has_char(vteunistr c,
}
bool
DrawingContext::draw_char(struct _vte_draw_text_request *request,
DrawingContext::draw_char(TextRequest* request,
uint32_t attr,
vte::color::rgb const* color,
double alpha,
......
......@@ -34,17 +34,6 @@
#define VTE_DRAW_BOLD 1
#define VTE_DRAW_ITALIC 2
/* A request to draw a particular character spanning a given number of columns
at the given location. Unlike most APIs, (x,y) specifies the top-left
corner of the cell into which the character will be drawn instead of the
left end of the baseline. */
struct _vte_draw_text_request {
vteunistr c;
gshort x, y, columns;
guint8 mirror : 1; /* Char has RTL resolved directionality, mirror if mirrorable. */
guint8 box_mirror : 1; /* Add box drawing chars to the set of mirrorable characters. */
};
namespace vte {
namespace view {
......@@ -52,6 +41,22 @@ class FontInfo;
class DrawingContext {
public:
/* A request to draw a particular character spanning a given number of columns
at the given location. Unlike most APIs, (x,y) specifies the top-left
corner of the cell into which the character will be drawn instead of the
left end of the baseline. */
struct TextRequest {
vteunistr c;
int16_t x, y, columns;
/* Char has RTL resolved directionality, mirror if mirrorable. */
uint8_t mirror : 1;
/* Add box drawing chars to the set of mirrorable characters. */
uint8_t box_mirror : 1;
};
DrawingContext() noexcept = default;
~DrawingContext();
......@@ -88,13 +93,13 @@ public:
int& right);
bool has_bold(guint style);
void draw_text(struct _vte_draw_text_request *requests,
void draw_text(TextRequest* requests,
gsize n_requests,
uint32_t attr,
vte::color::rgb const* color,
double alpha,
guint style);
bool draw_char(struct _vte_draw_text_request *request,
bool draw_char(TextRequest* request,
uint32_t attr,
vte::color::rgb const* color,
double alpha,
......@@ -139,7 +144,7 @@ private:
int font_width,
int columns,
int font_height);
void draw_text_internal(struct _vte_draw_text_request *requests,
void draw_text_internal(TextRequest* requests,
gsize n_requests,
uint32_t attr,
vte::color::rgb const* color,
......
......@@ -1138,7 +1138,7 @@ public:
void paint_cursor();
void paint_im_preedit_string();
void draw_cells(struct _vte_draw_text_request *items,
void draw_cells(vte::view::DrawingContext::TextRequest* items,
gssize n,
uint32_t fore,
uint32_t back,
......@@ -1159,7 +1159,7 @@ public:
void translate_pango_cells(PangoAttrList *attrs,
VteCell *cells,
gsize n_cells);
void draw_cells_with_attributes(struct _vte_draw_text_request *items,
void draw_cells_with_attributes(vte::view::DrawingContext::TextRequest* items,
gssize n,
PangoAttrList *attrs,
bool draw_default_bg,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment