ngl: Improve shortcuts for shadow nodes

For shadow nodes, we try pretty hard to avoid
rendering shadows, and and we have a shortcut
that just renders text offset, but we can try
harder to do nothing - if the text is offset
by zero, we don't need to draw it at all.
This commit is contained in:
Matthias Clasen 2021-09-16 08:04:09 -04:00 committed by Benjamin Otte
parent 62954a0338
commit 9e14de2534

View File

@ -3055,21 +3055,24 @@ gsk_ngl_render_job_visit_shadow_node (GskNglRenderJob *job,
graphene_rect_t bounds;
guint16 color[4];
if (shadow->radius == 0 &&
gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE)
{
gsk_ngl_render_job_offset (job, dx, dy);
gsk_ngl_render_job_visit_text_node (job, shadow_child, &shadow->color, TRUE);
gsk_ngl_render_job_offset (job, -dx, -dy);
continue;
}
if (RGBA_IS_CLEAR (&shadow->color))
continue;
if (node_is_invisible (shadow_child))
continue;
if (shadow->radius == 0 &&
gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE)
{
if (dx != 0 || dy != 0)
{
gsk_ngl_render_job_offset (job, dx, dy);
gsk_ngl_render_job_visit_text_node (job, shadow_child, &shadow->color, TRUE);
gsk_ngl_render_job_offset (job, -dx, -dy);
}
continue;
}
if (shadow->radius > 0)
{
float min_x;