[vte] draw: Move struct _vte_draw_text_request into DrawingContext
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] draw: Move struct _vte_draw_text_request into DrawingContext
- Date: Mon, 1 Jun 2020 20:50:42 +0000 (UTC)
commit 405d3f78fde37dbcc93beb5ad8bf7454e9e2ad50
Author: Christian Persch <chpe src gnome org>
Date: Mon Jun 1 22:48:43 2020 +0200
draw: Move struct _vte_draw_text_request into DrawingContext
src/vte.cc | 12 +++++-------
src/vtedraw.cc | 6 +++---
src/vtedraw.hh | 33 +++++++++++++++++++--------------
src/vteinternal.hh | 4 ++--
4 files changed, 29 insertions(+), 26 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 27acc6ac..8850db03 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -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,
diff --git a/src/vtedraw.cc b/src/vtedraw.cc
index 277a217c..e2efc245 100644
--- a/src/vtedraw.cc
+++ b/src/vtedraw.cc
@@ -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,
diff --git a/src/vtedraw.hh b/src/vtedraw.hh
index e1228a0a..2b435b88 100644
--- a/src/vtedraw.hh
+++ b/src/vtedraw.hh
@@ -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,
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 2feb6460..c56edf06 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]