cogl/pango: Add argument to supply extra snippet
This will be applied to the pipeline used for drawing, and can be used to include color state transformation snippets. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
This commit is contained in:
parent
fe63242d60
commit
9a0fbbfa81
6 changed files with 49 additions and 34 deletions
|
@ -771,7 +771,8 @@ clutter_text_node_draw (ClutterPaintNode *node,
|
||||||
tnode->layout,
|
tnode->layout,
|
||||||
op->op.texrect[0],
|
op->op.texrect[0],
|
||||||
op->op.texrect[1],
|
op->op.texrect[1],
|
||||||
&tnode->color);
|
&tnode->color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (clipped)
|
if (clipped)
|
||||||
cogl_framebuffer_pop_clip (fb);
|
cogl_framebuffer_pop_clip (fb);
|
||||||
|
|
|
@ -1951,7 +1951,7 @@ paint_selection_rectangle (ClutterText *self,
|
||||||
color->blue / 255.0f,
|
color->blue / 255.0f,
|
||||||
paint_opacity / 255.0f * color->alpha / 255.0f);
|
paint_opacity / 255.0f * color->alpha / 255.0f);
|
||||||
|
|
||||||
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color, NULL);
|
||||||
|
|
||||||
cogl_framebuffer_pop_clip (fb);
|
cogl_framebuffer_pop_clip (fb);
|
||||||
g_object_unref (color_pipeline);
|
g_object_unref (color_pipeline);
|
||||||
|
@ -2758,7 +2758,7 @@ clutter_text_paint (ClutterActor *self,
|
||||||
priv->text_color.green / 255.0f,
|
priv->text_color.green / 255.0f,
|
||||||
priv->text_color.blue / 255.0f,
|
priv->text_color.blue / 255.0f,
|
||||||
real_opacity / 255.0f);
|
real_opacity / 255.0f);
|
||||||
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
|
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color, NULL);
|
||||||
|
|
||||||
selection_paint (text, fb);
|
selection_paint (text, fb);
|
||||||
|
|
||||||
|
|
|
@ -391,8 +391,9 @@ _cogl_framebuffer_draw_display_list_texture (CoglFramebuffer *fb,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pango_display_list_render (CoglFramebuffer *fb,
|
cogl_pango_display_list_render (CoglFramebuffer *fb,
|
||||||
CoglPangoDisplayList *dl,
|
CoglPangoDisplayList *dl,
|
||||||
|
CoglSnippet *extra_snippet,
|
||||||
const CoglColor *color)
|
const CoglColor *color)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -401,6 +402,7 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
|
||||||
{
|
{
|
||||||
CoglPangoDisplayListNode *node = l->data;
|
CoglPangoDisplayListNode *node = l->data;
|
||||||
CoglColor draw_color;
|
CoglColor draw_color;
|
||||||
|
g_autoptr (CoglPipeline) pipeline = NULL;
|
||||||
|
|
||||||
if (node->pipeline == NULL)
|
if (node->pipeline == NULL)
|
||||||
{
|
{
|
||||||
|
@ -414,6 +416,8 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pipeline = cogl_pipeline_copy (node->pipeline);
|
||||||
|
|
||||||
if (node->color_override)
|
if (node->color_override)
|
||||||
/* Use the override color but preserve the alpha from the
|
/* Use the override color but preserve the alpha from the
|
||||||
draw color */
|
draw color */
|
||||||
|
@ -427,17 +431,20 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
|
||||||
draw_color = *color;
|
draw_color = *color;
|
||||||
cogl_color_premultiply (&draw_color);
|
cogl_color_premultiply (&draw_color);
|
||||||
|
|
||||||
cogl_pipeline_set_color (node->pipeline, &draw_color);
|
cogl_pipeline_set_color (pipeline, &draw_color);
|
||||||
|
|
||||||
|
if (extra_snippet)
|
||||||
|
cogl_pipeline_add_snippet (pipeline, extra_snippet);
|
||||||
|
|
||||||
switch (node->type)
|
switch (node->type)
|
||||||
{
|
{
|
||||||
case COGL_PANGO_DISPLAY_LIST_TEXTURE:
|
case COGL_PANGO_DISPLAY_LIST_TEXTURE:
|
||||||
_cogl_framebuffer_draw_display_list_texture (fb, node->pipeline, node);
|
_cogl_framebuffer_draw_display_list_texture (fb, pipeline, node);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COGL_PANGO_DISPLAY_LIST_RECTANGLE:
|
case COGL_PANGO_DISPLAY_LIST_RECTANGLE:
|
||||||
cogl_framebuffer_draw_rectangle (fb,
|
cogl_framebuffer_draw_rectangle (fb,
|
||||||
node->pipeline,
|
pipeline,
|
||||||
node->d.rectangle.x_1,
|
node->d.rectangle.x_1,
|
||||||
node->d.rectangle.y_1,
|
node->d.rectangle.y_1,
|
||||||
node->d.rectangle.x_2,
|
node->d.rectangle.x_2,
|
||||||
|
@ -447,7 +454,7 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
|
||||||
case COGL_PANGO_DISPLAY_LIST_TRAPEZOID:
|
case COGL_PANGO_DISPLAY_LIST_TRAPEZOID:
|
||||||
cogl_primitive_draw (node->d.trapezoid.primitive,
|
cogl_primitive_draw (node->d.trapezoid.primitive,
|
||||||
fb,
|
fb,
|
||||||
node->pipeline);
|
pipeline);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,9 @@ _cogl_pango_display_list_add_trapezoid (CoglPangoDisplayList *dl,
|
||||||
float x_22);
|
float x_22);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pango_display_list_render (CoglFramebuffer *framebuffer,
|
cogl_pango_display_list_render (CoglFramebuffer *framebuffer,
|
||||||
CoglPangoDisplayList *dl,
|
CoglPangoDisplayList *dl,
|
||||||
|
CoglSnippet *extra_snippet,
|
||||||
const CoglColor *color);
|
const CoglColor *color);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -361,7 +361,8 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
|
||||||
PangoLayout *layout,
|
PangoLayout *layout,
|
||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
const CoglColor *color)
|
const CoglColor *color,
|
||||||
|
CoglSnippet *extra_snippet)
|
||||||
{
|
{
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
CoglPangoRenderer *priv;
|
CoglPangoRenderer *priv;
|
||||||
|
@ -423,8 +424,9 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
|
||||||
cogl_framebuffer_push_matrix (fb);
|
cogl_framebuffer_push_matrix (fb);
|
||||||
cogl_framebuffer_translate (fb, x, y, 0);
|
cogl_framebuffer_translate (fb, x, y, 0);
|
||||||
|
|
||||||
_cogl_pango_display_list_render (fb,
|
cogl_pango_display_list_render (fb,
|
||||||
qdata->display_list,
|
qdata->display_list,
|
||||||
|
extra_snippet,
|
||||||
color);
|
color);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (fb);
|
cogl_framebuffer_pop_matrix (fb);
|
||||||
|
@ -448,7 +450,8 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||||
PangoLayoutLine *line,
|
PangoLayoutLine *line,
|
||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
const CoglColor *color)
|
const CoglColor *color,
|
||||||
|
CoglSnippet *extra_snippet)
|
||||||
{
|
{
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
CoglPangoRenderer *priv;
|
CoglPangoRenderer *priv;
|
||||||
|
@ -472,8 +475,9 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||||
pango_renderer_draw_layout_line (PANGO_RENDERER (priv), line,
|
pango_renderer_draw_layout_line (PANGO_RENDERER (priv), line,
|
||||||
pango_x, pango_y);
|
pango_x, pango_y);
|
||||||
|
|
||||||
_cogl_pango_display_list_render (fb,
|
cogl_pango_display_list_render (fb,
|
||||||
priv->display_list,
|
priv->display_list,
|
||||||
|
extra_snippet,
|
||||||
color);
|
color);
|
||||||
|
|
||||||
_cogl_pango_display_list_free (priv->display_list);
|
_cogl_pango_display_list_free (priv->display_list);
|
||||||
|
|
|
@ -155,7 +155,8 @@ cogl_pango_show_layout (CoglFramebuffer *framebuffer,
|
||||||
PangoLayout *layout,
|
PangoLayout *layout,
|
||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
const CoglColor *color);
|
const CoglColor *color,
|
||||||
|
CoglSnippet *extra_snippet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pango_show_layout_line: (skip)
|
* cogl_pango_show_layout_line: (skip)
|
||||||
|
@ -173,7 +174,8 @@ cogl_pango_show_layout_line (CoglFramebuffer *framebuffer,
|
||||||
PangoLayoutLine *line,
|
PangoLayoutLine *line,
|
||||||
float x,
|
float x,
|
||||||
float y,
|
float y,
|
||||||
const CoglColor *color);
|
const CoglColor *color,
|
||||||
|
CoglSnippet *extra_snippet);
|
||||||
|
|
||||||
|
|
||||||
#define COGL_PANGO_TYPE_RENDERER (cogl_pango_renderer_get_type ())
|
#define COGL_PANGO_TYPE_RENDERER (cogl_pango_renderer_get_type ())
|
||||||
|
|
Loading…
Reference in a new issue