mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 13:30:19 +00:00
Merge branch 'wip/otte/for-main' into 'main'
widget: Remove unused headers from gtkwidget.h See merge request GNOME/gtk!6319
This commit is contained in:
commit
de8fdd822c
@ -26,3 +26,13 @@ gsk_rect_intersects (const graphene_rect_t *r1,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_rect_to_float (const graphene_rect_t *rect,
|
||||
float values[4])
|
||||
{
|
||||
values[0] = rect->origin.x;
|
||||
values[1] = rect->origin.y;
|
||||
values[2] = rect->size.width;
|
||||
values[3] = rect->size.height;
|
||||
}
|
||||
|
||||
|
@ -2152,6 +2152,52 @@ clear_path (gpointer inout_path)
|
||||
g_clear_pointer ((GskPath **) inout_path, gsk_path_unref);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_dash (GtkCssParser *parser,
|
||||
Context *context,
|
||||
gpointer out_dash)
|
||||
{
|
||||
GArray *dash;
|
||||
double d;
|
||||
|
||||
/* because CSS does this, too */
|
||||
if (gtk_css_parser_try_ident (parser, "none"))
|
||||
{
|
||||
*((GArray **) out_dash) = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
dash = g_array_new (FALSE, FALSE, sizeof (float));
|
||||
while (gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_SIGNLESS_NUMBER) ||
|
||||
gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_SIGNLESS_INTEGER))
|
||||
{
|
||||
if (!gtk_css_parser_consume_number (parser, &d))
|
||||
{
|
||||
g_array_free (dash, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_array_append_vals (dash, (float[1]) { d }, 1);
|
||||
}
|
||||
|
||||
if (dash->len == 0)
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Empty dash array");
|
||||
g_array_free (dash, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*((GArray **) out_dash) = dash;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clear_dash (gpointer inout_array)
|
||||
{
|
||||
g_clear_pointer ((GArray **) inout_array, g_array_unref);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_enum (GtkCssParser *parser,
|
||||
GType type,
|
||||
@ -2248,6 +2294,8 @@ parse_stroke_node (GtkCssParser *parser,
|
||||
int line_cap = GSK_LINE_CAP_BUTT;
|
||||
int line_join = GSK_LINE_JOIN_MITER;
|
||||
double miter_limit = 4.0;
|
||||
GArray *dash = NULL;
|
||||
double dash_offset = 0.0;
|
||||
GskStroke *stroke;
|
||||
|
||||
const Declaration declarations[] = {
|
||||
@ -2256,7 +2304,9 @@ parse_stroke_node (GtkCssParser *parser,
|
||||
{ "line-width", parse_positive_double, NULL, &line_width },
|
||||
{ "line-cap", parse_line_cap, NULL, &line_cap },
|
||||
{ "line-join", parse_line_join, NULL, &line_join },
|
||||
{ "miter-limit", parse_positive_double, NULL, &miter_limit }
|
||||
{ "miter-limit", parse_positive_double, NULL, &miter_limit },
|
||||
{ "dash", parse_dash, clear_dash, &dash },
|
||||
{ "dash-offset", parse_double, NULL, &dash_offset}
|
||||
};
|
||||
GskRenderNode *result;
|
||||
|
||||
@ -2270,6 +2320,12 @@ parse_stroke_node (GtkCssParser *parser,
|
||||
gsk_stroke_set_line_cap (stroke, line_cap);
|
||||
gsk_stroke_set_line_join (stroke, line_join);
|
||||
gsk_stroke_set_miter_limit (stroke, miter_limit);
|
||||
if (dash)
|
||||
{
|
||||
gsk_stroke_set_dash (stroke, (float *) dash->data, dash->len);
|
||||
g_array_free (dash, TRUE);
|
||||
}
|
||||
gsk_stroke_set_dash_offset (stroke, dash_offset);
|
||||
|
||||
result = gsk_stroke_node_new (child, path, stroke);
|
||||
|
||||
@ -3280,6 +3336,34 @@ append_path_param (Printer *p,
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
append_dash_param (Printer *p,
|
||||
const char *param_name,
|
||||
const float *dash,
|
||||
gsize n_dash)
|
||||
{
|
||||
_indent (p);
|
||||
g_string_append (p->str, "dash: ");
|
||||
|
||||
if (n_dash == 0)
|
||||
{
|
||||
g_string_append (p->str, "none");
|
||||
}
|
||||
else
|
||||
{
|
||||
gsize i;
|
||||
|
||||
string_append_double (p->str, dash[0]);
|
||||
for (i = 1; i < n_dash; i++)
|
||||
{
|
||||
g_string_append_c (p->str, ' ');
|
||||
string_append_double (p->str, dash[i]);
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append (p->str, ";\n");
|
||||
}
|
||||
|
||||
static void
|
||||
render_node_print (Printer *p,
|
||||
GskRenderNode *node)
|
||||
@ -3468,6 +3552,8 @@ render_node_print (Printer *p,
|
||||
case GSK_STROKE_NODE:
|
||||
{
|
||||
const GskStroke *stroke;
|
||||
const float *dash;
|
||||
gsize n_dash;
|
||||
|
||||
start_node (p, "stroke", node_name);
|
||||
|
||||
@ -3479,6 +3565,10 @@ render_node_print (Printer *p,
|
||||
append_enum_param (p, "line-cap", GSK_TYPE_LINE_CAP, gsk_stroke_get_line_cap (stroke));
|
||||
append_enum_param (p, "line-join", GSK_TYPE_LINE_JOIN, gsk_stroke_get_line_join (stroke));
|
||||
append_float_param (p, "miter-limit", gsk_stroke_get_miter_limit (stroke), 4.0f);
|
||||
dash = gsk_stroke_get_dash (stroke, &n_dash);
|
||||
if (dash)
|
||||
append_dash_param (p, "dash", dash, n_dash);
|
||||
append_float_param (p, "dash-offset", gsk_stroke_get_dash_offset (stroke), 0.0f);
|
||||
|
||||
end_node (p);
|
||||
}
|
||||
|
@ -108,10 +108,6 @@ if have_vulkan
|
||||
endif
|
||||
|
||||
gsk_private_vulkan_shaders = []
|
||||
# This is an odd split because we use configure_file() below to workaround
|
||||
# a limitation in meson preventing using custom_target() with gnome.compile_resources()
|
||||
# and that requires file paths, but we also need to have dependencies during development
|
||||
# on constantly regenerated files.
|
||||
gsk_private_vulkan_compiled_shaders = []
|
||||
gsk_private_vulkan_compiled_shaders_deps = []
|
||||
gsk_private_vulkan_shader_headers = []
|
||||
@ -159,7 +155,7 @@ if get_variable('broadway_enabled')
|
||||
])
|
||||
endif
|
||||
|
||||
gsk_resources_xml = configure_file(output: 'gsk.resources.xml',
|
||||
gsk_resources_xml = custom_target(output: 'gsk.resources.xml',
|
||||
input: 'gen-gsk-gresources-xml.py',
|
||||
command: [
|
||||
find_program('gen-gsk-gresources-xml.py'),
|
||||
@ -195,7 +191,6 @@ gsk_deps = [
|
||||
pango_dep,
|
||||
cairo_dep,
|
||||
cairo_csi_dep,
|
||||
pixbuf_dep,
|
||||
libgdk_dep,
|
||||
]
|
||||
|
||||
|
@ -43,11 +43,11 @@ gsk_vulkan_blend_mode_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanBlendModeOp *self = (GskVulkanBlendModeOp *) op;
|
||||
GskVulkanBlendModeInstance *instance = (GskVulkanBlendModeInstance *) (data + ((GskVulkanShaderOp *) op)->vertex_offset);
|
||||
|
||||
gsk_vulkan_rect_to_float (&self->bounds, instance->rect);
|
||||
gsk_vulkan_rect_to_float (&self->top.rect, instance->top_rect);
|
||||
gsk_vulkan_rect_to_float (&self->bottom.rect, instance->bottom_rect);
|
||||
gsk_vulkan_rect_to_float (&self->top.tex_rect, instance->top_tex_rect);
|
||||
gsk_vulkan_rect_to_float (&self->bottom.tex_rect, instance->bottom_tex_rect);
|
||||
gsk_rect_to_float (&self->bounds, instance->rect);
|
||||
gsk_rect_to_float (&self->top.rect, instance->top_rect);
|
||||
gsk_rect_to_float (&self->bottom.rect, instance->bottom_rect);
|
||||
gsk_rect_to_float (&self->top.tex_rect, instance->top_tex_rect);
|
||||
gsk_rect_to_float (&self->bottom.tex_rect, instance->bottom_tex_rect);
|
||||
|
||||
instance->top_tex_id = self->top.image_descriptor;
|
||||
instance->bottom_tex_id = self->bottom.image_descriptor;
|
||||
|
@ -41,8 +41,8 @@ gsk_vulkan_blur_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanBlurOp *self = (GskVulkanBlurOp *) op;
|
||||
GskVulkanBlurInstance *instance = (GskVulkanBlurInstance *) (data + ((GskVulkanShaderOp *) op)->vertex_offset);
|
||||
|
||||
gsk_vulkan_rect_to_float (&self->rect, instance->rect);
|
||||
gsk_vulkan_rect_to_float (&self->tex_rect, instance->tex_rect);
|
||||
gsk_rect_to_float (&self->rect, instance->rect);
|
||||
gsk_rect_to_float (&self->tex_rect, instance->tex_rect);
|
||||
instance->tex_id = self->image_descriptor;
|
||||
instance->radius = self->radius;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ gsk_vulkan_cross_fade_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanCrossFadeOp *self = (GskVulkanCrossFadeOp *) op;
|
||||
GskVulkanCrossFadeInstance *instance = (GskVulkanCrossFadeInstance *) (data + ((GskVulkanShaderOp *) op)->vertex_offset);
|
||||
|
||||
gsk_vulkan_rect_to_float (&self->bounds, instance->rect);
|
||||
gsk_vulkan_rect_to_float (&self->start.rect, instance->start_rect);
|
||||
gsk_vulkan_rect_to_float (&self->end.rect, instance->end_rect);
|
||||
gsk_vulkan_rect_to_float (&self->start.tex_rect, instance->start_tex_rect);
|
||||
gsk_vulkan_rect_to_float (&self->end.tex_rect, instance->end_tex_rect);
|
||||
gsk_rect_to_float (&self->bounds, instance->rect);
|
||||
gsk_rect_to_float (&self->start.rect, instance->start_rect);
|
||||
gsk_rect_to_float (&self->end.rect, instance->end_rect);
|
||||
gsk_rect_to_float (&self->start.tex_rect, instance->start_tex_rect);
|
||||
gsk_rect_to_float (&self->end.tex_rect, instance->end_tex_rect);
|
||||
|
||||
instance->start_tex_id = self->start.image_descriptor;
|
||||
instance->end_tex_id = self->end.image_descriptor;
|
||||
|
@ -42,8 +42,8 @@ gsk_vulkan_glyph_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanGlyphOp *self = (GskVulkanGlyphOp *) op;
|
||||
GskVulkanGlyphInstance *instance = (GskVulkanGlyphInstance *) (data + ((GskVulkanShaderOp *) op)->vertex_offset);
|
||||
|
||||
gsk_vulkan_rect_to_float (&self->rect, instance->rect);
|
||||
gsk_vulkan_rect_to_float (&self->tex_rect, instance->tex_rect);
|
||||
gsk_rect_to_float (&self->rect, instance->rect);
|
||||
gsk_rect_to_float (&self->tex_rect, instance->tex_rect);
|
||||
instance->tex_id = self->image_descriptor;
|
||||
gsk_vulkan_rgba_to_float (&self->color, instance->color);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ gsk_vulkan_linear_gradient_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanLinearGradientOp *self = (GskVulkanLinearGradientOp *) op;
|
||||
GskVulkanLinearInstance *instance = (GskVulkanLinearInstance *) (data + ((GskVulkanShaderOp *) op)->vertex_offset);
|
||||
|
||||
gsk_vulkan_rect_to_float (&self->rect, instance->rect);
|
||||
gsk_rect_to_float (&self->rect, instance->rect);
|
||||
gsk_vulkan_point_to_float (&self->start, instance->start);
|
||||
gsk_vulkan_point_to_float (&self->end, instance->end);
|
||||
instance->repeating = self->repeating;
|
||||
|
@ -60,11 +60,11 @@ gsk_vulkan_mask_op_collect_vertex_data (GskVulkanOp *op,
|
||||
GskVulkanMaskOp *self = (GskVulkanMaskOp *) op;
|
||||
GskVulkanMaskInstance *instance = (GskVulkanMaskInstance *) (data + ((GskVulkanShaderOp *) op)->vertex_offset);
|
||||
|
||||
gsk_vulkan_rect_to_float (&self->source.rect, instance->source_rect);
|
||||
gsk_vulkan_rect_to_float (&self->source.tex_rect, instance->source_tex_rect);
|
||||
gsk_rect_to_float (&self->source.rect, instance->source_rect);
|
||||
gsk_rect_to_float (&self->source.tex_rect, instance->source_tex_rect);
|
||||
instance->source_id = self->source.image_descriptor;
|
||||
gsk_vulkan_rect_to_float (&self->mask.rect, instance->mask_rect);
|
||||
gsk_vulkan_rect_to_float (&self->mask.tex_rect, instance->mask_tex_rect);
|
||||
gsk_rect_to_float (&self->mask.rect, instance->mask_rect);
|
||||
gsk_rect_to_float (&self->mask.tex_rect, instance->mask_tex_rect);
|
||||
instance->mask_id = self->mask.image_descriptor;
|
||||
instance->mask_mode = self->mask_mode;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "gskdebugprivate.h"
|
||||
|
||||
#include "gskrectprivate.h"
|
||||
#include "gskroundedrectprivate.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
@ -37,16 +38,6 @@ gsk_vulkan_normalize_tex_coords (graphene_rect_t *tex_coords,
|
||||
rect->size.height / tex->size.height);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_vulkan_rect_to_float (const graphene_rect_t *rect,
|
||||
float values[4])
|
||||
{
|
||||
values[0] = rect->origin.x;
|
||||
values[1] = rect->origin.y;
|
||||
values[2] = rect->size.width;
|
||||
values[3] = rect->size.height;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_vulkan_rgba_to_float (const GdkRGBA *rgba,
|
||||
float values[4])
|
||||
|
@ -1,9 +1,11 @@
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D textures[50000];
|
||||
layout(set = 1, binding = 0) readonly buffer FloatBuffers {
|
||||
float floats[];
|
||||
} buffers[50000];
|
||||
|
||||
#define get_sampler(id) textures[id]
|
||||
#define get_buffer(id) buffers[id]
|
||||
#define get_float(id) get_buffer(0).floats[id]
|
||||
#define get_sampler(id) textures[nonuniformEXT (id)]
|
||||
#define get_buffer(id) buffers[nonuniformEXT (id)]
|
||||
#define get_float(id) get_buffer(0).floats[nonuniformEXT (id)]
|
||||
|
||||
|
@ -93,12 +93,12 @@ foreach shader: gsk_private_vulkan_shaders
|
||||
endforeach
|
||||
|
||||
foreach shader: gsk_private_vulkan_vertex_shaders
|
||||
shader_header = configure_file(output: '@0@.h'.format(shader),
|
||||
input: shader,
|
||||
command: [
|
||||
find_program('generate-header.py'),
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true)
|
||||
shader_header = custom_target(output: '@0@.h'.format(shader),
|
||||
input: shader,
|
||||
command: [
|
||||
find_program('generate-header.py'),
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true)
|
||||
gsk_private_vulkan_shader_headers += shader_header
|
||||
endforeach
|
||||
|
@ -29,6 +29,7 @@
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkborder.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gsk/gsk.h>
|
||||
#include <gtk/gtkaccelgroup.h>
|
||||
#include <gtk/gtkborder.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
#include <gtk/gtkshortcut.h>
|
||||
#include <gtk/gtkshortcutaction.h>
|
||||
#include <gtk/gtktypes.h>
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "gtkactionmuxerprivate.h"
|
||||
#include "gtkatcontextprivate.h"
|
||||
#include "gtkborder.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkeventcontrollerprivate.h"
|
||||
#include "gtklistlistmodelprivate.h"
|
||||
|
@ -309,6 +309,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
'missing-declarations',
|
||||
'missing-prototypes',
|
||||
'nonnull',
|
||||
'override-init',
|
||||
'pointer-to-int-cast',
|
||||
'redundant-decls',
|
||||
'return-type',
|
||||
|
Loading…
Reference in New Issue
Block a user