Compare commits
152 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfefa884ad | |||
| 72b8c6cf74 | |||
| 501095452a | |||
| 2ede31b682 | |||
| 1355367360 | |||
| 761995ce3c | |||
| d164dd3146 | |||
| 4b9b55ab17 | |||
| 6e9767c7c1 | |||
| b2f783b70b | |||
| 5a68426c9a | |||
| 32d77fa874 | |||
| 8d00af6351 | |||
| a91a0720f5 | |||
| f01208ad94 | |||
| 56b955f819 | |||
| 0d7761269c | |||
| 9ebaafa2af | |||
| 25ea6beb39 | |||
| 905bb2c6fd | |||
| b4b7e9b040 | |||
| c3fcf0f7b0 | |||
| 60fc48e71f | |||
| 01d9886eea | |||
| a97231c8bf | |||
| 8ac8a027b2 | |||
| 070f3a61ac | |||
| 022347fa85 | |||
| ebb6076aca | |||
| 7b66bc45aa | |||
| 698aa7c0f3 | |||
| 70699efc71 | |||
| cebc95f253 | |||
| f9c6bd125b | |||
| 4733ca193b | |||
| c7b345f73e | |||
| 1fbc61f2cb | |||
| 565694ede5 | |||
| 0df03b054d | |||
| 73d01d3130 | |||
| 80f3357117 | |||
| d5b34aecdd | |||
| d16d2135e6 | |||
| 53b52abd30 | |||
| e55e9e3b36 | |||
| 9f9cea219f | |||
| dbee1a8160 | |||
| 133cd87bdf | |||
| 9f8e84cb60 | |||
| b8057b088e | |||
| cf8cca8724 | |||
| d97767014c | |||
| 2f974a1f5a | |||
| 4e2c7d5eb0 | |||
| a5d1cb93ef | |||
| 401b902cbf | |||
| 9f2778b97c | |||
| ed4eeb8adb | |||
| fb36d30685 | |||
| 385b9a7241 | |||
| c2abf30c46 | |||
| 50a47f55d9 | |||
| cd7fe772a7 | |||
| 317bba756e | |||
| 2212049e8f | |||
| 0f26a006ee | |||
| 3c451b3ec7 | |||
| 323adf9aa8 | |||
| 70f0cde730 | |||
| 14e78663ee | |||
| d8279209a2 | |||
| a0527ff0bd | |||
| 771ea81715 | |||
| f22a3f9ec6 | |||
| 246876a404 | |||
| 27a086b5f0 | |||
| 8158945de9 | |||
| 1c85141612 | |||
| 690381672b | |||
| 3d7ff44dc5 | |||
| a518c59098 | |||
| 1dd5e92499 | |||
| fbd3c5ebd0 | |||
| 48dc7df5b7 | |||
| 0c4c90d606 | |||
| da954d20f9 | |||
| ff262c081e | |||
| c6967234de | |||
| cdbfb35067 | |||
| 53e17ab14e | |||
| 550e98090a | |||
| 2771befdd9 | |||
| 911730493d | |||
| d05f47a695 | |||
| 11dc15207e | |||
| 4ea748a676 | |||
| b78d2a7f75 | |||
| 1fd9e1e916 | |||
| 24ceb47cbc | |||
| 8872e1cbb0 | |||
| c1e2ffac83 | |||
| 17df646663 | |||
| 6f8fae590f | |||
| 4146db0003 | |||
| 9c228cc634 | |||
| df2cdb6913 | |||
| 22a5447039 | |||
| a2475051fa | |||
| d41fb7c5a6 | |||
| 3b28c46595 | |||
| f57300b924 | |||
| c146f225ff | |||
| 9f4f65be4a | |||
| 93715b963e | |||
| c1407f2ca6 | |||
| 3b299f574d | |||
| a51c6aed47 | |||
| b552cf74dd | |||
| 0be0265751 | |||
| 207dd6fe0d | |||
| a87ff8d556 | |||
| 153cb8316e | |||
| 7ad7c0d8c1 | |||
| 61595af586 | |||
| d240c35850 | |||
| d276eb9e9a | |||
| afe4cbf26d | |||
| 76e5ef6937 | |||
| 0ed43f66a9 | |||
| 4882514234 | |||
| a15e87d2a6 | |||
| cc92b9b19f | |||
| bf0120f73d | |||
| 7f06eed8da | |||
| dc30044829 | |||
| 781fe2d7fa | |||
| b8a61f7899 | |||
| a44ca6756a | |||
| 490a9f193d | |||
| 754d364efd | |||
| 4939f0bb75 | |||
| 7537d80047 | |||
| c5bdf0a995 | |||
| 04870fc1a1 | |||
| 43e5bc795a | |||
| f3ec58d290 | |||
| 5b3d14e15b | |||
| 131ab11f5c | |||
| a2eb467663 | |||
| 06f85ee566 | |||
| aab40ad6a2 | |||
| 473881357c |
@@ -19,6 +19,7 @@ flatpak build ${builddir} meson \
|
||||
--buildtype=debugoptimized \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dvulkan=disabled \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-testsuite=false \
|
||||
-Dbuild-examples=false \
|
||||
@@ -27,7 +28,7 @@ flatpak build ${builddir} meson \
|
||||
-Ddemo-profile=devel \
|
||||
_flatpak_build
|
||||
|
||||
flatpak build ${builddir} ninja -C _flatpak_build install
|
||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
||||
|
||||
flatpak-builder \
|
||||
--user --disable-rofiles-fuse \
|
||||
|
||||
+1
-1
@@ -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/ce/user/project/issues/automatic_issue_closing.html)
|
||||
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
to automatically close the issue when merging the commit with the upstream
|
||||
repository:
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -199,6 +200,7 @@
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"GSK_RENDERER" : "opengl"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -129,6 +130,8 @@
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
],
|
||||
@@ -129,6 +130,8 @@
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "demos.h"
|
||||
#include "fontify.h"
|
||||
|
||||
#include "demo_conf.h"
|
||||
#include "profile_conf.h"
|
||||
|
||||
static GtkWidget *info_view;
|
||||
static GtkWidget *source_view;
|
||||
|
||||
@@ -236,7 +236,7 @@ foreach flag: common_cflags
|
||||
endif
|
||||
endforeach
|
||||
|
||||
gtkdemo_deps += [ demo_conf_h ]
|
||||
gtkdemo_deps += [ profile_conf_h ]
|
||||
|
||||
executable('gtk4-demo',
|
||||
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "iconbrowserapp.h"
|
||||
#include "iconbrowserwin.h"
|
||||
|
||||
#include "demo_conf.h"
|
||||
#include "profile_conf.h"
|
||||
|
||||
struct _IconBrowserApp
|
||||
{
|
||||
|
||||
@@ -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, demo_conf_h ],
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
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()
|
||||
|
||||
@@ -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, demo_conf_h ],
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
include_directories: confinc,
|
||||
c_args: common_cflags,
|
||||
win_subsystem: 'windows',
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "node-editor-application.h"
|
||||
|
||||
#include "node-editor-window.h"
|
||||
|
||||
#include "demo_conf.h"
|
||||
#include "profile_conf.h"
|
||||
|
||||
static const char *css =
|
||||
"textview.editor {"
|
||||
@@ -247,11 +249,63 @@ 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)
|
||||
{
|
||||
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "gsk/broadway/gskbroadwayrenderer.h"
|
||||
#endif
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include <cairo.h>
|
||||
#ifdef CAIRO_HAS_SVG_SURFACE
|
||||
#include <cairo-svg.h>
|
||||
@@ -55,6 +57,7 @@ struct _NodeEditorWindow
|
||||
GtkWidget *testcase_name_entry;
|
||||
GtkWidget *testcase_save_button;
|
||||
GtkWidget *scale_scale;
|
||||
GtkWidget *crash_warning;
|
||||
|
||||
GtkWidget *renderer_listbox;
|
||||
GListStore *renderers;
|
||||
@@ -64,6 +67,9 @@ struct _NodeEditorWindow
|
||||
GFileMonitor *file_monitor;
|
||||
|
||||
GArray *errors;
|
||||
|
||||
guint update_timeout;
|
||||
gboolean auto_reload;
|
||||
};
|
||||
|
||||
struct _NodeEditorWindowClass
|
||||
@@ -71,6 +77,13 @@ 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
|
||||
@@ -163,19 +176,84 @@ text_iter_skip_whitespace_backward (GtkTextIter *iter)
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
NodeEditorWindow *self)
|
||||
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)
|
||||
{
|
||||
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);
|
||||
@@ -236,73 +314,19 @@ text_changed (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
g_clear_pointer (&big_node, gsk_render_node_unref);
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
|
||||
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);
|
||||
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
gunichar c = gtk_text_iter_get_char (&iter);
|
||||
if (self->auto_reload)
|
||||
reload (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);
|
||||
highlight_text (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1101,6 +1125,9 @@ 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);
|
||||
@@ -1540,6 +1567,79 @@ edit_action_cb (GtkWidget *widget,
|
||||
node_editor_window_edit (self, &start);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_map (GtkWidget *widget)
|
||||
{
|
||||
char *path;
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->map (widget);
|
||||
|
||||
path = get_autosave_path (NULL);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
g_free (path);
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -1551,6 +1651,8 @@ 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");
|
||||
@@ -1558,6 +1660,14 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
widget_class->realize = node_editor_window_realize;
|
||||
widget_class->unrealize = node_editor_window_unrealize;
|
||||
|
||||
widget_class->map = node_editor_window_map;
|
||||
|
||||
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);
|
||||
@@ -1567,6 +1677,7 @@ 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);
|
||||
@@ -1579,6 +1690,7 @@ 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);
|
||||
|
||||
@@ -1630,11 +1742,133 @@ 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),
|
||||
@@ -1647,6 +1881,10 @@ 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,
|
||||
@@ -1684,25 +1922,9 @@ 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);
|
||||
|
||||
/* 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);
|
||||
set_initial_text (self);
|
||||
|
||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (initiate_autosave), self);
|
||||
|
||||
if (g_getenv ("GSK_RENDERER"))
|
||||
{
|
||||
|
||||
@@ -37,3 +37,5 @@ NodeEditorWindow * node_editor_window_new (NodeEditorApplication
|
||||
|
||||
gboolean node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file);
|
||||
|
||||
char * get_autosave_path (const char *suffix);
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<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>
|
||||
@@ -24,7 +32,6 @@
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
||||
<object class="GtkPopover" id="testcase_popover">
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
@@ -39,7 +46,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>
|
||||
@@ -52,7 +59,6 @@
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="wrap">1</property>
|
||||
@@ -66,7 +72,6 @@
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel" id="testcase_error_label">
|
||||
<property name="wrap">1</property>
|
||||
@@ -78,7 +83,6 @@
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkButton" id="testcase_save_button">
|
||||
<property name="label">Save</property>
|
||||
@@ -86,9 +90,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>
|
||||
@@ -100,7 +104,6 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="default-width">1024</property>
|
||||
@@ -185,83 +188,128 @@
|
||||
</object>
|
||||
</child>
|
||||
<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">
|
||||
<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"/>
|
||||
<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">
|
||||
<style>
|
||||
<class name="editor" />
|
||||
<class name="app-notification"/>
|
||||
</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>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</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">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkGestureClick">
|
||||
<property name="button">1</property>
|
||||
<signal name="pressed" handler="click_gesture_pressed"/>
|
||||
<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>
|
||||
<child>
|
||||
<object class="GtkGestureClick">
|
||||
<property name="button">1</property>
|
||||
<signal name="pressed" handler="click_gesture_pressed"/>
|
||||
</object>
|
||||
</child>
|
||||
</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>
|
||||
</property>
|
||||
<property name="end-child">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<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="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<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">
|
||||
<property name="actions">copy</property>
|
||||
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
|
||||
<property name="formats">application/x-gtk-render-node</property>
|
||||
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<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 class="GtkListBox" id="renderer_listbox">
|
||||
<property name="selection-mode">none</property>
|
||||
</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>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
@@ -322,27 +322,39 @@ stroke bounds of the path.
|
||||
|
||||
### text
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| color | `<color>` | black | non-default |
|
||||
| font | `<string>` | "Cantarell 11" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| 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 |
|
||||
|
||||
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 | `<url>` | *see below* | always |
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ------------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| texture | `<string>`?`<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,7 +1,7 @@
|
||||
executable('gtk4-print-editor',
|
||||
sources: ['print-editor.c'],
|
||||
c_args: common_cflags,
|
||||
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "demo_conf.h"
|
||||
#include "profile_conf.h"
|
||||
|
||||
static GtkWidget *main_window;
|
||||
static GFile *filename = NULL;
|
||||
|
||||
@@ -66,7 +66,7 @@ endif
|
||||
executable('gtk4-widget-factory',
|
||||
sources: ['widget-factory.c', widgetfactory_resources],
|
||||
c_args: common_cflags,
|
||||
dependencies: [ libgtk_dep, demo_conf_h ],
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "demo_conf.h"
|
||||
#include "profile_conf.h"
|
||||
|
||||
static void
|
||||
change_dark_state (GSimpleAction *action,
|
||||
|
||||
@@ -11,13 +11,17 @@ Editor render nodes
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-node-editor** [OPTIONS...]
|
||||
| **gtk4-node-editor** [OPTIONS...] [FILE]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-node-editor`` is a utility to show and edit render node files.
|
||||
Such render node files can be obtained e.g. from the GTK inspector.
|
||||
Such render node files can be obtained e.g. from the GTK inspector or
|
||||
as part of the testsuite in the GTK sources.
|
||||
|
||||
``gtk4-node-editor`` is used by GTK developers for debugging and testing,
|
||||
and it has built-in support for saving testcases as part of the GTK testsuite.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
@@ -25,3 +29,21 @@ OPTIONS
|
||||
``-h, --help``
|
||||
|
||||
Show the application help.
|
||||
|
||||
``--version``
|
||||
|
||||
Show the program version.
|
||||
|
||||
``--reset``
|
||||
|
||||
Don't restore autosaved content and remove autosave files.
|
||||
|
||||
ENVIRONMENT
|
||||
-----------
|
||||
|
||||
``GTK_SOURCE_DIR``
|
||||
|
||||
can be set to point to the location where the GTK sources reside, so that
|
||||
testcases can be saved to the right location. If unsed, `gtk4-node-editor``
|
||||
checks if the current working directory looks like a GTK checkout, and failing
|
||||
that, saves testcase in the the current working directory.
|
||||
|
||||
@@ -12,9 +12,10 @@ SYNOPSIS
|
||||
--------
|
||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -50,3 +51,31 @@ 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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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,19 +415,24 @@ 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.
|
||||
|
||||
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.
|
||||
::: 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.
|
||||
|
||||
|
||||
### `GSK_GPU_SKIP`
|
||||
|
||||
|
||||
+2
-1
@@ -289,7 +289,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
*/
|
||||
device_props[PROP_MODIFIER_STATE] =
|
||||
g_param_spec_flags ("modifier-state", NULL, NULL,
|
||||
GDK_TYPE_MODIFIER_TYPE, 0,
|
||||
GDK_TYPE_MODIFIER_TYPE,
|
||||
GDK_NO_MODIFIER_MASK,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, device_props);
|
||||
|
||||
+4
-4
@@ -56,10 +56,10 @@ static struct {
|
||||
GdkCursor *cursor;
|
||||
} drag_cursors[] = {
|
||||
{ GDK_ACTION_ASK, "dnd-ask", NULL },
|
||||
{ GDK_ACTION_COPY, "dnd-copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "dnd-move", NULL },
|
||||
{ GDK_ACTION_LINK, "dnd-link", NULL },
|
||||
{ 0, "dnd-none", NULL },
|
||||
{ GDK_ACTION_COPY, "copy", NULL },
|
||||
{ GDK_ACTION_MOVE, "move", NULL },
|
||||
{ GDK_ACTION_LINK, "alias", NULL },
|
||||
{ 0, "no-drop", NULL },
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
+9
-1
@@ -161,7 +161,12 @@ 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, &q_internal_format, &q_format, &q_type, q_swizzle);
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&q_internal_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
continue;
|
||||
@@ -193,6 +198,7 @@ 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 &&
|
||||
@@ -255,6 +261,7 @@ 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);
|
||||
}
|
||||
@@ -266,6 +273,7 @@ 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);
|
||||
}
|
||||
|
||||
+79
-36
@@ -335,7 +335,8 @@ struct _GdkMemoryFormatDescription
|
||||
GdkMemoryDepth depth;
|
||||
const GdkMemoryFormat *fallbacks;
|
||||
struct {
|
||||
GLint internal_format;
|
||||
GLint internal_gl_format;
|
||||
GLint internal_gles_format;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
GLint swizzle[4];
|
||||
@@ -375,7 +376,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -402,7 +404,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -429,7 +432,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -455,7 +459,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -482,7 +487,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -509,7 +515,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -536,7 +543,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -562,7 +570,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -590,7 +599,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -618,7 +628,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -646,7 +657,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -673,7 +685,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -701,7 +714,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB8,
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -728,7 +742,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB8,
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.format = GL_BGR,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -759,7 +774,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB16,
|
||||
.internal_gl_format = GL_RGB16,
|
||||
.internal_gles_format = GL_RGB16,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -788,7 +804,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16,
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -817,7 +834,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16,
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -846,7 +864,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB16F,
|
||||
.internal_gl_format = GL_RGB16F,
|
||||
.internal_gles_format = GL_RGB16F,
|
||||
.format = GL_RGB,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -874,7 +893,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16F,
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -902,7 +922,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16F,
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -931,7 +952,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB32F,
|
||||
.internal_gl_format = GL_RGB32F,
|
||||
.internal_gles_format = GL_RGB32F,
|
||||
.format = GL_RGB,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -959,7 +981,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA32F,
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -987,7 +1010,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA32F,
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -1014,7 +1038,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG8,
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1041,7 +1066,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG8,
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1068,7 +1094,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R8,
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@@ -1098,7 +1125,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG16,
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1128,7 +1156,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG16,
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1158,7 +1187,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R16,
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@@ -1185,7 +1215,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R8,
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1215,7 +1246,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R16,
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1244,7 +1276,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R16F,
|
||||
.internal_gl_format = GL_R16F,
|
||||
.internal_gles_format = GL_R16F,
|
||||
.format = GL_RED,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1273,7 +1306,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R32F,
|
||||
.internal_gl_format = GL_R32F,
|
||||
.internal_gles_format = GL_R32F,
|
||||
.format = GL_RED,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1473,12 +1507,16 @@ 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])
|
||||
{
|
||||
*out_internal_format = memory_formats[format].gl.internal_format;
|
||||
if (gles)
|
||||
*out_internal_format = memory_formats[format].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[format].gl.internal_gl_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);
|
||||
@@ -1487,6 +1525,7 @@ 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
|
||||
@@ -1504,6 +1543,7 @@ 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,
|
||||
@@ -1516,7 +1556,10 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
return FALSE;
|
||||
|
||||
*out_actual_format = actual;
|
||||
*out_internal_format = memory_formats[actual].gl.internal_format;
|
||||
if (gles)
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gl_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);
|
||||
|
||||
@@ -55,11 +55,13 @@ 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,
|
||||
|
||||
@@ -194,7 +194,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
|
||||
@@ -1796,6 +1796,7 @@ 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 } },
|
||||
};
|
||||
@@ -1845,13 +1846,6 @@ find_translation_entry_by_setting (const char *setting)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
high_contrast_changed (GdkDisplay *display)
|
||||
{
|
||||
gdk_display_setting_changed (display, "gtk-theme-name");
|
||||
gdk_display_setting_changed (display, "gtk-icon-theme-name");
|
||||
}
|
||||
|
||||
static void
|
||||
settings_changed (GSettings *settings,
|
||||
const char *key,
|
||||
@@ -1866,7 +1860,7 @@ settings_changed (GSettings *settings,
|
||||
if (entry->type != G_TYPE_NONE)
|
||||
gdk_display_setting_changed (display, entry->setting);
|
||||
else if (strcmp (key, "high-contrast") == 0)
|
||||
high_contrast_changed (display);
|
||||
gdk_display_setting_changed (display, "gtk-theme-name");
|
||||
else
|
||||
update_xft_settings (display);
|
||||
}
|
||||
|
||||
@@ -2859,6 +2859,7 @@ tablet_tool_handle_proximity_out (void *data,
|
||||
|
||||
gdk_device_update_tool (tablet->stylus_device, NULL);
|
||||
g_clear_object (&tablet->pointer_info.cursor);
|
||||
tablet->pointer_info.cursor_is_default = FALSE;
|
||||
}
|
||||
|
||||
static double *
|
||||
|
||||
@@ -1973,8 +1973,10 @@ gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
return FALSE;
|
||||
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
|
||||
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,
|
||||
@@ -2155,15 +2157,14 @@ 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 (display_wayland->xdg_activation)
|
||||
if (seat && 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.
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,7 @@ 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"},
|
||||
|
||||
@@ -1504,6 +1504,7 @@ 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,
|
||||
@@ -1514,6 +1515,7 @@ 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,
|
||||
@@ -1529,6 +1531,7 @@ 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,
|
||||
@@ -1546,6 +1549,7 @@ 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,
|
||||
|
||||
+29
-29
@@ -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 * fabs (scale_x);
|
||||
out_rect->corner[i].height = rect->corner[i].height * fabs (scale_y);
|
||||
out_rect->corner[i].width = rect->corner[i].width * fabsf (scale_x);
|
||||
out_rect->corner[i].height = rect->corner[i].height * fabsf (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 * fabs (scale_x));
|
||||
int surface_height = ceilf (node->bounds.size.height * fabs (scale_y));
|
||||
int surface_width = ceilf (node->bounds.size.width * fabsf (scale_x));
|
||||
int surface_height = ceilf (node->bounds.size.height * fabsf (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, fabs (scale_x), fabs (scale_y));
|
||||
cairo_surface_set_device_scale (rendered_surface, fabsf (scale_x), fabsf (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, fabs (scale_x), fabs (scale_y));
|
||||
cairo_surface_set_device_scale (surface, fabsf (scale_x), fabsf (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 / fabs (scale_x) : 0,
|
||||
scale_y < 0 ? 0 : - surface_height / fabs (scale_y));
|
||||
cairo_translate (cr, scale_x < 0 ? - surface_width / fabsf (scale_x) : 0,
|
||||
scale_y < 0 ? 0 : - surface_height / fabsf (scale_y));
|
||||
cairo_set_source_surface (cr, rendered_surface, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, surface_width / fabs (scale_x), surface_height / fabs (scale_y));
|
||||
cairo_rectangle (cr, 0, 0, surface_width / fabsf (scale_x), surface_height / fabsf (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 * fabs (scale_x),
|
||||
texture_height * fabs (scale_y),
|
||||
blur_radius * fabs (scale_x),
|
||||
blur_radius * fabs (scale_y));
|
||||
texture_width * fabsf (scale_x),
|
||||
texture_height * fabsf (scale_y),
|
||||
blur_radius * fabsf (scale_x),
|
||||
blur_radius * fabsf (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 (fabs (p->x - b1.x) > FLT_EPSILON && fabs (p->x - b2.x) > FLT_EPSILON)
|
||||
if (fabsf (p->x - b1.x) > FLT_EPSILON && fabsf (p->x - b2.x) > FLT_EPSILON)
|
||||
return FALSE;
|
||||
if (fabs (p->y - b1.y) > FLT_EPSILON && fabs (p->y - b2.y) > FLT_EPSILON)
|
||||
if (fabsf (p->y - b1.y) > FLT_EPSILON && fabsf (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 * fabs (scale_x),
|
||||
blur_radius * fabs (scale_y));
|
||||
blur_radius * fabsf (scale_x),
|
||||
blur_radius * fabsf (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)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale_x);
|
||||
texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale_y);
|
||||
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);
|
||||
|
||||
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 * fabs (scale_x),
|
||||
blur_radius * fabs (scale_y));
|
||||
blur_radius * fabsf (scale_x),
|
||||
blur_radius * fabsf (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, fabs (job->scale_x), fabs (job->scale_y)));
|
||||
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (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 (fabs (job->scale_x), fabs (job->scale_y)); /* TODO: Fix for uneven scales? */
|
||||
float text_scale = MAX (fabsf (job->scale_x), fabsf (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, fabs (job->scale_x), fabs (job->scale_y)));
|
||||
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (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 * fabs (job->scale_x)) < 0.5 ||
|
||||
(scale_y * fabs (job->scale_y)) < 0.5;
|
||||
use_mipmap = (scale_x * fabsf (job->scale_x)) < 0.5 ||
|
||||
(scale_y * fabsf (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, fabs (job->scale_x), fabs (job->scale_y)));
|
||||
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (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 * fabs (job->scale_x)) < 0.5 ||
|
||||
(scale_y * fabs (job->scale_y)) < 0.5;
|
||||
use_mipmap = (scale_x * fabsf (job->scale_x)) < 0.5 ||
|
||||
(scale_y * fabsf (job->scale_y)) < 0.5;
|
||||
|
||||
if G_LIKELY (texture->width <= max_texture_size &&
|
||||
texture->height <= max_texture_size)
|
||||
|
||||
@@ -117,9 +117,8 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
||||
g_hash_table_iter_remove (&iter);
|
||||
dropped++;
|
||||
}
|
||||
|
||||
if (periodic_scan)
|
||||
entry->accessed = FALSE;
|
||||
else if (periodic_scan)
|
||||
entry->accessed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +439,6 @@ 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);
|
||||
|
||||
@@ -119,7 +119,7 @@ gsk_gl_device_create_atlas_image (GskGpuDevice *device,
|
||||
GskGLDevice *self = GSK_GL_DEVICE (device);
|
||||
|
||||
return gsk_gl_image_new (self,
|
||||
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
GDK_MEMORY_DEFAULT,
|
||||
GSK_GPU_IMAGE_RENDERABLE,
|
||||
width,
|
||||
height);
|
||||
@@ -638,6 +638,7 @@ 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,
|
||||
@@ -647,6 +648,7 @@ 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,
|
||||
@@ -670,6 +672,7 @@ 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,
|
||||
|
||||
@@ -60,7 +60,7 @@ gsk_gpu_blend_mode_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float opacity,
|
||||
GskBlendMode blend_mode,
|
||||
guint32 bottom_descriptor,
|
||||
|
||||
@@ -10,7 +10,7 @@ void gsk_gpu_blend_mode_op (GskGpuF
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float opacity,
|
||||
GskBlendMode blend_mode,
|
||||
guint32 start_descriptor,
|
||||
|
||||
@@ -63,9 +63,9 @@ gsk_gpu_blur_op_full (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_vec2_t *blur_direction,
|
||||
const graphene_point_t *blur_direction,
|
||||
const GdkRGBA *blur_color)
|
||||
{
|
||||
GskGpuBlurInstance *instance;
|
||||
@@ -79,7 +79,8 @@ gsk_gpu_blur_op_full (GskGpuFrame *frame,
|
||||
|
||||
gsk_gpu_rect_to_float (rect, offset, instance->rect);
|
||||
gsk_gpu_rect_to_float (tex_rect, offset, instance->tex_rect);
|
||||
graphene_vec2_to_float (blur_direction, instance->blur_direction);
|
||||
instance->blur_direction[0] = blur_direction->x;
|
||||
instance->blur_direction[1] = blur_direction->y;
|
||||
gsk_gpu_rgba_to_float (blur_color, instance->blur_color);
|
||||
instance->tex_id = descriptor;
|
||||
}
|
||||
@@ -90,9 +91,9 @@ gsk_gpu_blur_op (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_vec2_t *blur_direction)
|
||||
const graphene_point_t *blur_direction)
|
||||
{
|
||||
gsk_gpu_blur_op_full (frame,
|
||||
0,
|
||||
@@ -112,9 +113,9 @@ gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_vec2_t *blur_direction,
|
||||
const graphene_point_t *blur_direction,
|
||||
const GdkRGBA *shadow_color)
|
||||
{
|
||||
gsk_gpu_blur_op_full (frame,
|
||||
|
||||
@@ -11,18 +11,18 @@ void gsk_gpu_blur_op (GskGpuF
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_vec2_t *blur_direction);
|
||||
const graphene_point_t *blur_direction);
|
||||
|
||||
void gsk_gpu_blur_shadow_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_vec2_t *blur_direction,
|
||||
const graphene_point_t *blur_direction,
|
||||
const GdkRGBA *shadow_color);
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void
|
||||
gsk_gpu_border_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const GskRoundedRect *outline,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_point_t *inside_offset,
|
||||
const float widths[4],
|
||||
const GdkRGBA colors[4])
|
||||
@@ -118,7 +118,7 @@ gsk_gpu_border_op (GskGpuFrame *frame,
|
||||
NULL,
|
||||
&instance);
|
||||
|
||||
gsk_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
gsk_gpu_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ G_BEGIN_DECLS
|
||||
void gsk_gpu_border_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const GskRoundedRect *outline,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_point_t *inside_offset,
|
||||
const float widths[4],
|
||||
const GdkRGBA colors[4]);
|
||||
|
||||
@@ -86,7 +86,7 @@ gsk_gpu_box_shadow_op (GskGpuFrame *frame,
|
||||
const graphene_point_t *shadow_offset,
|
||||
float spread,
|
||||
float blur_radius,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GskGpuBoxshadowInstance *instance;
|
||||
@@ -102,11 +102,10 @@ gsk_gpu_box_shadow_op (GskGpuFrame *frame,
|
||||
&instance);
|
||||
|
||||
gsk_gpu_rect_to_float (bounds, offset, instance->bounds);
|
||||
gsk_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
gsk_gpu_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
gsk_gpu_rgba_to_float (color, instance->color);
|
||||
instance->shadow_offset[0] = shadow_offset->x;
|
||||
instance->shadow_offset[1] = shadow_offset->y;
|
||||
instance->shadow_spread = spread;
|
||||
instance->blur_radius = blur_radius;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ void gsk_gpu_box_shadow_op (
|
||||
const graphene_point_t *shadow_offset,
|
||||
float spread,
|
||||
float blur_radius,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GdkRGBA *color);
|
||||
|
||||
|
||||
|
||||
+26
-20
@@ -14,6 +14,14 @@ 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)
|
||||
@@ -54,17 +62,6 @@ 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:
|
||||
@@ -72,6 +69,14 @@ 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;
|
||||
@@ -124,6 +129,7 @@ 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))
|
||||
@@ -174,6 +180,7 @@ 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))
|
||||
@@ -231,12 +238,10 @@ gsk_gpu_clip_transform (GskGpuClip *dest,
|
||||
|
||||
gboolean
|
||||
gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
graphene_rect_t r = *rect;
|
||||
r.origin.x += offset->x;
|
||||
r.origin.y += offset->y;
|
||||
graphene_rect_t r = gsk_rect_add_offset (*rect, *offset);
|
||||
|
||||
switch (self->type)
|
||||
{
|
||||
@@ -246,6 +251,7 @@ 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);
|
||||
@@ -254,12 +260,10 @@ gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
|
||||
|
||||
gboolean
|
||||
gsk_gpu_clip_contains_rect (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
graphene_rect_t r = *rect;
|
||||
r.origin.x += offset->x;
|
||||
r.origin.y += offset->y;
|
||||
graphene_rect_t r = gsk_rect_add_offset (*rect, *offset);
|
||||
|
||||
switch (self->type)
|
||||
{
|
||||
@@ -269,6 +273,7 @@ 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);
|
||||
|
||||
@@ -279,10 +284,11 @@ gsk_gpu_clip_contains_rect (const GskGpuClip *self,
|
||||
|
||||
GskGpuShaderClip
|
||||
gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
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)
|
||||
|
||||
@@ -18,6 +18,9 @@ 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 */
|
||||
@@ -34,6 +37,8 @@ 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,
|
||||
@@ -54,15 +59,15 @@ gboolean gsk_gpu_clip_transform (GskGpuC
|
||||
GskTransform *transform,
|
||||
const graphene_rect_t *viewport) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
gboolean gsk_gpu_clip_contains_rect (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
gboolean gsk_gpu_clip_contains_rect (const GskGpuClip *self,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT;
|
||||
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,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *rect);
|
||||
gboolean gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *rect);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ gsk_gpu_colorize_op (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *descriptors,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ void gsk_gpu_colorize_op (GskGpuF
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const GdkRGBA *color);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ gsk_gpu_color_matrix_op (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_matrix_t *color_matrix,
|
||||
const graphene_vec4_t *color_offset)
|
||||
@@ -85,7 +85,7 @@ gsk_gpu_color_matrix_op_opacity (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
float opacity)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ void gsk_gpu_color_matrix_op (GskGpuF
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
const graphene_matrix_t *color_matrix,
|
||||
const graphene_vec4_t *color_offset);
|
||||
@@ -21,7 +21,7 @@ void gsk_gpu_color_matrix_op_opacity (GskGpuF
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect,
|
||||
float opacity);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void
|
||||
gsk_gpu_color_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GskGpuColorInstance *instance;
|
||||
|
||||
@@ -9,7 +9,7 @@ G_BEGIN_DECLS
|
||||
void gsk_gpu_color_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GdkRGBA *color);
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ gsk_gpu_conic_gradient_op (GskGpuFrame *frame,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *center,
|
||||
float angle,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GskColorStop *stops,
|
||||
gsize n_stops)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ void gsk_gpu_conic_gradient_op (GskGpuF
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *center,
|
||||
float angle,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GskColorStop *stops,
|
||||
gsize n_stops);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ gsk_gpu_cross_fade_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float opacity,
|
||||
float progress,
|
||||
guint32 start_descriptor,
|
||||
|
||||
@@ -10,7 +10,7 @@ void gsk_gpu_cross_fade_op (GskGpuF
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float opacity,
|
||||
float progress,
|
||||
guint32 start_descriptor,
|
||||
|
||||
@@ -48,7 +48,7 @@ struct _GskGpuCachedClass
|
||||
GskGpuCached *cached);
|
||||
gboolean (* should_collect) (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestsamp);
|
||||
gint64 timestamp);
|
||||
};
|
||||
|
||||
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 timestsamp)
|
||||
gint64 timestamp)
|
||||
{
|
||||
/* 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, priv->first_cached);
|
||||
gsk_gpu_cached_free (self, cached);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +661,6 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
return cache->image;
|
||||
}
|
||||
|
||||
cache = g_new (GskGpuCachedGlyph, 1);
|
||||
pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
|
||||
origin.x = floor (ink_rect.x * scale / PANGO_SCALE);
|
||||
origin.y = floor (ink_rect.y * scale / PANGO_SCALE);
|
||||
@@ -709,8 +708,8 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
.height = rect.size.height + 2 * padding,
|
||||
},
|
||||
scale,
|
||||
&GRAPHENE_POINT_INIT (cache->origin.x + 1,
|
||||
cache->origin.y + 1));
|
||||
&GRAPHENE_POINT_INIT (cache->origin.x + padding,
|
||||
cache->origin.y + padding));
|
||||
|
||||
g_hash_table_insert (priv->glyph_cache, cache, cache);
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
|
||||
@@ -721,3 +720,4 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "gskvulkandescriptorsprivate.h"
|
||||
#endif
|
||||
|
||||
#include "gskrectprivate.h"
|
||||
|
||||
typedef struct _GskGpuGlobalsOp GskGpuGlobalsOp;
|
||||
|
||||
struct _GskGpuGlobalsOp
|
||||
@@ -87,15 +89,16 @@ static const GskGpuOpClass GSK_GPU_GLOBALS_OP_CLASS = {
|
||||
|
||||
void
|
||||
gsk_gpu_globals_op (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const GskScale *scale,
|
||||
const graphene_matrix_t *mvp,
|
||||
const GskRoundedRect *clip)
|
||||
{
|
||||
GskGpuGlobalsOp *self;
|
||||
GskPoint zero = gsk_point_init (0, 0);
|
||||
|
||||
self = (GskGpuGlobalsOp *) gsk_gpu_op_alloc (frame, &GSK_GPU_GLOBALS_OP_CLASS);
|
||||
|
||||
graphene_matrix_to_float (mvp, self->instance.mvp);
|
||||
gsk_rounded_rect_to_float (clip, graphene_point_zero (), self->instance.clip);
|
||||
graphene_vec2_to_float (scale, self->instance.scale);
|
||||
gsk_gpu_rounded_rect_to_float (clip, &zero, self->instance.clip);
|
||||
gsk_scale_to_float (scale, self->instance.scale);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "gskgpuopprivate.h"
|
||||
|
||||
#include <gsk/gskroundedrect.h>
|
||||
#include "gsk/gskscaleprivate.h"
|
||||
#include <graphene.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -17,7 +18,7 @@ struct _GskGpuGlobalsInstance
|
||||
};
|
||||
|
||||
void gsk_gpu_globals_op (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const GskScale *scale,
|
||||
const graphene_matrix_t *mvp,
|
||||
const GskRoundedRect *clip);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ gsk_gpu_linear_gradient_op (GskGpuFrame *frame,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *start,
|
||||
const graphene_point_t *end,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GskColorStop *stops,
|
||||
gsize n_stops)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ void gsk_gpu_linear_gradient_op (GskGpuF
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *start,
|
||||
const graphene_point_t *end,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GskColorStop *stops,
|
||||
gsize n_stops);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ gsk_gpu_mask_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float opacity,
|
||||
GskMaskMode mask_mode,
|
||||
guint32 source_descriptor,
|
||||
|
||||
@@ -10,7 +10,7 @@ void gsk_gpu_mask_op (GskGpuF
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuDescriptors *desc,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float opacity,
|
||||
GskMaskMode mask_mode,
|
||||
guint32 source_descriptor,
|
||||
|
||||
+185
-295
@@ -40,6 +40,8 @@
|
||||
#include "gskroundedrectprivate.h"
|
||||
#include "gskstrokeprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
#include "gskscaleprivate.h"
|
||||
#include "gskpointprivate.h"
|
||||
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
|
||||
@@ -104,12 +106,12 @@ struct _GskGpuNodeProcessor
|
||||
GskGpuFrame *frame;
|
||||
GskGpuDescriptors *desc;
|
||||
cairo_rectangle_int_t scissor;
|
||||
GskGpuBlend blend;
|
||||
graphene_point_t offset;
|
||||
graphene_matrix_t projection;
|
||||
graphene_vec2_t scale;
|
||||
GskTransform *modelview;
|
||||
GskGpuClip clip;
|
||||
GskGpuBlend blend;
|
||||
GskPoint offset;
|
||||
GskScale scale;
|
||||
GskTransform *modelview;
|
||||
graphene_matrix_t projection;
|
||||
float opacity;
|
||||
|
||||
GskGpuGlobals pending_globals;
|
||||
@@ -129,8 +131,8 @@ struct _GskGpuPatternWriter
|
||||
GskGpuDescriptors *desc;
|
||||
|
||||
graphene_rect_t bounds;
|
||||
graphene_point_t offset;
|
||||
graphene_vec2_t scale;
|
||||
GskPoint offset;
|
||||
GskScale scale;
|
||||
guint stack;
|
||||
|
||||
PatternBuffer buffer;
|
||||
@@ -175,24 +177,20 @@ gsk_gpu_node_processor_init (GskGpuNodeProcessor *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
float scale_x = viewport->size.width / width;
|
||||
float scale_y = viewport->size.height / height;
|
||||
gsk_gpu_clip_init_rect (&self->clip,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
scale_x * clip->x,
|
||||
scale_y * clip->y,
|
||||
scale_x * clip->width,
|
||||
scale_y * clip->height
|
||||
));
|
||||
graphene_rect_t rect;
|
||||
|
||||
rect = gsk_rect_scale (GRAPHENE_RECT_INIT (clip->x, clip->y, clip->width, clip->height),
|
||||
gsk_scale_init (viewport->size.width / width,
|
||||
viewport->size.height / height));
|
||||
gsk_gpu_clip_init_rect (&self->clip, &rect);
|
||||
}
|
||||
|
||||
self->modelview = NULL;
|
||||
gsk_gpu_image_get_projection_matrix (target, &self->projection);
|
||||
graphene_vec2_init (&self->scale,
|
||||
width / viewport->size.width,
|
||||
height / viewport->size.height);
|
||||
self->offset = GRAPHENE_POINT_INIT (-viewport->origin.x,
|
||||
-viewport->origin.y);
|
||||
self->scale = gsk_scale_init (width / viewport->size.width,
|
||||
height / viewport->size.height);
|
||||
self->offset = gsk_point_init (-viewport->origin.x,
|
||||
-viewport->origin.y);
|
||||
self->opacity = 1.0;
|
||||
self->pending_globals = GSK_GPU_GLOBAL_MATRIX | GSK_GPU_GLOBAL_SCALE | GSK_GPU_GLOBAL_CLIP | GSK_GPU_GLOBAL_SCISSOR | GSK_GPU_GLOBAL_BLEND;
|
||||
}
|
||||
@@ -304,41 +302,20 @@ gsk_gpu_node_processor_add_images (GskGpuNodeProcessor *self,
|
||||
while (desc != self->desc);
|
||||
}
|
||||
|
||||
static void
|
||||
rect_round_to_pixels (const graphene_rect_t *src,
|
||||
const graphene_vec2_t *pixel_scale,
|
||||
graphene_rect_t *dest)
|
||||
{
|
||||
float x, y, xscale, yscale, inv_xscale, inv_yscale;
|
||||
|
||||
xscale = graphene_vec2_get_x (pixel_scale);
|
||||
yscale = graphene_vec2_get_y (pixel_scale);
|
||||
inv_xscale = 1.0f / xscale;
|
||||
inv_yscale = 1.0f / yscale;
|
||||
|
||||
x = floorf (src->origin.x * xscale);
|
||||
y = floorf (src->origin.y * yscale);
|
||||
*dest = GRAPHENE_RECT_INIT (
|
||||
x * inv_xscale,
|
||||
y * inv_yscale,
|
||||
(ceil ((src->origin.x + src->size.width) * xscale) - x) * inv_xscale,
|
||||
(ceil ((src->origin.y + src->size.height) * yscale) - y) * inv_yscale);
|
||||
}
|
||||
|
||||
static GskGpuImage *
|
||||
gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
|
||||
GskGpuFrame *frame,
|
||||
GdkMemoryDepth depth,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport)
|
||||
gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
|
||||
GskGpuFrame *frame,
|
||||
GdkMemoryDepth depth,
|
||||
const GskScale *scale,
|
||||
const graphene_rect_t *viewport)
|
||||
{
|
||||
GskGpuImage *image;
|
||||
cairo_rectangle_int_t area;
|
||||
|
||||
area.x = 0;
|
||||
area.y = 0;
|
||||
area.width = ceil (graphene_vec2_get_x (scale) * viewport->size.width);
|
||||
area.height = ceil (graphene_vec2_get_y (scale) * viewport->size.height);
|
||||
area.width = ceilf (gsk_scale_get_x (*scale) * viewport->size.width);
|
||||
area.height = ceilf (gsk_scale_get_y (*scale) * viewport->size.height);
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
@@ -397,16 +374,13 @@ gsk_gpu_node_processor_process (GskGpuFrame *frame,
|
||||
static void
|
||||
gsk_gpu_pattern_writer_init (GskGpuPatternWriter *self,
|
||||
GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_point_t *offset,
|
||||
const GskScale *scale,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *bounds)
|
||||
{
|
||||
self->frame = frame;
|
||||
self->desc = NULL;
|
||||
self->bounds = GRAPHENE_RECT_INIT (bounds->origin.x + offset->x,
|
||||
bounds->origin.y + offset->y,
|
||||
bounds->size.width,
|
||||
bounds->size.height);
|
||||
self->bounds = gsk_rect_add_offset (*bounds, *offset);
|
||||
self->offset = *offset;
|
||||
self->scale = *scale;
|
||||
self->stack = 0;
|
||||
@@ -475,12 +449,12 @@ gsk_gpu_pattern_writer_append_vec4 (GskGpuPatternWriter *self,
|
||||
static void
|
||||
gsk_gpu_pattern_writer_append_point (GskGpuPatternWriter *self,
|
||||
const graphene_point_t *point,
|
||||
const graphene_point_t *offset)
|
||||
const GskPoint *offset)
|
||||
{
|
||||
float f[2];
|
||||
|
||||
f[0] = point->x + offset->x;
|
||||
f[1] = point->y + offset->y;
|
||||
f[0] = point->x + gsk_point_get_x (*offset);
|
||||
f[1] = point->y + gsk_point_get_y (*offset);
|
||||
|
||||
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
|
||||
}
|
||||
@@ -488,7 +462,7 @@ gsk_gpu_pattern_writer_append_point (GskGpuPatternWriter *self,
|
||||
static void
|
||||
gsk_gpu_pattern_writer_append_rect (GskGpuPatternWriter *self,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset)
|
||||
const GskPoint *offset)
|
||||
{
|
||||
float f[4];
|
||||
|
||||
@@ -552,78 +526,14 @@ gsk_gpu_pattern_writer_add_image (GskGpuPatternWriter *self,
|
||||
return gsk_gpu_descriptors_add_image (self->desc, image, sampler, out_descriptor);
|
||||
}
|
||||
|
||||
static void
|
||||
extract_scale_from_transform (GskTransform *transform,
|
||||
float *out_scale_x,
|
||||
float *out_scale_y)
|
||||
{
|
||||
switch (gsk_transform_get_category (transform))
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
*out_scale_x = 1.0f;
|
||||
*out_scale_y = 1.0f;
|
||||
return;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
float scale_x, scale_y, dx, dy;
|
||||
gsk_transform_to_affine (transform, &scale_x, &scale_y, &dx, &dy);
|
||||
*out_scale_x = fabs (scale_x);
|
||||
*out_scale_y = fabs (scale_y);
|
||||
}
|
||||
return;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
{
|
||||
float skew_x, skew_y, scale_x, scale_y, angle, dx, dy;
|
||||
gsk_transform_to_2d_components (transform,
|
||||
&skew_x, &skew_y,
|
||||
&scale_x, &scale_y,
|
||||
&angle,
|
||||
&dx, &dy);
|
||||
*out_scale_x = fabs (scale_x);
|
||||
*out_scale_y = fabs (scale_y);
|
||||
}
|
||||
return;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
{
|
||||
graphene_quaternion_t rotation;
|
||||
graphene_matrix_t matrix;
|
||||
graphene_vec4_t perspective;
|
||||
graphene_vec3_t translation;
|
||||
graphene_vec3_t matrix_scale;
|
||||
graphene_vec3_t shear;
|
||||
|
||||
gsk_transform_to_matrix (transform, &matrix);
|
||||
graphene_matrix_decompose (&matrix,
|
||||
&translation,
|
||||
&matrix_scale,
|
||||
&rotation,
|
||||
&shear,
|
||||
&perspective);
|
||||
|
||||
*out_scale_x = fabs (graphene_vec3_get_x (&matrix_scale));
|
||||
*out_scale_y = fabs (graphene_vec3_get_y (&matrix_scale));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gsk_gpu_node_processor_rect_is_integer (GskGpuNodeProcessor *self,
|
||||
const graphene_rect_t *rect,
|
||||
cairo_rectangle_int_t *int_rect)
|
||||
{
|
||||
graphene_rect_t transformed_rect;
|
||||
float scale_x = graphene_vec2_get_x (&self->scale);
|
||||
float scale_y = graphene_vec2_get_y (&self->scale);
|
||||
float scale_x = gsk_scale_get_x (self->scale);
|
||||
float scale_y = gsk_scale_get_y (self->scale);
|
||||
|
||||
switch (gsk_transform_get_category (self->modelview))
|
||||
{
|
||||
@@ -661,10 +571,8 @@ static void
|
||||
gsk_gpu_node_processor_get_clip_bounds (GskGpuNodeProcessor *self,
|
||||
graphene_rect_t *out_bounds)
|
||||
{
|
||||
graphene_rect_offset_r (&self->clip.rect.bounds,
|
||||
- self->offset.x,
|
||||
- self->offset.y,
|
||||
out_bounds);
|
||||
*out_bounds = gsk_rect_init_offset (self->clip.rect.bounds,
|
||||
gsk_point_negate (self->offset));
|
||||
|
||||
/* FIXME: We could try the scissor rect here.
|
||||
* But how often is that smaller than the clip bounds?
|
||||
@@ -757,7 +665,7 @@ gsk_gpu_node_processor_image_op (GskGpuNodeProcessor *self,
|
||||
static GskGpuImage *
|
||||
gsk_gpu_get_node_as_image (GskGpuFrame *frame,
|
||||
const graphene_rect_t *clip_bounds,
|
||||
const graphene_vec2_t *scale,
|
||||
const GskScale *scale,
|
||||
GskRenderNode *node,
|
||||
graphene_rect_t *out_bounds)
|
||||
{
|
||||
@@ -787,7 +695,6 @@ gsk_gpu_get_node_as_image (GskGpuFrame *frame,
|
||||
gsk_rect_intersection (clip_bounds, &node->bounds, &clipped);
|
||||
if (gsk_rect_is_empty (&clipped))
|
||||
return NULL;
|
||||
rect_round_to_pixels (&clipped, scale, &clipped);
|
||||
|
||||
result = gsk_gpu_upload_cairo_op (frame,
|
||||
scale,
|
||||
@@ -808,7 +715,6 @@ gsk_gpu_get_node_as_image (GskGpuFrame *frame,
|
||||
gsk_rect_intersection (clip_bounds, &node->bounds, &clipped);
|
||||
if (gsk_rect_is_empty (&clipped))
|
||||
return NULL;
|
||||
rect_round_to_pixels (&clipped, scale, &clipped);
|
||||
|
||||
GSK_DEBUG (FALLBACK, "Offscreening node '%s'", g_type_name_from_instance ((GTypeInstance *) node));
|
||||
result = gsk_gpu_render_pass_op_offscreen (frame,
|
||||
@@ -931,17 +837,18 @@ gsk_gpu_node_processor_get_node_as_image (GskGpuNodeProcessor *self,
|
||||
graphene_rect_t *out_bounds)
|
||||
{
|
||||
GskGpuImage *image, *ensure;
|
||||
graphene_rect_t default_clip;
|
||||
graphene_rect_t clip;
|
||||
|
||||
if (clip_bounds == NULL)
|
||||
{
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &default_clip))
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip))
|
||||
return NULL;
|
||||
clip_bounds = &default_clip;
|
||||
clip_bounds = &clip;
|
||||
}
|
||||
clip = gsk_rect_round_to_pixels (*clip_bounds, self->scale, self->offset);
|
||||
|
||||
image = gsk_gpu_get_node_as_image (self->frame,
|
||||
clip_bounds,
|
||||
&clip,
|
||||
&self->scale,
|
||||
node,
|
||||
out_bounds);
|
||||
@@ -980,9 +887,8 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
GskGpuNodeProcessor other;
|
||||
GskGpuImage *intermediate;
|
||||
guint32 intermediate_descriptor;
|
||||
graphene_vec2_t direction;
|
||||
graphene_rect_t clip_rect, intermediate_rect;
|
||||
graphene_point_t real_offset;
|
||||
GskPoint real_offset;
|
||||
int width, height;
|
||||
float clip_radius;
|
||||
|
||||
@@ -994,8 +900,8 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
if (!gsk_rect_intersection (rect, &clip_rect, &intermediate_rect))
|
||||
return;
|
||||
|
||||
width = ceil (graphene_vec2_get_x (&self->scale) * intermediate_rect.size.width);
|
||||
height = ceil (graphene_vec2_get_y (&self->scale) * intermediate_rect.size.height);
|
||||
width = ceilf (gsk_scale_get_x (self->scale) * intermediate_rect.size.width);
|
||||
height = ceilf (gsk_scale_get_y (self->scale) * intermediate_rect.size.height);
|
||||
|
||||
intermediate = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (self->frame),
|
||||
FALSE,
|
||||
@@ -1016,7 +922,6 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
|
||||
gsk_gpu_node_processor_sync_globals (&other, 0);
|
||||
|
||||
graphene_vec2_init (&direction, blur_radius, 0.0f);
|
||||
gsk_gpu_blur_op (other.frame,
|
||||
gsk_gpu_clip_get_shader_clip (&other.clip, &other.offset, &intermediate_rect),
|
||||
source_desc,
|
||||
@@ -1024,7 +929,7 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
&intermediate_rect,
|
||||
&other.offset,
|
||||
source_rect,
|
||||
&direction);
|
||||
&GRAPHENE_POINT_INIT (blur_radius, 0));
|
||||
|
||||
gsk_gpu_render_pass_end_op (other.frame,
|
||||
intermediate,
|
||||
@@ -1032,9 +937,7 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
|
||||
gsk_gpu_node_processor_finish (&other);
|
||||
|
||||
real_offset = GRAPHENE_POINT_INIT (self->offset.x + shadow_offset->x,
|
||||
self->offset.y + shadow_offset->y);
|
||||
graphene_vec2_init (&direction, 0.0f, blur_radius);
|
||||
real_offset = gsk_point_add (self->offset, gsk_point_init (shadow_offset->x, shadow_offset->y));
|
||||
intermediate_descriptor = gsk_gpu_node_processor_add_image (self, intermediate, GSK_GPU_SAMPLER_TRANSPARENT);
|
||||
if (shadow_color)
|
||||
{
|
||||
@@ -1045,7 +948,7 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
rect,
|
||||
&real_offset,
|
||||
&intermediate_rect,
|
||||
&direction,
|
||||
&GRAPHENE_POINT_INIT (0, blur_radius),
|
||||
shadow_color);
|
||||
}
|
||||
else
|
||||
@@ -1057,7 +960,7 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
rect,
|
||||
&real_offset,
|
||||
&intermediate_rect,
|
||||
&direction);
|
||||
&GRAPHENE_POINT_INIT (0, blur_radius));
|
||||
}
|
||||
|
||||
g_object_unref (intermediate);
|
||||
@@ -1073,6 +976,8 @@ gsk_gpu_node_processor_add_fallback_node (GskGpuNodeProcessor *self,
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clipped_bounds))
|
||||
return;
|
||||
|
||||
clipped_bounds = gsk_rect_round_to_pixels (clipped_bounds, self->scale, self->offset);
|
||||
|
||||
gsk_gpu_node_processor_sync_globals (self, 0);
|
||||
|
||||
image = gsk_gpu_upload_cairo_op (self->frame,
|
||||
@@ -1293,9 +1198,7 @@ gsk_gpu_node_processor_add_node_clipped (GskGpuNodeProcessor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
graphene_rect_offset_r (clip_bounds,
|
||||
self->offset.x, self->offset.y,
|
||||
&clip);
|
||||
clip = gsk_rect_add_offset (*clip_bounds, self->offset);
|
||||
|
||||
gsk_gpu_clip_init_copy (&old_clip, &self->clip);
|
||||
|
||||
@@ -1426,7 +1329,8 @@ gsk_gpu_node_processor_add_rounded_clip_node_with_mask (GskGpuNodeProcessor *sel
|
||||
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
rect_round_to_pixels (&clip_bounds, &self->scale, &clip_bounds);
|
||||
|
||||
clip_bounds = gsk_rect_round_to_pixels (clip_bounds, self->scale, self->offset);
|
||||
|
||||
child_image = gsk_gpu_node_processor_get_node_as_image (self,
|
||||
0,
|
||||
@@ -1503,7 +1407,7 @@ gsk_gpu_node_processor_add_rounded_clip_node (GskGpuNodeProcessor *self,
|
||||
gsk_gpu_clip_init_copy (&old_clip, &self->clip);
|
||||
|
||||
clip = *original_clip;
|
||||
gsk_rounded_rect_offset (&clip, self->offset.x, self->offset.y);
|
||||
gsk_rounded_rect_offset (&clip, gsk_point_get_x (self->offset), gsk_point_get_y (self->offset));
|
||||
|
||||
if (!gsk_gpu_clip_intersect_rounded_rect (&self->clip, &old_clip, &clip))
|
||||
{
|
||||
@@ -1532,8 +1436,8 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
|
||||
{
|
||||
GskRenderNode *child;
|
||||
GskTransform *transform;
|
||||
graphene_point_t old_offset;
|
||||
graphene_vec2_t old_scale;
|
||||
GskPoint old_offset;
|
||||
GskScale old_scale;
|
||||
GskTransform *old_modelview;
|
||||
GskGpuClip old_clip;
|
||||
|
||||
@@ -1548,8 +1452,7 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
|
||||
float dx, dy;
|
||||
gsk_transform_to_translate (transform, &dx, &dy);
|
||||
old_offset = self->offset;
|
||||
self->offset.x += dx;
|
||||
self->offset.y += dy;
|
||||
self->offset = gsk_point_add (self->offset, gsk_point_init (dx,dy));
|
||||
gsk_gpu_node_processor_add_node (self, child);
|
||||
self->offset = old_offset;
|
||||
}
|
||||
@@ -1566,13 +1469,11 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
|
||||
|
||||
gsk_transform_to_affine (transform, &scale_x, &scale_y, &dx, &dy);
|
||||
gsk_gpu_clip_scale (&self->clip, &old_clip, scale_x, scale_y);
|
||||
self->offset.x = (self->offset.x + dx) / scale_x;
|
||||
self->offset.y = (self->offset.y + dy) / scale_y;
|
||||
graphene_vec2_init (&self->scale, fabs (scale_x), fabs (scale_y));
|
||||
graphene_vec2_multiply (&self->scale, &old_scale, &self->scale);
|
||||
self->offset = gsk_point_divide (gsk_point_add (self->offset, gsk_point_init (dx, dy)), gsk_scale_init (scale_x, scale_y));
|
||||
self->scale = gsk_scale_multiply (old_scale, gsk_scale_init (fabsf (scale_x), fabsf (scale_y)));
|
||||
self->modelview = gsk_transform_scale (self->modelview,
|
||||
scale_x / fabs (scale_x),
|
||||
scale_y / fabs (scale_y));
|
||||
scale_x / fabsf (scale_x),
|
||||
scale_y / fabsf (scale_y));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1582,14 +1483,15 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
{
|
||||
GskTransform *clip_transform;
|
||||
float scale_x, scale_y, old_pixels, new_pixels;
|
||||
float old_pixels, new_pixels;
|
||||
GskScale scale;
|
||||
|
||||
clip_transform = gsk_transform_transform (gsk_transform_translate (NULL, &self->offset), transform);
|
||||
clip_transform = gsk_transform_transform (gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (gsk_point_get_x (self->offset), gsk_point_get_y (self->offset))), transform);
|
||||
gsk_gpu_clip_init_copy (&old_clip, &self->clip);
|
||||
|
||||
if (gsk_gpu_clip_contains_rect (&self->clip, &self->offset, &node->bounds))
|
||||
{
|
||||
gsk_gpu_clip_init_empty (&self->clip, &child->bounds);
|
||||
gsk_gpu_clip_init_contained (&self->clip, &child->bounds);
|
||||
}
|
||||
else if (old_clip.type == GSK_GPU_CLIP_NONE)
|
||||
{
|
||||
@@ -1598,7 +1500,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_empty (&self->clip, &new_bounds);
|
||||
gsk_gpu_clip_init_contained (&self->clip, &new_bounds);
|
||||
}
|
||||
else if (!gsk_gpu_clip_transform (&self->clip, &old_clip, clip_transform, &child->bounds))
|
||||
{
|
||||
@@ -1629,26 +1531,25 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self,
|
||||
old_modelview = gsk_transform_ref (self->modelview);
|
||||
|
||||
self->modelview = gsk_transform_scale (self->modelview,
|
||||
graphene_vec2_get_x (&self->scale),
|
||||
graphene_vec2_get_y (&self->scale));
|
||||
gsk_scale_get_x (self->scale),
|
||||
gsk_scale_get_y (self->scale));
|
||||
self->modelview = gsk_transform_transform (self->modelview, clip_transform);
|
||||
gsk_transform_unref (clip_transform);
|
||||
|
||||
extract_scale_from_transform (self->modelview, &scale_x, &scale_y);
|
||||
scale = gsk_scale_extract_from_transform (self->modelview);
|
||||
|
||||
old_pixels = graphene_vec2_get_x (&old_scale) * graphene_vec2_get_y (&old_scale) *
|
||||
old_pixels = gsk_scale_get_x (old_scale) * gsk_scale_get_y (old_scale) *
|
||||
old_clip.rect.bounds.size.width * old_clip.rect.bounds.size.height;
|
||||
new_pixels = scale_x * scale_y * self->clip.rect.bounds.size.width * self->clip.rect.bounds.size.height;
|
||||
new_pixels = gsk_scale_get_x (scale) * gsk_scale_get_y (scale) *
|
||||
self->clip.rect.bounds.size.width * self->clip.rect.bounds.size.height;
|
||||
if (new_pixels > 2 * old_pixels)
|
||||
{
|
||||
float forced_downscale = 2 * old_pixels / new_pixels;
|
||||
scale_x *= forced_downscale;
|
||||
scale_y *= forced_downscale;
|
||||
}
|
||||
scale = gsk_scale_multiply (scale, gsk_scale_init_uniform (2 * old_pixels / new_pixels));
|
||||
|
||||
self->modelview = gsk_transform_scale (self->modelview, 1 / scale_x, 1 / scale_y);
|
||||
graphene_vec2_init (&self->scale, scale_x, scale_y);
|
||||
self->offset = *graphene_point_zero ();
|
||||
self->modelview = gsk_transform_scale (self->modelview,
|
||||
1 / gsk_scale_get_x (scale),
|
||||
1 / gsk_scale_get_y (scale));
|
||||
self->scale = scale;
|
||||
self->offset = gsk_point_init (0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1675,8 +1576,8 @@ gsk_gpu_node_processor_create_transform_pattern (GskGpuPatternWriter *self,
|
||||
{
|
||||
GskRenderNode *child;
|
||||
GskTransform *transform;
|
||||
graphene_point_t old_offset;
|
||||
graphene_vec2_t old_scale;
|
||||
GskPoint old_offset;
|
||||
GskScale old_scale;
|
||||
graphene_rect_t old_bounds;
|
||||
gboolean result;
|
||||
|
||||
@@ -1695,8 +1596,7 @@ gsk_gpu_node_processor_create_transform_pattern (GskGpuPatternWriter *self,
|
||||
{
|
||||
float dx, dy;
|
||||
gsk_transform_to_translate (transform, &dx, &dy);
|
||||
self->offset.x += dx;
|
||||
self->offset.y += dy;
|
||||
self->offset = gsk_point_add (self->offset, gsk_point_init (dx, dy));
|
||||
result = gsk_gpu_node_processor_create_node_pattern (self, child);
|
||||
self->offset = old_offset;
|
||||
return result;
|
||||
@@ -1705,22 +1605,21 @@ gsk_gpu_node_processor_create_transform_pattern (GskGpuPatternWriter *self,
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
float sx, sy, dx, dy, inv_sx, inv_sy;
|
||||
GskPoint p;
|
||||
graphene_vec4_t vec4;
|
||||
if (!gsk_gpu_pattern_writer_push_stack (self))
|
||||
return FALSE;
|
||||
gsk_transform_to_affine (transform, &sx, &sy, &dx, &dy);
|
||||
inv_sx = 1.f / sx;
|
||||
inv_sy = 1.f / sy;
|
||||
p = gsk_point_add (self->offset, gsk_point_init (dx, dy));
|
||||
gsk_gpu_pattern_writer_append_uint (self, GSK_GPU_PATTERN_AFFINE);
|
||||
graphene_vec4_init (&vec4, self->offset.x + dx, self->offset.y + dy, inv_sx, inv_sy);
|
||||
graphene_vec4_init (&vec4, gsk_point_get_x (p), gsk_point_get_y (p), inv_sx, inv_sy);
|
||||
gsk_gpu_pattern_writer_append_vec4 (self, &vec4);
|
||||
self->bounds.origin.x = (self->bounds.origin.x - self->offset.x - dx) * inv_sx;
|
||||
self->bounds.origin.y = (self->bounds.origin.y - self->offset.y - dy) * inv_sy;
|
||||
self->bounds.size.width *= inv_sx;
|
||||
self->bounds.size.height *= inv_sy;
|
||||
self->offset = GRAPHENE_POINT_INIT (0, 0);
|
||||
graphene_vec2_init (&self->scale, fabs (sx), fabs (sy));
|
||||
graphene_vec2_multiply (&self->scale, &old_scale, &self->scale);
|
||||
self->bounds = gsk_rect_scale (gsk_rect_subtract_offset (self->bounds, p),
|
||||
gsk_scale_init (inv_sx, inv_sy));
|
||||
self->offset = gsk_point_init (0, 0);
|
||||
self->scale = gsk_scale_multiply (gsk_scale_init (fabsf (sx), fabsf (sy)), old_scale);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1742,9 +1641,9 @@ gsk_gpu_node_processor_create_transform_pattern (GskGpuPatternWriter *self,
|
||||
gsk_gpu_pattern_writer_append_uint (self, GSK_GPU_PATTERN_POSITION_POP);
|
||||
|
||||
gsk_gpu_pattern_writer_pop_stack (self);
|
||||
self->scale = old_scale;
|
||||
self->bounds = old_bounds;
|
||||
self->offset = old_offset;
|
||||
self->scale = old_scale;
|
||||
self->bounds = old_bounds;
|
||||
self->offset = old_offset;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1769,11 +1668,10 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
|
||||
cairo_rectangle_int_t int_clipped;
|
||||
graphene_rect_t rect, clipped;
|
||||
const GdkRGBA *color;
|
||||
GskPoint zero = gsk_point_init (0, 0);
|
||||
|
||||
color = gsk_color_node_get_color (node);
|
||||
graphene_rect_offset_r (&node->bounds,
|
||||
self->offset.x, self->offset.y,
|
||||
&rect);
|
||||
rect = gsk_rect_add_offset (node->bounds, self->offset);
|
||||
gsk_rect_intersection (&self->clip.rect.bounds, &rect, &clipped);
|
||||
|
||||
if (gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_CLEAR) &&
|
||||
@@ -1804,24 +1702,24 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
scale_x = graphene_vec2_get_x (&self->scale);
|
||||
scale_y = graphene_vec2_get_y (&self->scale);
|
||||
scale_x = gsk_scale_get_x (self->scale);
|
||||
scale_y = gsk_scale_get_y (self->scale);
|
||||
clipped = GRAPHENE_RECT_INIT (int_clipped.x / scale_x, int_clipped.y / scale_y,
|
||||
int_clipped.width / scale_x, int_clipped.height / scale_y);
|
||||
shader_clip = gsk_gpu_clip_get_shader_clip (&self->clip, graphene_point_zero(), &clipped);
|
||||
shader_clip = gsk_gpu_clip_get_shader_clip (&self->clip, &zero, &clipped);
|
||||
if (shader_clip != GSK_GPU_SHADER_CLIP_NONE)
|
||||
{
|
||||
gsk_rounded_rect_get_largest_cover (&self->clip.rect, &clipped, &cover);
|
||||
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;
|
||||
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;
|
||||
if (int_clipped.width == 0 || int_clipped.height == 0)
|
||||
{
|
||||
gsk_gpu_color_op (self->frame,
|
||||
shader_clip,
|
||||
&clipped,
|
||||
graphene_point_zero (),
|
||||
&zero,
|
||||
color);
|
||||
return;
|
||||
}
|
||||
@@ -1831,13 +1729,13 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
|
||||
gsk_gpu_color_op (self->frame,
|
||||
shader_clip,
|
||||
&GRAPHENE_RECT_INIT (clipped.origin.x, clipped.origin.y, cover.origin.x - clipped.origin.x, clipped.size.height),
|
||||
graphene_point_zero (),
|
||||
&zero,
|
||||
color);
|
||||
if (clipped.origin.y != cover.origin.y)
|
||||
gsk_gpu_color_op (self->frame,
|
||||
shader_clip,
|
||||
&GRAPHENE_RECT_INIT (clipped.origin.x, clipped.origin.y, clipped.size.width, cover.origin.y - clipped.origin.y),
|
||||
graphene_point_zero (),
|
||||
&zero,
|
||||
color);
|
||||
if (clipped.origin.x + clipped.size.width != cover.origin.x + cover.size.width)
|
||||
gsk_gpu_color_op (self->frame,
|
||||
@@ -1846,7 +1744,7 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
|
||||
clipped.origin.y,
|
||||
clipped.origin.x + clipped.size.width - cover.origin.x - cover.size.width,
|
||||
clipped.size.height),
|
||||
graphene_point_zero (),
|
||||
&zero,
|
||||
color);
|
||||
if (clipped.origin.y + clipped.size.height != cover.origin.y + cover.size.height)
|
||||
gsk_gpu_color_op (self->frame,
|
||||
@@ -1855,7 +1753,7 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
|
||||
cover.origin.y + cover.size.height,
|
||||
clipped.size.width,
|
||||
clipped.origin.y + clipped.size.height - cover.origin.y - cover.size.height),
|
||||
graphene_point_zero (),
|
||||
&zero,
|
||||
color);
|
||||
}
|
||||
}
|
||||
@@ -1932,8 +1830,8 @@ gsk_gpu_node_processor_add_texture_node (GskGpuNodeProcessor *self,
|
||||
}
|
||||
|
||||
if (gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_MIPMAP) &&
|
||||
(gdk_texture_get_width (texture) > 2 * node->bounds.size.width * graphene_vec2_get_x (&self->scale) ||
|
||||
gdk_texture_get_height (texture) > 2 * node->bounds.size.height * graphene_vec2_get_y (&self->scale)))
|
||||
(gdk_texture_get_width (texture) > 2 * node->bounds.size.width * gsk_scale_get_x (self->scale) ||
|
||||
gdk_texture_get_height (texture) > 2 * node->bounds.size.height * gsk_scale_get_y (self->scale)))
|
||||
{
|
||||
guint32 descriptor;
|
||||
|
||||
@@ -1999,8 +1897,8 @@ gsk_gpu_node_processor_create_texture_pattern (GskGpuPatternWriter *self,
|
||||
}
|
||||
|
||||
if (gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_MIPMAP) &&
|
||||
(gdk_texture_get_width (texture) > 2 * node->bounds.size.width * graphene_vec2_get_x (&self->scale) ||
|
||||
gdk_texture_get_height (texture) > 2 * node->bounds.size.height * graphene_vec2_get_y (&self->scale)))
|
||||
(gdk_texture_get_width (texture) > 2 * node->bounds.size.width * gsk_scale_get_x (self->scale) ||
|
||||
gdk_texture_get_height (texture) > 2 * node->bounds.size.height * gsk_scale_get_y (self->scale)))
|
||||
{
|
||||
image = gsk_gpu_node_processor_ensure_image (self->frame,
|
||||
image,
|
||||
@@ -2043,18 +1941,18 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
|
||||
guint32 descriptor;
|
||||
gboolean need_mipmap, need_offscreen;
|
||||
|
||||
need_offscreen = self->modelview != NULL ||
|
||||
!graphene_vec2_equal (&self->scale, graphene_vec2_one ());
|
||||
need_offscreen = self->modelview != NULL || !gsk_scale_is_one (self->scale);
|
||||
if (need_offscreen)
|
||||
{
|
||||
GskGpuImage *offscreen;
|
||||
graphene_rect_t clip_bounds;
|
||||
GskScale one = gsk_scale_init (1, 1);
|
||||
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
gsk_rect_round_larger (&clip_bounds);
|
||||
clip_bounds = gsk_rect_round_larger (clip_bounds);
|
||||
offscreen = gsk_gpu_render_pass_op_offscreen (self->frame,
|
||||
graphene_vec2_one (),
|
||||
&one,
|
||||
&clip_bounds,
|
||||
node);
|
||||
descriptor = gsk_gpu_node_processor_add_image (self, offscreen, GSK_GPU_SAMPLER_DEFAULT);
|
||||
@@ -2250,7 +2148,8 @@ gsk_gpu_node_processor_add_gradient_node (GskGpuNodeProcessor *self,
|
||||
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &bounds))
|
||||
return;
|
||||
rect_round_to_pixels (&bounds, &self->scale, &bounds);
|
||||
|
||||
bounds = gsk_rect_round_to_pixels (bounds, self->scale, self->offset);
|
||||
|
||||
image = gsk_gpu_node_processor_init_draw (&other,
|
||||
self->frame,
|
||||
@@ -2545,8 +2444,7 @@ gsk_gpu_node_processor_add_shadow_node (GskGpuNodeProcessor *self,
|
||||
const GskShadow *shadow = gsk_shadow_node_get_shadow (node, i);
|
||||
if (shadow->radius == 0)
|
||||
{
|
||||
graphene_point_t shadow_offset = GRAPHENE_POINT_INIT (self->offset.x + shadow->dx,
|
||||
self->offset.y + shadow->dy);
|
||||
GskPoint shadow_offset = gsk_point_add (self->offset, gsk_point_init (shadow->dx, shadow->dy));
|
||||
gsk_gpu_colorize_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &shadow_offset, &child->bounds),
|
||||
desc,
|
||||
@@ -2972,9 +2870,9 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
GskGpuDevice *device;
|
||||
const PangoGlyphInfo *glyphs;
|
||||
PangoFont *font;
|
||||
graphene_point_t offset;
|
||||
GskPoint offset;
|
||||
guint i, num_glyphs;
|
||||
float scale, inv_scale;
|
||||
GskScale scale, inv;
|
||||
GdkRGBA color;
|
||||
|
||||
if (self->opacity < 1.0 &&
|
||||
@@ -2990,18 +2888,17 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *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 = gsk_point_add (gsk_point_init_from_graphene (gsk_text_node_get_offset (node)), self->offset);
|
||||
|
||||
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
|
||||
inv_scale = 1.f / scale;
|
||||
scale = gsk_scale_max (self->scale);
|
||||
inv = gsk_scale_invert (scale);
|
||||
|
||||
for (i = 0; i < num_glyphs; i++)
|
||||
{
|
||||
GskGpuImage *image;
|
||||
graphene_rect_t glyph_bounds, glyph_tex_rect;
|
||||
graphene_point_t glyph_offset;
|
||||
GskPoint g_offset;
|
||||
guint32 descriptor;
|
||||
|
||||
image = gsk_gpu_device_lookup_glyph_image (device,
|
||||
@@ -3009,34 +2906,36 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
0,
|
||||
scale,
|
||||
gsk_scale_get_x (scale),
|
||||
&glyph_bounds,
|
||||
&glyph_offset);
|
||||
|
||||
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);
|
||||
glyph_tex_rect = gsk_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);
|
||||
glyph_bounds = gsk_rect_scale (GRAPHENE_RECT_INIT (0, 0, glyph_bounds.size.width, glyph_bounds.size.height), inv);
|
||||
g_offset = gsk_point_add (gsk_point_add (offset, gsk_point_divide (gsk_point_init_from_graphene (&glyph_offset), scale)),
|
||||
gsk_point_init (glyphs[i].geometry.x_offset/(float)PANGO_SCALE,
|
||||
glyphs[i].geometry.y_offset/(float)PANGO_SCALE));
|
||||
|
||||
descriptor = gsk_gpu_node_processor_add_image (self, image, GSK_GPU_SAMPLER_DEFAULT);
|
||||
if (gsk_text_node_has_color_glyphs (node))
|
||||
if (glyphs[i].attr.is_color)
|
||||
gsk_gpu_texture_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &g_offset, &glyph_bounds),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&glyph_bounds,
|
||||
&glyph_offset,
|
||||
&g_offset,
|
||||
&glyph_tex_rect);
|
||||
else
|
||||
gsk_gpu_colorize_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &g_offset, &glyph_bounds),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&glyph_bounds,
|
||||
&glyph_offset,
|
||||
&g_offset,
|
||||
&glyph_tex_rect,
|
||||
&color);
|
||||
|
||||
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
|
||||
offset = gsk_point_add (offset, gsk_point_init ((float) glyphs[i].geometry.width / PANGO_SCALE, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3049,10 +2948,10 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
PangoFont *font;
|
||||
guint num_glyphs;
|
||||
gsize i;
|
||||
float scale, inv_scale;
|
||||
GskScale scale, inv;
|
||||
guint32 tex_id;
|
||||
GskGpuImage *last_image;
|
||||
graphene_point_t offset;
|
||||
GskPoint offset;
|
||||
|
||||
if (gsk_text_node_has_color_glyphs (node))
|
||||
return FALSE;
|
||||
@@ -3061,12 +2960,10 @@ 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 = gsk_point_add (gsk_point_init_from_graphene (gsk_text_node_get_offset (node)), self->offset);
|
||||
|
||||
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
|
||||
inv_scale = 1.f / scale;
|
||||
scale = gsk_scale_max (self->scale);
|
||||
inv = gsk_scale_invert (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));
|
||||
@@ -3078,13 +2975,15 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
GskGpuImage *image;
|
||||
graphene_rect_t glyph_bounds;
|
||||
graphene_point_t glyph_offset;
|
||||
GskPoint g_offset;
|
||||
graphene_rect_t rect;
|
||||
|
||||
image = gsk_gpu_device_lookup_glyph_image (device,
|
||||
self->frame,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
0,
|
||||
scale,
|
||||
gsk_scale_get_x (scale),
|
||||
&glyph_bounds,
|
||||
&glyph_offset);
|
||||
|
||||
@@ -3096,23 +2995,22 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
last_image = image;
|
||||
}
|
||||
|
||||
graphene_rect_scale (&glyph_bounds, 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);
|
||||
g_offset = gsk_point_add (gsk_point_add (offset, gsk_point_divide (gsk_point_init_from_graphene (&glyph_offset), scale)),
|
||||
gsk_point_init (glyphs[i].geometry.x_offset / (float)PANGO_SCALE,
|
||||
glyphs[i].geometry.y_offset / (float)PANGO_SCALE));
|
||||
|
||||
gsk_gpu_pattern_writer_append_uint (self, tex_id);
|
||||
gsk_gpu_pattern_writer_append_rect (self,
|
||||
&glyph_bounds,
|
||||
&glyph_offset);
|
||||
gsk_gpu_pattern_writer_append_rect (self,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0, 0,
|
||||
gsk_gpu_image_get_width (image) * inv_scale,
|
||||
gsk_gpu_image_get_height (image) * inv_scale
|
||||
),
|
||||
&glyph_offset);
|
||||
rect = gsk_rect_scale (GRAPHENE_RECT_INIT (0, 0, glyph_bounds.size.width, glyph_bounds.size.height),
|
||||
inv);
|
||||
gsk_gpu_pattern_writer_append_rect (self, &rect, &g_offset);
|
||||
rect = gsk_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);
|
||||
gsk_gpu_pattern_writer_append_rect (self, &rect, &g_offset);
|
||||
|
||||
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
|
||||
offset = gsk_point_add (offset, gsk_point_init ((float) glyphs[i].geometry.width / PANGO_SCALE, 0));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -3212,10 +3110,10 @@ gsk_gpu_node_processor_repeat_tile (GskGpuNodeProcessor *self,
|
||||
graphene_rect_t clipped_child_bounds, offset_rect;
|
||||
guint32 descriptor;
|
||||
|
||||
gsk_rect_init_offset (&offset_rect,
|
||||
rect,
|
||||
- x * child_bounds->size.width,
|
||||
- y * child_bounds->size.height);
|
||||
offset_rect = gsk_rect_init_offset (*rect,
|
||||
gsk_point_multiply (gsk_point_init (child_bounds->size.width, child_bounds->size.height),
|
||||
gsk_scale_init (-x, -y)));
|
||||
|
||||
if (!gsk_rect_intersection (&offset_rect, child_bounds, &clipped_child_bounds))
|
||||
{
|
||||
/* The math has gone wrong probably, someone should look at this. */
|
||||
@@ -3344,23 +3242,21 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self,
|
||||
else
|
||||
{
|
||||
/* repeat in both directions */
|
||||
graphene_point_t old_offset, offset;
|
||||
GskPoint old_offset, offset;
|
||||
graphene_rect_t clip_bounds;
|
||||
float x, y;
|
||||
float x, y, offset_x, offset_y;
|
||||
|
||||
old_offset = self->offset;
|
||||
|
||||
for (x = floorf (tile_left); x < ceilf (tile_right); x++)
|
||||
{
|
||||
offset.x = x * child_bounds->size.width;
|
||||
offset_x = x * child_bounds->size.width;
|
||||
for (y = floorf (tile_top); y < ceilf (tile_bottom); y++)
|
||||
{
|
||||
offset.y = y * child_bounds->size.height;
|
||||
self->offset = GRAPHENE_POINT_INIT (old_offset.x + offset.x, old_offset.y + offset.y);
|
||||
clip_bounds = GRAPHENE_RECT_INIT (bounds.origin.x - offset.x,
|
||||
bounds.origin.y - offset.y,
|
||||
bounds.size.width,
|
||||
bounds.size.height);
|
||||
offset_y = y * child_bounds->size.height;
|
||||
offset = gsk_point_init (offset_x, offset_y);
|
||||
self->offset = gsk_point_add (old_offset, offset);
|
||||
clip_bounds = gsk_rect_subtract_offset (bounds, offset);
|
||||
if (!gsk_rect_intersection (&clip_bounds, child_bounds, &clip_bounds))
|
||||
continue;
|
||||
gsk_gpu_node_processor_add_node_clipped (self,
|
||||
@@ -3401,10 +3297,7 @@ gsk_gpu_node_processor_create_repeat_pattern (GskGpuPatternWriter *self,
|
||||
gsk_gpu_pattern_writer_append_rect (self, child_bounds, &self->offset);
|
||||
|
||||
old_bounds = self->bounds;
|
||||
self->bounds = GRAPHENE_RECT_INIT (child_bounds->origin.x + self->offset.x,
|
||||
child_bounds->origin.y + self->offset.y,
|
||||
child_bounds->size.width,
|
||||
child_bounds->size.height);
|
||||
self->bounds = gsk_rect_add_offset (*child_bounds, self->offset);
|
||||
|
||||
if (!gsk_gpu_node_processor_create_node_pattern (self, child))
|
||||
{
|
||||
@@ -3477,6 +3370,8 @@ gsk_gpu_node_processor_add_fill_node (GskGpuNodeProcessor *self,
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
|
||||
clip_bounds = gsk_rect_round_to_pixels (clip_bounds, self->scale, self->offset);
|
||||
|
||||
child = gsk_fill_node_get_child (node);
|
||||
|
||||
mask_image = gsk_gpu_upload_cairo_op (self->frame,
|
||||
@@ -3517,9 +3412,9 @@ gsk_gpu_node_processor_add_fill_node (GskGpuNodeProcessor *self,
|
||||
descriptors);
|
||||
|
||||
gsk_gpu_mask_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &clip_bounds),
|
||||
self->desc,
|
||||
&node->bounds,
|
||||
&clip_bounds,
|
||||
&self->offset,
|
||||
self->opacity,
|
||||
GSK_MASK_MODE_ALPHA,
|
||||
@@ -3573,6 +3468,8 @@ gsk_gpu_node_processor_add_stroke_node (GskGpuNodeProcessor *self,
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
|
||||
clip_bounds = gsk_rect_round_to_pixels (clip_bounds, self->scale, self->offset);
|
||||
|
||||
child = gsk_stroke_node_get_child (node);
|
||||
|
||||
mask_image = gsk_gpu_upload_cairo_op (self->frame,
|
||||
@@ -3613,9 +3510,9 @@ gsk_gpu_node_processor_add_stroke_node (GskGpuNodeProcessor *self,
|
||||
descriptors);
|
||||
|
||||
gsk_gpu_mask_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &clip_bounds),
|
||||
self->desc,
|
||||
&node->bounds,
|
||||
&clip_bounds,
|
||||
&self->offset,
|
||||
self->opacity,
|
||||
GSK_MASK_MODE_ALPHA,
|
||||
@@ -3645,15 +3542,9 @@ gsk_gpu_node_processor_add_subsurface_node (GskGpuNodeProcessor *self,
|
||||
if (!gdk_subsurface_is_above_parent (subsurface))
|
||||
{
|
||||
cairo_rectangle_int_t int_rect;
|
||||
graphene_rect_t r = gsk_rect_add_offset (node->bounds, self->offset);
|
||||
|
||||
if (!gsk_gpu_node_processor_rect_is_integer (self,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
node->bounds.origin.x + self->offset.x,
|
||||
node->bounds.origin.y + self->offset.y,
|
||||
node->bounds.size.width,
|
||||
node->bounds.size.height
|
||||
),
|
||||
&int_rect))
|
||||
if (!gsk_gpu_node_processor_rect_is_integer (self, &r, &int_rect))
|
||||
{
|
||||
g_warning ("FIXME: non-integer aligned subsurface?!");
|
||||
}
|
||||
@@ -3907,6 +3798,7 @@ gsk_gpu_node_processor_add_node (GskGpuNodeProcessor *self,
|
||||
* there's quaranteed to be at least 1 pixel that needs to be drawn */
|
||||
if (node->bounds.size.width == 0 || node->bounds.size.height == 0)
|
||||
return;
|
||||
|
||||
if (!gsk_gpu_clip_may_intersect_rect (&self->clip, &self->offset, &node->bounds))
|
||||
return;
|
||||
|
||||
@@ -3970,13 +3862,11 @@ gsk_gpu_node_processor_create_node_pattern (GskGpuPatternWriter *self,
|
||||
gsk_gpu_descriptors_set_size (self->desc, images_before, buffers_before);
|
||||
}
|
||||
|
||||
bounds = gsk_rect_round_to_pixels (gsk_rect_subtract_offset (self->bounds, self->offset),
|
||||
self->scale,
|
||||
self->offset);
|
||||
image = gsk_gpu_get_node_as_image (self->frame,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
self->bounds.origin.x - self->offset.x,
|
||||
self->bounds.origin.y - self->offset.y,
|
||||
self->bounds.size.width,
|
||||
self->bounds.size.height
|
||||
),
|
||||
&bounds,
|
||||
&self->scale,
|
||||
node,
|
||||
&bounds);
|
||||
|
||||
@@ -66,11 +66,12 @@ gsk_gpu_radial_gradient_op (GskGpuFrame *frame,
|
||||
const graphene_point_t *radius,
|
||||
float start,
|
||||
float end,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GskColorStop *stops,
|
||||
gsize n_stops)
|
||||
{
|
||||
GskGpuRadialgradientInstance *instance;
|
||||
GskPoint zero = gsk_point_init (0, 0);
|
||||
|
||||
g_assert (n_stops > 1);
|
||||
g_assert (n_stops <= 7);
|
||||
@@ -85,7 +86,7 @@ gsk_gpu_radial_gradient_op (GskGpuFrame *frame,
|
||||
|
||||
gsk_gpu_rect_to_float (rect, offset, instance->rect);
|
||||
gsk_gpu_point_to_float (center, offset, instance->center_radius);
|
||||
gsk_gpu_point_to_float (radius, graphene_point_zero(), &instance->center_radius[2]);
|
||||
gsk_gpu_point_to_float (radius, &zero, &instance->center_radius[2]);
|
||||
instance->startend[0] = start;
|
||||
instance->startend[1] = end;
|
||||
gsk_gpu_rgba_to_float (&stops[MIN (n_stops - 1, 6)].color, instance->color6);
|
||||
|
||||
@@ -16,7 +16,7 @@ void gsk_gpu_radial_gradient_op (GskGpuF
|
||||
const graphene_point_t *radius,
|
||||
float start,
|
||||
float end,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GskColorStop *stops,
|
||||
gsize n_stops);
|
||||
|
||||
|
||||
@@ -335,16 +335,16 @@ gsk_gpu_render_pass_end_op (GskGpuFrame *frame,
|
||||
}
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gpu_render_pass_op_offscreen (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node)
|
||||
gsk_gpu_render_pass_op_offscreen (GskGpuFrame *frame,
|
||||
const GskScale *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GskGpuImage *image;
|
||||
int width, height;
|
||||
|
||||
width = ceil (graphene_vec2_get_x (scale) * viewport->size.width);
|
||||
height = ceil (graphene_vec2_get_y (scale) * viewport->size.height);
|
||||
width = ceil (gsk_scale_get_x (*scale) * viewport->size.width);
|
||||
height = ceil (gsk_scale_get_y (*scale) * viewport->size.height);
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
#include "gsk/gskscaleprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* We only need this for the final VkImageLayout, but don't tell anyone */
|
||||
@@ -24,7 +26,7 @@ void gsk_gpu_render_pass_end_op (GskGpuF
|
||||
GskRenderPassType pass_type);
|
||||
|
||||
GskGpuImage * gsk_gpu_render_pass_op_offscreen (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const GskScale *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void
|
||||
gsk_gpu_rounded_color_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const GskRoundedRect *outline,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GskGpuRoundedcolorInstance *instance;
|
||||
@@ -69,7 +69,7 @@ gsk_gpu_rounded_color_op (GskGpuFrame *frame,
|
||||
NULL,
|
||||
&instance);
|
||||
|
||||
gsk_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
gsk_gpu_rounded_rect_to_float (outline, offset, instance->outline);
|
||||
gsk_gpu_rgba_to_float (color, instance->color);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ G_BEGIN_DECLS
|
||||
void gsk_gpu_rounded_color_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const GskRoundedRect *outline,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const GdkRGBA *color);
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "gskgpuopprivate.h"
|
||||
|
||||
#include "gskgputypesprivate.h"
|
||||
#include "gskpointprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -69,11 +70,11 @@ gsk_gpu_rgba_to_float (const GdkRGBA *rgba,
|
||||
|
||||
static inline void
|
||||
gsk_gpu_point_to_float (const graphene_point_t *point,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float values[2])
|
||||
{
|
||||
values[0] = point->x + offset->x;
|
||||
values[1] = point->y + offset->y;
|
||||
values[0] = point->x + gsk_point_get_x (*offset);
|
||||
values[1] = point->y + gsk_point_get_y (*offset);
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -62,7 +62,7 @@ gsk_gpu_straight_alpha_op (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect)
|
||||
{
|
||||
GskGpuStraightalphaInstance *instance;
|
||||
|
||||
@@ -12,7 +12,7 @@ void gsk_gpu_straight_alpha_op (GskGpuF
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect);
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ gsk_gpu_texture_op (GskGpuFrame *frame,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect)
|
||||
{
|
||||
GskGpuTextureInstance *instance;
|
||||
|
||||
@@ -11,7 +11,7 @@ void gsk_gpu_texture_op (GskGpuF
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
const graphene_rect_t *tex_rect);
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gsk/gskenums.h"
|
||||
#include "gsk/gsktypes.h"
|
||||
|
||||
#include "gdk/gdkmemoryformatprivate.h"
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void
|
||||
gsk_gpu_uber_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 pattern_id)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ G_BEGIN_DECLS
|
||||
void gsk_gpu_uber_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 pattern_id);
|
||||
|
||||
|
||||
@@ -451,12 +451,12 @@ static const GskGpuOpClass GSK_GPU_UPLOAD_CAIRO_OP_CLASS = {
|
||||
};
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gpu_upload_cairo_op (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskGpuCairoFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify user_destroy)
|
||||
gsk_gpu_upload_cairo_op (GskGpuFrame *frame,
|
||||
const GskScale *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskGpuCairoFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify user_destroy)
|
||||
{
|
||||
GskGpuUploadCairoOp *self;
|
||||
|
||||
@@ -465,8 +465,8 @@ gsk_gpu_upload_cairo_op (GskGpuFrame *frame,
|
||||
self->image = gsk_gpu_device_create_upload_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
GDK_MEMORY_DEFAULT,
|
||||
ceil (graphene_vec2_get_x (scale) * viewport->size.width),
|
||||
ceil (graphene_vec2_get_y (scale) * viewport->size.height));
|
||||
ceil (gsk_scale_get_x (*scale) * viewport->size.width),
|
||||
ceil (gsk_scale_get_y (*scale) * viewport->size.height));
|
||||
self->viewport = *viewport;
|
||||
self->func = func;
|
||||
self->user_data = user_data;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "gskgpuopprivate.h"
|
||||
|
||||
#include "gsktypes.h"
|
||||
#include "gsk/gskscaleprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -14,7 +15,7 @@ GskGpuImage * gsk_gpu_upload_texture_op_try (GskGpuF
|
||||
GdkTexture *texture);
|
||||
|
||||
GskGpuImage * gsk_gpu_upload_cairo_op (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const GskScale *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskGpuCairoFunc func,
|
||||
gpointer user_data,
|
||||
|
||||
@@ -75,6 +75,12 @@ gsk_ngl_renderer_make_current (GskGpuRenderer *renderer)
|
||||
gdk_gl_context_make_current (GDK_GL_CONTEXT (gsk_gpu_renderer_get_context (renderer)));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_ngl_renderer_free_backbuffer (GskNglRenderer *self)
|
||||
{
|
||||
g_clear_object (&self->backbuffer);
|
||||
}
|
||||
|
||||
static GskGpuImage *
|
||||
gsk_ngl_renderer_get_backbuffer (GskGpuRenderer *renderer)
|
||||
{
|
||||
@@ -91,7 +97,7 @@ gsk_ngl_renderer_get_backbuffer (GskGpuRenderer *renderer)
|
||||
gsk_gpu_image_get_width (self->backbuffer) != ceil (gdk_surface_get_width (surface) * scale) ||
|
||||
gsk_gpu_image_get_height (self->backbuffer) != ceil (gdk_surface_get_height (surface) * scale))
|
||||
{
|
||||
g_clear_object (&self->backbuffer);
|
||||
gsk_ngl_renderer_free_backbuffer (self);
|
||||
self->backbuffer = gsk_gl_image_new_backbuffer (GSK_GL_DEVICE (gsk_gpu_renderer_get_device (renderer)),
|
||||
GDK_MEMORY_DEFAULT /* FIXME */,
|
||||
ceil (gdk_surface_get_width (surface) * scale),
|
||||
@@ -124,10 +130,21 @@ gsk_ngl_renderer_get_dmabuf_formats (GskGpuRenderer *renderer)
|
||||
return display->egl_dmabuf_formats;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_ngl_renderer_unrealize (GskRenderer *renderer)
|
||||
{
|
||||
GskNglRenderer *self = GSK_NGL_RENDERER (renderer);
|
||||
|
||||
gsk_ngl_renderer_free_backbuffer (self);
|
||||
|
||||
GSK_RENDERER_CLASS (gsk_ngl_renderer_parent_class)->unrealize (renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_ngl_renderer_class_init (GskNglRendererClass *klass)
|
||||
{
|
||||
GskGpuRendererClass *gpu_renderer_class = GSK_GPU_RENDERER_CLASS (klass);
|
||||
GskRendererClass *renderer_class = GSK_RENDERER_CLASS (klass);
|
||||
|
||||
gpu_renderer_class->frame_type = GSK_TYPE_GL_FRAME;
|
||||
|
||||
@@ -138,6 +155,8 @@ gsk_ngl_renderer_class_init (GskNglRendererClass *klass)
|
||||
gpu_renderer_class->wait = gsk_ngl_renderer_wait;
|
||||
gpu_renderer_class->get_scale = gsk_ngl_renderer_get_scale;
|
||||
gpu_renderer_class->get_dmabuf_formats = gsk_ngl_renderer_get_dmabuf_formats;
|
||||
|
||||
renderer_class->unrealize = gsk_ngl_renderer_unrealize;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+1
-1
@@ -1819,7 +1819,7 @@ gsk_rect_contour_get_stroke_bounds (const GskContour *contour,
|
||||
graphene_rect_t rect;
|
||||
|
||||
graphene_rect_init (&rect, self->x, self->y, self->width, self->height);
|
||||
graphene_rect_inset (&rect, - stroke->line_width, - stroke->line_width);
|
||||
graphene_rect_inset (&rect, - 0.5 * stroke->line_width, - 0.5 * stroke->line_width);
|
||||
gsk_bounding_box_init_from_rect (bounds, &rect);
|
||||
|
||||
return TRUE;
|
||||
|
||||
+148
-11
@@ -1,20 +1,157 @@
|
||||
#pragma once
|
||||
|
||||
#include "gsktypes.h"
|
||||
#include <graphene.h>
|
||||
#include <math.h>
|
||||
#include <smmintrin.h>
|
||||
|
||||
static inline void G_GNUC_PURE
|
||||
gsk_point_interpolate (const graphene_point_t *p1,
|
||||
const graphene_point_t *p2,
|
||||
float t,
|
||||
graphene_point_t *p)
|
||||
#include "gskscaleprivate.h"
|
||||
|
||||
struct _GskPoint
|
||||
{
|
||||
p->x = p1->x * (1 - t) + p2->x * t;
|
||||
p->Y = p1->y * (1 - t) + p2->y * t;
|
||||
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
|
||||
};
|
||||
|
||||
static inline float
|
||||
gsk_point_get_x (const GskPoint p)
|
||||
{
|
||||
return graphene_simd4f_get_x (p.v);
|
||||
}
|
||||
|
||||
static inline float G_GNUC_PURE
|
||||
gsk_point_distance (const graphene_point_t *p1,
|
||||
const graphene_point_t *p2)
|
||||
static inline float
|
||||
gsk_point_get_y (const GskPoint p)
|
||||
{
|
||||
return sqrtf ((p1->x - p2->x)*(p1->x - p2->x) + (p1->y - p2->y)*(p1->y - p2->y));
|
||||
return graphene_simd4f_get_y (p.v);
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_init (float x,
|
||||
float y)
|
||||
{
|
||||
GskPoint p;
|
||||
|
||||
p.v = graphene_simd4f_init (x, y, 0.f, 0.f);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_init_from_graphene (const graphene_point_t *p)
|
||||
{
|
||||
return gsk_point_init (p->x, p->y);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_point_to_float (const GskPoint *p,
|
||||
float v[2])
|
||||
{
|
||||
graphene_simd4f_dup_2f (p->v, v);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gsk_point_is_zero (const GskPoint p)
|
||||
{
|
||||
return gsk_point_get_x (p) == 0 && gsk_point_get_y (p) == 0;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_negate (const GskPoint p)
|
||||
{
|
||||
GskPoint neg;
|
||||
|
||||
neg.v = graphene_simd4f_neg (p.v);
|
||||
|
||||
return neg;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_multiply (const GskPoint p,
|
||||
const GskScale s)
|
||||
{
|
||||
GskPoint q;
|
||||
|
||||
q.v = graphene_simd4f_mul (p.v, s.v);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_divide (const GskPoint p,
|
||||
const GskScale s)
|
||||
{
|
||||
GskPoint q;
|
||||
|
||||
q.v = graphene_simd4f_div (p.v, s.v);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_add (const GskPoint p1,
|
||||
const GskPoint p2)
|
||||
{
|
||||
GskPoint p;
|
||||
|
||||
p.v = graphene_simd4f_add (p1.v, p2.v);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_subtract (const GskPoint p1,
|
||||
const GskPoint p2)
|
||||
{
|
||||
GskPoint p;
|
||||
|
||||
p.v = graphene_simd4f_sub (p1.v, p2.v);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSE4
|
||||
|
||||
# define graphene_simd4f_floor(v) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_floor_ps ((v)); \
|
||||
}))
|
||||
|
||||
# define graphene_simd4f_ceil(v) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_ceil_ps ((v)); \
|
||||
}))
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_floor (const GskPoint p)
|
||||
{
|
||||
GskPoint q;
|
||||
|
||||
q.v = graphene_simd4f_floor (p.v);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_ceil (const GskPoint p)
|
||||
{
|
||||
GskPoint q;
|
||||
|
||||
q.v = graphene_simd4f_ceil (p.v);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_floor (const GskPoint p)
|
||||
{
|
||||
return gsk_point_init (floorf (gsk_point_get_x (p)), floorf (gsk_point_get_y (p)));
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_point_ceil (const GskPoint p)
|
||||
{
|
||||
return gsk_point_init (ceilf (gsk_point_get_x (p)), ceilf (gsk_point_get_y (p)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+96
-16
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <graphene.h>
|
||||
#include <math.h>
|
||||
#include "gskscaleprivate.h"
|
||||
#include "gskpointprivate.h"
|
||||
|
||||
|
||||
static inline void
|
||||
gsk_rect_init (graphene_rect_t *r,
|
||||
@@ -23,13 +26,14 @@ gsk_rect_init_from_rect (graphene_rect_t *r,
|
||||
gsk_rect_init (r, r1->origin.x, r1->origin.y, r1->size.width, r1->size.height);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_rect_init_offset (graphene_rect_t *r,
|
||||
const graphene_rect_t *src,
|
||||
float dx,
|
||||
float dy)
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_init_offset (const graphene_rect_t src,
|
||||
const GskPoint offset)
|
||||
{
|
||||
gsk_rect_init (r, src->origin.x + dx, src->origin.y + dy, src->size.width, src->size.height);
|
||||
return GRAPHENE_RECT_INIT (src.origin.x + gsk_point_get_x (offset),
|
||||
src.origin.y + gsk_point_get_y (offset),
|
||||
src.size.width,
|
||||
src.size.height);
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
@@ -113,22 +117,98 @@ gsk_rect_equal (const graphene_rect_t *r1,
|
||||
|
||||
static inline void
|
||||
gsk_gpu_rect_to_float (const graphene_rect_t *rect,
|
||||
const graphene_point_t *offset,
|
||||
const GskPoint *offset,
|
||||
float values[4])
|
||||
{
|
||||
values[0] = rect->origin.x + offset->x;
|
||||
values[1] = rect->origin.y + offset->y;
|
||||
values[0] = rect->origin.x + gsk_point_get_x (*offset);
|
||||
values[1] = rect->origin.y + gsk_point_get_y (*offset);
|
||||
values[2] = rect->size.width;
|
||||
values[3] = rect->size.height;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_rect_round_larger (graphene_rect_t *rect)
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_round_larger (const graphene_rect_t rect)
|
||||
{
|
||||
float x = floor (rect->origin.x);
|
||||
float y = floor (rect->origin.y);
|
||||
*rect = GRAPHENE_RECT_INIT (x, y,
|
||||
ceil (rect->origin.x + rect->size.width) - x,
|
||||
ceil (rect->origin.y + rect->size.height) - y);
|
||||
float x = floorf (rect.origin.x);
|
||||
float y = floorf (rect.origin.y);
|
||||
|
||||
return GRAPHENE_RECT_INIT (x, y,
|
||||
ceilf (rect.origin.x + rect.size.width) - x,
|
||||
ceilf (rect.origin.y + rect.size.height) - y);
|
||||
}
|
||||
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_scale (const graphene_rect_t r,
|
||||
const GskScale scale)
|
||||
{
|
||||
float sx = gsk_scale_get_x (scale);
|
||||
float sy = gsk_scale_get_y (scale);
|
||||
|
||||
if (G_UNLIKELY (sx < 0 || sy < 0))
|
||||
{
|
||||
graphene_rect_t res;
|
||||
graphene_rect_scale (&r, sx, sy, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
return GRAPHENE_RECT_INIT (r.origin.x * sx,
|
||||
r.origin.y * sy,
|
||||
r.size.width * sx,
|
||||
r.size.height * sy);
|
||||
}
|
||||
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_add_offset (const graphene_rect_t r,
|
||||
const GskPoint offset)
|
||||
{
|
||||
return GRAPHENE_RECT_INIT (r.origin.x + gsk_point_get_x (offset),
|
||||
r.origin.y + gsk_point_get_y (offset),
|
||||
r.size.width,
|
||||
r.size.height);
|
||||
}
|
||||
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_subtract_offset (const graphene_rect_t r,
|
||||
const GskPoint offset)
|
||||
{
|
||||
return GRAPHENE_RECT_INIT (r.origin.x - gsk_point_get_x (offset),
|
||||
r.origin.y - gsk_point_get_y (offset),
|
||||
r.size.width,
|
||||
r.size.height);
|
||||
}
|
||||
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_from_points (GskPoint p0,
|
||||
GskPoint p1)
|
||||
{
|
||||
return GRAPHENE_RECT_INIT (gsk_point_get_x (p0),
|
||||
gsk_point_get_y (p0),
|
||||
gsk_point_get_x (p1) - gsk_point_get_x (p0),
|
||||
gsk_point_get_y (p1) - gsk_point_get_y (p0));
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_rect_get_origin (const graphene_rect_t rect)
|
||||
{
|
||||
return gsk_point_init (rect.origin.x, rect.origin.y);
|
||||
}
|
||||
|
||||
static inline GskPoint
|
||||
gsk_rect_get_opposite (const graphene_rect_t rect)
|
||||
{
|
||||
return gsk_point_init (rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
|
||||
}
|
||||
|
||||
static inline graphene_rect_t
|
||||
gsk_rect_round_to_pixels (const graphene_rect_t src,
|
||||
const GskScale scale,
|
||||
const GskPoint offset)
|
||||
{
|
||||
GskPoint p0, p1;
|
||||
|
||||
p0 = gsk_point_subtract (gsk_point_divide (gsk_point_floor (gsk_point_multiply (gsk_point_add (gsk_rect_get_origin (src), offset), scale)), scale), offset);
|
||||
|
||||
p1 = gsk_point_divide (gsk_point_subtract (gsk_point_ceil (gsk_point_multiply (gsk_point_add (gsk_rect_get_opposite (src), offset), scale)), p0), scale);
|
||||
|
||||
return gsk_rect_from_points (p0, p1);
|
||||
}
|
||||
|
||||
@@ -5658,6 +5658,7 @@ struct _GskTextNode
|
||||
{
|
||||
GskRenderNode render_node;
|
||||
|
||||
PangoFontMap *fontmap;
|
||||
PangoFont *font;
|
||||
gboolean has_color_glyphs;
|
||||
|
||||
@@ -5675,6 +5676,7 @@ 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);
|
||||
@@ -5788,6 +5790,7 @@ 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;
|
||||
|
||||
+280
-26
@@ -46,12 +46,20 @@
|
||||
#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;
|
||||
@@ -65,7 +73,7 @@ struct _Declaration
|
||||
};
|
||||
|
||||
static void
|
||||
context_init (Context *context)
|
||||
context_init (Context *context)
|
||||
{
|
||||
memset (context, 0, sizeof (Context));
|
||||
}
|
||||
@@ -75,6 +83,7 @@ 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
|
||||
@@ -844,20 +853,35 @@ parse_mask_mode (GtkCssParser *parser,
|
||||
}
|
||||
|
||||
static PangoFont *
|
||||
font_from_string (const char *string)
|
||||
font_from_string (PangoFontMap *fontmap,
|
||||
const char *string)
|
||||
{
|
||||
PangoFontDescription *desc;
|
||||
PangoFontMap *font_map;
|
||||
PangoContext *context;
|
||||
PangoContext *ctx;
|
||||
PangoFont *font;
|
||||
|
||||
desc = pango_font_description_from_string (string);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
pango_font_description_free (desc);
|
||||
g_object_unref (context);
|
||||
|
||||
return font;
|
||||
}
|
||||
@@ -926,22 +950,204 @@ 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 void
|
||||
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;
|
||||
}
|
||||
|
||||
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_FAILED,
|
||||
"Failed to add %s to FcConfig", path);
|
||||
return;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
static void
|
||||
add_font_from_bytes (Context *context,
|
||||
GBytes *bytes,
|
||||
GError **error)
|
||||
{
|
||||
GFile *file;
|
||||
GIOStream *iostream;
|
||||
GOutputStream *ostream;
|
||||
|
||||
file = g_file_new_tmp ("gtk4-font-XXXXXX.ttf", (GFileIOStream **) &iostream, error);
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
g_io_stream_close (iostream, NULL, NULL);
|
||||
g_object_unref (iostream);
|
||||
|
||||
add_font_from_file (context, g_file_peek_path (file), error);
|
||||
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
#else /* !HAVE_PANGOFT */
|
||||
|
||||
static void
|
||||
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");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
parse_font (GtkCssParser *parser,
|
||||
Context *context,
|
||||
gpointer out_font)
|
||||
{
|
||||
PangoFont *font;
|
||||
PangoFont *font = NULL;
|
||||
char *s;
|
||||
GtkCssLocation start_location;
|
||||
PangoFontMap *fontmap;
|
||||
|
||||
fontmap = pango_cairo_font_map_get_default ();
|
||||
|
||||
s = gtk_css_parser_consume_string (parser);
|
||||
if (s == NULL)
|
||||
return FALSE;
|
||||
|
||||
font = font_from_string (s);
|
||||
if (font == NULL)
|
||||
start_location = *gtk_css_parser_get_start_location (parser);
|
||||
|
||||
if (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_URL) ||
|
||||
gtk_css_parser_has_function (parser, "url"))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "This font does not exist.");
|
||||
char *url;
|
||||
char *scheme;
|
||||
GBytes *bytes = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
/* If we have a url, it is a bug if the font already exists in our custom fontmap */
|
||||
if (context->fontmap)
|
||||
{
|
||||
font = font_from_string (context->fontmap, s);
|
||||
if (font)
|
||||
{
|
||||
g_object_unref (font);
|
||||
gtk_css_parser_error_value (parser, "This font already exists.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
url = gtk_css_parser_consume_url (parser);
|
||||
|
||||
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)
|
||||
{
|
||||
add_font_from_bytes (context, bytes, &error);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
fontmap = context->fontmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (error != NULL);
|
||||
|
||||
gtk_css_parser_emit_error (parser,
|
||||
&start_location,
|
||||
gtk_css_parser_get_end_location (parser),
|
||||
error);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
font = font_from_string (fontmap, s);
|
||||
|
||||
if (!font && context->fontmap && fontmap != context->fontmap)
|
||||
font = font_from_string (context->fontmap, s);
|
||||
|
||||
if (!font)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "This font does not exist.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2013,7 +2219,7 @@ parse_text_node (GtkCssParser *parser,
|
||||
|
||||
if (font == NULL)
|
||||
{
|
||||
font = font_from_string ("Cantarell 11");
|
||||
font = font_from_string (pango_cairo_font_map_get_default (), "Cantarell 11");
|
||||
g_assert (font);
|
||||
}
|
||||
|
||||
@@ -2629,6 +2835,7 @@ typedef struct
|
||||
gsize named_node_counter;
|
||||
GHashTable *named_textures;
|
||||
gsize named_texture_counter;
|
||||
GHashTable *serialized_fonts;
|
||||
} Printer;
|
||||
|
||||
static void
|
||||
@@ -2781,6 +2988,7 @@ 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);
|
||||
}
|
||||
@@ -2792,6 +3000,7 @@ 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 */
|
||||
@@ -3235,6 +3444,59 @@ 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)
|
||||
@@ -3788,29 +4050,21 @@ 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);
|
||||
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);
|
||||
g_string_append (p->str, "font: ");
|
||||
gsk_text_node_serialize_font (node, p);
|
||||
g_string_append (p->str, ";\n");
|
||||
|
||||
_indent (p);
|
||||
g_string_append (p->str, "glyphs: ");
|
||||
|
||||
gsk_text_node_serialize_glyphs (node, p->str);
|
||||
|
||||
g_string_append_c (p->str, ';');
|
||||
g_string_append_c (p->str, '\n');
|
||||
g_string_append (p->str, ";\n");
|
||||
|
||||
if (!graphene_point_equal (offset, graphene_point_zero ()))
|
||||
append_point_param (p, "offset", offset);
|
||||
|
||||
@@ -6,4 +6,3 @@
|
||||
GskRenderNode * gsk_render_node_deserialize_from_bytes (GBytes *bytes,
|
||||
GskParseErrorFunc error_func,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
@@ -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 = fabs (scale_x);
|
||||
scale_y = fabs (scale_y);
|
||||
scale_x = fabsf (scale_x);
|
||||
scale_y = fabsf (scale_y);
|
||||
|
||||
for (guint i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "gskroundedrect.h"
|
||||
#include "gskrectprivate.h"
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
@@ -48,6 +49,21 @@ void gsk_rounded_rect_path (const GskRounde
|
||||
void gsk_rounded_rect_to_float (const GskRoundedRect *self,
|
||||
const graphene_point_t *offset,
|
||||
float rect[12]);
|
||||
static inline void
|
||||
gsk_gpu_rounded_rect_to_float (const GskRoundedRect *self,
|
||||
const GskPoint *offset,
|
||||
float rect[12])
|
||||
{
|
||||
guint i;
|
||||
|
||||
gsk_gpu_rect_to_float (&self->bounds, offset, rect);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
rect[4 + i] = self->corner[i].width;
|
||||
rect[8 + i] = self->corner[i].height;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean gsk_rounded_rect_equal (gconstpointer rect1,
|
||||
gconstpointer rect2) G_GNUC_PURE;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "config.h"
|
||||
#include "gskscaleprivate.h"
|
||||
#include "gsktransform.h"
|
||||
|
||||
GskScale
|
||||
gsk_scale_extract_from_transform (GskTransform *transform)
|
||||
{
|
||||
switch (gsk_transform_get_category (transform))
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
G_GNUC_FALLTHROUGH;
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_IDENTITY:
|
||||
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
|
||||
return gsk_scale_init (1, 1);
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
float scale_x, scale_y, dx, dy;
|
||||
gsk_transform_to_affine (transform, &scale_x, &scale_y, &dx, &dy);
|
||||
return gsk_scale_init (fabsf (scale_x), fabsf (scale_y));
|
||||
}
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_2D:
|
||||
{
|
||||
float skew_x, skew_y, scale_x, scale_y, angle, dx, dy;
|
||||
gsk_transform_to_2d_components (transform,
|
||||
&skew_x, &skew_y,
|
||||
&scale_x, &scale_y,
|
||||
&angle,
|
||||
&dx, &dy);
|
||||
return gsk_scale_init (fabsf (scale_x), fabsf (scale_y));
|
||||
}
|
||||
|
||||
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
|
||||
case GSK_TRANSFORM_CATEGORY_ANY:
|
||||
case GSK_TRANSFORM_CATEGORY_3D:
|
||||
{
|
||||
graphene_quaternion_t rotation;
|
||||
graphene_matrix_t matrix;
|
||||
graphene_vec4_t perspective;
|
||||
graphene_vec3_t translation;
|
||||
graphene_vec3_t matrix_scale;
|
||||
graphene_vec3_t shear;
|
||||
|
||||
gsk_transform_to_matrix (transform, &matrix);
|
||||
graphene_matrix_decompose (&matrix,
|
||||
&translation,
|
||||
&matrix_scale,
|
||||
&rotation,
|
||||
&shear,
|
||||
&perspective);
|
||||
|
||||
return gsk_scale_init (fabsf (graphene_vec3_get_x (&matrix_scale)),
|
||||
fabsf (graphene_vec3_get_y (&matrix_scale)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
|
||||
#include "gsktypes.h"
|
||||
#include <graphene.h>
|
||||
#include <math.h>
|
||||
|
||||
struct _GskScale
|
||||
{
|
||||
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
|
||||
};
|
||||
|
||||
static inline float
|
||||
gsk_scale_get_x (const GskScale s)
|
||||
{
|
||||
return graphene_simd4f_get_x (s.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gsk_scale_get_y (const GskScale s)
|
||||
{
|
||||
return graphene_simd4f_get_y (s.v);
|
||||
}
|
||||
|
||||
static inline GskScale
|
||||
gsk_scale_init (float x,
|
||||
float y)
|
||||
{
|
||||
GskScale s;
|
||||
|
||||
s.v = graphene_simd4f_init (x, y, 0.f, 0.f);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline GskScale
|
||||
gsk_scale_init_uniform (float x)
|
||||
{
|
||||
return gsk_scale_init (x, x);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_scale_to_float (const GskScale *s,
|
||||
float v[2])
|
||||
{
|
||||
graphene_simd4f_dup_2f (s->v, v);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gsk_scale_is_one (const GskScale s)
|
||||
{
|
||||
return gsk_scale_get_x (s) == 1 && gsk_scale_get_y (s) == 1;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gsk_scale_is_uniform (const GskScale s)
|
||||
{
|
||||
return gsk_scale_get_x (s) == gsk_scale_get_y (s);
|
||||
}
|
||||
|
||||
static inline GskScale
|
||||
gsk_scale_invert (const GskScale s)
|
||||
{
|
||||
GskScale inv;
|
||||
|
||||
inv.v = graphene_simd4f_reciprocal (s.v);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
static inline GskScale
|
||||
gsk_scale_multiply (const GskScale s1,
|
||||
const GskScale s2)
|
||||
{
|
||||
GskScale s;
|
||||
|
||||
s.v = graphene_simd4f_mul (s1.v, s2.v);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline GskScale
|
||||
gsk_scale_divide (const GskScale s1,
|
||||
const GskScale s2)
|
||||
{
|
||||
GskScale s;
|
||||
|
||||
s.v = graphene_simd4f_div (s1.v, s2.v);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
# define graphene_simd4f_shuffle_yxzw(v) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_shuffle_ps ((v), (v), _MM_SHUFFLE (1, 0, 2, 3)); \
|
||||
}))
|
||||
|
||||
|
||||
static inline GskScale
|
||||
gsk_scale_max (const GskScale s)
|
||||
{
|
||||
GskScale m;
|
||||
|
||||
m.v = graphene_simd4f_max (graphene_simd4f_shuffle_yxzw (s.v), s.v);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
GskScale gsk_scale_extract_from_transform (GskTransform *transform);
|
||||
+2
-1
@@ -34,4 +34,5 @@ typedef struct _GskRenderNode GskRenderNode;
|
||||
typedef struct _GskRoundedRect GskRoundedRect;
|
||||
typedef struct _GskStroke GskStroke;
|
||||
typedef struct _GskTransform GskTransform;
|
||||
|
||||
typedef struct _GskScale GskScale;
|
||||
typedef struct _GskPoint GskPoint;
|
||||
|
||||
@@ -51,6 +51,7 @@ gsk_private_sources = files([
|
||||
'gskdebug.c',
|
||||
'gskprivate.c',
|
||||
'gskprofiler.c',
|
||||
'gskscale.c',
|
||||
'gl/gskglattachmentstate.c',
|
||||
'gl/gskglbuffer.c',
|
||||
'gl/gskglcommandqueue.c',
|
||||
|
||||
@@ -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,
|
||||
0,
|
||||
GDK_NO_MODIFIER_MASK,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 (G_IS_FILE (file), FALSE);
|
||||
g_return_val_if_fail (file == NULL || 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);
|
||||
|
||||
@@ -1355,22 +1355,6 @@ 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))
|
||||
{
|
||||
|
||||
@@ -269,11 +269,12 @@ gtk_column_view_cell_widget_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_column_view_cell_widget_dispose (GObject *object)
|
||||
/* 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)
|
||||
{
|
||||
GtkColumnViewCellWidget *self = GTK_COLUMN_VIEW_CELL_WIDGET (object);
|
||||
|
||||
if (self->column)
|
||||
{
|
||||
gtk_column_view_column_remove_cell (self->column, self);
|
||||
@@ -288,6 +289,15 @@ gtk_column_view_cell_widget_dispose (GObject *object)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user