mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
nodeparser: Fix parsing of color-matrix node
Negative offsets in the color matrix were inverted because it used the rect parser.
This commit is contained in:
parent
e8eb96ae0c
commit
0410125f20
@ -68,6 +68,23 @@ parse_rect (GtkCssParser *parser,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_vec4 (GtkCssParser *parser,
|
||||
gpointer out_vec4)
|
||||
{
|
||||
double numbers[4];
|
||||
|
||||
if (!gtk_css_parser_consume_number (parser, &numbers[0]) ||
|
||||
!gtk_css_parser_consume_number (parser, &numbers[1]) ||
|
||||
!gtk_css_parser_consume_number (parser, &numbers[2]) ||
|
||||
!gtk_css_parser_consume_number (parser, &numbers[3]))
|
||||
return FALSE;
|
||||
|
||||
graphene_vec4_init (out_vec4, numbers[0], numbers[1], numbers[2], numbers[3]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_texture (GtkCssParser *parser,
|
||||
gpointer out_data)
|
||||
@ -1490,23 +1507,20 @@ parse_color_matrix_node (GtkCssParser *parser)
|
||||
GskRenderNode *child = NULL;
|
||||
graphene_matrix_t matrix;
|
||||
GskTransform *transform = NULL;
|
||||
graphene_rect_t offset_rect = GRAPHENE_RECT_INIT (0, 0, 0, 0);
|
||||
graphene_vec4_t offset;
|
||||
const Declaration declarations[] = {
|
||||
{ "matrix", parse_transform, clear_transform, &transform },
|
||||
{ "offset", parse_rect, NULL, &offset_rect },
|
||||
{ "offset", parse_vec4, NULL, &offset },
|
||||
{ "child", parse_node, clear_node, &child }
|
||||
};
|
||||
GskRenderNode *result;
|
||||
|
||||
graphene_vec4_init (&offset, 0, 0, 0, 0);
|
||||
|
||||
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
|
||||
if (child == NULL)
|
||||
child = create_default_render_node ();
|
||||
|
||||
graphene_vec4_init (&offset,
|
||||
offset_rect.origin.x, offset_rect.origin.y,
|
||||
offset_rect.size.width, offset_rect.size.height);
|
||||
|
||||
gsk_transform_to_matrix (transform, &matrix);
|
||||
|
||||
result = gsk_color_matrix_node_new (child, &matrix, &offset);
|
||||
|
10
testsuite/gsk/compare/color-matrix-parsing.node
Normal file
10
testsuite/gsk/compare/color-matrix-parsing.node
Normal file
@ -0,0 +1,10 @@
|
||||
color-matrix {
|
||||
matrix: matrix3d(255, 0, 0, 0,
|
||||
0, 255, 0, 0,
|
||||
0, 0, 255, 0,
|
||||
0, 0, 0, 1);
|
||||
offset: -127 -127 -127 0;
|
||||
child: color {
|
||||
color: #80007f;
|
||||
}
|
||||
}
|
BIN
testsuite/gsk/compare/color-matrix-parsing.png
Normal file
BIN
testsuite/gsk/compare/color-matrix-parsing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 144 B |
@ -36,6 +36,7 @@ compare_render_tests = [
|
||||
'clip-nested1',
|
||||
'color-blur0',
|
||||
'color-matrix-identity',
|
||||
'color-matrix-parsing',
|
||||
'cross-fade-in-opacity',
|
||||
'css-background',
|
||||
'empty-blend',
|
||||
|
Loading…
Reference in New Issue
Block a user