rendernode: Implement fast-path for solid fills

They happen so often that it's worth avoiding the clip + paint path
there.
This commit is contained in:
Benjamin Otte 2023-07-30 19:59:37 +02:00 committed by Matthias Clasen
parent 438d936f57
commit 4e7d578881

View File

@ -26,6 +26,7 @@
#include "gskdiffprivate.h"
#include "gl/gskglrenderer.h"
#include "gskpathprivate.h"
#include "gskrectprivate.h"
#include "gskrendererprivate.h"
#include "gskroundedrectprivate.h"
#include "gsktransformprivate.h"
@ -4412,9 +4413,17 @@ gsk_fill_node_draw (GskRenderNode *node,
break;
}
gsk_path_to_cairo (self->path, cr);
cairo_clip (cr);
gsk_render_node_draw (self->child, cr);
if (gsk_render_node_get_node_type (self->child) == GSK_COLOR_NODE &&
gsk_rect_contains_rect (&self->child->bounds, &node->bounds))
{
gdk_cairo_set_source_rgba (cr, gsk_color_node_get_color (self->child));
cairo_fill (cr);
}
else
{
cairo_clip (cr);
gsk_render_node_draw (self->child, cr);
}
cairo_restore (cr);
}