Compare commits

...

2 Commits

Author SHA1 Message Date
Timm Bäder
984a9c2c09 Parse render nodes from text files 2019-03-02 16:55:17 +01:00
Timm Bäder
0c406160e6 testsuite: Port gl tests to text-based format 2019-03-02 11:16:30 +01:00
48 changed files with 1564 additions and 46 deletions

View File

@@ -42,6 +42,7 @@
#include "gskdebugprivate.h"
#include "gskrendererprivate.h"
#include "gskrendernodeparserprivate.h"
#include <graphene-gobject.h>
@@ -328,19 +329,11 @@ gsk_render_node_diff (GskRenderNode *node1,
GBytes *
gsk_render_node_serialize (GskRenderNode *node)
{
GVariant *node_variant, *variant;
GBytes *result;
char *str;
node_variant = gsk_render_node_serialize_node (node);
variant = g_variant_new ("(suuv)",
GSK_RENDER_NODE_SERIALIZATION_ID,
(guint32) GSK_RENDER_NODE_SERIALIZATION_VERSION,
(guint32) gsk_render_node_get_node_type (node),
node_variant);
result = g_variant_get_data_as_bytes (variant);
g_variant_unref (variant);
str = gsk_render_node_serialize_to_string (node);
result = g_bytes_new_take (str, strlen (str));
return result;
}
@@ -397,36 +390,9 @@ GskRenderNode *
gsk_render_node_deserialize (GBytes *bytes,
GError **error)
{
char *id_string;
guint32 version, node_type;
GVariant *variant, *node_variant;
GskRenderNode *node = NULL;
variant = g_variant_new_from_bytes (G_VARIANT_TYPE ("(suuv)"), bytes, FALSE);
g_variant_get (variant, "(suuv)", &id_string, &version, &node_type, &node_variant);
if (!g_str_equal (id_string, GSK_RENDER_NODE_SERIALIZATION_ID))
{
g_set_error (error, GSK_SERIALIZATION_ERROR, GSK_SERIALIZATION_UNSUPPORTED_FORMAT,
"Data not in GskRenderNode serialization format.");
goto out;
}
if (version != GSK_RENDER_NODE_SERIALIZATION_VERSION)
{
g_set_error (error, GSK_SERIALIZATION_ERROR, GSK_SERIALIZATION_UNSUPPORTED_VERSION,
"Format version %u not supported.", version);
goto out;
}
node = gsk_render_node_deserialize_node (node_type, node_variant, error);
out:
g_free (id_string);
g_variant_unref (node_variant);
g_variant_unref (variant);
node = gsk_render_node_deserialize_from_string ((const char *)g_bytes_get_data (bytes, NULL));
return node;
}

1408
gsk/gskrendernodeparser.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
#ifndef __GSK_RENDER_NODE_PARSER_PRIVATE_H__
#define __GSK_RENDER_NODE_PARSER_PRIVATE_H__
#include "gskrendernode.h"
GskRenderNode * gsk_render_node_deserialize_from_string (const char *string);
char * gsk_render_node_serialize_to_string (GskRenderNode *root);
#endif

View File

@@ -33,6 +33,7 @@ gsk_private_sources = files([
'gskdebug.c',
'gskprivate.c',
'gskprofiler.c',
'gskrendernodeparser.c',
'gl/gskshaderbuilder.c',
'gl/gskglprofiler.c',
'gl/gskglrenderer.c',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

View File

@@ -0,0 +1,10 @@
clip {
clip = (60, 80, 60, 70)
rounded_clip {
clip = (20, 50, 100, 100) 50
color {
bounds = (20, 50, 100, 100)
color = (1, 0, 0, 1)
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,13 @@
cross_fade {
progress = 0.5
color {
bounds = (0, 0, 200, 200)
color = (1, 1, 1, 1)
}
linear_gradient {
bounds = (100, 100, 200, 200)
start = (200, 100)
end = (200, 300)
stops = (0, (1, 0, 0, 1)) (1, (0, 1, 0, 1))
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,9 @@
rounded_clip {
clip = (0, 0, 50, 100) 25
linear_gradient {
bounds = (0, 0, 50, 100)
start = (0, 0)
end = (0, 100)
stops = (0, (1, 0, 0, 1)) (1, (0, 0, 1, 1))
}
}

View File

@@ -0,0 +1,14 @@
container {
linear_gradient {
bounds = (0, 0, 50, 100)
start = (0, 0)
end = (0, 100)
stops = (0, (1, 0, 0, 1)) (1, (0, 0, 1, 1))
}
linear_gradient {
bounds = (50, 0, 50, 100)
start = (50, 0)
end = (100, 0)
stops = (0, (1, 0, 0, 1)) (1, (0, 0, 1, 1))
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

View File

@@ -0,0 +1,13 @@
clip {
clip = (50, 50, 50, 50)
opacity {
opacity = 0.4
rounded_clip {
clip = (50, 50, 100, 100) 50
color {
bounds = (50, 50, 100, 100)
color = (1, 0, 0, 1)
}
}
}
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 40, 40) (5.714286, 5.714286) (2.857143, 2.857143) (17.142859, 17.142859) (22.857143, 22.857143)
color = (0, 0, 0, 0.5)
dx = 20
dy = 20
spread = 1
blur_radius = 4
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 200, 200)
color = (0, 0, 0, 1)
dx = 0
dy = 0
spread = 0
blur_radius = 40
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 40, 40) (5.714286, 5.714286) (2.857143, 2.857143) (17.142859, 17.142859) (22.857143, 22.857143)
color = (0, 0, 0, 0.5)
dx = 0
dy = 0
spread = 1
blur_radius = 4
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 100, 100)
color = (0, 0, 0, 1)
dx = -100
dy = 100
spread = 10
blur_radius = 0
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 100, 100)
color = (0, 0, 0, 1)
dx = 10
dy = 0
spread = 10
blur_radius = 0
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 100, 100)
color = (0, 0, 0, 1)
dx = 0
dy = 10
spread = 10
blur_radius = 0
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 200, 200) 50 0 50 0
color = (0, 0, 0, 0.5)
dx = 10
dy = 10
spread = 30
blur_radius = 0
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 200, 200) 0 100 0 100
color = (0, 0, 0, 0.5)
dx = 10
dy = 10
spread = 30
blur_radius = 0
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 200, 200) 7 7 0 0
color = (0, 0, 0, 1)
dx = 0
dy = 0
spread = 1
blur_radius = 0
}

View File

@@ -0,0 +1,8 @@
outset_shadow {
outline = (100, 100, 100, 100)
color = (0, 0, 0, 1)
dx = 0
dy = 0
spread = 10
blur_radius = 0
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 613 B

View File

@@ -42,22 +42,16 @@ gl_tests = [
['outset shadow blurred simple', 'outset_shadow_blurred_simple'],
['outset shadow blurred small', 'outset_shadow_blurred_small'],
['outset shadow blurred offset', 'outset_shadow_blurred_offset'],
['outset shadow transformed', 'outset_shadow_translated'],
['Transform in Shadow', 'shadow_transform1'],
['Crossfade simple', 'cross_fade'],
['Crossfade transformed', 'cross_fade_transformed'],
['Clipped crossfade', 'clipped_cross_fade'],
['Clipped rounded clip', 'clipped_rounded_clip'],
['clipped rounded clip2', 'transformed_clipped_rounded_clip'],
['gradient simple', 'gradient_simple'],
['gradient transformed', 'gradient_transformed'],
['gradient clipped', 'gradient_clipped'],
['offscreen opacity', 'opacity_clip'],
]
foreach gl_test : gl_tests
test('GL ' + gl_test[0], compare_render,
args: [join_paths(meson.current_source_dir(), 'gl', gl_test[1] + '.node'),
args: [join_paths(meson.current_source_dir(), 'gl', gl_test[1] + '.txt'),
join_paths(meson.current_source_dir(), 'gl', gl_test[1] + '.gl.png')],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',