mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
compare-render: Create the reference texture at startup
This allows exiting early when it doesn't exist.
This commit is contained in:
parent
5b62f29b5e
commit
8ac6c08f00
@ -361,6 +361,15 @@ main (int argc, char **argv)
|
||||
if (!node)
|
||||
return 1;
|
||||
|
||||
/* Load the given reference png file */
|
||||
reference_texture = gdk_texture_new_from_filename (png_file, &error);
|
||||
if (reference_texture == NULL)
|
||||
{
|
||||
g_print ("Error loading reference surface: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (plain)
|
||||
{
|
||||
/* Render the .node file and download to cairo surface */
|
||||
@ -369,16 +378,6 @@ main (int argc, char **argv)
|
||||
|
||||
save_image (rendered_texture, node_file, ".out.png");
|
||||
|
||||
/* Load the given reference png file */
|
||||
reference_texture = gdk_texture_new_from_filename (png_file, &error);
|
||||
if (reference_texture == NULL)
|
||||
{
|
||||
g_print ("Error loading reference surface: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
save_image (rendered_texture, node_file, ".out.png");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Now compare the two */
|
||||
diff_texture = reftest_compare_textures (rendered_texture, reference_texture);
|
||||
if (diff_texture)
|
||||
@ -388,7 +387,6 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
g_clear_object (&diff_texture);
|
||||
g_clear_object (&reference_texture);
|
||||
g_clear_object (&rendered_texture);
|
||||
}
|
||||
|
||||
@ -731,6 +729,7 @@ skip_clip:
|
||||
gsk_render_node_unref (node2);
|
||||
}
|
||||
|
||||
g_object_unref (reference_texture);
|
||||
gsk_render_node_unref (node);
|
||||
gsk_renderer_unrealize (renderer);
|
||||
g_object_unref (renderer);
|
||||
|
Loading…
Reference in New Issue
Block a user