Merge branch 'wip/otte/for-main' into 'main'

testsuite: Adapt color-matrix testcase

See merge request GNOME/gtk!6018
This commit is contained in:
Benjamin Otte
2023-06-05 04:07:27 +00:00
9 changed files with 47 additions and 18 deletions

View File

@@ -3956,27 +3956,29 @@ gsk_repeat_node_draw (GskRenderNode *node,
cairo_pattern_t *pattern;
cairo_surface_t *surface;
cairo_t *surface_cr;
double scale_x, scale_y, width, height;
cairo_matrix_t matrix;
cairo_get_matrix (cr, &matrix);
width = ceil (self->child_bounds.size.width * (ABS (matrix.xx) + ABS (matrix.yx)));
height = ceil (self->child_bounds.size.height * (ABS (matrix.xy) + ABS (matrix.yy)));
surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_COLOR_ALPHA,
ceilf (self->child_bounds.size.width),
ceilf (self->child_bounds.size.height));
width, height);
cairo_surface_get_device_scale (surface, &scale_x, &scale_y);
scale_x *= width / self->child_bounds.size.width;
scale_y *= height / self->child_bounds.size.height;
cairo_surface_set_device_scale (surface, scale_x, scale_y);
cairo_surface_set_device_offset (surface,
- self->child_bounds.origin.x * scale_x,
- self->child_bounds.origin.y * scale_y);
surface_cr = cairo_create (surface);
cairo_translate (surface_cr,
- self->child_bounds.origin.x,
- self->child_bounds.origin.y);
gsk_render_node_draw (self->child, surface_cr);
cairo_destroy (surface_cr);
pattern = cairo_pattern_create_for_surface (surface);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_pattern_set_matrix (pattern,
&(cairo_matrix_t) {
.xx = 1.0,
.yy = 1.0,
.x0 = - self->child_bounds.origin.x,
.y0 = - self->child_bounds.origin.y
});
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy (surface);

View File

@@ -77,6 +77,11 @@ gtk_string_sorter_get_key (GtkExpression *expression,
return NULL;
string = g_value_get_string (&value);
if (string == NULL)
{
g_value_unset (&value);
return NULL;
}
if (ignore_case)
s = g_utf8_casefold (string, -1);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -30,3 +30,22 @@ transform {
}
transform: translate(6, 20);
}
/* cover the rounded corners */
color {
color: red;
bounds: 6 20 25 25;
}
color {
color: red;
bounds: 617 20 25 25;
}
color {
color: red;
bounds: 6 131 25 25;
}
color {
color: red;
bounds: 617 131 25 25;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

View File

@@ -1,7 +1,7 @@
color-matrix {
child: color {
bounds: 0 0 50 50;
color: rgba(255, 0, 0, 0.5);
color: rgba(255, 0, 0, 0.4);
}
matrix: none;
offset: 0 0 0 0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 145 B

View File

@@ -28,7 +28,7 @@ compare_render_tests = [
'clip-in-rounded-clip1',
'clip-in-rounded-clip2',
'clip-in-rounded-clip3',
'clipped-repeat-3d-ngl',
'clipped-repeat',
'clipped_rounded_clip',
'clip-nested1',
'clip-translate-offscreen',

View File

@@ -34,14 +34,16 @@ diff_with_file (const char *file1,
gssize len,
GError **error)
{
const char *command[] = { "diff", "-u", file1, NULL, NULL };
char *diff, *tmpfile;
char *diff_cmd, *diff, *tmpfile;
int fd;
diff = NULL;
if (g_find_program_in_path ("diff"))
diff_cmd = g_find_program_in_path ("diff");
if (diff_cmd)
{
const char *command[] = { diff_cmd, "-u", file1, NULL, NULL };
if (len < 0)
len = strlen (text);
@@ -65,7 +67,7 @@ diff_with_file (const char *file1,
g_spawn_sync (NULL,
(char **) command,
NULL,
G_SPAWN_SEARCH_PATH,
0,
NULL, NULL,
&diff,
NULL, NULL,
@@ -74,6 +76,7 @@ diff_with_file (const char *file1,
done:
g_unlink (tmpfile);
g_free (tmpfile);
g_free (diff_cmd);
}
else
{