compare-render: Do less work for replay

We don't need to render the node, we have a reference image.
This commit is contained in:
Matthias Clasen 2024-08-24 20:11:32 -04:00
parent 90c65e3611
commit 5e6cf622e3

View File

@ -592,7 +592,6 @@ main (int argc, char **argv)
if (replay)
{
GskRenderNode *node2;
GdkTexture *rendered_texture2;
graphene_rect_t node_bounds, node2_bounds;
GtkSnapshot *snapshot = gtk_snapshot_new ();
@ -609,14 +608,13 @@ main (int argc, char **argv)
/* Check that the node didn't grow. */
success = success && graphene_rect_contains_rect (&node_bounds, &node2_bounds);
rendered_texture = gsk_renderer_render_texture (renderer, node, &node_bounds);
save_image (rendered_texture, node_file, "-replayed.ref.png");
rendered_texture2 = gsk_renderer_render_texture (renderer, node2, &node_bounds);
save_image (rendered_texture2, node_file, "-replayed.out.png");
reference_texture = gdk_texture_new_from_filename (png_file, &error);
rendered_texture = gsk_renderer_render_texture (renderer, node2, &node_bounds);
save_image (rendered_texture, node_file, "-replayed.out.png");
g_assert_nonnull (reference_texture);
g_assert_nonnull (rendered_texture);
g_assert_nonnull (rendered_texture2);
diff_texture = reftest_compare_textures (rendered_texture, rendered_texture2);
diff_texture = reftest_compare_textures (reference_texture, rendered_texture);
if (diff_texture)
{
@ -625,8 +623,8 @@ main (int argc, char **argv)
}
g_clear_object (&diff_texture);
g_clear_object (&reference_texture);
g_clear_object (&rendered_texture);
g_clear_object (&rendered_texture2);
gsk_render_node_unref (node2);
}