Compare commits

..

3 Commits

Author SHA1 Message Date
Matthias Clasen 34990b6dc2 gsk: Give up on text nodes with unuploadable glyphs
If we can't upload the glyphs, just give up and use fallback.
2024-01-11 14:54:34 -05:00
Matthias Clasen 8d74defbc1 gsk: Don't try to upload NULL images
It doesn't work. Just return NULL and let the caller handle it,
like we do in other cases where obtaining an image fails.
2024-01-11 06:26:23 -05:00
Matthias Clasen fe95da256b gpu: Plug a memory leak 2024-01-11 06:25:22 -05:00
164 changed files with 7456 additions and 18966 deletions
+1 -2
View File
@@ -19,7 +19,6 @@ flatpak build ${builddir} meson \
--buildtype=debugoptimized \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dvulkan=disabled \
-Dbuild-tests=false \
-Dbuild-testsuite=false \
-Dbuild-examples=false \
@@ -28,7 +27,7 @@ flatpak build ${builddir} meson \
-Ddemo-profile=devel \
_flatpak_build
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
flatpak build ${builddir} ninja -C _flatpak_build install
flatpak-builder \
--user --disable-rofiles-fuse \
+1 -1
View File
@@ -213,7 +213,7 @@ Closes #1234
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
- If your commit is addressing an issue, use the
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
to automatically close the issue when merging the commit with the upstream
repository:
-2
View File
@@ -185,7 +185,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -200,7 +199,6 @@
],
"build-options" : {
"env" : {
"GSK_RENDERER" : "opengl"
}
}
}
@@ -114,7 +114,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -114,7 +114,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -130,8 +129,6 @@
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}
@@ -114,7 +114,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -130,8 +129,6 @@
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
#include "demos.h"
#include "fontify.h"
#include "profile_conf.h"
#include "demo_conf.h"
static GtkWidget *info_view;
static GtkWidget *source_view;
+1 -1
View File
@@ -236,7 +236,7 @@ foreach flag: common_cflags
endif
endforeach
gtkdemo_deps += [ profile_conf_h ]
gtkdemo_deps += [ demo_conf_h ]
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
+1 -1
View File
@@ -4,7 +4,7 @@
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "profile_conf.h"
#include "demo_conf.h"
struct _IconBrowserApp
{
+1 -1
View File
@@ -14,7 +14,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
executable('gtk4-icon-browser',
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
+13
View File
@@ -1,3 +1,16 @@
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
demo_profile = get_option('demo-profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
command: [gen_demo_header, meson.project_source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,
build_always_stale: true,
)
)
# appdata
appdata_config = configuration_data()
+1 -1
View File
@@ -12,7 +12,7 @@ node_editor_resources = gnome.compile_resources('node_editor_resources',
executable('gtk4-node-editor',
sources: [node_editor_sources, node_editor_resources],
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
c_args: common_cflags,
win_subsystem: 'windows',
+45 -59
View File
@@ -19,13 +19,15 @@
#include "config.h"
#include <glib/gstdio.h>
#ifdef HAVE_PANGOFT
#include <pango/pangofc-fontmap.h>
#endif
#include "node-editor-application.h"
#include "node-editor-window.h"
#include "profile_conf.h"
#include "demo_conf.h"
static const char *css =
"textview.editor {"
@@ -47,11 +49,47 @@ struct _NodeEditorApplicationClass
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
G_DEFINE_TYPE (NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
static void
maybe_add_test_fonts (void)
{
#ifdef HAVE_PANGOFT
const char *subdir = "testsuite/gsk/fonts";
const char *source_dir;
char *dir;
source_dir = g_getenv ("GTK_SOURCE_DIR");
if (source_dir)
{
char *abs_source_dir = g_canonicalize_filename (source_dir, NULL);
dir = g_canonicalize_filename (subdir, abs_source_dir);
g_free (abs_source_dir);
}
else
{
char *current_dir = g_get_current_dir ();
dir = g_canonicalize_filename (subdir, current_dir);
g_free (current_dir);
}
if (g_file_test (dir, G_FILE_TEST_EXISTS))
{
FcConfig *config;
config = FcConfigGetCurrent ();
FcConfigAppFontAddDir (config, (const FcChar8 *) dir);
}
g_free (dir);
#endif
}
static void
node_editor_application_init (NodeEditorApplication *app)
{
maybe_add_test_fonts ();
}
static void
@@ -249,63 +287,11 @@ node_editor_application_class_init (NodeEditorApplicationClass *class)
application_class->open = node_editor_application_open;
}
static void
print_version (void)
{
g_print ("gtk4-node-editor %s%s%s\n",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "");
}
static int
local_options (GApplication *app,
GVariantDict *options,
gpointer data)
{
gboolean version = FALSE;
gboolean reset = FALSE;
g_variant_dict_lookup (options, "version", "b", &version);
if (version)
{
print_version ();
return 0;
}
g_variant_dict_lookup (options, "reset", "b", &reset);
if (reset)
{
char *path;
path = get_autosave_path ("-unsafe");
g_remove (path);
g_free (path);
path = get_autosave_path (NULL);
g_remove (path);
g_free (path);
}
return -1;
}
NodeEditorApplication *
node_editor_application_new (void)
{
NodeEditorApplication *app;
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
"application-id", "org.gtk.gtk4.NodeEditor",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
g_application_add_main_option (G_APPLICATION (app), "reset", 0, 0,G_OPTION_ARG_NONE, "Remove autosave content", NULL);
g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL);
return app;
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
"application-id", "org.gtk.gtk4.NodeEditor",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
}
+89 -292
View File
@@ -28,8 +28,6 @@
#include "gsk/broadway/gskbroadwayrenderer.h"
#endif
#include <glib/gstdio.h>
#include <cairo.h>
#ifdef CAIRO_HAS_SVG_SURFACE
#include <cairo-svg.h>
@@ -57,7 +55,6 @@ struct _NodeEditorWindow
GtkWidget *testcase_name_entry;
GtkWidget *testcase_save_button;
GtkWidget *scale_scale;
GtkWidget *crash_warning;
GtkWidget *renderer_listbox;
GListStore *renderers;
@@ -67,9 +64,6 @@ struct _NodeEditorWindow
GFileMonitor *file_monitor;
GArray *errors;
guint update_timeout;
gboolean auto_reload;
};
struct _NodeEditorWindowClass
@@ -77,13 +71,6 @@ struct _NodeEditorWindowClass
GtkApplicationWindowClass parent_class;
};
enum {
PROP_AUTO_RELOAD = 1,
NUM_PROPERTIES
};
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
static void
@@ -176,84 +163,19 @@ text_iter_skip_whitespace_backward (GtkTextIter *iter)
}
static void
highlight_text (NodeEditorWindow *self)
{
GtkTextIter iter;
GtkTextIter start, end;
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
while (!gtk_text_iter_is_end (&iter))
{
gunichar c = gtk_text_iter_get_char (&iter);
if (c == '{')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename", &word_start, &word_end);
}
else if (c == ':')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname", &word_start, &word_end);
}
else if (c == '"')
{
GtkTextIter string_start = iter;
GtkTextIter string_end = iter;
gtk_text_iter_forward_char (&iter);
while (!gtk_text_iter_is_end (&iter))
{
c = gtk_text_iter_get_char (&iter);
if (c == '"')
{
gtk_text_iter_forward_char (&iter);
string_end = iter;
break;
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string", &string_start, &string_end);
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens", &start, &end);
}
static void
reload (NodeEditorWindow *self)
text_changed (GtkTextBuffer *buffer,
NodeEditorWindow *self)
{
char *text;
GBytes *bytes;
GtkTextIter iter;
GtkTextIter start, end;
float scale;
GskRenderNode *big_node;
g_array_remove_range (self->errors, 0, self->errors->len);
text = get_current_text (self->text_buffer);
text_buffer_remove_all_tags (self->text_buffer);
bytes = g_bytes_new_take (text, strlen (text));
g_clear_pointer (&self->node, gsk_render_node_unref);
@@ -314,19 +236,73 @@ reload (NodeEditorWindow *self)
}
g_clear_pointer (&big_node, gsk_render_node_unref);
}
static void
text_changed (GtkTextBuffer *buffer,
NodeEditorWindow *self)
{
g_array_remove_range (self->errors, 0, self->errors->len);
text_buffer_remove_all_tags (self->text_buffer);
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
if (self->auto_reload)
reload (self);
while (!gtk_text_iter_is_end (&iter))
{
gunichar c = gtk_text_iter_get_char (&iter);
highlight_text (self);
if (c == '{')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename",
&word_start, &word_end);
}
else if (c == ':')
{
GtkTextIter word_end = iter;
GtkTextIter word_start;
gtk_text_iter_backward_char (&word_end);
text_iter_skip_whitespace_backward (&word_end);
word_start = word_end;
gtk_text_iter_backward_word_start (&word_start);
text_iter_skip_alpha_backward (&word_start);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname",
&word_start, &word_end);
}
else if (c == '"')
{
GtkTextIter string_start = iter;
GtkTextIter string_end = iter;
gtk_text_iter_forward_char (&iter);
while (!gtk_text_iter_is_end (&iter))
{
c = gtk_text_iter_get_char (&iter);
if (c == '"')
{
gtk_text_iter_forward_char (&iter);
string_end = iter;
break;
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string",
&string_start, &string_end);
}
gtk_text_iter_forward_char (&iter);
}
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens",
&start, &end);
}
static void
@@ -1125,9 +1101,6 @@ node_editor_window_finalize (GObject *object)
{
NodeEditorWindow *self = (NodeEditorWindow *)object;
if (self->update_timeout)
g_source_remove (self->update_timeout);
g_array_free (self->errors, TRUE);
g_clear_pointer (&self->node, gsk_render_node_unref);
@@ -1567,62 +1540,6 @@ edit_action_cb (GtkWidget *widget,
node_editor_window_edit (self, &start);
}
static void
node_editor_window_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
switch (prop_id)
{
case PROP_AUTO_RELOAD:
{
gboolean auto_reload = g_value_get_boolean (value);
if (self->auto_reload != auto_reload)
{
self->auto_reload = auto_reload;
if (self->auto_reload)
reload (self);
}
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
node_editor_window_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (object);
switch (prop_id)
{
case PROP_AUTO_RELOAD:
g_value_set_boolean (value, self->auto_reload);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
close_crash_warning (GtkButton *button,
NodeEditorWindow *self)
{
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), FALSE);
}
static void
node_editor_window_class_init (NodeEditorWindowClass *class)
{
@@ -1634,8 +1551,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
object_class->dispose = node_editor_window_dispose;
object_class->finalize = node_editor_window_finalize;
object_class->set_property = node_editor_window_set_property;
object_class->get_property = node_editor_window_get_property;
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
@@ -1643,12 +1558,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
widget_class->realize = node_editor_window_realize;
widget_class->unrealize = node_editor_window_unrealize;
properties[PROP_AUTO_RELOAD] = g_param_spec_boolean ("auto-reload", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
@@ -1658,7 +1567,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, crash_warning);
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
gtk_widget_class_bind_template_callback (widget_class, open_cb);
@@ -1671,7 +1579,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
gtk_widget_class_bind_template_callback (widget_class, close_crash_warning);
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
@@ -1723,133 +1630,11 @@ static GActionEntry win_entries[] = {
{ "open", window_open, NULL, NULL, NULL },
};
char *
get_autosave_path (const char *suffix)
{
char *path;
char *name;
name = g_strconcat ("autosave", suffix, NULL);
path = g_build_filename (g_get_user_cache_dir (), "gtk4-node-editor", name, NULL);
g_free (name);
return path;
}
static void
set_initial_text (NodeEditorWindow *self)
{
char *path, *path1;
char *initial_text;
gsize len;
path = get_autosave_path (NULL);
path1 = get_autosave_path ("-unsafe");
if (g_file_get_contents (path, &initial_text, &len, NULL))
{
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
else if (g_file_get_contents (path1, &initial_text, &len, NULL))
{
self->auto_reload = FALSE;
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), TRUE);
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
else
{
/* Default */
gtk_text_buffer_set_text (self->text_buffer,
"shadow {\n"
" child: texture {\n"
" bounds: 0 0 128 128;\n"
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
" }\n"
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
"}\n"
"\n"
"transform {\n"
" child: text {\n"
" color: rgb(46,52,54);\n"
" font: \"Cantarell Bold 11\";\n"
" glyphs: \"GTK Node Editor\";\n"
" offset: 8 14.418;\n"
" }\n"
" transform: translate(0, 140);\n"
"}", -1);
}
g_free (path);
g_free (path1);
}
static void
autosave_contents (NodeEditorWindow *self)
{
char *path = NULL;
char *dir = NULL;
char *contents;
GtkTextIter start, end;
gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
contents = gtk_text_buffer_get_text (self->text_buffer, &start, &end, TRUE);
path = get_autosave_path ("-unsafe");
dir = g_path_get_dirname (path);
g_mkdir_with_parents (dir, 0755);
g_file_set_contents (path, contents, -1, NULL);
g_free (dir);
g_free (path);
g_free (contents);
}
static void
mark_autosave_as_safe (void)
{
char *path1 = NULL;
char *path2 = NULL;
path1 = get_autosave_path ("-unsafe");
path2 = get_autosave_path (NULL);
g_rename (path1, path2);
}
static gboolean
update_timeout_cb (gpointer data)
{
NodeEditorWindow *self = data;
self->update_timeout = 0;
mark_autosave_as_safe ();
return G_SOURCE_REMOVE;
}
static void
initiate_autosave (NodeEditorWindow *self)
{
autosave_contents (self);
if (self->update_timeout != 0)
g_source_remove (self->update_timeout);
self->update_timeout = g_timeout_add (100, update_timeout_cb, self);
}
static void
node_editor_window_init (NodeEditorWindow *self)
{
GAction *action;
gtk_widget_init_template (GTK_WIDGET (self));
self->auto_reload = TRUE;
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
G_LIST_MODEL (self->renderers),
@@ -1862,10 +1647,6 @@ node_editor_window_init (NodeEditorWindow *self)
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
action = G_ACTION (g_property_action_new ("auto-reload", self, "auto-reload"));
g_action_map_add_action (G_ACTION_MAP (self), action);
g_object_unref (action);
self->tag_table = gtk_text_tag_table_new ();
gtk_text_tag_table_add (self->tag_table,
g_object_new (GTK_TYPE_TEXT_TAG,
@@ -1903,9 +1684,25 @@ node_editor_window_init (NodeEditorWindow *self)
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
set_initial_text (self);
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (initiate_autosave), self);
/* Default */
gtk_text_buffer_set_text (self->text_buffer,
"shadow {\n"
" child: texture {\n"
" bounds: 0 0 128 128;\n"
" texture: url(\"resource:///org/gtk/gtk4/node-editor/icons/apps/org.gtk.gtk4.NodeEditor.svg\");\n"
" }\n"
" shadows: rgba(0,0,0,0.5) 0 1 12;\n"
"}\n"
"\n"
"transform {\n"
" child: text {\n"
" color: rgb(46,52,54);\n"
" font: \"Cantarell Bold 11\";\n"
" glyphs: \"GTK Node Editor\";\n"
" offset: 8 14.418;\n"
" }\n"
" transform: translate(0, 140);\n"
"}", -1);
if (g_getenv ("GSK_RENDERER"))
{
-2
View File
@@ -37,5 +37,3 @@ NodeEditorWindow * node_editor_window_new (NodeEditorApplication
gboolean node_editor_window_load (NodeEditorWindow *self,
GFile *file);
char * get_autosave_path (const char *suffix);
+63 -111
View File
@@ -2,14 +2,6 @@
<interface>
<menu id="gear_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Reload automatically</attribute>
<attribute name="action">win.auto-reload</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
@@ -32,6 +24,7 @@
</item>
</section>
</menu>
<object class="GtkPopover" id="testcase_popover">
<child>
<object class="GtkGrid">
@@ -46,7 +39,7 @@
<object class="GtkEntry" id="testcase_name_entry">
<property name="hexpand">1</property>
<property name="activates-default">1</property>
<signal name="notify::text" handler="testcase_name_entry_changed_cb"/>
<signal name="notify::text" handler="testcase_name_entry_changed_cb" />
</object>
</child>
<child>
@@ -59,6 +52,7 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="wrap">1</property>
@@ -72,6 +66,7 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="testcase_error_label">
<property name="wrap">1</property>
@@ -83,6 +78,7 @@
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="testcase_save_button">
<property name="label">Save</property>
@@ -90,9 +86,9 @@
<property name="halign">end</property>
<property name="receives-default">1</property>
<property name="sensitive">0</property>
<signal name="clicked" handler="testcase_save_clicked_cb"/>
<signal name="clicked" handler="testcase_save_clicked_cb" />
<style>
<class name="suggested-action"/>
<class name="suggested-action" />
</style>
<layout>
<property name="row">4</property>
@@ -104,6 +100,7 @@
</object>
</child>
</object>
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">GTK Node Editor</property>
<property name="default-width">1024</property>
@@ -188,128 +185,83 @@
</object>
</child>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkRevealer" id="crash_warning">
<property name="transition-type">slide-down</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="child">
<object class="GtkFrame">
<object class="GtkPaned">
<property name="shrink-start-child">false</property>
<property name="shrink-end-child">false</property>
<property name="position">400</property>
<property name="start-child">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTextView" id="text_view">
<property name="wrap-mode">word</property>
<property name="monospace">1</property>
<property name="top-margin">6</property>
<property name="left-margin">6</property>
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<property name="extra-menu">extra_menu</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="app-notification"/>
<class name="editor" />
</style>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<property name="halign">1</property>
<property name="label" translatable="1">The application may have crashed.
As a precaution, auto-loading has been turned off.
</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="valign">3</property>
<property name="use-underline">1</property>
<property name="label" translatable="1">_Close</property>
<signal name="clicked" handler="close_crash_warning"/>
</object>
</child>
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="click_gesture_pressed"/>
</object>
</property>
</child>
</object>
</property>
</child>
</object>
</child>
<property name="child">
<object class="GtkPaned">
<property name="shrink-start-child">false</property>
<property name="shrink-end-child">false</property>
<property name="position">400</property>
<property name="start-child">
</property>
<property name="end-child">
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="min-content-height">100</property>
<property name="min-content-width">100</property>
<child>
<object class="GtkTextView" id="text_view">
<property name="wrap-mode">word</property>
<property name="monospace">1</property>
<property name="top-margin">6</property>
<property name="left-margin">6</property>
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<property name="extra-menu">extra_menu</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="editor"/>
</style>
<object class="GtkViewport">
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="click_gesture_pressed"/>
</object>
</child>
</object>
</child>
</object>
</property>
<property name="end-child">
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="min-content-height">100</property>
<property name="min-content-width">100</property>
<child>
<object class="GtkViewport">
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkDropTargetAsync">
<object class="GtkDragSource">
<property name="actions">copy</property>
<property name="formats">application/x-gtk-render-node</property>
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkListBox" id="renderer_listbox">
<property name="selection-mode">none</property>
<object class="GtkDropTargetAsync">
<property name="actions">copy</property>
<property name="formats">application/x-gtk-render-node</property>
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</property>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkListBox" id="renderer_listbox">
<property name="selection-mode">none</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
+10 -22
View File
@@ -322,39 +322,27 @@ stroke bounds of the path.
### text
| property | syntax | default | printed |
| -------- | ------------------- | ------------------- | ----------- |
| color | `<color>` | black | non-default |
| font | `<string>` `<url>`? | "Cantarell 11" | always |
| glyphs | `<glyphs>` | "Hello" | always |
| offset | `<point>` | 0 0 | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| color | `<color>` | black | non-default |
| font | `<string>` | "Cantarell 11" | always |
| glyphs | `<glyphs>` | "Hello" | always |
| offset | `<point>` | 0 0 | non-default |
Creates a node like `gsk_text_node_new()` with the given properties.
If a url is specified for the font, it must point to a font file for the
font that is specified in the string. It can be either a data url containing
a base64-encoded font file, or a regular url that points to a font file.
Glyphs can be specified as an ASCII string, or as a comma-separated list of
their glyph ID and advance width. Optionally, x and y offsets and flags can
be specified as well, like this: 40 10 0 0 color.
If the given font does not exist or the given glyphs are invalid for the given
font, an error node will be returned.
### texture
| property | syntax | default | printed |
| -------- | ------------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| texture | `<string>`?`<url>`? | *see below* | always |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| texture | `<url>` | *see below* | always |
Creates a node like `gsk_texture_node_new()` with the given properties.
If a string is specified for the texture, it will be used as a name for the text.
Textures can be reused by specifying the name of a previously used texture. In
that case, the url can be omitted.
The default texture is a 10x10 checkerboard with the top left and bottom right
5x5 being in the color #FF00CC and the other part being transparent. A possible
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
+1 -1
View File
@@ -1,7 +1,7 @@
executable('gtk4-print-editor',
sources: ['print-editor.c'],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
+1 -1
View File
@@ -4,7 +4,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "profile_conf.h"
#include "demo_conf.h"
static GtkWidget *main_window;
static GFile *filename = NULL;
+1 -1
View File
@@ -66,7 +66,7 @@ endif
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
+1 -1
View File
@@ -25,7 +25,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "profile_conf.h"
#include "demo_conf.h"
static void
change_dark_state (GSimpleAction *action,
-8
View File
@@ -30,14 +30,6 @@ OPTIONS
Show the application help.
``--version``
Show the program version.
``--reset``
Don't restore autosaved content and remove autosave files.
ENVIRONMENT
-----------
+1 -30
View File
@@ -12,10 +12,9 @@ SYNOPSIS
--------
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
DESCRIPTION
-----------
@@ -51,31 +50,3 @@ The name of the file to write can be specified as a second FILE argument.
Use the given renderer. Use ``--renderer=help`` to get a information
about poassible values for the ``RENDERER``.
Benchmark
^^^^^^^^^
The ``benchmark`` command benchmarks rendering of a node with the existing renderers
and prints the runtimes.
``--renderer=RENDERER``
Add the given renderer. This argument can be passed multiple times to test multiple
renderers. By default, all major GTK renderers are run.
``--runs=RUNS``
Number of times to render the node on each renderer. By default, this is 3 times.
Keep in mind that the first run is often used to populate caches and might be
significantly slower.
``--no-download``
Do not attempt to download the result. This may cause the measurement to not include
the execution of the commands on the GPU. It can be useful to use this flag to test
command submission performance.
+13 -18
View File
@@ -357,7 +357,7 @@ devices.
### `GDK_VULKAN_SKIP`
This variable can be set to a list of values, which cause GDK to
disable features of the Vulkan support.
disable features of the Vulkan support.
Note that these features may already be disabled if the Vulkan driver
does not support them.
@@ -415,24 +415,19 @@ using and the GDK backend supports them:
`vulkan`
: Selects the Vulkan renderer
Note that on Windows, if one is running Nahimic 3 on a system with
nVidia graphics, one needs to stop the "Nahimic service" or insert
the GTK application into the Nahimic blacklist, as noted in
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/, or use the cairo renderer (at the cost of being unable to use
OpenGL features), or use GDK_DEBUG=gl-gles if you know that GLES
support is enabled for the build.
::: note
If you are running the Nahimic 3 service on a Windows system with
nVidia graphics, you need to perform one of the following:
- stop the "Nahimic service"
- insert the GTK application into the Nahimic blocklist, as noted in the
[nVidia forums](https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/)
- use the cairo renderer (at the cost of being unable to use OpenGL features)
- use `GDK_DEBUG=gl-gles`, if you know that GLES support is enabled for the build.
This is a known issue, as the above link indicates, and affects quite
a number of applications—sadly, since this issue lies within the
nVidia graphics driver and/or the Nahimic 3 code, we are not able
to rememdy this on the GTK side; the best bet before trying the above
workarounds is to try to update your graphics drivers and Nahimic
installation.
This is a known issue, as the above link indicates, and affects quite
a number of applications--sadly, since this issue lies within the
nVidia graphics driver and/or the Nahimic 3 code, we are not able
to rememdy this on the GTK side; the best bet before trying the above
workarounds is to try to update your graphics drivers and Nahimic
installation.
### `GSK_GPU_SKIP`
+3 -1
View File
@@ -222,6 +222,7 @@ gdk_parse_debug_var (const char *variable,
}
else
{
char *val = g_strndup (p, q - p);
for (i = 0; i < nkeys; i++)
{
if (strlen (keys[i].key) == q - p &&
@@ -232,7 +233,8 @@ gdk_parse_debug_var (const char *variable,
}
}
if (i == nkeys)
fprintf (stderr, "Unrecognized value \"%.*s\". Try %s=help\n", (int) (q - p), p, variable);
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
g_free (val);
}
p = q;
+1 -2
View File
@@ -289,8 +289,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
*/
device_props[PROP_MODIFIER_STATE] =
g_param_spec_flags ("modifier-state", NULL, NULL,
GDK_TYPE_MODIFIER_TYPE,
GDK_NO_MODIFIER_MASK,
GDK_TYPE_MODIFIER_TYPE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, device_props);
+6 -3
View File
@@ -1363,7 +1363,7 @@ gdk_display_init_gl (GdkDisplay *self)
return;
}
gdk_profiler_end_mark (before2, "Realize OpenGL context", NULL);
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
/* Only assign after realize, so GdkGLContext::realize() can use
* gdk_display_get_gl_context() == NULL to differentiate between
@@ -1373,7 +1373,7 @@ gdk_display_init_gl (GdkDisplay *self)
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
gdk_profiler_end_mark (before, "Init OpenGL", NULL);
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
}
/**
@@ -1768,6 +1768,7 @@ gdk_display_init_egl (GdkDisplay *self,
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
int major, minor;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
@@ -1794,6 +1795,7 @@ gdk_display_init_egl (GdkDisplay *self,
return FALSE;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
if (!eglInitialize (priv->egl_display, &major, &minor))
{
priv->egl_display = NULL;
@@ -1802,6 +1804,7 @@ gdk_display_init_egl (GdkDisplay *self,
_("Could not initialize EGL display"));
return FALSE;
}
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
@@ -1891,7 +1894,7 @@ gdk_display_init_egl (GdkDisplay *self,
g_free (ext);
}
gdk_profiler_end_mark (start_time, "Init EGL", NULL);
gdk_profiler_end_mark (start_time, "init EGL", NULL);
return TRUE;
}
+4 -4
View File
@@ -56,10 +56,10 @@ static struct {
GdkCursor *cursor;
} drag_cursors[] = {
{ GDK_ACTION_ASK, "dnd-ask", NULL },
{ GDK_ACTION_COPY, "copy", NULL },
{ GDK_ACTION_MOVE, "move", NULL },
{ GDK_ACTION_LINK, "alias", NULL },
{ 0, "no-drop", NULL },
{ GDK_ACTION_COPY, "dnd-copy", NULL },
{ GDK_ACTION_MOVE, "dnd-move", NULL },
{ GDK_ACTION_LINK, "dnd-link", NULL },
{ 0, "dnd-none", NULL },
};
enum {
+5 -5
View File
@@ -687,7 +687,7 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[UPDATE], 0);
gdk_profiler_end_mark (before, "Frameclock update", NULL);
gdk_profiler_end_mark (before, "frameclock update", NULL);
}
void
@@ -699,7 +699,7 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[LAYOUT], 0);
gdk_profiler_end_mark (before, "Frameclock layout", NULL);
gdk_profiler_end_mark (before, "frameclock layout", NULL);
}
void
@@ -711,7 +711,7 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[PAINT], 0);
gdk_profiler_end_mark (before, "Frameclock paint", NULL);
gdk_profiler_end_mark (before, "frameclock paint", NULL);
}
void
@@ -811,12 +811,12 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
{
if (timings->drawn_time != 0)
{
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "Drawn window", NULL);
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "drawn window", NULL);
}
if (timings->presentation_time != 0)
{
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "Presented window", NULL);
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "presented window", NULL);
}
gdk_profiler_set_counter (fps_counter, gdk_frame_clock_get_fps (clock));
+1 -1
View File
@@ -694,7 +694,7 @@ gdk_frame_clock_paint_idle (void *data)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
priv->sleep_serial = get_sleep_serial ();
gdk_profiler_end_mark (before, "Frameclock cycle", NULL);
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
return FALSE;
}
+11 -2
View File
@@ -386,7 +386,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
gdk_profiler_end_mark (start_time, "Create EGL context", NULL);
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
return api;
}
@@ -669,7 +669,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
egl_surface = gdk_surface_get_egl_surface (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL swap buffers", NULL);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL", "swap buffers");
if (priv->eglSwapBuffersWithDamage)
{
@@ -2042,6 +2042,15 @@ gdk_gl_context_has_sync (GdkGLContext *self)
return priv->has_sync;
}
/* Return if GL_BGRA works with glTexImage2D */
gboolean
gdk_gl_context_has_bgra (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->has_bgra;
}
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
* can be used
*/
+2
View File
@@ -171,6 +171,8 @@ gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext
gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
double gdk_gl_context_get_scale (GdkGLContext *self);
+1 -9
View File
@@ -161,12 +161,7 @@ gdk_gl_texture_find_format (GdkGLContext *context,
if (!(gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_RENDERABLE))
continue;
gdk_memory_format_gl_format (format,
gdk_gl_context_get_use_es (context),
&q_internal_format,
&q_format,
&q_type,
q_swizzle);
gdk_memory_format_gl_format (format, &q_internal_format, &q_format, &q_type, q_swizzle);
if (q_format != gl_format || q_type != gl_type)
continue;
@@ -198,7 +193,6 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
((gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_USABLE) == GDK_GL_FORMAT_USABLE))
{
gdk_memory_format_gl_format (format,
gdk_gl_context_get_use_es (context),
&gl_internal_format,
&gl_format, &gl_type, gl_swizzle);
if (download->stride == expected_stride &&
@@ -261,7 +255,6 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
actual_format = gdk_memory_format_get_straight (actual_format);
gdk_memory_format_gl_format (actual_format,
gdk_gl_context_get_use_es (context),
&gl_internal_format,
&gl_read_format, &gl_read_type, gl_swizzle);
}
@@ -273,7 +266,6 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
actual_format = gdk_memory_format_get_straight (actual_format);
gdk_memory_format_gl_format (actual_format,
gdk_gl_context_get_use_es (context),
&gl_internal_format,
&gl_read_format, &gl_read_type, gl_swizzle);
}
+36 -79
View File
@@ -335,8 +335,7 @@ struct _GdkMemoryFormatDescription
GdkMemoryDepth depth;
const GdkMemoryFormat *fallbacks;
struct {
GLint internal_gl_format;
GLint internal_gles_format;
GLint internal_format;
GLenum format;
GLenum type;
GLint swizzle[4];
@@ -376,8 +375,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_BGRA,
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -404,8 +402,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -432,8 +429,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -459,8 +455,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -487,8 +482,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_BGRA,
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -515,8 +509,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -543,8 +536,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -570,8 +562,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -599,8 +590,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_BGRA,
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
@@ -628,8 +618,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
@@ -657,8 +646,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
@@ -685,8 +673,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA8,
.internal_gles_format = GL_RGBA8,
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
@@ -714,8 +701,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGB8,
.internal_gles_format = GL_RGB8,
.internal_format = GL_RGB8,
.format = GL_RGB,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -742,8 +728,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGB8,
.internal_gles_format = GL_RGB8,
.internal_format = GL_RGB8,
.format = GL_BGR,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -774,8 +759,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGB16,
.internal_gles_format = GL_RGB16,
.internal_format = GL_RGB16,
.format = GL_RGB,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -804,8 +788,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA16,
.internal_gles_format = GL_RGBA16,
.internal_format = GL_RGBA16,
.format = GL_RGBA,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -834,8 +817,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA16,
.internal_gles_format = GL_RGBA16,
.internal_format = GL_RGBA16,
.format = GL_RGBA,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -864,8 +846,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGB16F,
.internal_gles_format = GL_RGB16F,
.internal_format = GL_RGB16F,
.format = GL_RGB,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -893,8 +874,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA16F,
.internal_gles_format = GL_RGBA16F,
.internal_format = GL_RGBA16F,
.format = GL_RGBA,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -922,8 +902,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA16F,
.internal_gles_format = GL_RGBA16F,
.internal_format = GL_RGBA16F,
.format = GL_RGBA,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -952,8 +931,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGB32F,
.internal_gles_format = GL_RGB32F,
.internal_format = GL_RGB32F,
.format = GL_RGB,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -981,8 +959,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA32F,
.internal_gles_format = GL_RGBA32F,
.internal_format = GL_RGBA32F,
.format = GL_RGBA,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -1010,8 +987,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RGBA32F,
.internal_gles_format = GL_RGBA32F,
.internal_format = GL_RGBA32F,
.format = GL_RGBA,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
@@ -1038,8 +1014,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RG8,
.internal_gles_format = GL_RG8,
.internal_format = GL_RG8,
.format = GL_RG,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
@@ -1066,8 +1041,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RG8,
.internal_gles_format = GL_RG8,
.internal_format = GL_RG8,
.format = GL_RG,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
@@ -1094,8 +1068,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_R8,
.internal_gles_format = GL_R8,
.internal_format = GL_R8,
.format = GL_RED,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
@@ -1125,8 +1098,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RG16,
.internal_gles_format = GL_RG16,
.internal_format = GL_RG16,
.format = GL_RG,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
@@ -1156,8 +1128,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_RG16,
.internal_gles_format = GL_RG16,
.internal_format = GL_RG16,
.format = GL_RG,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
@@ -1187,8 +1158,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_R16,
.internal_gles_format = GL_R16,
.internal_format = GL_R16,
.format = GL_RED,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
@@ -1215,8 +1185,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_R8,
.internal_gles_format = GL_R8,
.internal_format = GL_R8,
.format = GL_RED,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
@@ -1246,8 +1215,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_R16,
.internal_gles_format = GL_R16,
.internal_format = GL_R16,
.format = GL_RED,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
@@ -1276,8 +1244,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_R16F,
.internal_gles_format = GL_R16F,
.internal_format = GL_R16F,
.format = GL_RED,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
@@ -1306,8 +1273,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
-1,
},
.gl = {
.internal_gl_format = GL_R32F,
.internal_gles_format = GL_R32F,
.internal_format = GL_R32F,
.format = GL_RED,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
@@ -1507,16 +1473,12 @@ gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth)
void
gdk_memory_format_gl_format (GdkMemoryFormat format,
gboolean gles,
GLint *out_internal_format,
GLenum *out_format,
GLenum *out_type,
GLint out_swizzle[4])
{
if (gles)
*out_internal_format = memory_formats[format].gl.internal_gles_format;
else
*out_internal_format = memory_formats[format].gl.internal_gl_format;
*out_internal_format = memory_formats[format].gl.internal_format;
*out_format = memory_formats[format].gl.format;
*out_type = memory_formats[format].gl.type;
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
@@ -1525,7 +1487,6 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
/*
* gdk_memory_format_gl_rgba_format:
* @format: The format to query
* @gles: TRUE for GLES, FALSE for GL
* @out_actual_format: The actual RGBA format
* @out_internal_format: the GL internal format
* @out_format: the GL format
@@ -1543,7 +1504,6 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
**/
gboolean
gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
gboolean gles,
GdkMemoryFormat *out_actual_format,
GLint *out_internal_format,
GLenum *out_format,
@@ -1556,10 +1516,7 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
return FALSE;
*out_actual_format = actual;
if (gles)
*out_internal_format = memory_formats[actual].gl.internal_gles_format;
else
*out_internal_format = memory_formats[actual].gl.internal_gl_format;
*out_internal_format = memory_formats[actual].gl.internal_format;
*out_format = memory_formats[actual].gl.format;
*out_type = memory_formats[actual].gl.type;
memcpy (out_swizzle, memory_formats[format].gl.rgba_swizzle, sizeof(GLint) * 4);
-2
View File
@@ -55,13 +55,11 @@ GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth
GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST;
GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST;
void gdk_memory_format_gl_format (GdkMemoryFormat format,
gboolean gles,
GLint *out_internal_format,
GLenum *out_format,
GLenum *out_type,
GLint out_swizzle[4]);
gboolean gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
gboolean gles,
GdkMemoryFormat *out_actual_format,
GLint *out_internal_format,
GLenum *out_format,
+6 -7
View File
@@ -32,7 +32,6 @@
#include "version/gdkversionmacros.h"
#include "gdkframeclockprivate.h"
#define CATEGORY "GTK"
gboolean
gdk_profiler_is_running (void)
@@ -51,7 +50,7 @@ void
const char *message)
{
#ifdef HAVE_SYSPROF
sysprof_collector_mark (begin_time, duration, CATEGORY, name, message);
sysprof_collector_mark (begin_time, duration, "gtk", name, message);
#endif
}
@@ -61,7 +60,7 @@ void
const char *message)
{
#ifdef HAVE_SYSPROF
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message);
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message);
#endif
}
@@ -75,7 +74,7 @@ void
#ifdef HAVE_SYSPROF
va_list args;
va_start (args, message_format);
sysprof_collector_mark_vprintf (begin_time, duration, CATEGORY, name, message_format, args);
sysprof_collector_mark_vprintf (begin_time, duration, "gtk", name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
@@ -89,7 +88,7 @@ void
#ifdef HAVE_SYSPROF
va_list args;
va_start (args, message_format);
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message_format, args);
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
@@ -104,7 +103,7 @@ guint
counter.id = sysprof_collector_request_counters (1);
counter.type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
counter.value.vdbl = 0.0;
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
g_strlcpy (counter.category, "gtk", sizeof counter.category);
g_strlcpy (counter.name, name, sizeof counter.name);
g_strlcpy (counter.description, description, sizeof counter.name);
@@ -126,7 +125,7 @@ guint
counter.id = sysprof_collector_request_counters (1);
counter.type = SYSPROF_CAPTURE_COUNTER_INT64;
counter.value.v64 = 0;
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
g_strlcpy (counter.category, "gtk", sizeof counter.category);
g_strlcpy (counter.name, name, sizeof counter.name);
g_strlcpy (counter.description, description, sizeof counter.name);
+2 -2
View File
@@ -2839,7 +2839,7 @@ add_event_mark (GdkEvent *event,
class = g_type_class_ref (GDK_TYPE_EVENT_TYPE);
value = g_enum_get_value (class, event_type);
g_type_class_unref (class);
kind = value ? value->value_nick : "Event";
kind = value ? value->value_nick : "event";
switch ((int) event_type)
{
@@ -2909,7 +2909,7 @@ add_event_mark (GdkEvent *event,
break;
}
gdk_profiler_add_mark (time, end_time - time, "Event", message ? message : kind);
gdk_profiler_add_mark (time, end_time - time, "event", message ? message : kind);
g_free (message);
#endif
+1 -1
View File
@@ -237,7 +237,7 @@ gdk_load_jpeg (GBytes *input_bytes,
g_bytes_unref (bytes);
gdk_profiler_end_mark (before, "Load jpeg", NULL);
gdk_profiler_end_mark (before, "jpeg load", NULL);
return texture;
}
+1 -1
View File
@@ -304,7 +304,7 @@ gdk_load_png (GBytes *bytes,
{
gint64 end = GDK_PROFILER_CURRENT_TIME;
if (end - before > 500000)
gdk_profiler_add_mark (before, end - before, "Load png", NULL);
gdk_profiler_add_mark (before, end - before, "png load", NULL);
}
return texture;
+1 -1
View File
@@ -504,7 +504,7 @@ gdk_load_tiff (GBytes *input_bytes,
{
gint64 end = GDK_PROFILER_CURRENT_TIME;
if (end - before > 500000)
gdk_profiler_add_mark (before, end - before, "Load tiff", NULL);
gdk_profiler_add_mark (before, end - before, "tiff load", NULL);
}
return texture;
+2 -2
View File
@@ -186,7 +186,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
@@ -206,7 +206,7 @@ gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}
+1 -2
View File
@@ -1253,7 +1253,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
g_value_unset (&v);
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
gdk_profiler_end_mark (before, "wayland", "load cursor theme");
}
@@ -1796,7 +1796,6 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contast", G_TYPE_NONE, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "show-status-shapes", "gtk-show-status-shapes", G_TYPE_BOOLEAN, { .b = FALSE } },
/* Note, this setting doesn't exist, the portal and gsd fake it */
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
};
+1 -1
View File
@@ -1012,7 +1012,7 @@ gdk_wayland_surface_create_xdg_popup (GdkWaylandPopup *wayland_popup,
}
}
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
wl_surface_commit (impl->display_server.wl_surface);
if (GDK_IS_POPUP (surface))
+1 -1
View File
@@ -274,7 +274,7 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
GdkFrameTimings *timings;
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event");
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
+6 -7
View File
@@ -830,7 +830,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
maybe_set_gtk_surface_modal (wayland_toplevel);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
wl_surface_commit (wayland_surface->display_server.wl_surface);
}
@@ -1973,10 +1973,8 @@ gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
return FALSE;
seat = gdk_display_get_default_seat (surface->display);
if (!seat)
return FALSE;
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat), NULL);
gtk_surface1_titlebar_gesture (wayland_toplevel->display_server.gtk_surface,
@@ -2157,14 +2155,15 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel,
GdkWaylandSurface *wayland_surface = GDK_WAYLAND_SURFACE (toplevel);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
GdkWaylandSeat *seat =
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
gchar *startup_id = NULL;
startup_id = g_steal_pointer (&display_wayland->startup_notification_id);
if (seat && display_wayland->xdg_activation)
if (display_wayland->xdg_activation)
{
GdkWaylandSeat *seat =
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
/* If the focus request does not have a startup ID associated, get a
* new token to activate the window.
*/
-1
View File
@@ -39,7 +39,6 @@ static const struct {
{"Gtk/CursorThemeSize", "gtk-cursor-theme-size"},
{"Gtk/ColorScheme", "gtk-color-scheme"},
{"Gtk/EnableAnimations", "gtk-enable-animations"},
{"Gtk/ShowStatusStates", "gtk-show-status-shapes"},
{"Xft/Antialias", "gtk-xft-antialias"},
{"Xft/Hinting", "gtk-xft-hinting"},
{"Xft/HintStyle", "gtk-xft-hintstyle"},
-479
View File
@@ -1,479 +0,0 @@
#pragma once
#include <graphene.h>
#include <math.h>
#include "gsktypesprivate.h"
#include "scaleprivate.h"
#include "pointprivate.h"
#ifndef USE_SIMD
struct _Box
{
float x0, y0, x1, y1;
};
static inline float
box_x0 (const Box box)
{
return box.x0;
}
static inline float
box_y0 (const Box box)
{
return box.y0;
}
static inline float
box_x1 (const Box box)
{
return box.x1;
}
static inline float
box_y1 (const Box box)
{
return box.y1;
}
static inline float
box_width (const Box box)
{
return box.x1 - box.x0;
}
static inline float
box_height (const Box box)
{
return box.y1 - box.y0;
}
/* Assumes x0 <= x1 && y0 <= y1 */
static inline Box
box (float x0,
float y0,
float x1,
float y1)
{
return (Box) { .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1 };
}
static inline Box
box_from_rect (float x,
float y,
float w,
float h)
{
return box (x, y, x + w, y + h);
}
static inline Box
box_from_graphene (const graphene_rect_t *rect)
{
return box_from_rect (rect->origin.x,
rect->origin.y,
rect->size.width,
rect->size.height);
}
/* Assumes p0.x <= p1.x && p0.y <= p1.y */
static inline Box
box_from_points (Point p0,
Point p1)
{
return box (p0.x, p0.y, p1.x, p1.y);
}
static inline Point
box_origin (const Box box)
{
return point (box.x0, box.y0);
}
static inline Point
box_opposite (const Box box)
{
return point (box.x1, box.y1);
}
static inline void
box_to_float (const Box box,
float v[4])
{
v[0] = box.x0;
v[1] = box.y0;
v[2] = box.x1 - box.x0;
v[3] = box.y1 - box.y0;
}
static inline Box
box_inset (const Box box,
float dx,
float dy)
{
return (Box) { .x0 = box.x0 + dx, .y0 = box.y0 + dy,
.x1 = box.x1 - dx, .y1 = box.y1 - dy };
}
static inline gboolean
box_intersect (const Box box1,
const Box box2,
Box *box)
{
Box b;
b.x0 = MAX (box1.x0, box2.x0);
b.y0 = MAX (box1.y0, box2.y0);
b.x1 = MIN (box1.x1, box2.x1);
b.y1 = MIN (box1.y1, box2.y1);
if (b.x0 <= b.x1 && b.y0 <= b.x1)
{
if (box)
*box = b;
return TRUE;
}
return FALSE;
}
static inline gboolean
box_equal (const Box box1,
const Box box2)
{
return memcmp (&box1, &box2, sizeof (Box)) == 0;
}
static inline gboolean
box_contains (const Box box1,
const Box box2)
{
Box box;
if (box_intersect (box1, box2, &box))
return box_equal (box, box2);
return FALSE;
}
static inline gboolean
box_empty (const Box box)
{
return box.x0 == box.x1 || box.y0 == box.y1;
}
static inline Box
box_add (const Box box,
const Point offset)
{
return (Box) { .x0 = box.x0 + offset.x, .y0 = box.y0 + offset.y,
.x1 = box.x1 + offset.x, .y1 = box.y1 + offset.y };
}
static inline Box
box_sub (const Box box,
const Point offset)
{
return (Box) { .x0 = box.x0 - offset.x, .y0 = box.y0 - offset.y,
.x1 = box.x1 - offset.x, .y1 = box.y1 - offset.y };
}
static inline Box
box_mul (const Box box,
const Scale scale)
{
Box b = (Box) { .x0 = box.x0 * scale.x, .y0 = box.y0 * scale.y,
.x1 = box.x1 * scale.x, .y1 = box.y1 * scale.y };
if (G_UNLIKELY (scale.x < 0 || scale.y < 0))
return (Box) { .x0 = MIN (b.x0, b.x1), .y0 = MIN (b.y0, b.y1),
.x1 = MAX (b.x0, b.x1), .y1 = MAX (b.y0, b.y1) };
return b;
}
static inline Box
box_div (const Box box,
const Scale scale)
{
return box_mul (box, scale_inv (scale));
}
static inline void
box_offset_to_float (const Box box,
const Point offset,
float v[4])
{
box_to_float (box_add (box, offset), v);
}
static inline Box
box_round_larger (const Box box)
{
return (Box) { .x0 = floorf (box.x0), .y0 = floorf (box.y0),
.x1 = ceilf (box.x1), .y1 = ceilf (box.y1) };
}
static inline Box
box_round_to_pixels (const Box box,
const Scale scale,
const Point offset)
{
return box_sub (box_div (box_round_larger (box_mul (box_add (box, offset), scale)), scale), offset);
}
#else /* USE_SIMD */
struct _Box
{
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
};
static inline float
box_x0 (const Box box)
{
return graphene_simd4f_get_x (box.v);
}
static inline float
box_y0 (const Box box)
{
return graphene_simd4f_get_y (box.v);
}
static inline float
box_x1 (const Box box)
{
return graphene_simd4f_get_z (box.v);
}
static inline float
box_y1 (const Box box)
{
return graphene_simd4f_get_w (box.v);
}
static inline float
box_width (const Box box)
{
return box_x1 (box) - box_x0 (box);
}
static inline float
box_height (const Box box)
{
return box_y1 (box) - box_y0 (box);
}
static inline Box
box (float x0,
float y0,
float x1,
float y1)
{
return (Box) { .v = graphene_simd4f_init (x0, y0, x1, y1) };
}
static inline Box
box_from_rect (float x,
float y,
float w,
float h)
{
return box (x, y, x + w, y + h);
}
static inline Box
box_from_graphene (const graphene_rect_t *rect)
{
return box_from_rect (rect->origin.x,
rect->origin.y,
rect->size.width,
rect->size.height);
}
/* { a[0], a[1], b[0], b[1] } */
# define graphene_simd4f_splat_xyxy(a,b) \
(__extension__ ({ \
(graphene_simd4f_t) _mm_shuffle_ps ((a), (b), _MM_SHUFFLE (1, 0, 1, 0)); \
}))
static inline Box
box_from_points (Point p0,
Point p1)
{
return (Box) { .v = graphene_simd4f_splat_xyxy (p0.v, p1.v) };
}
static inline Point
box_origin (const Box box)
{
return (Point) { .v = graphene_simd4f_zero_zw (box.v) };
}
static inline Point
box_opposite (const Box box)
{
return (Point) { .v = graphene_simd4f_zero_zw (graphene_simd4f_shuffle_zwxy (box.v)) };
}
static inline void
box_to_float (const Box box,
float v[4])
{
graphene_simd4f_dup_4f (box.v, v);
v[2] -= v[0];
v[3] -= v[1];
}
static inline Box
box_inset (const Box box,
float dx,
float dy)
{
return (Box) { .v = graphene_simd4f_add (box.v, graphene_simd4f_init (dx, dy, -dx, -dy)) };
}
/* return a[0] < b[0] && a[1] < b[1] */
#ifndef graphene_simd4f_cmple_xy
# define graphene_simd4f_cmple_xy(a,b) \
(__extension__ ({ \
__m128i __res = (__m128i) _mm_cmple_ps ((a), (b)); \
(bool) ((_mm_movemask_epi8 (__res) & 0xff) == 0xff); \
}))
#endif
static inline gboolean
box_intersect (const Box box1,
const Box box2,
Box *box)
{
graphene_simd4f_t s, t, t1;
s = graphene_simd4f_max (box1.v, box2.v);
t = graphene_simd4f_min (box1.v, box2.v);
t1 = graphene_simd4f_shuffle_zwxy (t);
if (graphene_simd4f_cmple_xy (s, t1))
{
if (box)
box->v = graphene_simd4f_splat_xyxy (s, t);
return TRUE;
}
return FALSE;
}
static inline gboolean
box_equal (const Box box1,
const Box box2)
{
return (gboolean) !!graphene_simd4f_cmp_eq (box1.v, box2.v);
}
static inline gboolean
box_contains (const Box box1,
const Box box2)
{
Box box;
if (box_intersect (box1, box2, &box))
return box_equal (box, box2);
return FALSE;
}
static inline gboolean
box_empty (const Box box)
{
/* FIXME simd */
return box_x0 (box) == box_x1 (box) || box_y0 (box) == box_y1 (box);
}
/* a splat variation */
#ifndef graphene_simd4f_shuffle_xyxy
# define graphene_simd4f_shuffle_xyxy(v) \
(__extension__ ({ \
(graphene_simd4f_t) _mm_shuffle_ps ((v), (v), _MM_SHUFFLE (1, 0, 1, 0)); \
}))
#endif
static inline Box
box_add (const Box box,
const Point offset)
{
return (Box) { .v = graphene_simd4f_add (box.v, graphene_simd4f_shuffle_xyxy (offset.v)) };
}
static inline Box
box_sub (const Box box,
const Point offset)
{
return (Box) { .v = graphene_simd4f_sub (box.v, graphene_simd4f_shuffle_xyxy (offset.v)) };
}
static inline Box
box_mul (const Box box,
const Scale scale)
{
Box b = (Box) { .v = graphene_simd4f_mul (box.v, graphene_simd4f_shuffle_xyxy (scale.v)) };
if (G_UNLIKELY (!graphene_simd4f_cmple_xy (graphene_simd4f_init (0, 0, 0, 0), scale.v)))
{
graphene_simd4f_t v = graphene_simd4f_shuffle_zwxy (b.v);
graphene_simd4f_t s = graphene_simd4f_min (b.v, v);
graphene_simd4f_t t = graphene_simd4f_max (b.v, v);
return (Box) { .v = graphene_simd4f_splat_xyxy (s, t) };
}
return b;
}
static inline Box
box_div (const Box box,
const Scale scale)
{
return box_mul (box, scale_inv (scale));
}
static inline void
box_offset_to_float (const Box box,
const Point offset,
float v[4])
{
box_to_float (box_add (box, offset), v);
}
#ifdef __SSE4_1__
static inline Box
box_round_larger (const Box box)
{
return { (Box) .v = graphene_simd4f_splat_xyxy (graphene_simd4f_floor (b.v), graphene_simd4f_ceil (b.v)) };
}
#else
static inline Box
box_round_larger (const Box b)
{
return box (floorf (box_x0 (b)),
floorf (box_y0 (b)),
ceilf (box_x1 (b)),
ceilf (box_y1 (b)));
}
#endif
static inline Box
box_round_to_pixels (const Box box,
const Scale scale,
const Point offset)
{
return box_sub (box_div (box_round_larger (box_mul (box_add (box, offset), scale)), scale), offset);
}
#endif
+4 -8
View File
@@ -1504,7 +1504,6 @@ memory_format_gl_format (GskGLCommandQueue *self,
if ((flags & required_flags) == required_flags)
{
gdk_memory_format_gl_format (data_format,
gdk_gl_context_get_use_es (self->context),
gl_internalformat,
gl_format,
gl_type,
@@ -1515,7 +1514,6 @@ memory_format_gl_format (GskGLCommandQueue *self,
/* Second, try the potential RGBA format */
if (gdk_memory_format_gl_rgba_format (data_format,
gdk_gl_context_get_use_es (self->context),
&alt_format,
gl_internalformat,
gl_format,
@@ -1531,7 +1529,6 @@ memory_format_gl_format (GskGLCommandQueue *self,
return data_format;
gdk_memory_format_gl_format (alt_format,
gdk_gl_context_get_use_es (self->context),
gl_internalformat,
gl_format,
gl_type,
@@ -1549,7 +1546,6 @@ memory_format_gl_format (GskGLCommandQueue *self,
if (((flags & required_flags) == required_flags))
{
gdk_memory_format_gl_format (fallbacks[i],
gdk_gl_context_get_use_es (self->context),
gl_internalformat,
gl_format,
gl_type,
@@ -1608,8 +1604,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
if (gdk_profiler_is_running ())
{
gdk_profiler_end_markf (start_time,
"Download texture chunk",
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
"Download Texture chunk",
"Tile %dx%d Size %dx%d", x, y, width, height);
start_time = GDK_PROFILER_CURRENT_TIME;
}
@@ -1654,8 +1650,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
g_bytes_unref (bytes);
if (gdk_profiler_is_running ())
gdk_profiler_end_markf (start_time,
"Upload texture chunk",
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
"Upload Texture chunk",
"Tile %dx%d Size %dx%d", x, y, width, height);
}
+2 -2
View File
@@ -424,7 +424,7 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
failure:
g_clear_object (&compiler);
gdk_profiler_end_mark (start_time, "Load GL programs", NULL);
gdk_profiler_end_mark (start_time, "load programs", NULL);
return ret;
}
@@ -477,7 +477,7 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
self->icons_library = gsk_gl_icon_library_new (self);
self->shadows_library = gsk_gl_shadow_library_new (self);
gdk_profiler_end_mark (before, "Create GL driver", NULL);
gdk_profiler_end_mark (before, "create GskGLDriver", NULL);
return g_steal_pointer (&self);
}
+6 -2
View File
@@ -119,7 +119,11 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
memset (pixel_data, 255, sizeof pixel_data);
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
#if G_BYTE_ORDER == G_BIG_ENDIAN
|| gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
#endif
)
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
@@ -376,7 +380,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
char message[64];
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload glyph", message);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Glyph", message);
}
}
+1 -1
View File
@@ -211,6 +211,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
char message[64];
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload icon", message);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Icon", message);
}
}
+31 -31
View File
@@ -830,8 +830,8 @@ rounded_rect_scale_corners (const GskRoundedRect *rect,
{
for (guint i = 0; i < G_N_ELEMENTS (out_rect->corner); i++)
{
out_rect->corner[i].width = rect->corner[i].width * fabsf (scale_x);
out_rect->corner[i].height = rect->corner[i].height * fabsf (scale_y);
out_rect->corner[i].width = rect->corner[i].width * fabs (scale_x);
out_rect->corner[i].height = rect->corner[i].height * fabs (scale_y);
}
if (scale_x < 0)
@@ -1173,8 +1173,8 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
{
float scale_x = job->scale_x;
float scale_y = job->scale_y;
int surface_width = ceilf (node->bounds.size.width * fabsf (scale_x));
int surface_height = ceilf (node->bounds.size.height * fabsf (scale_y));
int surface_width = ceilf (node->bounds.size.width * fabs (scale_x));
int surface_height = ceilf (node->bounds.size.height * fabs (scale_y));
GdkTexture *texture;
cairo_surface_t *surface;
cairo_surface_t *rendered_surface;
@@ -1203,7 +1203,7 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
surface_width,
surface_height);
cairo_surface_set_device_scale (rendered_surface, fabsf (scale_x), fabsf (scale_y));
cairo_surface_set_device_scale (rendered_surface, fabs (scale_x), fabs (scale_y));
cr = cairo_create (rendered_surface);
cairo_save (cr);
@@ -1217,16 +1217,16 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
surface_width,
surface_height);
cairo_surface_set_device_scale (surface, fabsf (scale_x), fabsf (scale_y));
cairo_surface_set_device_scale (surface, fabs (scale_x), fabs (scale_y));
cr = cairo_create (surface);
/* We draw upside down here, so it matches what GL does. */
cairo_save (cr);
cairo_scale (cr, scale_x < 0 ? -1 : 1, scale_y < 0 ? 1 : -1);
cairo_translate (cr, scale_x < 0 ? - surface_width / fabsf (scale_x) : 0,
scale_y < 0 ? 0 : - surface_height / fabsf (scale_y));
cairo_translate (cr, scale_x < 0 ? - surface_width / fabs (scale_x) : 0,
scale_y < 0 ? 0 : - surface_height / fabs (scale_y));
cairo_set_source_surface (cr, rendered_surface, 0, 0);
cairo_rectangle (cr, 0, 0, surface_width / fabsf (scale_x), surface_height / fabsf (scale_y));
cairo_rectangle (cr, 0, 0, surface_width / fabs (scale_x), surface_height / fabs (scale_y));
cairo_fill (cr);
cairo_restore (cr);
cairo_destroy (cr);
@@ -1432,10 +1432,10 @@ blur_node (GskGLRenderJob *job,
offscreen->texture_id = blur_offscreen (job,
offscreen,
texture_width * fabsf (scale_x),
texture_height * fabsf (scale_y),
blur_radius * fabsf (scale_x),
blur_radius * fabsf (scale_y));
texture_width * fabs (scale_x),
texture_height * fabs (scale_y),
blur_radius * fabs (scale_x),
blur_radius * fabs (scale_y));
init_full_texture_region (offscreen);
}
@@ -2019,9 +2019,9 @@ result_is_axis_aligned (GskTransform *transform,
for (guint i = 0; i < 4; i++)
{
p = graphene_quad_get_point (&q, i);
if (fabsf (p->x - b1.x) > FLT_EPSILON && fabsf (p->x - b2.x) > FLT_EPSILON)
if (fabs (p->x - b1.x) > FLT_EPSILON && fabs (p->x - b2.x) > FLT_EPSILON)
return FALSE;
if (fabsf (p->y - b1.y) > FLT_EPSILON && fabsf (p->y - b2.y) > FLT_EPSILON)
if (fabs (p->y - b1.y) > FLT_EPSILON && fabs (p->y - b2.y) > FLT_EPSILON)
return FALSE;
}
@@ -2304,8 +2304,8 @@ gsk_gl_render_job_visit_blurred_inset_shadow_node (GskGLRenderJob *job,
&offscreen,
texture_width,
texture_height,
blur_radius * fabsf (scale_x),
blur_radius * fabsf (scale_y));
blur_radius * fabs (scale_x),
blur_radius * fabs (scale_y));
gsk_gl_driver_release_render_target (job->driver, render_target, TRUE);
@@ -2501,8 +2501,8 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
do_slicing = TRUE;
}
texture_width = (int)ceilf ((scaled_outline.bounds.size.width + blur_extra) * scale_x);
texture_height = (int)ceilf ((scaled_outline.bounds.size.height + blur_extra) * scale_y);
texture_width = (int)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale_x);
texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale_y);
scaled_outline.bounds.origin.x = extra_blur_pixels_x;
scaled_outline.bounds.origin.y = extra_blur_pixels_y;
@@ -2577,8 +2577,8 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
&offscreen,
texture_width,
texture_height,
blur_radius * fabsf (scale_x),
blur_radius * fabsf (scale_y));
blur_radius * fabs (scale_x),
blur_radius * fabs (scale_y));
gsk_gl_shadow_library_insert (job->driver->shadows_library,
&scaled_outline,
@@ -2834,7 +2834,7 @@ gsk_gl_render_job_visit_cross_fade_node (GskGLRenderJob *job,
offscreen_end.reset_clip = TRUE;
offscreen_end.bounds = &node->bounds;
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (job->scale_y)));
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabs (job->scale_x), fabs (job->scale_y)));
if (!gsk_gl_render_job_visit_node_with_offscreen (job, start_node, &offscreen_start))
{
@@ -2964,7 +2964,7 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
const PangoFont *font = gsk_text_node_get_font (node);
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
const graphene_point_t *offset = gsk_text_node_get_offset (node);
float text_scale = MAX (fabsf (job->scale_x), fabsf (job->scale_y)); /* TODO: Fix for uneven scales? */
float text_scale = MAX (fabs (job->scale_x), fabs (job->scale_y)); /* TODO: Fix for uneven scales? */
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
float x = offset->x + job->offset_x;
float y = offset->y + job->offset_y;
@@ -3263,7 +3263,7 @@ gsk_gl_render_job_visit_blend_node (GskGLRenderJob *job,
bottom_offscreen.force_offscreen = TRUE;
bottom_offscreen.reset_clip = TRUE;
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (job->scale_y)));
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabs (job->scale_x), fabs (job->scale_y)));
/* TODO: We create 2 textures here as big as the blend node, but both the
* start and the end node might be a lot smaller than that. */
@@ -3344,8 +3344,8 @@ gsk_gl_render_job_texture_mask_for_color (GskGLRenderJob *job,
gboolean use_mipmap;
guint16 cc[4];
use_mipmap = (scale_x * fabsf (job->scale_x)) < 0.5 ||
(scale_y * fabsf (job->scale_y)) < 0.5;
use_mipmap = (scale_x * fabs (job->scale_x)) < 0.5 ||
(scale_y * fabs (job->scale_y)) < 0.5;
rgba_to_half (rgba, cc);
gsk_gl_render_job_upload_texture (job, texture, use_mipmap, &offscreen);
@@ -3396,7 +3396,7 @@ gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
mask_offscreen.reset_clip = TRUE;
mask_offscreen.do_not_cache = TRUE;
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (job->scale_y)));
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabs (job->scale_x), fabs (job->scale_y)));
/* TODO: We create 2 textures here as big as the mask node, but both
* nodes might be a lot smaller than that.
@@ -3664,8 +3664,8 @@ gsk_gl_render_job_visit_texture (GskGLRenderJob *job,
float scale_y = bounds->size.height / texture->height;
gboolean use_mipmap;
use_mipmap = (scale_x * fabsf (job->scale_x)) < 0.5 ||
(scale_y * fabsf (job->scale_y)) < 0.5;
use_mipmap = (scale_x * fabs (job->scale_x)) < 0.5 ||
(scale_y * fabs (job->scale_y)) < 0.5;
if G_LIKELY (texture->width <= max_texture_size &&
texture->height <= max_texture_size)
@@ -4544,7 +4544,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
gsk_gl_render_job_visit_node (job, root);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_end_mark (start_time, "Build GL command queue", "");
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Build GL command queue", "");
#if 0
/* At this point the atlases have uploaded content while we processed
@@ -4562,7 +4562,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
gdk_gl_context_push_debug_group (job->command_queue->context, "Executing command queue");
gsk_gl_command_queue_execute (job->command_queue, surface_height, scale, job->region, job->default_framebuffer);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_end_mark (start_time, "Execute GL command queue", "");
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Execute GL command queue", "");
}
static int
+4 -2
View File
@@ -117,8 +117,9 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
g_hash_table_iter_remove (&iter);
dropped++;
}
else if (periodic_scan)
entry->accessed = FALSE;
if (periodic_scan)
entry->accessed = FALSE;
}
}
@@ -439,6 +440,7 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
entry->texture = texture;
entry->is_atlased = FALSE;
entry->accessed = TRUE;
entry->area.x = padding / (float) (padding + width + padding);
entry->area.y = padding / (float) (padding + height + padding);
entry->area.x2 = (padding + width) / (float) (padding + width + padding);
-3
View File
@@ -638,7 +638,6 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
*out_format = format;
*out_flags = flags;
gdk_memory_format_gl_format (format,
gdk_gl_context_get_use_es (context),
out_gl_internal_format,
out_gl_format,
out_gl_type,
@@ -648,7 +647,6 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
/* Second, try the potential RGBA format */
if (gdk_memory_format_gl_rgba_format (format,
gdk_gl_context_get_use_es (context),
&alt_format,
out_gl_internal_format,
out_gl_format,
@@ -672,7 +670,6 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
*out_format = fallbacks[i];
*out_flags = flags;
gdk_memory_format_gl_format (fallbacks[i],
gdk_gl_context_get_use_es (context),
out_gl_internal_format,
out_gl_format,
out_gl_type,
+11 -60
View File
@@ -14,14 +14,6 @@ gsk_gpu_clip_init_empty (GskGpuClip *clip,
gsk_rounded_rect_init_from_rect (&clip->rect, rect, 0);
}
void
gsk_gpu_clip_init_contained (GskGpuClip *clip,
const graphene_rect_t *rect)
{
clip->type = GSK_GPU_CLIP_CONTAINED;
gsk_rounded_rect_init_from_rect (&clip->rect, rect, 0);
}
void
gsk_gpu_clip_init_rect (GskGpuClip *clip,
const graphene_rect_t *rect)
@@ -62,6 +54,17 @@ gsk_gpu_clip_intersect_rect (GskGpuClip *dest,
{
GskRoundedRectIntersection res;
if (gsk_rect_contains_rect (rect, &src->rect.bounds))
{
gsk_gpu_clip_init_copy (dest, src);
return TRUE;
}
if (!gsk_rect_intersects (rect, &src->rect.bounds))
{
dest->type = GSK_GPU_CLIP_ALL_CLIPPED;
return TRUE;
}
switch (src->type)
{
case GSK_GPU_CLIP_ALL_CLIPPED:
@@ -69,14 +72,6 @@ gsk_gpu_clip_intersect_rect (GskGpuClip *dest,
break;
case GSK_GPU_CLIP_NONE:
if (gsk_rect_contains_rect (rect, &src->rect.bounds))
{
gsk_gpu_clip_init_copy (dest, src);
return TRUE;
}
G_GNUC_FALLTHROUGH;
case GSK_GPU_CLIP_CONTAINED:
gsk_gpu_clip_init_copy (dest, src);
if (gsk_rect_intersection (&dest->rect.bounds, rect, &dest->rect.bounds))
dest->type = GSK_GPU_CLIP_RECT;
@@ -129,7 +124,6 @@ gsk_gpu_clip_intersect_rounded_rect (GskGpuClip *dest,
break;
case GSK_GPU_CLIP_NONE:
case GSK_GPU_CLIP_CONTAINED:
case GSK_GPU_CLIP_RECT:
res = gsk_rounded_rect_intersect_with_rect (rounded, &src->rect.bounds, &dest->rect);
if (!gsk_gpu_clip_init_after_intersection (dest, res))
@@ -180,7 +174,6 @@ gsk_gpu_clip_transform (GskGpuClip *dest,
return TRUE;
case GSK_GPU_CLIP_NONE:
case GSK_GPU_CLIP_CONTAINED:
case GSK_GPU_CLIP_RECT:
case GSK_GPU_CLIP_ROUNDED:
switch (gsk_transform_get_category (transform))
@@ -253,7 +246,6 @@ gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
return FALSE;
case GSK_GPU_CLIP_NONE:
case GSK_GPU_CLIP_CONTAINED:
case GSK_GPU_CLIP_RECT:
case GSK_GPU_CLIP_ROUNDED:
return gsk_rect_intersects (&self->rect.bounds, &r);
@@ -277,7 +269,6 @@ gsk_gpu_clip_contains_rect (const GskGpuClip *self,
return FALSE;
case GSK_GPU_CLIP_NONE:
case GSK_GPU_CLIP_CONTAINED:
case GSK_GPU_CLIP_RECT:
return gsk_rect_contains_rect (&self->rect.bounds, &r);
@@ -292,7 +283,6 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
const graphene_rect_t *rect)
{
if (self->type == GSK_GPU_CLIP_NONE ||
self->type == GSK_GPU_CLIP_CONTAINED ||
gsk_gpu_clip_contains_rect (self, offset, rect))
return GSK_GPU_SHADER_CLIP_NONE;
else if (self->type == GSK_GPU_CLIP_RECT)
@@ -301,42 +291,3 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
return GSK_GPU_SHADER_CLIP_ROUNDED;
}
gboolean
gsk_gpu_clip_contains_box (const GskGpuClip *self,
const Point *offset,
const Box *box)
{
Box b = box_add (*box, *offset);
switch (self->type)
{
default:
g_assert_not_reached();
case GSK_GPU_CLIP_ALL_CLIPPED:
return FALSE;
case GSK_GPU_CLIP_NONE:
case GSK_GPU_CLIP_CONTAINED:
case GSK_GPU_CLIP_RECT:
return box_contains (box_from_graphene (&self->rect.bounds), b);
case GSK_GPU_CLIP_ROUNDED:
return gsk_rounded_rect_contains_rect (&self->rect, &GRAPHENE_RECT_INIT (box_x0 (b), box_y0 (b), box_width (b), box_height (b)));
}
}
GskGpuShaderClip
gsk_gpu_clip_get_shader_clip2 (const GskGpuClip *self,
const Point *offset,
const Box *box)
{
if (self->type == GSK_GPU_CLIP_NONE ||
self->type == GSK_GPU_CLIP_CONTAINED ||
gsk_gpu_clip_contains_box (self, offset, box))
return GSK_GPU_SHADER_CLIP_NONE;
else if (self->type == GSK_GPU_CLIP_RECT)
return GSK_GPU_SHADER_CLIP_RECT;
else
return GSK_GPU_SHADER_CLIP_ROUNDED;
}
+1 -14
View File
@@ -5,7 +5,6 @@
#include <gdk/gdk.h>
#include <graphene.h>
#include <gsk/gskroundedrect.h>
#include "boxprivate.h"
G_BEGIN_DECLS
@@ -19,9 +18,6 @@ typedef enum {
* to the actual bounds of the underlying framebuffer
*/
GSK_GPU_CLIP_NONE,
/* The clip exists outside the rect, so clipping must
* happen if rendering can't be proven to stay in the rect */
GSK_GPU_CLIP_CONTAINED,
/* The clip is a rectangular area */
GSK_GPU_CLIP_RECT,
/* The clip is a rounded rectangle */
@@ -38,8 +34,6 @@ struct _GskGpuClip
void gsk_gpu_clip_init_empty (GskGpuClip *clip,
const graphene_rect_t *rect);
void gsk_gpu_clip_init_contained (GskGpuClip *clip,
const graphene_rect_t *rect);
void gsk_gpu_clip_init_copy (GskGpuClip *self,
const GskGpuClip *src);
void gsk_gpu_clip_init_rect (GskGpuClip *clip,
@@ -66,16 +60,9 @@ gboolean gsk_gpu_clip_contains_rect (const G
gboolean gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
const graphene_point_t *offset,
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT;
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
const graphene_point_t *offset,
const graphene_rect_t *rect);
gboolean gsk_gpu_clip_contains_box (const GskGpuClip *self,
const Point *offset,
const Box *box) G_GNUC_WARN_UNUSED_RESULT;
GskGpuShaderClip gsk_gpu_clip_get_shader_clip2 (const GskGpuClip *self,
const Point *offset,
const Box *box);
G_END_DECLS
+18 -25
View File
@@ -48,7 +48,7 @@ struct _GskGpuCachedClass
GskGpuCached *cached);
gboolean (* should_collect) (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp);
gint64 timestsamp);
};
struct _GskGpuCached
@@ -285,7 +285,7 @@ gsk_gpu_cached_glyph_free (GskGpuDevice *device,
static gboolean
gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
gint64 timestsamp)
{
/* FIXME */
return FALSE;
@@ -336,7 +336,7 @@ gsk_gpu_device_gc (GskGpuDevice *self,
{
next = cached->next;
if (gsk_gpu_cached_should_collect (self, cached, timestamp))
gsk_gpu_cached_free (self, cached);
gsk_gpu_cached_free (self, priv->first_cached);
}
}
@@ -517,21 +517,15 @@ gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
if (best_slice >= i && i == atlas->n_slices)
{
gsize slice_height;
if (!can_add_slice)
return FALSE;
slice_height = round_up_atlas_size (MAX (height, 4));
if (slice_height > ATLAS_SIZE - y)
return FALSE;
atlas->n_slices++;
if (atlas->n_slices == MAX_SLICES_PER_ATLAS)
slice_height = ATLAS_SIZE - y;
atlas->slices[i].height = ATLAS_SIZE - y;
else
atlas->slices[i].height = round_up_atlas_size (MAX (height, 4));
atlas->slices[i].width = 0;
atlas->slices[i].height = slice_height;
best_y = y;
best_slice = i;
}
@@ -656,7 +650,6 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
graphene_point_t origin;
GskGpuImage *image;
gsize atlas_x, atlas_y, padding;
float subpixel_x, subpixel_y;
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
if (cache)
@@ -668,13 +661,11 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
return cache->image;
}
subpixel_x = (flags & 3) / 4.f;
subpixel_y = ((flags >> 2) & 3) / 4.f;
pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
origin.x = floor (ink_rect.x * scale / PANGO_SCALE + subpixel_x);
origin.y = floor (ink_rect.y * scale / PANGO_SCALE + subpixel_y);
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * scale / PANGO_SCALE + subpixel_x) - origin.x;
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * scale / PANGO_SCALE + subpixel_y) - origin.y;
origin.x = floor (ink_rect.x * scale / PANGO_SCALE);
origin.y = floor (ink_rect.y * scale / PANGO_SCALE);
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * scale / PANGO_SCALE) - origin.x;
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * scale / PANGO_SCALE) - origin.y;
padding = 1;
image = gsk_gpu_device_add_atlas_image (self,
@@ -690,7 +681,10 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
}
else
{
image = gsk_gpu_device_create_upload_image (self, FALSE, GDK_MEMORY_DEFAULT, rect.size.width, rect.size.height),
image = gsk_gpu_device_create_upload_image (self, FALSE, GDK_MEMORY_DEFAULT, rect.size.width, rect.size.height);
if (!image)
return NULL;
rect.origin.x = 0;
rect.origin.y = 0;
padding = 0;
@@ -703,8 +697,8 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
cache->scale = scale,
cache->bounds = rect,
cache->image = image,
cache->origin = GRAPHENE_POINT_INIT (- origin.x + subpixel_x,
- origin.y + subpixel_y);
cache->origin = GRAPHENE_POINT_INIT (- origin.x + (flags & 3) / 4.f,
- origin.y + ((flags >> 2) & 3) / 4.f);
gsk_gpu_upload_glyph_op (frame,
cache->image,
@@ -717,8 +711,8 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
.height = rect.size.height + 2 * padding,
},
scale,
&GRAPHENE_POINT_INIT (cache->origin.x + padding,
cache->origin.y + padding));
&GRAPHENE_POINT_INIT (cache->origin.x + 1,
cache->origin.y + 1));
g_hash_table_insert (priv->glyph_cache, cache, cache);
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
@@ -729,4 +723,3 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */
+92 -98
View File
@@ -43,10 +43,6 @@
#include "gdk/gdkrgbaprivate.h"
#include "scaleprivate.h"
#include "pointprivate.h"
#include "boxprivate.h"
/* A note about coordinate systems
*
* The rendering code keeps track of multiple coordinate systems to optimize rendering as
@@ -326,8 +322,8 @@ rect_round_to_pixels (const graphene_rect_t *src,
*dest = GRAPHENE_RECT_INIT (
x * inv_xscale - pixel_offset->x,
y * inv_yscale - pixel_offset->y,
(ceilf ((src->origin.x + pixel_offset->x + src->size.width) * xscale) - x) * inv_xscale,
(ceilf ((src->origin.y + pixel_offset->y + src->size.height) * yscale) - y) * inv_yscale);
(ceil ((src->origin.x + pixel_offset->x + src->size.width) * xscale) - x) * inv_xscale,
(ceil ((src->origin.y + pixel_offset->y + src->size.height) * yscale) - y) * inv_yscale);
}
static GskGpuImage *
@@ -342,8 +338,8 @@ gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
area.x = 0;
area.y = 0;
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width);
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height);
area.width = ceil (graphene_vec2_get_x (scale) * viewport->size.width);
area.height = ceil (graphene_vec2_get_y (scale) * viewport->size.height);
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
FALSE,
@@ -502,18 +498,6 @@ gsk_gpu_pattern_writer_append_rect (GskGpuPatternWriter *self,
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
}
static void
gsk_gpu_pattern_writer_append_box (GskGpuPatternWriter *self,
const Box box,
const Point offset)
{
float f[4];
box_offset_to_float (box, offset, f);
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
}
static void
gsk_gpu_pattern_writer_append_rgba (GskGpuPatternWriter *self,
const GdkRGBA *rgba)
@@ -1010,8 +994,8 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
if (!gsk_rect_intersection (rect, &clip_rect, &intermediate_rect))
return;
width = ceilf (graphene_vec2_get_x (&self->scale) * intermediate_rect.size.width);
height = ceilf (graphene_vec2_get_y (&self->scale) * intermediate_rect.size.height);
width = ceil (graphene_vec2_get_x (&self->scale) * intermediate_rect.size.width);
height = ceil (graphene_vec2_get_y (&self->scale) * intermediate_rect.size.height);
intermediate = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (self->frame),
FALSE,
@@ -1607,7 +1591,7 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
if (gsk_gpu_clip_contains_rect (&self->clip, &self->offset, &node->bounds))
{
gsk_gpu_clip_init_contained (&self->clip, &child->bounds);
gsk_gpu_clip_init_empty (&self->clip, &child->bounds);
}
else if (old_clip.type == GSK_GPU_CLIP_NONE)
{
@@ -1616,7 +1600,7 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
inverse = gsk_transform_invert (gsk_transform_ref (clip_transform));
gsk_transform_transform_bounds (inverse, &old_clip.rect.bounds, &new_bounds);
gsk_transform_unref (inverse);
gsk_gpu_clip_init_contained (&self->clip, &new_bounds);
gsk_gpu_clip_init_empty (&self->clip, &new_bounds);
}
else if (!gsk_gpu_clip_transform (&self->clip, &old_clip, clip_transform, &child->bounds))
{
@@ -1830,10 +1814,10 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
if (shader_clip != GSK_GPU_SHADER_CLIP_NONE)
{
gsk_rounded_rect_get_largest_cover (&self->clip.rect, &clipped, &cover);
int_clipped.x = ceilf (cover.origin.x * scale_x);
int_clipped.y = ceilf (cover.origin.y * scale_y);
int_clipped.width = floorf ((cover.origin.x + cover.size.width) * scale_x) - int_clipped.x;
int_clipped.height = floorf ((cover.origin.y + cover.size.height) * scale_y) - int_clipped.y;
int_clipped.x = ceil (cover.origin.x * scale_x);
int_clipped.y = ceil (cover.origin.y * scale_y);
int_clipped.width = floor ((cover.origin.x + cover.size.width) * scale_x) - int_clipped.x;
int_clipped.height = floor ((cover.origin.y + cover.size.height) * scale_y) - int_clipped.y;
if (int_clipped.width == 0 || int_clipped.height == 0)
{
gsk_gpu_color_op (self->frame,
@@ -2990,11 +2974,10 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
GskGpuDevice *device;
const PangoGlyphInfo *glyphs;
PangoFont *font;
Point offset;
Scale scale, s4, pango_scale;
graphene_point_t offset;
guint i, num_glyphs;
float scale, inv_scale;
GdkRGBA color;
gboolean glyph_align;
if (self->opacity < 1.0 &&
gsk_text_node_has_color_glyphs (node))
@@ -3003,83 +2986,80 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
return;
}
glyph_align = gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_GLYPH_ALIGN) &&
gsk_transform_get_category (self->modelview) >= GSK_TRANSFORM_CATEGORY_2D;
device = gsk_gpu_frame_get_device (self->frame);
color = *gsk_text_node_get_color (node);
color.alpha *= self->opacity;
num_glyphs = gsk_text_node_get_num_glyphs (node);
glyphs = gsk_text_node_get_glyphs (node, NULL);
font = gsk_text_node_get_font (node);
offset = *gsk_text_node_get_offset (node);
offset.x += self->offset.x;
offset.y += self->offset.y;
offset = point_add (point_from_graphene (gsk_text_node_get_offset (node)),
point_from_graphene (&self->offset));
scale = scale_max (scale_from_graphene (&self->scale));
s4 = scale_mul (scale, scale_from_float (4));
pango_scale = scale_from_float (PANGO_SCALE);
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
inv_scale = 1.f / scale;
for (i = 0; i < num_glyphs; i++)
{
GskGpuImage *image;
graphene_rect_t glyph_bds;
graphene_point_t glyph_ofs;
Box glyph_bounds, glyph_tex_rect;
Point g_ofs, glyph_origin;
graphene_rect_t glyph_bounds, glyph_tex_rect;
graphene_point_t glyph_offset;
guint32 descriptor;
GskGpuGlyphLookupFlags flags;
glyph_origin = point_add (offset, point_div (point (glyphs[i].geometry.x_offset, glyphs[i].geometry.y_offset), pango_scale));
if (glyph_align)
{
glyph_origin = point_round (point_mul (glyph_origin, s4));
flags = ((int) point_x (glyph_origin) & 3) |
(((int) point_y (glyph_origin) & 3) << 2);
glyph_origin = point_div (glyph_origin, s4);
}
else
{
flags = 0;
}
image = gsk_gpu_device_lookup_glyph_image (device,
self->frame,
font,
glyphs[i].glyph,
flags,
scale_x (scale),
&glyph_bds,
&glyph_ofs);
0,
scale,
&glyph_bounds,
&glyph_offset);
glyph_tex_rect = box_div (box_from_rect (-glyph_bds.origin.x, -glyph_bds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), scale);
if (!image)
{
if (GSK_DEBUG_CHECK (FALLBACK))
{
PangoFontDescription *desc;
char *name;
glyph_bounds = box_div (box_from_rect (0, 0, glyph_bds.size.width, glyph_bds.size.height), scale);
desc = pango_font_describe (font);
name = pango_font_description_to_string (desc);
gdk_debug_message ("failed to cache glyph %u for font %s at scale %g",
glyphs[i].glyph,
name,
scale);
g_free (name);
pango_font_description_free (desc);
}
g_ofs = point_from_graphene (&glyph_ofs);
glyph_origin = point_sub (glyph_origin, point_div (g_ofs, scale));
gsk_gpu_node_processor_add_fallback_node (self, node);
return;
}
graphene_rect_scale (&GRAPHENE_RECT_INIT (-glyph_bounds.origin.x, -glyph_bounds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), inv_scale, inv_scale, &glyph_tex_rect);
graphene_rect_scale (&GRAPHENE_RECT_INIT(0, 0, glyph_bounds.size.width, glyph_bounds.size.height), inv_scale, inv_scale, &glyph_bounds);
glyph_offset = GRAPHENE_POINT_INIT (offset.x - glyph_offset.x * inv_scale + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
offset.y - glyph_offset.y * inv_scale + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
descriptor = gsk_gpu_node_processor_add_image (self, image, GSK_GPU_SAMPLER_DEFAULT);
if (glyphs[i].attr.is_color)
gsk_gpu_texture_op (self->frame,
gsk_gpu_clip_get_shader_clip2 (&self->clip, &g_ofs, &glyph_bounds),
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
self->desc,
descriptor,
&GRAPHENE_RECT_INIT (box_x0 (glyph_bounds), box_y0 (glyph_bounds), box_width (glyph_bounds), box_height (glyph_bounds)),
&GRAPHENE_POINT_INIT (point_x (glyph_origin), point_y (glyph_origin)),
&GRAPHENE_RECT_INIT (box_x0 (glyph_tex_rect), box_y0 (glyph_tex_rect), box_width (glyph_tex_rect), box_height (glyph_tex_rect)));
&glyph_bounds,
&glyph_offset,
&glyph_tex_rect);
else
gsk_gpu_colorize_op (self->frame,
gsk_gpu_clip_get_shader_clip2 (&self->clip, &g_ofs, &glyph_bounds),
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
self->desc,
descriptor,
&GRAPHENE_RECT_INIT (box_x0 (glyph_bounds), box_y0 (glyph_bounds), box_width (glyph_bounds), box_height (glyph_bounds)),
&GRAPHENE_POINT_INIT (point_x (glyph_origin), point_y (glyph_origin)),
&GRAPHENE_RECT_INIT (box_x0 (glyph_tex_rect), box_y0 (glyph_tex_rect), box_width (glyph_tex_rect), box_height (glyph_tex_rect)),
&glyph_bounds,
&glyph_offset,
&glyph_tex_rect,
&color);
offset = point_add (offset, point (glyphs[i].geometry.width / (float)PANGO_SCALE, 0));
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
}
}
@@ -3092,10 +3072,10 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
PangoFont *font;
guint num_glyphs;
gsize i;
Scale scale, pango_scale;
float scale, inv_scale;
guint32 tex_id;
GskGpuImage *last_image;
Point offset;
graphene_point_t offset;
if (gsk_text_node_has_color_glyphs (node))
return FALSE;
@@ -3104,11 +3084,12 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
num_glyphs = gsk_text_node_get_num_glyphs (node);
glyphs = gsk_text_node_get_glyphs (node, NULL);
font = gsk_text_node_get_font (node);
offset = *gsk_text_node_get_offset (node);
offset.x += self->offset.x;
offset.y += self->offset.y;
offset = point_add (point_from_graphene (gsk_text_node_get_offset (node)),
point_from_graphene (&self->offset));
scale = scale_max (scale_from_graphene (&self->scale));
pango_scale = scale_from_float (PANGO_SCALE);
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
inv_scale = 1.f / scale;
gsk_gpu_pattern_writer_append_uint (self, GSK_GPU_PATTERN_GLYPHS);
gsk_gpu_pattern_writer_append_rgba (self, gsk_text_node_get_color (node));
@@ -3118,20 +3099,20 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
for (i = 0; i < num_glyphs; i++)
{
GskGpuImage *image;
graphene_rect_t glyph_bds;
graphene_point_t glyph_ofs;
Point glyph_offset;
Box glyph_bounds;
Box glyph_tex_rect;
graphene_rect_t glyph_bounds;
graphene_point_t glyph_offset;
image = gsk_gpu_device_lookup_glyph_image (device,
self->frame,
font,
glyphs[i].glyph,
0,
scale_x (scale),
&glyph_bds,
&glyph_ofs);
scale,
&glyph_bounds,
&glyph_offset);
if (!image)
return FALSE;
if (image != last_image)
{
@@ -3141,15 +3122,28 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
last_image = image;
}
glyph_offset = point_add (point_sub (offset, point_div (glyph_offset, scale)), point_div (point (glyphs[i].geometry.x_offset, glyphs[i].geometry.y_offset), pango_scale));
glyph_offset = GRAPHENE_POINT_INIT (offset.x - glyph_offset.x * inv_scale + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
offset.y - glyph_offset.y * inv_scale + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
glyph_bounds = box_div (box_from_rect (0, 0, glyph_bds.size.width, glyph_bds.size.height), scale);
glyph_tex_rect = box_div (box_from_rect (-glyph_bds.origin.x, - glyph_bds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), scale);
gsk_gpu_pattern_writer_append_uint (self, tex_id);
gsk_gpu_pattern_writer_append_box (self, glyph_bounds, glyph_offset);
gsk_gpu_pattern_writer_append_box (self, glyph_tex_rect, glyph_offset);
gsk_gpu_pattern_writer_append_rect (self,
&GRAPHENE_RECT_INIT (
0,
0,
glyph_bounds.size.width * inv_scale,
glyph_bounds.size.height * inv_scale
),
&glyph_offset);
gsk_gpu_pattern_writer_append_rect (self,
&GRAPHENE_RECT_INIT (
- glyph_bounds.origin.x * inv_scale,
- glyph_bounds.origin.y * inv_scale,
gsk_gpu_image_get_width (image) * inv_scale,
gsk_gpu_image_get_height (image) * inv_scale
),
&glyph_offset);
offset = point_add (offset, point (glyphs[i].geometry.width / (float)PANGO_SCALE, 0));
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
}
return TRUE;
@@ -3277,8 +3271,8 @@ gsk_gpu_node_processor_repeat_tile (GskGpuNodeProcessor *self,
rect,
&self->offset,
&GRAPHENE_RECT_INIT (
clipped_child_bounds.origin.x + x * child_bounds->size.width,
clipped_child_bounds.origin.y + y * child_bounds->size.height,
clipped_child_bounds.origin.x - x * child_bounds->size.width,
clipped_child_bounds.origin.y - y * child_bounds->size.height,
clipped_child_bounds.size.width,
clipped_child_bounds.size.height
));
-1
View File
@@ -30,7 +30,6 @@ static const GdkDebugKey gsk_gpu_optimization_keys[] = {
{ "blit", GSK_GPU_OPTIMIZE_BLIT, "Use shaders instead of vkCmdBlit()/glBlitFramebuffer()" },
{ "gradients", GSK_GPU_OPTIMIZE_GRADIENTS, "Don't supersample gradients" },
{ "mipmap", GSK_GPU_OPTIMIZE_MIPMAP, "Avoid creating mipmaps" },
{ "glyph-align", GSK_GPU_OPTIMIZE_GLYPH_ALIGN, "Never align glyphs to the subpixel grid" },
{ "gl-baseinstance", GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE, "Assume no ARB/EXT_base_instance support" },
};
+1 -2
View File
@@ -117,8 +117,7 @@ typedef enum {
GSK_GPU_OPTIMIZE_BLIT = 1 << 3,
GSK_GPU_OPTIMIZE_GRADIENTS = 1 << 4,
GSK_GPU_OPTIMIZE_MIPMAP = 1 << 5,
GSK_GPU_OPTIMIZE_GLYPH_ALIGN = 1 << 6,
/* These require hardware support */
GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE = 1 << 7,
GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE = 1 << 6,
} GskGpuOptimizations;
-17
View File
@@ -132,20 +132,3 @@ gsk_rect_round_larger (graphene_rect_t *rect)
ceil (rect->origin.y + rect->size.height) - y);
}
static inline void
gsk_rect_scale (const graphene_rect_t *r,
float sx,
float sy,
graphene_rect_t *res)
{
if (G_UNLIKELY (sx < 0 || sy < 0))
{
graphene_rect_scale (r, sx, sy, res);
return;
}
res->origin.x = r->origin.x * sx;
res->origin.y = r->origin.y * sy;
res->size.width = r->size.width * sx;
res->size.height = r->size.height * sy;
}
-10
View File
@@ -3335,7 +3335,6 @@ gsk_container_node_new (GskRenderNode **children,
self->children = g_malloc_n (n_children, sizeof (GskRenderNode *));
self->children[0] = gsk_render_node_ref (children[0]);
node->offscreen_for_opacity = children[0]->offscreen_for_opacity;
gsk_rect_init_from_rect (&bounds, &(children[0]->bounds));
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth,
gsk_render_node_get_preferred_depth (children[0]));
@@ -4092,7 +4091,6 @@ gsk_repeat_node_draw_tiled (cairo_t *cr,
const graphene_rect_t *child_bounds)
{
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
cairo_save (cr);
/* reset the clip so we get an unclipped pattern for repeating */
@@ -4109,11 +4107,6 @@ gsk_repeat_node_draw_tiled (cairo_t *cr,
cairo_restore (cr);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_pattern_get_matrix (pattern, &matrix);
cairo_matrix_translate (&matrix,
- x * child_bounds->size.width,
- y * child_bounds->size.height);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
@@ -5665,7 +5658,6 @@ struct _GskTextNode
{
GskRenderNode render_node;
PangoFontMap *fontmap;
PangoFont *font;
gboolean has_color_glyphs;
@@ -5683,7 +5675,6 @@ gsk_text_node_finalize (GskRenderNode *node)
GskRenderNodeClass *parent_class = g_type_class_peek (g_type_parent (GSK_TYPE_TEXT_NODE));
g_object_unref (self->font);
g_object_unref (self->fontmap);
g_free (self->glyphs);
parent_class->finalize (node);
@@ -5797,7 +5788,6 @@ gsk_text_node_new (PangoFont *font,
node = (GskRenderNode *) self;
node->offscreen_for_opacity = FALSE;
self->fontmap = g_object_ref (pango_font_get_font_map (font));
self->font = g_object_ref (font);
self->color = *color;
self->offset = *offset;
+35 -306
View File
@@ -46,20 +46,12 @@
#include <cairo-script-interpreter.h>
#endif
#include <pango/pangocairo.h>
#ifdef HAVE_PANGOFT
#include <pango/pangofc-fontmap.h>
#endif
#include <glib/gstdio.h>
typedef struct _Context Context;
struct _Context
{
GHashTable *named_nodes;
GHashTable *named_textures;
PangoFontMap *fontmap;
};
typedef struct _Declaration Declaration;
@@ -73,7 +65,7 @@ struct _Declaration
};
static void
context_init (Context *context)
context_init (Context *context)
{
memset (context, 0, sizeof (Context));
}
@@ -83,7 +75,6 @@ context_finish (Context *context)
{
g_clear_pointer (&context->named_nodes, g_hash_table_unref);
g_clear_pointer (&context->named_textures, g_hash_table_unref);
g_clear_object (&context->fontmap);
}
static gboolean
@@ -853,35 +844,20 @@ parse_mask_mode (GtkCssParser *parser,
}
static PangoFont *
font_from_string (PangoFontMap *fontmap,
const char *string)
font_from_string (const char *string)
{
PangoFontDescription *desc;
PangoContext *ctx;
PangoFontMap *font_map;
PangoContext *context;
PangoFont *font;
desc = pango_font_description_from_string (string);
ctx = pango_font_map_create_context (fontmap);
font = pango_font_map_load_font (fontmap, ctx, desc);
g_object_unref (ctx);
if (font)
{
PangoFontDescription *desc2;
const char *family, *family2;
desc2 = pango_font_describe (font);
family = pango_font_description_get_family (desc);
family2 = pango_font_description_get_family (desc2);
if (g_strcmp0 (family, family2) != 0)
g_clear_object (&font);
pango_font_description_free (desc2);
}
font_map = pango_cairo_font_map_get_default ();
context = pango_font_map_create_context (font_map);
font = pango_font_map_load_font (font_map, context, desc);
pango_font_description_free (desc);
g_object_unref (context);
return font;
}
@@ -950,229 +926,30 @@ create_ascii_glyphs (PangoFont *font)
return result;
}
#ifdef HAVE_PANGOFT
static void
delete_file (gpointer data)
{
char *path = data;
g_remove (path);
g_free (path);
}
static void
ensure_fontmap (Context *context)
{
FcConfig *config;
GPtrArray *files;
if (context->fontmap)
return;
context->fontmap = pango_cairo_font_map_new ();
config = FcInitLoadConfig ();
pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (context->fontmap), config);
FcConfigDestroy (config);
files = g_ptr_array_new_with_free_func (delete_file);
g_object_set_data_full (G_OBJECT (context->fontmap), "font-files", files, (GDestroyNotify) g_ptr_array_unref);
}
static gboolean
add_font_from_file (Context *context,
const char *path,
GError **error)
{
FcConfig *config;
GPtrArray *files;
ensure_fontmap (context);
if (!PANGO_IS_FC_FONT_MAP (context->fontmap))
{
g_set_error (error,
GTK_CSS_PARSER_ERROR,
GTK_CSS_PARSER_ERROR_FAILED,
"Custom fonts are not implemented for %s", G_OBJECT_TYPE_NAME (context->fontmap));
return FALSE;
}
config = pango_fc_font_map_get_config (PANGO_FC_FONT_MAP (context->fontmap));
if (!FcConfigAppFontAddFile (config, (FcChar8 *) path))
{
g_set_error (error,
GTK_CSS_PARSER_ERROR,
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
"Failed to load font");
return FALSE;
}
files = (GPtrArray *) g_object_get_data (G_OBJECT (context->fontmap), "font-files");
g_ptr_array_add (files, g_strdup (path));
pango_fc_font_map_config_changed (PANGO_FC_FONT_MAP (context->fontmap));
return TRUE;
}
static gboolean
add_font_from_bytes (Context *context,
GBytes *bytes,
GError **error)
{
GFile *file;
GIOStream *iostream;
GOutputStream *ostream;
gboolean result;
file = g_file_new_tmp ("gtk4-font-XXXXXX.ttf", (GFileIOStream **) &iostream, error);
if (!file)
return FALSE;
ostream = g_io_stream_get_output_stream (iostream);
if (g_output_stream_write_bytes (ostream, bytes, NULL, error) == -1)
{
g_object_unref (file);
g_object_unref (iostream);
return FALSE;
}
g_io_stream_close (iostream, NULL, NULL);
g_object_unref (iostream);
result = add_font_from_file (context, g_file_peek_path (file), error);
g_object_unref (file);
return result;
}
#else /* !HAVE_PANGOFT */
static gboolean
add_font_from_bytes (Context *context,
GBytes *bytes,
GError **error)
{
g_set_error (error,
GTK_CSS_PARSER_ERROR,
GTK_CSS_PARSER_ERROR_FAILED,
"Not implemented");
return FALSE;
}
#endif
static gboolean
parse_font (GtkCssParser *parser,
Context *context,
gpointer out_font)
{
PangoFont *font = NULL;
char *font_name;
PangoFont *font;
char *s;
font_name = gtk_css_parser_consume_string (parser);
if (font_name == NULL)
s = gtk_css_parser_consume_string (parser);
if (s == NULL)
return FALSE;
if (context->fontmap)
font = font_from_string (context->fontmap, font_name);
if (gtk_css_parser_has_url (parser))
{
char *url;
if (font != NULL)
{
gtk_css_parser_error_value (parser, "A font with this name already exists.");
/* consume the url to avoid more errors */
url = gtk_css_parser_consume_url (parser);
g_free (url);
}
else
{
char *scheme;
GBytes *bytes;
GError *error = NULL;
GtkCssLocation start_location;
gboolean success = FALSE;
start_location = *gtk_css_parser_get_start_location (parser);
url = gtk_css_parser_consume_url (parser);
if (url != NULL)
{
scheme = g_uri_parse_scheme (url);
if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
{
bytes = gtk_css_data_url_parse (url, NULL, &error);
}
else
{
GFile *file;
file = g_file_new_for_uri (url);
bytes = g_file_load_bytes (file, NULL, NULL, &error);
g_object_unref (file);
}
g_free (scheme);
g_free (url);
if (bytes != NULL)
{
success = add_font_from_bytes (context, bytes, &error);
g_bytes_unref (bytes);
}
if (!success)
{
gtk_css_parser_emit_error (parser,
&start_location,
gtk_css_parser_get_end_location (parser),
error);
}
}
if (success)
{
font = font_from_string (context->fontmap, font_name);
if (!font)
{
gtk_css_parser_error (parser,
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
&start_location,
gtk_css_parser_get_end_location (parser),
"The given url does not define a font named \"%s\"",
font_name);
}
}
}
}
else
{
if (!font)
font = font_from_string (pango_cairo_font_map_get_default (), font_name);
if (!font)
gtk_css_parser_error_value (parser, "The font \"%s\" does not exist", font_name);
}
g_free (font_name);
if (font)
{
*((PangoFont**)out_font) = font;
return TRUE;
}
else
font = font_from_string (s);
if (font == NULL)
{
gtk_css_parser_error_syntax (parser, "This font does not exist.");
return FALSE;
}
*((PangoFont**)out_font) = font;
g_free (s);
return TRUE;
}
static void
@@ -2236,7 +2013,7 @@ parse_text_node (GtkCssParser *parser,
if (font == NULL)
{
font = font_from_string (pango_cairo_font_map_get_default (), "Cantarell 11");
font = font_from_string ("Cantarell 11");
g_assert (font);
}
@@ -2852,7 +2629,6 @@ typedef struct
gsize named_node_counter;
GHashTable *named_textures;
gsize named_texture_counter;
GHashTable *serialized_fonts;
} Printer;
static void
@@ -3005,7 +2781,6 @@ printer_init (Printer *self,
self->named_node_counter = 0;
self->named_textures = g_hash_table_new_full (NULL, NULL, NULL, g_free);
self->named_texture_counter = 0;
self->serialized_fonts = g_hash_table_new (g_str_hash, g_str_equal);
printer_init_duplicates_for_node (self, node);
}
@@ -3017,7 +2792,6 @@ printer_clear (Printer *self)
g_string_free (self->str, TRUE);
g_hash_table_unref (self->named_nodes);
g_hash_table_unref (self->named_textures);
g_hash_table_unref (self->serialized_fonts);
}
#define IDENT_LEVEL 2 /* Spaces per level */
@@ -3461,59 +3235,6 @@ append_texture_param (Printer *p,
g_bytes_unref (bytes);
}
static void
gsk_text_node_serialize_font (GskRenderNode *node,
Printer *p)
{
PangoFont *font = gsk_text_node_get_font (node);
PangoFontMap *fontmap = pango_font_get_font_map (font);
PangoFontDescription *desc;
char *s;
desc = pango_font_describe (font);
s = pango_font_description_to_string (desc);
g_string_append_printf (p->str, "\"%s\"", s);
g_free (s);
pango_font_description_free (desc);
/* Check if this is a custom font that we created from a url */
if (!g_object_get_data (G_OBJECT (fontmap), "font-files"))
return;
#ifdef HAVE_PANGOFT
{
FcPattern *pat;
FcResult res;
const char *file;
char *data;
gsize len;
char *b64;
pat = pango_fc_font_get_pattern (PANGO_FC_FONT (font));
res = FcPatternGetString (pat, FC_FILE, 0, (FcChar8 **)&file);
if (res != FcResultMatch)
return;
if (g_hash_table_contains (p->serialized_fonts, file))
return;
if (!g_file_get_contents (file, &data, &len, NULL))
return;
g_hash_table_add (p->serialized_fonts, (gpointer) file);
b64 = base64_encode_with_linebreaks ((const guchar *) data, len);
g_string_append (p->str, " url(\"data:font/ttf;base64,");
append_escaping_newlines (p->str, b64);
g_string_append (p->str, "\")");
g_free (b64);
g_free (data);
}
#endif
}
void
gsk_text_node_serialize_glyphs (GskRenderNode *node,
GString *p)
@@ -4067,21 +3788,29 @@ render_node_print (Printer *p,
{
const graphene_point_t *offset = gsk_text_node_get_offset (node);
const GdkRGBA *color = gsk_text_node_get_color (node);
PangoFont *font = gsk_text_node_get_font (node);
PangoFontDescription *desc;
char *font_name;
start_node (p, "text", node_name);
if (!gdk_rgba_equal (color, &GDK_RGBA ("000000")))
if (!gdk_rgba_equal (color, &GDK_RGBA("000000")))
append_rgba_param (p, "color", color);
_indent (p);
g_string_append (p->str, "font: ");
gsk_text_node_serialize_font (node, p);
g_string_append (p->str, ";\n");
desc = pango_font_describe (font);
font_name = pango_font_description_to_string (desc);
g_string_append_printf (p->str, "font: \"%s\";\n", font_name);
g_free (font_name);
pango_font_description_free (desc);
_indent (p);
g_string_append (p->str, "glyphs: ");
gsk_text_node_serialize_glyphs (node, p->str);
g_string_append (p->str, ";\n");
g_string_append_c (p->str, ';');
g_string_append_c (p->str, '\n');
if (!graphene_point_equal (offset, graphene_point_zero ()))
append_point_param (p, "offset", offset);
+1
View File
@@ -6,3 +6,4 @@
GskRenderNode * gsk_render_node_deserialize_from_bytes (GBytes *bytes,
GskParseErrorFunc error_func,
gpointer user_data);
+2 -2
View File
@@ -311,8 +311,8 @@ gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
graphene_rect_scale (&src->bounds, scale_x, scale_y, &dest->bounds);
graphene_rect_offset (&dest->bounds, dx, dy);
scale_x = fabsf (scale_x);
scale_y = fabsf (scale_y);
scale_x = fabs (scale_x);
scale_y = fabs (scale_y);
for (guint i = 0; i < 4; i++)
{
-22
View File
@@ -1,22 +0,0 @@
/* GSK - The GTK Scene Kit
* Copyright 2024 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
typedef struct _Scale Scale;
typedef struct _Point Point;
typedef struct _Box Box;
-252
View File
@@ -1,252 +0,0 @@
#pragma once
#include "gsktypesprivate.h"
#include <graphene.h>
#include <math.h>
#include <smmintrin.h>
#include "scaleprivate.h"
#ifndef USE_SIMD
struct _Point
{
float x, y;
};
static inline float
point_x (const Point p)
{
return p.x;
}
static inline float
point_y (const Point p)
{
return p.y;
}
static inline Point
point (float x,
float y)
{
return (Point) { .x = x, .y = y };
}
static inline Point
point_from_graphene (const graphene_point_t *p)
{
return point (p->x, p->y);
}
static inline void
point_to_float (const Point p,
float v[2])
{
v[0] = p.x;
v[1] = p.y;
}
static inline Point
point_zero (void)
{
return point (0, 0);
}
static inline Point
point_neg (const Point p)
{
return (Point) { .x = -p.x, .y = -p.y };
}
static inline Point
point_mul (const Point p,
const Scale s)
{
return (Point) { .x = p.x * s.x, .y = p.y * s.y };
}
static inline Point
point_div (const Point p,
const Scale s)
{
return (Point) { .x = p.x / s.x, .y = p.y / s.y };
}
static inline Point
point_add (const Point p1,
const Point p2)
{
return (Point) { .x = p1.x + p2.x, .y = p1.y + p2.y };
}
static inline Point
point_sub (const Point p1,
const Point p2)
{
return (Point) { .x = p1.x - p2.x, .y = p1.y - p2.y };
}
static inline Point
point_floor (const Point p)
{
return (Point) { .x = floorf (p.x), .y = floorf (p.y) };
}
static inline Point
point_ceil (const Point p)
{
return (Point) { .x = ceilf (p.x), .y = ceilf (p.y) };
}
static inline Point
point_round (const Point p)
{
return (Point) { .x = roundf (p.x), .y = roundf (p.y) };
}
#else /* USE_SIMD */
#include <smmintrin.h>
struct _Point
{
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
};
static inline float
point_x (const Point p)
{
return graphene_simd4f_get_x (p.v);
}
static inline float
point_y (const Point p)
{
return graphene_simd4f_get_y (p.v);
}
static inline Point
point (float x,
float y)
{
return (Point) { .v = graphene_simd4f_init (x, y, 0.f, 0.f) };
}
static inline Point
point_from_graphene (const graphene_point_t *p)
{
return point (p->x, p->y);
}
static inline void
point_to_float (const Point p,
float v[2])
{
graphene_simd4f_dup_2f (p.v, v);
}
static inline Point
point_zero (void)
{
return point (0, 0);
}
static inline Point
point_neg (const Point p)
{
return (Point) { .v = graphene_simd4f_neg (p.v) };
}
static inline Point
point_mul (const Point p,
const Scale s)
{
return (Point) { .v = graphene_simd4f_mul (p.v, s.v) };
}
static inline Point
point_div (const Point p,
const Scale s)
{
return (Point) { .v = graphene_simd4f_div (p.v, s.v) };
}
static inline Point
point_add (const Point p1,
const Point p2)
{
return (Point) { .v = graphene_simd4f_add (p1.v, p2.v) };
}
static inline Point
point_sub (const Point p1,
const Point p2)
{
return (Point) { .v = graphene_simd4f_sub (p1.v, p2.v) };
}
#ifdef __SSE4_1__
#ifndef graphene_simd4f_floor
# define graphene_simd4f_floor(v) \
(__extension__ ({ \
(graphene_simd4f_t) _mm_floor_ps ((v)); \
}))
#endif
#ifndef graphene_simd4f_ceil
# define graphene_simd4f_ceil(v) \
(__extension__ ({ \
(graphene_simd4f_t) _mm_ceil_ps ((v)); \
}))
#endif
#ifndef graphene_simd4f_round
# define graphene_simd4f_round(v) \
(__extension__ ({ \
(graphene_simd4f_t) _mm_round_ps ((v)); \
}))
#endif
static inline Point
point_floor (const Point p)
{
return (Point) { .v = graphene_simd4f_floor (p.v) };
}
static inline Point
point_ceil (const Point p)
{
return (Point) { .v = graphene_simd4f_ceil (p.v) };
}
static inline Point
point_round (const Point p)
{
return (Point) { .v = graphene_simd4f_round (p.v) };
}
#else
static inline Point
point_floor (const Point p)
{
return point (floorf (point_x (p)), floorf (point_y (p)));
}
static inline Point
point_ceil (const Point p)
{
return point (ceilf (point_x (p)), ceilf (point_y (p)));
}
static inline Point
point_round (const Point p)
{
return point (roundf (point_x (p)), roundf (point_y (p)));
}
#endif
#endif
-183
View File
@@ -1,183 +0,0 @@
#pragma once
#include "gsktypesprivate.h"
#include <graphene.h>
#include <math.h>
#ifndef USE_SIMD
struct _Scale
{
float x, y;
};
static inline float
scale_x (const Scale s)
{
return s.x;
}
static inline float
scale_y (const Scale s)
{
return s.y;
}
static inline Scale
scale (float x,
float y)
{
return (Scale) { .x = x, .y = y };
}
static inline Scale
scale_from_float (float s)
{
return scale (s, s);
}
static inline Scale
scale_from_graphene (const graphene_vec2_t *v)
{
return (Scale) { .x = graphene_vec2_get_x (v), .y = graphene_vec2_get_y (v) };
}
static inline void
scale_to_float (const Scale s,
float v[2])
{
v[0] = s.x;
v[1] = s.y;
}
static inline gboolean
scale_equal (const Scale s1,
const Scale s2)
{
return (gboolean) (s1.x == s2.x && s1.y == s2.y);
}
static inline Scale
scale_one (void)
{
return scale (1, 1);
}
static inline Scale
scale_inv (const Scale s)
{
return (Scale) { .x = 1 / s.x, .y = 1 / s.y };
}
static inline Scale
scale_mul (const Scale s1,
const Scale s2)
{
return (Scale) { .x = s1.x * s2.x, .y = s1.y * s2.y };
}
static inline Scale
scale_div (const Scale s1,
const Scale s2)
{
return (Scale) { .x = s1.x / s2.x, .y = s1.y / s2.y };
}
static inline Scale
scale_max (const Scale s)
{
return (Scale) { .x = MAX (s.x, s.y), .y = MAX (s.x, s.y) };
}
#else /* USE_SIMD */
struct _Scale
{
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
};
static inline float
scale_x (const Scale s)
{
return graphene_simd4f_get_x (s.v);
}
static inline float
scale_y (const Scale s)
{
return graphene_simd4f_get_y (s.v);
}
static inline Scale
scale (float x,
float y)
{
return (Scale) { .v = graphene_simd4f_init (x, y, 0.f, 0.f) };
}
static inline Scale
scale_from_float (float s)
{
return scale (s, s);
}
static inline Scale
scale_from_graphene (const graphene_vec2_t *v)
{
return (Scale) { .v = v->__graphene_private_value };
}
static inline void
scale_to_float (const Scale s,
float v[2])
{
graphene_simd4f_dup_2f (s.v, v);
}
static inline gboolean
scale_equal (const Scale s1,
const Scale s2)
{
return (gboolean) graphene_simd4f_cmp_eq (s1.v, s2.v);
}
static inline Scale
scale_one (void)
{
return scale (1, 1);
}
static inline Scale
scale_inv (const Scale s)
{
return (Scale) { .v = graphene_simd4f_reciprocal (s.v) };
}
static inline Scale
scale_mul (const Scale s1,
const Scale s2)
{
return (Scale) { .v = graphene_simd4f_mul (s1.v, s2.v) };
}
static inline Scale
scale_div (const Scale s1,
const Scale s2)
{
return (Scale) { .v = graphene_simd4f_div (s1.v, s2.v) };
}
#ifndef graphene_simd4f_shuffle_yxzw
# define graphene_simd4f_shuffle_yxzw(v) \
(__extension__ ({ \
(graphene_simd4f_t) _mm_shuffle_ps ((v), (v), _MM_SHUFFLE (3, 2, 0, 1)); \
}))
#endif
static inline Scale
scale_max (const Scale s)
{
return (Scale) { .v = graphene_simd4f_max (graphene_simd4f_shuffle_yxzw (s.v), s.v) };
}
#endif
-8
View File
@@ -957,14 +957,6 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
return 1;
}
gboolean
gtk_css_parser_has_url (GtkCssParser *self)
{
return gtk_css_parser_has_token (self, GTK_CSS_TOKEN_URL)
|| gtk_css_parser_has_token (self, GTK_CSS_TOKEN_BAD_URL)
|| gtk_css_parser_has_function (self, "url");
}
/**
* gtk_css_parser_consume_url:
* @self: a `GtkCssParser`
-1
View File
@@ -116,7 +116,6 @@ gboolean gtk_css_parser_has_token (GtkCssParser
GtkCssTokenType token_type);
gboolean gtk_css_parser_has_ident (GtkCssParser *self,
const char *ident);
gboolean gtk_css_parser_has_url (GtkCssParser *self);
gboolean gtk_css_parser_has_number (GtkCssParser *self);
gboolean gtk_css_parser_has_integer (GtkCssParser *self);
gboolean gtk_css_parser_has_function (GtkCssParser *self,
+1 -1
View File
@@ -191,7 +191,7 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
PROP_ACCEL_MODS,
g_param_spec_flags ("accel-mods", NULL, NULL,
GDK_TYPE_MODIFIER_TYPE,
GDK_NO_MODIFIER_MASK,
0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
+1 -1
View File
@@ -403,7 +403,7 @@ gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
GError **error)
{
g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
g_return_val_if_fail (file == NULL || G_IS_FILE (file), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return GTK_FILE_CHOOSER_GET_IFACE (chooser)->set_current_folder (chooser, file, error);
+2 -2
View File
@@ -257,14 +257,14 @@ gtk_application_startup (GApplication *g_application)
before2 = GDK_PROFILER_CURRENT_TIME;
gtk_init ();
gdk_profiler_end_mark (before2, "gtk_init", NULL);
gdk_profiler_end_mark (before2, "gtk init", NULL);
priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
gtk_application_impl_startup (priv->impl, priv->register_session);
gtk_application_load_resources (application);
gdk_profiler_end_mark (before, "Application startup", NULL);
gdk_profiler_end_mark (before, "gtk application startup", NULL);
}
static void
+16
View File
@@ -1355,6 +1355,22 @@ gtk_at_context_get_text_accumulate (GtkATContext *self,
}
}
/* Step 2.G */
if (GTK_IS_LABEL (self->accessible))
{
const char *text = gtk_label_get_text (GTK_LABEL (self->accessible));
if (text && not_just_space (text))
append_with_space (res, text);
return;
}
else if (GTK_IS_INSCRIPTION (self->accessible))
{
const char *text = gtk_inscription_get_text (GTK_INSCRIPTION (self->accessible));
if (text && not_just_space (text))
append_with_space (res, text);
return;
}
/* Step 2.I */
if (GTK_IS_WIDGET (self->accessible))
{
+1 -1
View File
@@ -2251,7 +2251,7 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
guint64 after = GDK_PROFILER_CURRENT_TIME;
if (after - before > 500000) /* half a millisecond */
{
gdk_profiler_add_mark (before, after - before, "Builder load", filename);
gdk_profiler_add_mark (before, after - before, "builder load", filename);
}
}
}
+4 -14
View File
@@ -269,12 +269,11 @@ gtk_column_view_cell_widget_size_allocate (GtkWidget *widget,
}
}
/* This should be to be called when unsetting the parent, but we have no
* set_parent vfunc().
*/
void
gtk_column_view_cell_widget_unset_column (GtkColumnViewCellWidget *self)
static void
gtk_column_view_cell_widget_dispose (GObject *object)
{
GtkColumnViewCellWidget *self = GTK_COLUMN_VIEW_CELL_WIDGET (object);
if (self->column)
{
gtk_column_view_column_remove_cell (self->column, self);
@@ -289,15 +288,6 @@ gtk_column_view_cell_widget_unset_column (GtkColumnViewCellWidget *self)
g_clear_object (&self->column);
}
}
static void
gtk_column_view_cell_widget_dispose (GObject *object)
{
GtkColumnViewCellWidget *self = GTK_COLUMN_VIEW_CELL_WIDGET (object);
/* unset_parent() forgot to call this. Be very angry. */
g_warn_if_fail (self->column == NULL);
G_OBJECT_CLASS (gtk_column_view_cell_widget_parent_class)->dispose (object);
}
-1
View File
@@ -46,6 +46,5 @@ void gtk_column_view_cell_widget_remove (
GtkColumnViewCellWidget * gtk_column_view_cell_widget_get_next (GtkColumnViewCellWidget *self);
GtkColumnViewCellWidget * gtk_column_view_cell_widget_get_prev (GtkColumnViewCellWidget *self);
GtkColumnViewColumn * gtk_column_view_cell_widget_get_column (GtkColumnViewCellWidget *self);
void gtk_column_view_cell_widget_unset_column (GtkColumnViewCellWidget *self);
G_END_DECLS
-3
View File
@@ -592,9 +592,6 @@ void
gtk_column_view_row_widget_remove_child (GtkColumnViewRowWidget *self,
GtkWidget *child)
{
if (GTK_IS_COLUMN_VIEW_CELL_WIDGET (child))
gtk_column_view_cell_widget_unset_column (GTK_COLUMN_VIEW_CELL_WIDGET (child));
gtk_widget_unparent (child);
}
+1 -1
View File
@@ -1363,7 +1363,7 @@ gtk_css_node_validate (GtkCssNode *cssnode)
if (GDK_PROFILER_IS_RUNNING)
{
gdk_profiler_end_mark (before, "Validate CSS", "");
gdk_profiler_end_mark (before, "css validation", "");
gdk_profiler_set_int_counter (invalidated_nodes_counter, invalidated_nodes);
gdk_profiler_set_int_counter (created_styles_counter, created_styles);
invalidated_nodes = 0;
+2 -2
View File
@@ -1016,7 +1016,7 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
}
#endif
gdk_profiler_end_mark (before, "Create CSS selector tree", NULL);
gdk_profiler_end_mark (before, "create selector tree", NULL);
}
static void
@@ -1081,7 +1081,7 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
if (GDK_PROFILER_IS_RUNNING)
{
char *uri = g_file_get_uri (file);
gdk_profiler_end_mark (before, "CSS theme load", uri);
gdk_profiler_end_mark (before, "theme load", uri);
g_free (uri);
}
}
+2 -2
View File
@@ -75,7 +75,7 @@
*
* // This widget accepts two types of drop types: GFile objects
* // and GdkPixbuf objects
* gtk_drop_target_set_gtypes (target, (GType [2]) {
* gtk_drop_target_set_gtypes (target, (GTypes [2]) {
* G_TYPE_FILE,
* GDK_TYPE_PIXBUF,
* }, 2);
@@ -935,7 +935,7 @@ gtk_drop_target_get_formats (GtkDropTarget *self)
* that can be dropped on the target
* @n_types: number of @types
*
* Sets the supported `GType`s for this drop target.
* Sets the supported `GTypes` for this drop target.
*/
void
gtk_drop_target_set_gtypes (GtkDropTarget *self,
+2 -2
View File
@@ -761,7 +761,7 @@ populate_emoji_chooser (gpointer data)
now = g_get_monotonic_time ();
if (now > start + 200) /* 2 ms */
{
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "Emojichooser populate", NULL);
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate");
return G_SOURCE_CONTINUE;
}
}
@@ -771,7 +771,7 @@ populate_emoji_chooser (gpointer data)
chooser->box = NULL;
chooser->populate_idle = 0;
gdk_profiler_end_mark (start, "Emojichooser populate (finish)", NULL);
gdk_profiler_end_mark (start, "emojichooser", "populate (finish)");
return G_SOURCE_REMOVE;
}
+4 -7
View File
@@ -1803,19 +1803,16 @@ typedef enum { /*< prefix=GTK_ACCESSIBLE_SORT >*/
/**
* GtkPopoverMenuFlags:
* @GTK_POPOVER_MENU_SLIDING: Submenus are presented as sliding submenus that
* replace the main menu.
* @GTK_POPOVER_MENU_NESTED: Submenus are presented as traditional, nested
* popovers.
* @GTK_POPOVER_MENU_NESTED: Create submenus as nested
* popovers. Without this flag, submenus are created as
* sliding pages that replace the main menu.
*
* Flags that affect how [class@Gtk.PopoverMenu] widgets built from
* a [class@Gio.MenuModel] are created and displayed.
*
* Since: 4.14
*/
typedef enum { /*< prefix=GTK_POPOVER_MENU >*/
GTK_POPOVER_MENU_SLIDING = 0,
GTK_POPOVER_MENU_NESTED = 1 << 0
} GtkPopoverMenuFlags;
G_END_DECLS
+40 -163
View File
@@ -162,45 +162,6 @@
* ```
*/
typedef struct _WeakRefGuard WeakRefGuard;
struct _WeakRefGuard
{
gatomicrefcount ref_count;
gpointer data;
};
static WeakRefGuard *
weak_ref_guard_new (gpointer data)
{
WeakRefGuard *guard;
guard = g_new0 (WeakRefGuard, 1);
g_atomic_ref_count_init (&guard->ref_count);
guard->data = data;
return guard;
}
static WeakRefGuard *
weak_ref_guard_ref (WeakRefGuard *guard)
{
g_atomic_ref_count_inc (&guard->ref_count);
return guard;
}
static void
weak_ref_guard_unref (WeakRefGuard *guard)
{
/* Always clear data pointer after first unref so that it
* cannot be accessed unless both the expression/watch is
* valid _and_ the weak ref is still active.
*/
guard->data = NULL;
if (g_atomic_ref_count_dec (&guard->ref_count))
g_free (guard);
}
typedef struct _GtkExpressionClass GtkExpressionClass;
typedef struct _GtkExpressionSubWatch GtkExpressionSubWatch;
@@ -269,8 +230,7 @@ struct _GtkExpressionTypeInfo
struct _GtkExpressionWatch
{
GtkExpression *expression;
WeakRefGuard *guard;
GWeakRef this_wr;
GObject *this;
GDestroyNotify user_destroy;
GtkExpressionNotify notify;
gpointer user_data;
@@ -943,8 +903,7 @@ struct _GtkObjectExpression
{
GtkExpression parent;
WeakRefGuard *guard;
GWeakRef object_wr;
GObject *object;
GSList *watches;
};
@@ -958,50 +917,26 @@ static void
gtk_object_expression_weak_ref_cb (gpointer data,
GObject *object)
{
WeakRefGuard *guard = data;
GtkObjectExpression *self = guard->data;
GtkObjectExpression *self = (GtkObjectExpression *) data;
GSList *l;
if (self != NULL)
self->object = NULL;
for (l = self->watches; l; l = l->next)
{
GSList *iter = self->watches;
GtkObjectExpressionWatch *owatch = l->data;
while (iter)
{
GtkObjectExpressionWatch *owatch = iter->data;
iter = iter->next;
owatch->notify (owatch->user_data);
}
owatch->notify (owatch->user_data);
}
weak_ref_guard_unref (guard);
}
static void
gtk_object_expression_finalize (GtkExpression *expr)
{
GtkObjectExpression *self = (GtkObjectExpression *) expr;
GObject *object;
object = g_weak_ref_get (&self->object_wr);
if (object != NULL)
{
g_object_weak_unref (object, gtk_object_expression_weak_ref_cb, self->guard);
weak_ref_guard_unref (self->guard);
g_object_unref (object);
}
else
{
/* @object has been disposed. Which means that either our
* gtk_object_expression_weak_ref_cb has been called or we
* can expect it to be called shortly after this. No need to
* call g_object_weak_unref() or unref the handle which will
* be unref'ed by that callback.
*/
}
g_clear_pointer (&self->guard, weak_ref_guard_unref);
g_weak_ref_clear (&self->object_wr);
if (self->object)
g_object_weak_unref (self->object, gtk_object_expression_weak_ref_cb, self);
g_assert (self->watches == NULL);
@@ -1020,14 +955,12 @@ gtk_object_expression_evaluate (GtkExpression *expr,
GValue *value)
{
GtkObjectExpression *self = (GtkObjectExpression *) expr;
GObject *object;
object = g_weak_ref_get (&self->object_wr);
if (object == NULL)
if (self->object == NULL)
return FALSE;
g_value_init (value, gtk_expression_get_value_type (expr));
g_value_take_object (value, object);
g_value_set_object (value, self->object);
return TRUE;
}
@@ -1100,14 +1033,10 @@ gtk_object_expression_new (GObject *object)
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
result = gtk_expression_alloc (GTK_TYPE_OBJECT_EXPRESSION, G_OBJECT_TYPE (object));
self = (GtkObjectExpression *) result;
g_weak_ref_init (&self->object_wr, object);
self->guard = weak_ref_guard_new (self);
g_object_weak_ref (object,
gtk_object_expression_weak_ref_cb,
weak_ref_guard_ref (self->guard));
self->object = object;
g_object_weak_ref (object, gtk_object_expression_weak_ref_cb, self);
return result;
}
@@ -1124,17 +1053,10 @@ GObject *
gtk_object_expression_get_object (GtkExpression *expression)
{
GtkObjectExpression *self = (GtkObjectExpression *) expression;
GObject *object;
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (expression, GTK_TYPE_OBJECT_EXPRESSION), NULL);
object = g_weak_ref_get (&self->object_wr);
/* Return a borrowed instance */
if (object != NULL)
g_object_unref (object);
return object;
return self->object;
}
/* }}} */
@@ -1930,19 +1852,12 @@ static void
gtk_expression_watch_this_cb (gpointer data,
GObject *this)
{
WeakRefGuard *guard = data;
GtkExpressionWatch *watch = guard->data;
GtkExpressionWatch *watch = data;
if (watch != NULL)
{
g_weak_ref_set (&watch->this_wr, NULL);
watch->this = NULL;
watch->notify (watch->user_data);
gtk_expression_watch_unwatch (watch);
}
weak_ref_guard_unref (guard);
watch->notify (watch->user_data);
gtk_expression_watch_unwatch (watch);
}
static void
@@ -1996,12 +1911,9 @@ gtk_expression_watch (GtkExpression *self,
watch = g_atomic_rc_box_alloc0 (sizeof (GtkExpressionWatch) + gtk_expression_watch_size (self));
watch->expression = gtk_expression_ref (self);
watch->guard = weak_ref_guard_new (watch);
g_weak_ref_init (&watch->this_wr, this_);
watch->this = this_;
if (this_)
g_object_weak_ref (this_,
gtk_expression_watch_this_cb,
weak_ref_guard_ref (watch->guard));
g_object_weak_ref (this_, gtk_expression_watch_this_cb, watch);
watch->notify = notify;
watch->user_data = user_data;
watch->user_destroy = user_destroy;
@@ -2035,10 +1947,6 @@ gtk_expression_watch_finalize (gpointer data)
GtkExpressionWatch *watch G_GNUC_UNUSED = data;
g_assert (!gtk_expression_watch_is_watching (data));
weak_ref_guard_unref (watch->guard);
g_weak_ref_clear (&watch->this_wr);
}
/**
@@ -2068,27 +1976,17 @@ gtk_expression_watch_unref (GtkExpressionWatch *watch)
void
gtk_expression_watch_unwatch (GtkExpressionWatch *watch)
{
GObject *this;
if (!gtk_expression_watch_is_watching (watch))
return;
gtk_expression_subwatch_finish (watch->expression, (GtkExpressionSubWatch *) watch->sub);
this = g_weak_ref_get (&watch->this_wr);
if (this)
{
g_object_weak_unref (this, gtk_expression_watch_this_cb, watch->guard);
weak_ref_guard_unref (watch->guard);
g_weak_ref_set (&watch->this_wr, NULL);
}
if (watch->this)
g_object_weak_unref (watch->this, gtk_expression_watch_this_cb, watch);
if (watch->user_destroy)
watch->user_destroy (watch->user_data);
g_clear_object (&this);
g_clear_pointer (&watch->expression, gtk_expression_unref);
gtk_expression_watch_unref (watch);
@@ -2111,24 +2009,17 @@ gboolean
gtk_expression_watch_evaluate (GtkExpressionWatch *watch,
GValue *value)
{
GObject *this;
gboolean ret;
g_return_val_if_fail (watch != NULL, FALSE);
if (!gtk_expression_watch_is_watching (watch))
return FALSE;
this = g_weak_ref_get (&watch->this_wr);
ret = gtk_expression_evaluate (watch->expression, this, value);
g_clear_object (&this);
return ret;
return gtk_expression_evaluate (watch->expression, watch->this, value);
}
typedef struct {
GtkExpressionWatch *watch;
GWeakRef target_wr;
GObject *target;
GParamSpec *pspec;
} GtkExpressionBind;
@@ -2138,39 +2029,34 @@ invalidate_binds (gpointer unused,
{
GSList *l, *binds;
l = binds = g_object_get_data (object, "gtk-expression-binds");
while (l)
binds = g_object_get_data (object, "gtk-expression-binds");
for (l = binds; l; l = l->next)
{
GtkExpressionBind *bind = l->data;
l = l->next;
/* This guarantees we neither try to update bindings
* (which would wreck havoc because the object is
* dispose()ing itself) nor try to destroy bindings
* anymore, so destruction can be done in free_binds().
*/
g_weak_ref_set (&bind->target_wr, NULL);
bind->target = NULL;
}
}
static void
free_binds (gpointer data)
{
GSList *l = data;
GSList *l;
while (l)
for (l = data; l; l = l->next)
{
GtkExpressionBind *bind = l->data;
l = l->next;
g_assert (bind->target == NULL);
if (bind->watch)
gtk_expression_watch_unwatch (bind->watch);
g_weak_ref_clear (&bind->target_wr);
g_free (bind);
}
g_slist_free (data);
}
@@ -2178,21 +2064,17 @@ static void
gtk_expression_bind_free (gpointer data)
{
GtkExpressionBind *bind = data;
GObject *target = g_weak_ref_get (&bind->target_wr);
g_weak_ref_set (&bind->target_wr, NULL);
if (target)
if (bind->target)
{
GSList *binds;
binds = g_object_steal_data (target, "gtk-expression-binds");
binds = g_object_steal_data (bind->target, "gtk-expression-binds");
binds = g_slist_remove (binds, bind);
if (binds)
g_object_set_data_full (target, "gtk-expression-binds", binds, free_binds);
g_object_set_data_full (bind->target, "gtk-expression-binds", binds, free_binds);
else
g_object_weak_unref (target, invalidate_binds, NULL);
g_object_weak_unref (bind->target, invalidate_binds, NULL);
g_object_unref (target);
g_free (bind);
}
else
@@ -2214,19 +2096,14 @@ gtk_expression_bind_notify (gpointer data)
{
GValue value = G_VALUE_INIT;
GtkExpressionBind *bind = data;
GObject *target = g_weak_ref_get (&bind->target_wr);
if (target == NULL)
if (bind->target == NULL)
return;
if (!gtk_expression_watch_evaluate (bind->watch, &value))
{
g_object_unref (target);
return;
}
return;
g_object_set_property (target, bind->pspec->name, &value);
g_object_unref (target);
g_object_set_property (bind->target, bind->pspec->name, &value);
g_value_unset (&value);
}
@@ -2286,7 +2163,7 @@ gtk_expression_bind (GtkExpression *self,
binds = g_object_steal_data (target, "gtk-expression-binds");
if (binds == NULL)
g_object_weak_ref (target, invalidate_binds, NULL);
g_weak_ref_init (&bind->target_wr, target);
bind->target = target;
bind->pspec = pspec;
bind->watch = gtk_expression_watch (self,
this_,
-4
View File
@@ -47,8 +47,6 @@
* `GtkGLArea` sets up its own [class@Gdk.GLContext], and creates a custom
* GL framebuffer that the widget will do GL rendering onto. It also ensures
* that this framebuffer is the default GL rendering target when rendering.
* The completed rendering is integrated into the larger GTK scene graph as
* a texture.
*
* In order to draw, you have to connect to the [signal@Gtk.GLArea::render]
* signal, or subclass `GtkGLArea` and override the GtkGLAreaClass.render
@@ -66,8 +64,6 @@
* The `render()` function will be called when the `GtkGLArea` is ready
* for you to draw its content:
*
* The initial contents of the framebuffer are transparent.
*
* ```c
* static gboolean
* render (GtkGLArea *area, GdkGLContext *context)
-9
View File
@@ -44,15 +44,6 @@ void gtk_graphics_offload_set_child (GtkGraphicsOffload *
GDK_AVAILABLE_IN_4_14
GtkWidget * gtk_graphics_offload_get_child (GtkGraphicsOffload *self);
/**
* GtkGraphicsOffloadEnabled:
* @GTK_GRAPHICS_OFFLOAD_ENABLED: Graphics offloading is enabled.
* @GTK_GRAPHICS_OFFLOAD_DISABLED: Graphics offloading is disabled.
*
* Represents the state of graphics offlodading.
*
* Since: 4.14
*/
typedef enum
{
GTK_GRAPHICS_OFFLOAD_ENABLED,
+2 -2
View File
@@ -2069,7 +2069,7 @@ ensure_valid_themes (GtkIconTheme *self,
load_themes (self);
gdk_profiler_end_mark (before, "Icon theme load", self->current_theme);
gdk_profiler_end_mark (before, "icon theme load", self->current_theme);
if (was_valid)
queue_theme_changed (self);
@@ -3822,7 +3822,7 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
/* Don't report quick (< 0.5 msec) parses */
if (end - before > 500000 || !in_thread)
{
gdk_profiler_add_markf (before, (end - before), in_thread ? "Icon load (thread)" : "Icon load" ,
gdk_profiler_add_markf (before, (end - before), in_thread ? "icon load (thread)" : "icon load" ,
"%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
}
}
+1 -1
View File
@@ -353,7 +353,7 @@ init_compose_table_thread_cb (GTask *task,
g_task_return_boolean (task, TRUE);
gdk_profiler_end_mark (before, "Compose table load (thread)", NULL);
gdk_profiler_end_mark (before, "im compose table load (thread)", NULL);
}
static void
-5
View File
@@ -805,11 +805,6 @@ gtk_inscription_set_text (GtkInscription *self,
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL,
text,
-1);
}
/**
-5
View File
@@ -3086,11 +3086,6 @@ gtk_label_set_label_internal (GtkLabel *self,
g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_LABEL]);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL,
self->label,
-1);
return TRUE;
}
+3 -3
View File
@@ -549,7 +549,7 @@ do_post_parse_initialization (void)
gsk_render_node_init_types ();
_gtk_ensure_resources ();
gdk_profiler_end_mark (before, "Basic initialization", NULL);
gdk_profiler_end_mark (before, "basic initialization", NULL);
gtk_initialized = TRUE;
@@ -559,13 +559,13 @@ do_post_parse_initialization (void)
#endif
gtk_im_modules_init ();
gtk_media_file_extension_init ();
gdk_profiler_end_mark (before, "Init modules", NULL);
gdk_profiler_end_mark (before, "init modules", NULL);
before = GDK_PROFILER_CURRENT_TIME;
display_manager = gdk_display_manager_get ();
if (gdk_display_manager_get_default_display (display_manager) != NULL)
default_display_notify_cb (display_manager);
gdk_profiler_end_mark (before, "Create display", NULL);
gdk_profiler_end_mark (before, "create display", NULL);
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),
+3 -4
View File
@@ -6991,10 +6991,9 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
*
* If you want a widget to interact with a notebook through DnD
* (i.e.: accept dragged tabs from it) it must be set as a drop
* destination by adding to it a [class@Gtk.DropTarget] controller that accepts
* the GType `GTK_TYPE_NOTEBOOK_PAGE`. The `:value` of said drop target will be
* preloaded with a [class@Gtk.NotebookPage] object that corresponds to the
* dropped tab, so you can process the value via `::accept` or `::drop` signals.
* destination and accept the target GTK_NOTEBOOK_TAB. The notebook
* will fill the selection with a GtkWidget** pointing to the child
* widget that corresponds to the dropped tab.
*
* Note that you should use [method@Gtk.Notebook.detach_tab] instead
* of [method@Gtk.Notebook.remove_page] if you want to remove the tab
+1 -1
View File
@@ -53,7 +53,7 @@ _gtk_pango_attr_list_merge (PangoAttrList *into,
if (into)
pango_attr_list_filter (from, attr_list_merge_filter, into);
else
return pango_attr_list_ref (from);
return pango_attr_list_ref (from);
}
return into;
+6 -3
View File
@@ -637,8 +637,7 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
g_object_class_install_property (object_class,
PROP_FLAGS,
g_param_spec_flags ("flags", NULL, NULL,
GTK_TYPE_POPOVER_MENU_FLAGS,
GTK_POPOVER_MENU_SLIDING,
GTK_TYPE_POPOVER_MENU_FLAGS, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_EXPLICIT_NOTIFY));
@@ -784,7 +783,7 @@ GtkWidget *
gtk_popover_menu_new_from_model (GMenuModel *model)
{
return gtk_popover_menu_new_from_model_full (model, GTK_POPOVER_MENU_SLIDING);
return gtk_popover_menu_new_from_model_full (model, 0);
}
/**
@@ -800,6 +799,10 @@ gtk_popover_menu_new_from_model (GMenuModel *model)
* belongs. Actions can also be added using [method@Gtk.Widget.insert_action_group]
* on the parent widget or on any of its parent widgets.
*
* The only flag that is supported currently is
* %GTK_POPOVER_MENU_NESTED, which makes GTK create traditional,
* nested submenus instead of the default sliding submenus.
*
* Returns: the new `GtkPopoverMenu`
*/
GtkWidget *
-12
View File
@@ -172,7 +172,6 @@ enum {
PROP_ALTERNATIVE_SORT_ARROWS,
PROP_ENABLE_ANIMATIONS,
PROP_ERROR_BELL,
PROP_STATUS_SHAPES,
PROP_PRINT_BACKENDS,
PROP_PRINT_PREVIEW_COMMAND,
PROP_ENABLE_ACCELS,
@@ -572,17 +571,6 @@ gtk_settings_class_init (GtkSettingsClass *class)
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-show-status-shapes:
*
* When %TRUE, widgets like switches include shapes to indicate their on/off state.
*
* Since: 4.14
*/
pspecs[PROP_STATUS_SHAPES] = g_param_spec_boolean ("gtk-show-status-shapes", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-print-backends:
*
+1 -1
View File
@@ -671,7 +671,7 @@ gtk_keyval_trigger_class_init (GtkKeyvalTriggerClass *klass)
keyval_props[KEYVAL_PROP_MODIFIERS] =
g_param_spec_flags (I_("modifiers"), NULL, NULL,
GDK_TYPE_MODIFIER_TYPE,
GDK_NO_MODIFIER_MASK,
0,
G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE);
-1
View File
@@ -179,7 +179,6 @@ GDK_AVAILABLE_IN_ALL
GtkSelectionModel * gtk_stack_get_pages (GtkStack *stack);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStack, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStackPage, g_object_unref)
G_END_DECLS
-27
View File
@@ -549,18 +549,6 @@ state_set (GtkSwitch *self,
return TRUE;
}
static gboolean
translate_switch_shapes_to_opacity (GBinding *binding,
const GValue *from_value,
GValue *to_value,
gpointer user_data)
{
gboolean visible = g_value_get_boolean (from_value);
g_value_set_double (to_value, visible ? 1.0 : 0.0);
return TRUE;
}
static void
gtk_switch_class_init (GtkSwitchClass *klass)
{
@@ -670,7 +658,6 @@ gtk_switch_init (GtkSwitch *self)
{
GtkLayoutManager *layout;
GtkGesture *gesture;
GtkSettings *gtk_settings;
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
@@ -703,32 +690,18 @@ gtk_switch_init (GtkSwitch *self)
gtk_switch_allocate);
gtk_widget_set_layout_manager (GTK_WIDGET (self), layout);
gtk_settings = gtk_settings_get_default ();
self->on_image = g_object_new (GTK_TYPE_IMAGE,
"accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
"icon-name", "switch-on-symbolic",
NULL);
gtk_widget_set_parent (self->on_image, GTK_WIDGET (self));
g_object_bind_property_full (gtk_settings, "gtk-show-status-shapes",
self->on_image, "opacity",
G_BINDING_SYNC_CREATE,
translate_switch_shapes_to_opacity,
NULL, NULL, NULL);
self->off_image = g_object_new (GTK_TYPE_IMAGE,
"accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
"icon-name", "switch-off-symbolic",
NULL);
gtk_widget_set_parent (self->off_image, GTK_WIDGET (self));
g_object_bind_property_full (gtk_settings, "gtk-show-status-shapes",
self->off_image, "opacity",
G_BINDING_SYNC_CREATE,
translate_switch_shapes_to_opacity,
NULL, NULL, NULL);
self->slider = gtk_gizmo_new_with_role ("slider",
GTK_ACCESSIBLE_ROLE_NONE,
NULL, NULL, NULL, NULL, NULL, NULL);
+2 -2
View File
@@ -11956,7 +11956,7 @@ gtk_widget_render (GtkWidget *widget,
if (GDK_PROFILER_IS_RUNNING)
{
before_render = GDK_PROFILER_CURRENT_TIME;
gdk_profiler_add_mark (before_snapshot, (before_render - before_snapshot), "Widget snapshot", "");
gdk_profiler_add_mark (before_snapshot, (before_render - before_snapshot), "widget snapshot", "");
}
if (root != NULL)
@@ -11972,7 +11972,7 @@ gtk_widget_render (GtkWidget *widget,
gsk_render_node_unref (root);
gdk_profiler_end_mark (before_render, "Widget render", "");
gdk_profiler_end_mark (before_render, "widget render", "");
}
}

Some files were not shown because too many files have changed in this diff Show More