Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfefa884ad | |||
| 72b8c6cf74 | |||
| 501095452a | |||
| 2ede31b682 | |||
| 1355367360 |
@@ -1,81 +1,6 @@
|
||||
Overview of Changes in 4.13.6, 25-01-2024
|
||||
Overview of Changes in 4.13.6, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
This release changes the ngl renderer to be the default renderer.
|
||||
|
||||
The intent of this change is to get wider testing and verify that
|
||||
the new renderers are production-ready. If significant problems
|
||||
show up, we will revert this change for 4.14.
|
||||
|
||||
You can still override the renderer choice using the GSK_RENDERER
|
||||
environment variable.
|
||||
|
||||
Since ngl can handle fractional scaling much better than the old gl
|
||||
renderer, we allow fractional scaling by default with gl now. If you
|
||||
are using the old gl renderer (e.g. because your system is limited to
|
||||
GLES2), you can disable fractional scaling by setting the GDK_DEBUG
|
||||
environment variable to include the gl-no-fractional key.
|
||||
|
||||
* GtkColumnView:
|
||||
- Fix infinite loops in dispose
|
||||
- Fix problems with weak ref cycles in GtkExpression
|
||||
|
||||
* GtkListView:
|
||||
- Fix some corner cases with sections during insertions and deletions
|
||||
- Don't double-recycle widgets
|
||||
|
||||
* GtkStack:
|
||||
- Add automatic cleanup for GtkStackPage
|
||||
|
||||
* GDK:
|
||||
- Use standard cursor names for drag cursors
|
||||
- Enable fractional scaling with gl by default
|
||||
|
||||
* GSK:
|
||||
- Many fixes and improvements to the unified renderers:
|
||||
- Fix text rendering with the uber shader
|
||||
- Fix rounding issues with fractional scales
|
||||
- Fix some memory leaks
|
||||
- Many text rendering fixes
|
||||
- Implement subpixel positioning for glyphs
|
||||
- Support custom fonts in node files
|
||||
- Add tests for font rendering
|
||||
- Fix drawing of repeat nodes
|
||||
- Implement subpixels positioning
|
||||
- Evict stale textures, glyphs and atlases from the cache
|
||||
- Some fixes and improvements to the GL renderer:
|
||||
- Fix problems with GLES on Nvidia
|
||||
- Avoid a crash in the mask demo
|
||||
- Respect opacity of the first child node in containers
|
||||
- Some fixes and improvements to the fallback renderer:
|
||||
- Fix drawing of repeat nodes
|
||||
- Make ngl the default renderer
|
||||
|
||||
* Wayland:
|
||||
- Fix problems with tablet cursors
|
||||
- Fix problems without seats
|
||||
|
||||
* Accessibility:
|
||||
- Respect a separate "show-status-shapes setting
|
||||
- Fix change notification for accessible names on some widgets
|
||||
|
||||
* Inspector:
|
||||
- Show the git commit in devel builds
|
||||
|
||||
* Tools:
|
||||
- Make gtk4-node-editor autosave its contents
|
||||
- Add a benchmark command to gtk4-rendernode-tool
|
||||
|
||||
* Translation updates:
|
||||
French
|
||||
Galician
|
||||
Georgian
|
||||
Occitan
|
||||
Persian
|
||||
Russian
|
||||
Vietnamese
|
||||
|
||||
|
||||
Overview of Changes in 4.13.5, 07-01-2024
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -1567,6 +1567,23 @@ 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,
|
||||
@@ -1643,6 +1660,8 @@ 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);
|
||||
|
||||
@@ -25,8 +25,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
|
||||
|
||||
[extra]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/gtk-logo.svg",
|
||||
]
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -24,8 +24,6 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
|
||||
|
||||
[extra]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/gtk-logo.svg",
|
||||
]
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -67,8 +67,6 @@ content_files = [
|
||||
"macos.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/gtk-logo.svg",
|
||||
"images/rotated-text.png",
|
||||
"images/default_cursor.png",
|
||||
|
||||
@@ -36,8 +36,6 @@ content_files = [
|
||||
"paths.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"gtk-logo.svg",
|
||||
"images/arc-dark.png",
|
||||
"images/arc-light.png",
|
||||
|
||||
@@ -85,8 +85,6 @@ content_files = [
|
||||
"visual_index.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
"../images/favicon-192x192.png",
|
||||
"images/aboutdialog.png",
|
||||
"images/action-bar.png",
|
||||
"images/appchooserbutton.png",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="88.572334" height="96.050743" id="svg6843">
|
||||
<defs id="defs6845"/>
|
||||
<g transform="translate(-19.822308,-16.115941)" id="layer1">
|
||||
<path d="M 20.88413,30.82696 53.816977,55.527708 107.33282,39.060543 70.587303,17.177763 20.88413,30.82696 z" id="path6976" style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
||||
<path d="m 22.94243,82.287118 -2.0583,-51.460158 32.932847,24.700748 0,55.577152 L 22.94243,82.287118 z" id="path6978" style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
||||
<path d="m 53.816977,111.10486 49.399213,-20.58416 4.11663,-51.460157 -53.515843,16.467165 0,55.577152 z" id="path6980" style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"/>
|
||||
<path d="M 23.216626,81.319479 70.48573,67.361442 103.38422,90.444516" id="path6982" style="fill:none;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||
<path d="m 70.434539,17.875593 0,49.109284" id="path6984" style="fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -222,6 +222,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
}
|
||||
else
|
||||
{
|
||||
char *val = g_strndup (p, q - p);
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (strlen (keys[i].key) == q - p &&
|
||||
@@ -232,7 +233,8 @@ gdk_parse_debug_var (const char *variable,
|
||||
}
|
||||
}
|
||||
if (i == nkeys)
|
||||
fprintf (stderr, "Unrecognized value \"%.*s\". Try %s=help\n", (int) (q - p), p, variable);
|
||||
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
|
||||
g_free (val);
|
||||
}
|
||||
|
||||
p = q;
|
||||
|
||||
+6
-3
@@ -1363,7 +1363,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_profiler_end_mark (before2, "Realize OpenGL context", NULL);
|
||||
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
|
||||
|
||||
/* Only assign after realize, so GdkGLContext::realize() can use
|
||||
* gdk_display_get_gl_context() == NULL to differentiate between
|
||||
@@ -1373,7 +1373,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
|
||||
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
||||
|
||||
gdk_profiler_end_mark (before, "Init OpenGL", NULL);
|
||||
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1768,6 +1768,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
G_GNUC_UNUSED gint64 start_time2;
|
||||
int major, minor;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
@@ -1794,6 +1795,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
start_time2 = GDK_PROFILER_CURRENT_TIME;
|
||||
if (!eglInitialize (priv->egl_display, &major, &minor))
|
||||
{
|
||||
priv->egl_display = NULL;
|
||||
@@ -1802,6 +1804,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
_("Could not initialize EGL display"));
|
||||
return FALSE;
|
||||
}
|
||||
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
|
||||
|
||||
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
|
||||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
|
||||
@@ -1891,7 +1894,7 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
g_free (ext);
|
||||
}
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Init EGL", NULL);
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+5
-5
@@ -687,7 +687,7 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[UPDATE], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock update", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock update", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -699,7 +699,7 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[LAYOUT], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock layout", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock layout", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -711,7 +711,7 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
|
||||
|
||||
g_signal_emit (frame_clock, signals[PAINT], 0);
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock paint", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock paint", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -811,12 +811,12 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
|
||||
{
|
||||
if (timings->drawn_time != 0)
|
||||
{
|
||||
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "Drawn window", NULL);
|
||||
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "drawn window", NULL);
|
||||
}
|
||||
|
||||
if (timings->presentation_time != 0)
|
||||
{
|
||||
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "Presented window", NULL);
|
||||
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "presented window", NULL);
|
||||
}
|
||||
|
||||
gdk_profiler_set_counter (fps_counter, gdk_frame_clock_get_fps (clock));
|
||||
|
||||
@@ -694,7 +694,7 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
priv->sleep_serial = get_sleep_serial ();
|
||||
|
||||
gdk_profiler_end_mark (before, "Frameclock cycle", NULL);
|
||||
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+11
-2
@@ -386,7 +386,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Create EGL context", NULL);
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
}
|
||||
@@ -669,7 +669,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
egl_surface = gdk_surface_get_egl_surface (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL swap buffers", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL", "swap buffers");
|
||||
|
||||
if (priv->eglSwapBuffersWithDamage)
|
||||
{
|
||||
@@ -2042,6 +2042,15 @@ gdk_gl_context_has_sync (GdkGLContext *self)
|
||||
return priv->has_sync;
|
||||
}
|
||||
|
||||
/* Return if GL_BGRA works with glTexImage2D */
|
||||
gboolean
|
||||
gdk_gl_context_has_bgra (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_bgra;
|
||||
}
|
||||
|
||||
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
|
||||
* can be used
|
||||
*/
|
||||
|
||||
@@ -171,6 +171,8 @@ gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext
|
||||
|
||||
gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
+6
-7
@@ -32,7 +32,6 @@
|
||||
#include "version/gdkversionmacros.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
|
||||
#define CATEGORY "GTK"
|
||||
|
||||
gboolean
|
||||
gdk_profiler_is_running (void)
|
||||
@@ -51,7 +50,7 @@ void
|
||||
const char *message)
|
||||
{
|
||||
#ifdef HAVE_SYSPROF
|
||||
sysprof_collector_mark (begin_time, duration, CATEGORY, name, message);
|
||||
sysprof_collector_mark (begin_time, duration, "gtk", name, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ void
|
||||
const char *message)
|
||||
{
|
||||
#ifdef HAVE_SYSPROF
|
||||
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message);
|
||||
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -75,7 +74,7 @@ void
|
||||
#ifdef HAVE_SYSPROF
|
||||
va_list args;
|
||||
va_start (args, message_format);
|
||||
sysprof_collector_mark_vprintf (begin_time, duration, CATEGORY, name, message_format, args);
|
||||
sysprof_collector_mark_vprintf (begin_time, duration, "gtk", name, message_format, args);
|
||||
va_end (args);
|
||||
#endif /* HAVE_SYSPROF */
|
||||
}
|
||||
@@ -89,7 +88,7 @@ void
|
||||
#ifdef HAVE_SYSPROF
|
||||
va_list args;
|
||||
va_start (args, message_format);
|
||||
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message_format, args);
|
||||
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message_format, args);
|
||||
va_end (args);
|
||||
#endif /* HAVE_SYSPROF */
|
||||
}
|
||||
@@ -104,7 +103,7 @@ guint
|
||||
counter.id = sysprof_collector_request_counters (1);
|
||||
counter.type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
|
||||
counter.value.vdbl = 0.0;
|
||||
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
|
||||
g_strlcpy (counter.category, "gtk", sizeof counter.category);
|
||||
g_strlcpy (counter.name, name, sizeof counter.name);
|
||||
g_strlcpy (counter.description, description, sizeof counter.name);
|
||||
|
||||
@@ -126,7 +125,7 @@ guint
|
||||
counter.id = sysprof_collector_request_counters (1);
|
||||
counter.type = SYSPROF_CAPTURE_COUNTER_INT64;
|
||||
counter.value.v64 = 0;
|
||||
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
|
||||
g_strlcpy (counter.category, "gtk", sizeof counter.category);
|
||||
g_strlcpy (counter.name, name, sizeof counter.name);
|
||||
g_strlcpy (counter.description, description, sizeof counter.name);
|
||||
|
||||
|
||||
+2
-2
@@ -2839,7 +2839,7 @@ add_event_mark (GdkEvent *event,
|
||||
class = g_type_class_ref (GDK_TYPE_EVENT_TYPE);
|
||||
value = g_enum_get_value (class, event_type);
|
||||
g_type_class_unref (class);
|
||||
kind = value ? value->value_nick : "Event";
|
||||
kind = value ? value->value_nick : "event";
|
||||
|
||||
switch ((int) event_type)
|
||||
{
|
||||
@@ -2909,7 +2909,7 @@ add_event_mark (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
gdk_profiler_add_mark (time, end_time - time, "Event", message ? message : kind);
|
||||
gdk_profiler_add_mark (time, end_time - time, "event", message ? message : kind);
|
||||
|
||||
g_free (message);
|
||||
#endif
|
||||
|
||||
@@ -237,7 +237,7 @@ gdk_load_jpeg (GBytes *input_bytes,
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
gdk_profiler_end_mark (before, "Load jpeg", NULL);
|
||||
gdk_profiler_end_mark (before, "jpeg load", NULL);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ gdk_load_png (GBytes *bytes,
|
||||
{
|
||||
gint64 end = GDK_PROFILER_CURRENT_TIME;
|
||||
if (end - before > 500000)
|
||||
gdk_profiler_add_mark (before, end - before, "Load png", NULL);
|
||||
gdk_profiler_add_mark (before, end - before, "png load", NULL);
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
||||
@@ -504,7 +504,7 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
{
|
||||
gint64 end = GDK_PROFILER_CURRENT_TIME;
|
||||
if (end - before > 500000)
|
||||
gdk_profiler_add_mark (before, end - before, "Load tiff", NULL);
|
||||
gdk_profiler_add_mark (before, end - before, "tiff load", NULL);
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
||||
@@ -186,7 +186,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
|
||||
@@ -206,7 +206,7 @@ gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
}
|
||||
|
||||
@@ -1253,7 +1253,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
g_value_unset (&v);
|
||||
|
||||
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
||||
gdk_profiler_end_mark (before, "wayland", "load cursor theme");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1012,7 +1012,7 @@ gdk_wayland_surface_create_xdg_popup (GdkWaylandPopup *wayland_popup,
|
||||
}
|
||||
}
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (impl->display_server.wl_surface);
|
||||
|
||||
if (GDK_IS_POPUP (surface))
|
||||
|
||||
@@ -274,7 +274,7 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event");
|
||||
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
|
||||
|
||||
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
|
||||
|
||||
@@ -830,7 +830,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
|
||||
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
|
||||
maybe_set_gtk_surface_modal (wayland_toplevel);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
|
||||
wl_surface_commit (wayland_surface->display_server.wl_surface);
|
||||
}
|
||||
|
||||
|
||||
@@ -1608,8 +1608,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
{
|
||||
gdk_profiler_end_markf (start_time,
|
||||
"Download texture chunk",
|
||||
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
|
||||
"Download Texture chunk",
|
||||
"Tile %dx%d Size %dx%d", x, y, width, height);
|
||||
start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
}
|
||||
@@ -1654,8 +1654,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_end_markf (start_time,
|
||||
"Upload texture chunk",
|
||||
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
|
||||
"Upload Texture chunk",
|
||||
"Tile %dx%d Size %dx%d", x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
|
||||
failure:
|
||||
g_clear_object (&compiler);
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Load GL programs", NULL);
|
||||
gdk_profiler_end_mark (start_time, "load programs", NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -477,7 +477,7 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
|
||||
self->icons_library = gsk_gl_icon_library_new (self);
|
||||
self->shadows_library = gsk_gl_shadow_library_new (self);
|
||||
|
||||
gdk_profiler_end_mark (before, "Create GL driver", NULL);
|
||||
gdk_profiler_end_mark (before, "create GskGLDriver", NULL);
|
||||
|
||||
return g_steal_pointer (&self);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,11 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
||||
|
||||
memset (pixel_data, 255, sizeof pixel_data);
|
||||
|
||||
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
|
||||
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
|| gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
|
||||
#endif
|
||||
)
|
||||
{
|
||||
gl_format = GL_RGBA;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
@@ -376,7 +380,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
|
||||
{
|
||||
char message[64];
|
||||
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
|
||||
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload glyph", message);
|
||||
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Glyph", message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
||||
{
|
||||
char message[64];
|
||||
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
|
||||
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload icon", message);
|
||||
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Icon", message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4544,7 +4544,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
|
||||
gsk_gl_render_job_visit_node (job, root);
|
||||
gdk_gl_context_pop_debug_group (job->command_queue->context);
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Build GL command queue", "");
|
||||
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Build GL command queue", "");
|
||||
|
||||
#if 0
|
||||
/* At this point the atlases have uploaded content while we processed
|
||||
@@ -4562,7 +4562,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
|
||||
gdk_gl_context_push_debug_group (job->command_queue->context, "Executing command queue");
|
||||
gsk_gl_command_queue_execute (job->command_queue, surface_height, scale, job->region, job->default_framebuffer);
|
||||
gdk_gl_context_pop_debug_group (job->command_queue->context);
|
||||
gdk_profiler_end_mark (start_time, "Execute GL command queue", "");
|
||||
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Execute GL command queue", "");
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
@@ -238,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)
|
||||
{
|
||||
@@ -262,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)
|
||||
{
|
||||
@@ -288,7 +284,7 @@ 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 ||
|
||||
|
||||
@@ -59,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,
|
||||
|
||||
+37
-165
@@ -3,14 +3,10 @@
|
||||
#include "gskgpudeviceprivate.h"
|
||||
|
||||
#include "gskgpuframeprivate.h"
|
||||
#include "gskgpuimageprivate.h"
|
||||
#include "gskgpuuploadopprivate.h"
|
||||
|
||||
#include "gdk/gdkdisplayprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
#include "gdk/gdkprofilerprivate.h"
|
||||
|
||||
#include "gsk/gskdebugprivate.h"
|
||||
|
||||
#define MAX_SLICES_PER_ATLAS 64
|
||||
|
||||
@@ -18,14 +14,6 @@
|
||||
|
||||
#define MAX_ATLAS_ITEM_SIZE 256
|
||||
|
||||
G_STATIC_ASSERT (MAX_ATLAS_ITEM_SIZE < ATLAS_SIZE);
|
||||
|
||||
#define MAX_DEAD_PIXELS (ATLAS_SIZE * ATLAS_SIZE / 2)
|
||||
|
||||
#define CACHE_GC_TIMEOUT 15 /* seconds */
|
||||
|
||||
#define CACHE_MAX_AGE (G_TIME_SPAN_SECOND * 4) /* 4 seconds, in µs */
|
||||
|
||||
typedef struct _GskGpuCached GskGpuCached;
|
||||
typedef struct _GskGpuCachedClass GskGpuCachedClass;
|
||||
typedef struct _GskGpuCachedAtlas GskGpuCachedAtlas;
|
||||
@@ -66,34 +54,12 @@ struct _GskGpuCachedClass
|
||||
struct _GskGpuCached
|
||||
{
|
||||
const GskGpuCachedClass *class;
|
||||
|
||||
|
||||
GskGpuCachedAtlas *atlas;
|
||||
GskGpuCached *next;
|
||||
GskGpuCached *prev;
|
||||
|
||||
gint64 timestamp;
|
||||
gboolean stale;
|
||||
guint pixels; /* For glyphs, pixels. For atlases, dead pixels */
|
||||
};
|
||||
|
||||
static inline void
|
||||
mark_as_stale (GskGpuCached *cached,
|
||||
gboolean stale)
|
||||
{
|
||||
if (cached->stale != stale)
|
||||
{
|
||||
cached->stale = stale;
|
||||
|
||||
if (cached->atlas)
|
||||
{
|
||||
if (stale)
|
||||
((GskGpuCached *) cached->atlas)->pixels += cached->pixels;
|
||||
else
|
||||
((GskGpuCached *) cached->atlas)->pixels -= cached->pixels;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gpu_cached_free (GskGpuDevice *device,
|
||||
GskGpuCached *cached)
|
||||
@@ -109,8 +75,6 @@ gsk_gpu_cached_free (GskGpuDevice *device,
|
||||
else
|
||||
priv->first_cached = cached->next;
|
||||
|
||||
mark_as_stale (cached, TRUE);
|
||||
|
||||
cached->class->free (device, cached);
|
||||
}
|
||||
|
||||
@@ -150,8 +114,7 @@ gsk_gpu_cached_use (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
cached->timestamp = timestamp;
|
||||
mark_as_stale (cached, FALSE);
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -174,23 +137,10 @@ static void
|
||||
gsk_gpu_cached_atlas_free (GskGpuDevice *device,
|
||||
GskGpuCached *cached)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
|
||||
GskGpuCachedAtlas *self = (GskGpuCachedAtlas *) cached;
|
||||
GskGpuCached *c, *next;
|
||||
|
||||
/* Free all remaining glyphs on this atlas */
|
||||
for (c = priv->first_cached; c != NULL; c = next)
|
||||
{
|
||||
next = c->next;
|
||||
if (c->atlas == self)
|
||||
gsk_gpu_cached_free (device, c);
|
||||
}
|
||||
|
||||
if (priv->current_atlas == self)
|
||||
priv->current_atlas = NULL;
|
||||
|
||||
g_object_unref (self->image);
|
||||
|
||||
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
@@ -199,7 +149,8 @@ gsk_gpu_cached_atlas_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
return cached->pixels > MAX_DEAD_PIXELS;
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const GskGpuCachedClass GSK_GPU_CACHED_ATLAS_CLASS =
|
||||
@@ -239,8 +190,8 @@ gsk_gpu_cached_texture_free (GskGpuDevice *device,
|
||||
gboolean texture_still_alive;
|
||||
|
||||
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
|
||||
g_clear_object (&self->image);
|
||||
|
||||
g_object_unref (self->image);
|
||||
|
||||
if (!texture_still_alive)
|
||||
g_free (self);
|
||||
}
|
||||
@@ -250,7 +201,8 @@ gsk_gpu_cached_texture_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
return timestamp - cached->timestamp > CACHE_MAX_AGE;
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
|
||||
@@ -322,11 +274,8 @@ static void
|
||||
gsk_gpu_cached_glyph_free (GskGpuDevice *device,
|
||||
GskGpuCached *cached)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
|
||||
GskGpuCachedGlyph *self = (GskGpuCachedGlyph *) cached;
|
||||
|
||||
g_hash_table_remove (priv->glyph_cache, self);
|
||||
|
||||
g_object_unref (self->font);
|
||||
g_object_unref (self->image);
|
||||
|
||||
@@ -338,10 +287,7 @@ gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
if (timestamp - cached->timestamp > CACHE_MAX_AGE)
|
||||
mark_as_stale (cached, TRUE);
|
||||
|
||||
/* Glyphs are only collected when their atlas is freed */
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -379,77 +325,19 @@ static const GskGpuCachedClass GSK_GPU_CACHED_GLYPH_CLASS =
|
||||
/* }}} */
|
||||
/* {{{ GskGpuDevice */
|
||||
|
||||
static void
|
||||
print_cache_stats (GskGpuDevice *self)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
GskGpuCached *cached;
|
||||
guint glyphs = 0;
|
||||
guint stale_glyphs = 0;
|
||||
guint textures = 0;
|
||||
guint atlases = 0;
|
||||
GString *ratios = g_string_new ("");
|
||||
|
||||
for (cached = priv->first_cached; cached != NULL; cached = cached->next)
|
||||
{
|
||||
if (cached->class == &GSK_GPU_CACHED_GLYPH_CLASS)
|
||||
{
|
||||
glyphs++;
|
||||
if (cached->stale)
|
||||
stale_glyphs++;
|
||||
}
|
||||
else if (cached->class == &GSK_GPU_CACHED_TEXTURE_CLASS)
|
||||
textures++;
|
||||
else if (cached->class == &GSK_GPU_CACHED_ATLAS_CLASS)
|
||||
{
|
||||
double ratio;
|
||||
|
||||
atlases++;
|
||||
|
||||
ratio = (double) cached->pixels / (double) (ATLAS_SIZE * ATLAS_SIZE);
|
||||
|
||||
if (ratios->len == 0)
|
||||
g_string_append (ratios, " (ratios ");
|
||||
else
|
||||
g_string_append (ratios, ", ");
|
||||
g_string_append_printf (ratios, "%.2f", ratio);
|
||||
}
|
||||
}
|
||||
|
||||
if (ratios->len > 0)
|
||||
g_string_append (ratios, ")");
|
||||
|
||||
gdk_debug_message ("cached items\n"
|
||||
" glyphs: %5u (%u stale)\n"
|
||||
" textures: %5u\n"
|
||||
" atlases: %5u%s",
|
||||
glyphs, stale_glyphs, textures, atlases, ratios->str);
|
||||
|
||||
g_string_free (ratios, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_device_gc (GskGpuDevice *self,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
GskGpuCached *cached, *prev;
|
||||
gint64 before G_GNUC_UNUSED = GDK_PROFILER_CURRENT_TIME;
|
||||
GskGpuCached *cached, *next;
|
||||
|
||||
/* We walk the cache from the end so we don't end up with prev
|
||||
* being a leftover glyph on the atlas we are freeing
|
||||
*/
|
||||
for (cached = priv->last_cached; cached != NULL; cached = prev)
|
||||
for (cached = priv->first_cached; cached != NULL; cached = next)
|
||||
{
|
||||
prev = cached->prev;
|
||||
next = cached->next;
|
||||
if (gsk_gpu_cached_should_collect (self, cached, timestamp))
|
||||
gsk_gpu_cached_free (self, cached);
|
||||
}
|
||||
|
||||
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
|
||||
print_cache_stats (self);
|
||||
|
||||
gdk_profiler_end_mark (before, "Glyph cache GC", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -469,9 +357,8 @@ gsk_gpu_device_clear_cache (GskGpuDevice *self)
|
||||
g_assert (cached->next->prev == cached);
|
||||
}
|
||||
|
||||
/* We clear the cache from the end so glyphs get freed before their atlas */
|
||||
while (priv->last_cached)
|
||||
gsk_gpu_cached_free (self, priv->last_cached);
|
||||
while (priv->first_cached)
|
||||
gsk_gpu_cached_free (self, priv->first_cached);
|
||||
|
||||
g_assert (priv->last_cached == NULL);
|
||||
}
|
||||
@@ -485,7 +372,6 @@ gsk_gpu_device_dispose (GObject *object)
|
||||
gsk_gpu_device_clear_cache (self);
|
||||
g_hash_table_unref (priv->glyph_cache);
|
||||
g_hash_table_unref (priv->texture_cache);
|
||||
g_clear_handle_id (&priv->cache_gc_source, g_source_remove);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gpu_device_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -521,16 +407,6 @@ gsk_gpu_device_init (GskGpuDevice *self)
|
||||
g_direct_equal);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cache_gc_source_callback (gpointer data)
|
||||
{
|
||||
GskGpuDevice *self = data;
|
||||
|
||||
gsk_gpu_device_gc (self, g_get_monotonic_time ());
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_device_setup (GskGpuDevice *self,
|
||||
GdkDisplay *display,
|
||||
@@ -540,8 +416,6 @@ gsk_gpu_device_setup (GskGpuDevice *self,
|
||||
|
||||
priv->display = g_object_ref (display);
|
||||
priv->max_image_size = max_image_size;
|
||||
|
||||
priv->cache_gc_source = g_timeout_add_seconds (CACHE_GC_TIMEOUT, cache_gc_source_callback, self);
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
@@ -643,21 +517,15 @@ gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
|
||||
|
||||
if (best_slice >= i && i == atlas->n_slices)
|
||||
{
|
||||
gsize slice_height;
|
||||
|
||||
if (!can_add_slice)
|
||||
return FALSE;
|
||||
|
||||
slice_height = round_up_atlas_size (MAX (height, 4));
|
||||
if (slice_height > ATLAS_SIZE - y)
|
||||
return FALSE;
|
||||
|
||||
atlas->n_slices++;
|
||||
if (atlas->n_slices == MAX_SLICES_PER_ATLAS)
|
||||
slice_height = ATLAS_SIZE - y;
|
||||
|
||||
atlas->slices[i].height = ATLAS_SIZE - y;
|
||||
else
|
||||
atlas->slices[i].height = round_up_atlas_size (MAX (height, 4));
|
||||
atlas->slices[i].width = 0;
|
||||
atlas->slices[i].height = slice_height;
|
||||
best_y = y;
|
||||
best_slice = i;
|
||||
}
|
||||
@@ -708,14 +576,20 @@ gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
|
||||
return NULL;
|
||||
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE, timestamp);
|
||||
|
||||
|
||||
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
|
||||
return priv->current_atlas->image;
|
||||
{
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) priv->current_atlas, timestamp);
|
||||
return priv->current_atlas->image;
|
||||
}
|
||||
|
||||
gsk_gpu_device_ensure_atlas (self, TRUE, timestamp);
|
||||
|
||||
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
|
||||
return priv->current_atlas->image;
|
||||
{
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) priv->current_atlas, timestamp);
|
||||
return priv->current_atlas->image;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -732,8 +606,10 @@ gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
||||
if (cache == NULL)
|
||||
cache = g_hash_table_lookup (priv->texture_cache, texture);
|
||||
|
||||
if (cache && cache->image)
|
||||
return g_object_ref (cache->image);
|
||||
if (cache)
|
||||
{
|
||||
return g_object_ref (cache->image);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -774,7 +650,6 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
graphene_point_t origin;
|
||||
GskGpuImage *image;
|
||||
gsize atlas_x, atlas_y, padding;
|
||||
float subpixel_x, subpixel_y;
|
||||
|
||||
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
|
||||
if (cache)
|
||||
@@ -786,13 +661,11 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
return cache->image;
|
||||
}
|
||||
|
||||
subpixel_x = (flags & 3) / 4.f;
|
||||
subpixel_y = ((flags >> 2) & 3) / 4.f;
|
||||
pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
|
||||
origin.x = floor (ink_rect.x * scale / PANGO_SCALE + subpixel_x);
|
||||
origin.y = floor (ink_rect.y * scale / PANGO_SCALE + subpixel_y);
|
||||
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * scale / PANGO_SCALE + subpixel_x) - origin.x;
|
||||
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * scale / PANGO_SCALE + subpixel_y) - origin.y;
|
||||
origin.x = floor (ink_rect.x * scale / PANGO_SCALE);
|
||||
origin.y = floor (ink_rect.y * scale / PANGO_SCALE);
|
||||
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * scale / PANGO_SCALE) - origin.x;
|
||||
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * scale / PANGO_SCALE) - origin.y;
|
||||
padding = 1;
|
||||
|
||||
image = gsk_gpu_device_add_atlas_image (self,
|
||||
@@ -821,9 +694,8 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
cache->scale = scale,
|
||||
cache->bounds = rect,
|
||||
cache->image = image,
|
||||
cache->origin = GRAPHENE_POINT_INIT (- origin.x + subpixel_x,
|
||||
- origin.y + subpixel_y);
|
||||
((GskGpuCached *) cache)->pixels = (rect.size.width + 2 * padding) * (rect.size.height + 2 * padding);
|
||||
cache->origin = GRAPHENE_POINT_INIT (- origin.x + (flags & 3) / 4.f,
|
||||
- origin.y + ((flags >> 2) & 3) / 4.f);
|
||||
|
||||
gsk_gpu_upload_glyph_op (frame,
|
||||
cache->image,
|
||||
|
||||
@@ -220,7 +220,7 @@ gsk_gpu_frame_seal_ops (GskGpuFrame *self)
|
||||
{
|
||||
GskGpuFramePrivate *priv = gsk_gpu_frame_get_instance_private (self);
|
||||
GskGpuOp *last, *op;
|
||||
gsize i;
|
||||
guint i;
|
||||
|
||||
priv->first_op = (GskGpuOp *) gsk_gpu_ops_index (&priv->ops, 0);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
+172
-315
@@ -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,42 +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,
|
||||
const graphene_point_t *pixel_offset,
|
||||
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 + pixel_offset->x) * xscale);
|
||||
y = floorf ((src->origin.y + pixel_offset->y) * yscale);
|
||||
*dest = GRAPHENE_RECT_INIT (
|
||||
x * inv_xscale - pixel_offset->x,
|
||||
y * inv_yscale - pixel_offset->y,
|
||||
(ceilf ((src->origin.x + pixel_offset->x + src->size.width) * xscale) - x) * inv_xscale,
|
||||
(ceilf ((src->origin.y + pixel_offset->y + src->size.height) * yscale) - y) * inv_yscale);
|
||||
}
|
||||
|
||||
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 = ceilf (graphene_vec2_get_x (scale) * viewport->size.width);
|
||||
area.height = ceilf (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,
|
||||
@@ -398,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;
|
||||
@@ -476,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));
|
||||
}
|
||||
@@ -489,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];
|
||||
|
||||
@@ -553,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))
|
||||
{
|
||||
@@ -662,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?
|
||||
@@ -758,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)
|
||||
{
|
||||
@@ -938,7 +845,7 @@ gsk_gpu_node_processor_get_node_as_image (GskGpuNodeProcessor *self,
|
||||
return NULL;
|
||||
clip_bounds = &clip;
|
||||
}
|
||||
rect_round_to_pixels (clip_bounds, &self->scale, &self->offset, &clip);
|
||||
clip = gsk_rect_round_to_pixels (*clip_bounds, self->scale, self->offset);
|
||||
|
||||
image = gsk_gpu_get_node_as_image (self->frame,
|
||||
&clip,
|
||||
@@ -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 = ceilf (graphene_vec2_get_x (&self->scale) * intermediate_rect.size.width);
|
||||
height = ceilf (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,7 +976,7 @@ gsk_gpu_node_processor_add_fallback_node (GskGpuNodeProcessor *self,
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clipped_bounds))
|
||||
return;
|
||||
|
||||
rect_round_to_pixels (&clipped_bounds, &self->scale, &self->offset, &clipped_bounds);
|
||||
clipped_bounds = gsk_rect_round_to_pixels (clipped_bounds, self->scale, self->offset);
|
||||
|
||||
gsk_gpu_node_processor_sync_globals (self, 0);
|
||||
|
||||
@@ -1295,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);
|
||||
|
||||
@@ -1428,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, &self->offset, &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,
|
||||
@@ -1505,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))
|
||||
{
|
||||
@@ -1534,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;
|
||||
|
||||
@@ -1550,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;
|
||||
}
|
||||
@@ -1568,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;
|
||||
|
||||
@@ -1584,9 +1483,10 @@ 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))
|
||||
@@ -1631,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;
|
||||
|
||||
@@ -1677,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;
|
||||
|
||||
@@ -1697,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;
|
||||
@@ -1707,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;
|
||||
|
||||
@@ -1744,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;
|
||||
}
|
||||
@@ -1771,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) &&
|
||||
@@ -1806,11 +1702,11 @@ 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);
|
||||
@@ -1823,7 +1719,7 @@ gsk_gpu_node_processor_add_color_node (GskGpuNodeProcessor *self,
|
||||
gsk_gpu_color_op (self->frame,
|
||||
shader_clip,
|
||||
&clipped,
|
||||
graphene_point_zero (),
|
||||
&zero,
|
||||
color);
|
||||
return;
|
||||
}
|
||||
@@ -1833,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,
|
||||
@@ -1848,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,
|
||||
@@ -1857,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);
|
||||
}
|
||||
}
|
||||
@@ -1934,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;
|
||||
|
||||
@@ -2001,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,
|
||||
@@ -2045,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);
|
||||
@@ -2252,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, &self->offset, &bounds);
|
||||
|
||||
bounds = gsk_rect_round_to_pixels (bounds, self->scale, self->offset);
|
||||
|
||||
image = gsk_gpu_node_processor_init_draw (&other,
|
||||
self->frame,
|
||||
@@ -2547,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,
|
||||
@@ -2974,11 +2870,10 @@ 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;
|
||||
gboolean glyph_align;
|
||||
|
||||
if (self->opacity < 1.0 &&
|
||||
gsk_text_node_has_color_glyphs (node))
|
||||
@@ -2987,78 +2882,60 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
glyph_align = gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_GLYPH_ALIGN) &&
|
||||
gsk_transform_get_category (self->modelview) >= GSK_TRANSFORM_CATEGORY_2D;
|
||||
device = gsk_gpu_frame_get_device (self->frame);
|
||||
color = *gsk_text_node_get_color (node);
|
||||
color.alpha *= self->opacity;
|
||||
num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
font = gsk_text_node_get_font (node);
|
||||
offset = *gsk_text_node_get_offset (node);
|
||||
offset.x += self->offset.x;
|
||||
offset.y += self->offset.y;
|
||||
offset = 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, glyph_origin;
|
||||
graphene_point_t glyph_offset;
|
||||
GskPoint g_offset;
|
||||
guint32 descriptor;
|
||||
GskGpuGlyphLookupFlags flags;
|
||||
|
||||
glyph_origin = GRAPHENE_POINT_INIT (offset.x + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
offset.y + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
if (glyph_align)
|
||||
{
|
||||
glyph_origin.x = roundf (glyph_origin.x * scale * 4);
|
||||
glyph_origin.y = roundf (glyph_origin.y * scale * 4);
|
||||
flags = ((int) glyph_origin.x & 3) |
|
||||
(((int) glyph_origin.y & 3) << 2);
|
||||
glyph_origin.x = 0.25 * inv_scale * glyph_origin.x;
|
||||
glyph_origin.y = 0.25 * inv_scale * glyph_origin.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
image = gsk_gpu_device_lookup_glyph_image (device,
|
||||
self->frame,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
flags,
|
||||
scale,
|
||||
0,
|
||||
gsk_scale_get_x (scale),
|
||||
&glyph_bounds,
|
||||
&glyph_offset);
|
||||
|
||||
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_scale, inv_scale, &glyph_tex_rect);
|
||||
gsk_rect_scale (&GRAPHENE_RECT_INIT(0, 0, glyph_bounds.size.width, glyph_bounds.size.height), inv_scale, inv_scale, &glyph_bounds);
|
||||
glyph_origin = GRAPHENE_POINT_INIT (glyph_origin.x - glyph_offset.x * inv_scale,
|
||||
glyph_origin.y - glyph_offset.y * inv_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 (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_origin,
|
||||
&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_origin,
|
||||
&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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3071,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;
|
||||
@@ -3083,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));
|
||||
@@ -3100,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);
|
||||
|
||||
@@ -3118,28 +2995,22 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
last_image = image;
|
||||
}
|
||||
|
||||
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,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0,
|
||||
0,
|
||||
glyph_bounds.size.width * inv_scale,
|
||||
glyph_bounds.size.height * inv_scale
|
||||
),
|
||||
&glyph_offset);
|
||||
gsk_gpu_pattern_writer_append_rect (self,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
- glyph_bounds.origin.x * inv_scale,
|
||||
- glyph_bounds.origin.y * inv_scale,
|
||||
gsk_gpu_image_get_width (image) * inv_scale,
|
||||
gsk_gpu_image_get_height (image) * inv_scale
|
||||
),
|
||||
&glyph_offset);
|
||||
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;
|
||||
@@ -3239,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. */
|
||||
@@ -3267,8 +3138,8 @@ gsk_gpu_node_processor_repeat_tile (GskGpuNodeProcessor *self,
|
||||
rect,
|
||||
&self->offset,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
clipped_child_bounds.origin.x + x * child_bounds->size.width,
|
||||
clipped_child_bounds.origin.y + y * child_bounds->size.height,
|
||||
clipped_child_bounds.origin.x - x * child_bounds->size.width,
|
||||
clipped_child_bounds.origin.y - y * child_bounds->size.height,
|
||||
clipped_child_bounds.size.width,
|
||||
clipped_child_bounds.size.height
|
||||
));
|
||||
@@ -3371,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,
|
||||
@@ -3428,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))
|
||||
{
|
||||
@@ -3503,7 +3369,8 @@ gsk_gpu_node_processor_add_fill_node (GskGpuNodeProcessor *self,
|
||||
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
rect_round_to_pixels (&clip_bounds, &self->scale, &self->offset, &clip_bounds);
|
||||
|
||||
clip_bounds = gsk_rect_round_to_pixels (clip_bounds, self->scale, self->offset);
|
||||
|
||||
child = gsk_fill_node_get_child (node);
|
||||
|
||||
@@ -3600,7 +3467,8 @@ gsk_gpu_node_processor_add_stroke_node (GskGpuNodeProcessor *self,
|
||||
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
rect_round_to_pixels (&clip_bounds, &self->scale, &self->offset, &clip_bounds);
|
||||
|
||||
clip_bounds = gsk_rect_round_to_pixels (clip_bounds, self->scale, self->offset);
|
||||
|
||||
child = gsk_stroke_node_get_child (node);
|
||||
|
||||
@@ -3674,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?!");
|
||||
}
|
||||
@@ -3936,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;
|
||||
|
||||
@@ -3999,15 +3862,9 @@ gsk_gpu_node_processor_create_node_pattern (GskGpuPatternWriter *self,
|
||||
gsk_gpu_descriptors_set_size (self->desc, images_before, buffers_before);
|
||||
}
|
||||
|
||||
rect_round_to_pixels (&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
|
||||
),
|
||||
&self->scale,
|
||||
&self->offset,
|
||||
&bounds);
|
||||
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,
|
||||
&bounds,
|
||||
&self->scale,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ static const GdkDebugKey gsk_gpu_optimization_keys[] = {
|
||||
{ "blit", GSK_GPU_OPTIMIZE_BLIT, "Use shaders instead of vkCmdBlit()/glBlitFramebuffer()" },
|
||||
{ "gradients", GSK_GPU_OPTIMIZE_GRADIENTS, "Don't supersample gradients" },
|
||||
{ "mipmap", GSK_GPU_OPTIMIZE_MIPMAP, "Avoid creating mipmaps" },
|
||||
{ "glyph-align", GSK_GPU_OPTIMIZE_GLYPH_ALIGN, "Never align glyphs to the subpixel grid" },
|
||||
|
||||
{ "gl-baseinstance", GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE, "Assume no ARB/EXT_base_instance support" },
|
||||
};
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -117,8 +118,7 @@ typedef enum {
|
||||
GSK_GPU_OPTIMIZE_BLIT = 1 << 3,
|
||||
GSK_GPU_OPTIMIZE_GRADIENTS = 1 << 4,
|
||||
GSK_GPU_OPTIMIZE_MIPMAP = 1 << 5,
|
||||
GSK_GPU_OPTIMIZE_GLYPH_ALIGN = 1 << 6,
|
||||
/* These require hardware support */
|
||||
GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE = 1 << 7,
|
||||
GSK_GPU_OPTIMIZE_GL_BASE_INSTANCE = 1 << 6,
|
||||
} GskGpuOptimizations;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -18,68 +18,37 @@ vec4
|
||||
compute_color (void)
|
||||
{
|
||||
uint triangle_index = uint (GSK_VERTEX_INDEX) / 3u;
|
||||
uint index, fallback;
|
||||
uint index;
|
||||
|
||||
switch (triangle_index)
|
||||
{
|
||||
case 2u * SLICE_TOP_LEFT + 1u:
|
||||
index = TOP;
|
||||
fallback = LEFT;
|
||||
break;
|
||||
case 2u * SLICE_TOP:
|
||||
case 2u * SLICE_TOP + 1u:
|
||||
index = TOP;
|
||||
fallback = TOP;
|
||||
break;
|
||||
case 2u * SLICE_TOP_RIGHT:
|
||||
index = TOP;
|
||||
fallback = RIGHT;
|
||||
break;
|
||||
case 2u * SLICE_TOP_RIGHT + 1u:
|
||||
index = RIGHT;
|
||||
fallback = TOP;
|
||||
break;
|
||||
case 2u * SLICE_RIGHT:
|
||||
case 2u * SLICE_RIGHT + 1u:
|
||||
index = RIGHT;
|
||||
fallback = RIGHT;
|
||||
break;
|
||||
case 2u * SLICE_BOTTOM_RIGHT:
|
||||
index = RIGHT;
|
||||
fallback = BOTTOM;
|
||||
break;
|
||||
case 2u * SLICE_BOTTOM_RIGHT + 1u:
|
||||
index = BOTTOM;
|
||||
fallback = RIGHT;
|
||||
break;
|
||||
case 2u * SLICE_BOTTOM:
|
||||
case 2u * SLICE_BOTTOM + 1u:
|
||||
index = BOTTOM;
|
||||
fallback = BOTTOM;
|
||||
break;
|
||||
case 2u * SLICE_BOTTOM_LEFT:
|
||||
index = BOTTOM;
|
||||
fallback = LEFT;
|
||||
break;
|
||||
case 2u * SLICE_BOTTOM_LEFT + 1u:
|
||||
index = LEFT;
|
||||
fallback = BOTTOM;
|
||||
break;
|
||||
case 2u * SLICE_LEFT:
|
||||
case 2u * SLICE_LEFT + 1u:
|
||||
index = LEFT;
|
||||
fallback = LEFT;
|
||||
break;
|
||||
case 2u * SLICE_TOP_LEFT:
|
||||
index = LEFT;
|
||||
fallback = TOP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (in_border_widths[index] > 0.0)
|
||||
return color_premultiply (in_border_colors[index]);
|
||||
else
|
||||
return color_premultiply (in_border_colors[fallback]);
|
||||
return color_premultiply (in_border_colors[index]);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+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
|
||||
|
||||
+90
-27
@@ -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,39 +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 void
|
||||
gsk_rect_scale (const graphene_rect_t *r,
|
||||
float sx,
|
||||
float sy,
|
||||
graphene_rect_t *res)
|
||||
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_scale (r, sx, sy, res);
|
||||
return;
|
||||
graphene_rect_t res;
|
||||
graphene_rect_scale (&r, sx, sy, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res->origin.x = r->origin.x * sx;
|
||||
res->origin.y = r->origin.y * sy;
|
||||
res->size.width = r->size.width * sx;
|
||||
res->size.height = r->size.height * sy;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -3335,7 +3335,6 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
self->children = g_malloc_n (n_children, sizeof (GskRenderNode *));
|
||||
|
||||
self->children[0] = gsk_render_node_ref (children[0]);
|
||||
node->offscreen_for_opacity = children[0]->offscreen_for_opacity;
|
||||
gsk_rect_init_from_rect (&bounds, &(children[0]->bounds));
|
||||
node->preferred_depth = gdk_memory_depth_merge (node->preferred_depth,
|
||||
gsk_render_node_get_preferred_depth (children[0]));
|
||||
@@ -4092,7 +4091,6 @@ gsk_repeat_node_draw_tiled (cairo_t *cr,
|
||||
const graphene_rect_t *child_bounds)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
cairo_matrix_t matrix;
|
||||
|
||||
cairo_save (cr);
|
||||
/* reset the clip so we get an unclipped pattern for repeating */
|
||||
@@ -4109,11 +4107,6 @@ gsk_repeat_node_draw_tiled (cairo_t *cr,
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
|
||||
cairo_pattern_get_matrix (pattern, &matrix);
|
||||
cairo_matrix_translate (&matrix,
|
||||
- x * child_bounds->size.width,
|
||||
- y * child_bounds->size.height);
|
||||
cairo_pattern_set_matrix (pattern, &matrix);
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
+73
-90
@@ -981,7 +981,7 @@ ensure_fontmap (Context *context)
|
||||
g_object_set_data_full (G_OBJECT (context->fontmap), "font-files", files, (GDestroyNotify) g_ptr_array_unref);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
add_font_from_file (Context *context,
|
||||
const char *path,
|
||||
GError **error)
|
||||
@@ -997,7 +997,7 @@ add_font_from_file (Context *context,
|
||||
GTK_CSS_PARSER_ERROR,
|
||||
GTK_CSS_PARSER_ERROR_FAILED,
|
||||
"Custom fonts are not implemented for %s", G_OBJECT_TYPE_NAME (context->fontmap));
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
config = pango_fc_font_map_get_config (PANGO_FC_FONT_MAP (context->fontmap));
|
||||
@@ -1006,20 +1006,18 @@ add_font_from_file (Context *context,
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_CSS_PARSER_ERROR,
|
||||
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
"Failed to load font");
|
||||
return FALSE;
|
||||
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));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
add_font_from_bytes (Context *context,
|
||||
GBytes *bytes,
|
||||
GError **error)
|
||||
@@ -1027,11 +1025,10 @@ add_font_from_bytes (Context *context,
|
||||
GFile *file;
|
||||
GIOStream *iostream;
|
||||
GOutputStream *ostream;
|
||||
gboolean result;
|
||||
|
||||
file = g_file_new_tmp ("gtk4-font-XXXXXX.ttf", (GFileIOStream **) &iostream, error);
|
||||
if (!file)
|
||||
return FALSE;
|
||||
return;
|
||||
|
||||
ostream = g_io_stream_get_output_stream (iostream);
|
||||
if (g_output_stream_write_bytes (ostream, bytes, NULL, error) == -1)
|
||||
@@ -1039,22 +1036,20 @@ add_font_from_bytes (Context *context,
|
||||
g_object_unref (file);
|
||||
g_object_unref (iostream);
|
||||
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
g_io_stream_close (iostream, NULL, NULL);
|
||||
g_object_unref (iostream);
|
||||
|
||||
result = add_font_from_file (context, g_file_peek_path (file), error);
|
||||
add_font_from_file (context, g_file_peek_path (file), error);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else /* !HAVE_PANGOFT */
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
add_font_from_bytes (Context *context,
|
||||
GBytes *bytes,
|
||||
GError **error)
|
||||
@@ -1063,7 +1058,6 @@ add_font_from_bytes (Context *context,
|
||||
GTK_CSS_PARSER_ERROR,
|
||||
GTK_CSS_PARSER_ERROR_FAILED,
|
||||
"Not implemented");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1074,105 +1068,94 @@ parse_font (GtkCssParser *parser,
|
||||
gpointer out_font)
|
||||
{
|
||||
PangoFont *font = NULL;
|
||||
char *font_name;
|
||||
char *s;
|
||||
GtkCssLocation start_location;
|
||||
PangoFontMap *fontmap;
|
||||
|
||||
font_name = gtk_css_parser_consume_string (parser);
|
||||
if (font_name == NULL)
|
||||
fontmap = pango_cairo_font_map_get_default ();
|
||||
|
||||
s = gtk_css_parser_consume_string (parser);
|
||||
if (s == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (context->fontmap)
|
||||
font = font_from_string (context->fontmap, font_name);
|
||||
start_location = *gtk_css_parser_get_start_location (parser);
|
||||
|
||||
if (gtk_css_parser_has_url (parser))
|
||||
if (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_URL) ||
|
||||
gtk_css_parser_has_function (parser, "url"))
|
||||
{
|
||||
char *url;
|
||||
char *scheme;
|
||||
GBytes *bytes = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (font != NULL)
|
||||
/* If we have a url, it is a bug if the font already exists in our custom fontmap */
|
||||
if (context->fontmap)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "A font with this name already exists.");
|
||||
/* consume the url to avoid more errors */
|
||||
url = gtk_css_parser_consume_url (parser);
|
||||
g_free (url);
|
||||
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
|
||||
{
|
||||
char *scheme;
|
||||
GBytes *bytes;
|
||||
GError *error = NULL;
|
||||
GtkCssLocation start_location;
|
||||
gboolean success = FALSE;
|
||||
GFile *file;
|
||||
|
||||
start_location = *gtk_css_parser_get_start_location (parser);
|
||||
url = gtk_css_parser_consume_url (parser);
|
||||
file = g_file_new_for_uri (url);
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
if (url != NULL)
|
||||
{
|
||||
scheme = g_uri_parse_scheme (url);
|
||||
if (scheme && g_ascii_strcasecmp (scheme, "data") == 0)
|
||||
{
|
||||
bytes = gtk_css_data_url_parse (url, NULL, &error);
|
||||
}
|
||||
else
|
||||
{
|
||||
GFile *file;
|
||||
g_free (scheme);
|
||||
g_free (url);
|
||||
|
||||
file = g_file_new_for_uri (url);
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
g_object_unref (file);
|
||||
}
|
||||
if (bytes)
|
||||
{
|
||||
add_font_from_bytes (context, bytes, &error);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
g_free (scheme);
|
||||
g_free (url);
|
||||
if (bytes != NULL)
|
||||
{
|
||||
success = add_font_from_bytes (context, bytes, &error);
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
fontmap = context->fontmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (error != NULL);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
gtk_css_parser_emit_error (parser,
|
||||
&start_location,
|
||||
gtk_css_parser_get_end_location (parser),
|
||||
error);
|
||||
}
|
||||
}
|
||||
gtk_css_parser_emit_error (parser,
|
||||
&start_location,
|
||||
gtk_css_parser_get_end_location (parser),
|
||||
error);
|
||||
g_clear_error (&error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
font = font_from_string (context->fontmap, font_name);
|
||||
if (!font)
|
||||
{
|
||||
gtk_css_parser_error (parser,
|
||||
GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
&start_location,
|
||||
gtk_css_parser_get_end_location (parser),
|
||||
"The given url does not define a font named \"%s\"",
|
||||
font_name);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!font)
|
||||
font = font_from_string (pango_cairo_font_map_get_default (), font_name);
|
||||
|
||||
if (!font)
|
||||
gtk_css_parser_error_value (parser, "The font \"%s\" does not exist", font_name);
|
||||
}
|
||||
font = font_from_string (fontmap, s);
|
||||
|
||||
g_free (font_name);
|
||||
if (!font && context->fontmap && fontmap != context->fontmap)
|
||||
font = font_from_string (context->fontmap, s);
|
||||
|
||||
if (font)
|
||||
{
|
||||
*((PangoFont**)out_font) = font;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
if (!font)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "This font does not exist.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*((PangoFont**)out_font) = font;
|
||||
|
||||
g_free (s);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1401,6 +1401,14 @@ gtk_at_spi_context_finalize (GObject *gobject)
|
||||
G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_at_spi_context_constructed (GObject *gobject)
|
||||
{
|
||||
GtkAtSpiContext *self G_GNUC_UNUSED = GTK_AT_SPI_CONTEXT (gobject);
|
||||
|
||||
G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->constructed (gobject);
|
||||
}
|
||||
|
||||
static const char *get_bus_address (GdkDisplay *display);
|
||||
|
||||
static void
|
||||
@@ -1508,6 +1516,7 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GtkATContextClass *context_class = GTK_AT_CONTEXT_CLASS (klass);
|
||||
|
||||
gobject_class->constructed = gtk_at_spi_context_constructed;
|
||||
gobject_class->finalize = gtk_at_spi_context_finalize;
|
||||
|
||||
context_class->realize = gtk_at_spi_context_realize;
|
||||
|
||||
@@ -96,7 +96,7 @@ gtk_at_spi_root_finalize (GObject *gobject)
|
||||
g_free (self->desktop_name);
|
||||
g_free (self->desktop_path);
|
||||
|
||||
G_OBJECT_CLASS (gtk_at_spi_root_parent_class)->finalize (gobject);
|
||||
G_OBJECT_CLASS (gtk_at_spi_root_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -957,14 +957,6 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
|
||||
return 1;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_parser_has_url (GtkCssParser *self)
|
||||
{
|
||||
return gtk_css_parser_has_token (self, GTK_CSS_TOKEN_URL)
|
||||
|| gtk_css_parser_has_token (self, GTK_CSS_TOKEN_BAD_URL)
|
||||
|| gtk_css_parser_has_function (self, "url");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_css_parser_consume_url:
|
||||
* @self: a `GtkCssParser`
|
||||
|
||||
@@ -116,7 +116,6 @@ gboolean gtk_css_parser_has_token (GtkCssParser
|
||||
GtkCssTokenType token_type);
|
||||
gboolean gtk_css_parser_has_ident (GtkCssParser *self,
|
||||
const char *ident);
|
||||
gboolean gtk_css_parser_has_url (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_number (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_integer (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_function (GtkCssParser *self,
|
||||
|
||||
@@ -257,14 +257,14 @@ gtk_application_startup (GApplication *g_application)
|
||||
|
||||
before2 = GDK_PROFILER_CURRENT_TIME;
|
||||
gtk_init ();
|
||||
gdk_profiler_end_mark (before2, "gtk_init", NULL);
|
||||
gdk_profiler_end_mark (before2, "gtk init", NULL);
|
||||
|
||||
priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
|
||||
gtk_application_impl_startup (priv->impl, priv->register_session);
|
||||
|
||||
gtk_application_load_resources (application);
|
||||
|
||||
gdk_profiler_end_mark (before, "Application startup", NULL);
|
||||
gdk_profiler_end_mark (before, "gtk application startup", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+11
-5
@@ -604,10 +604,14 @@ static const struct {
|
||||
GtkAccessible *accessible,
|
||||
GdkDisplay *display);
|
||||
} a11y_backends[] = {
|
||||
#if defined(GDK_WINDOWING_WAYLAND) || defined(GDK_WINDOWING_X11)
|
||||
{ "AT-SPI", "atspi", gtk_at_spi_create_context },
|
||||
#if defined(GDK_WINDOWING_WAYLAND)
|
||||
{ "AT-SPI (Wayland)", "atspi", gtk_at_spi_create_context },
|
||||
#endif
|
||||
#if defined(GDK_WINDOWING_X11)
|
||||
{ "AT-SPI (X11)", "atspi", gtk_at_spi_create_context },
|
||||
#endif
|
||||
{ "Test", "test", gtk_test_at_context_new },
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -630,7 +634,6 @@ gtk_at_context_create (GtkAccessibleRole accessible_role,
|
||||
GdkDisplay *display)
|
||||
{
|
||||
static const char *gtk_a11y_env;
|
||||
GtkATContext *res = NULL;
|
||||
|
||||
if (gtk_a11y_env == NULL)
|
||||
{
|
||||
@@ -658,9 +661,12 @@ gtk_at_context_create (GtkAccessibleRole accessible_role,
|
||||
if (g_ascii_strcasecmp (gtk_a11y_env, "none") == 0)
|
||||
return NULL;
|
||||
|
||||
for (size_t i = 0; i < G_N_ELEMENTS (a11y_backends); i++)
|
||||
GtkATContext *res = NULL;
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS (a11y_backends); i++)
|
||||
{
|
||||
g_assert (a11y_backends[i].name != NULL);
|
||||
if (a11y_backends[i].name == NULL)
|
||||
break;
|
||||
|
||||
if (a11y_backends[i].create_context != NULL &&
|
||||
(*gtk_a11y_env == '0' || g_ascii_strcasecmp (a11y_backends[i].env_name, gtk_a11y_env) == 0))
|
||||
|
||||
@@ -2251,7 +2251,7 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
|
||||
guint64 after = GDK_PROFILER_CURRENT_TIME;
|
||||
if (after - before > 500000) /* half a millisecond */
|
||||
{
|
||||
gdk_profiler_add_mark (before, after - before, "Builder load", filename);
|
||||
gdk_profiler_add_mark (before, after - before, "builder load", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1363,7 +1363,7 @@ gtk_css_node_validate (GtkCssNode *cssnode)
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
gdk_profiler_end_mark (before, "Validate CSS", "");
|
||||
gdk_profiler_end_mark (before, "css validation", "");
|
||||
gdk_profiler_set_int_counter (invalidated_nodes_counter, invalidated_nodes);
|
||||
gdk_profiler_set_int_counter (created_styles_counter, created_styles);
|
||||
invalidated_nodes = 0;
|
||||
|
||||
@@ -1016,7 +1016,7 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
|
||||
}
|
||||
#endif
|
||||
|
||||
gdk_profiler_end_mark (before, "Create CSS selector tree", NULL);
|
||||
gdk_profiler_end_mark (before, "create selector tree", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1081,7 +1081,7 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
{
|
||||
char *uri = g_file_get_uri (file);
|
||||
gdk_profiler_end_mark (before, "CSS theme load", uri);
|
||||
gdk_profiler_end_mark (before, "theme load", uri);
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@
|
||||
*
|
||||
* // This widget accepts two types of drop types: GFile objects
|
||||
* // and GdkPixbuf objects
|
||||
* gtk_drop_target_set_gtypes (target, (GType [2]) {
|
||||
* gtk_drop_target_set_gtypes (target, (GTypes [2]) {
|
||||
* G_TYPE_FILE,
|
||||
* GDK_TYPE_PIXBUF,
|
||||
* }, 2);
|
||||
@@ -935,7 +935,7 @@ gtk_drop_target_get_formats (GtkDropTarget *self)
|
||||
* that can be dropped on the target
|
||||
* @n_types: number of @types
|
||||
*
|
||||
* Sets the supported `GType`s for this drop target.
|
||||
* Sets the supported `GTypes` for this drop target.
|
||||
*/
|
||||
void
|
||||
gtk_drop_target_set_gtypes (GtkDropTarget *self,
|
||||
|
||||
@@ -761,7 +761,7 @@ populate_emoji_chooser (gpointer data)
|
||||
now = g_get_monotonic_time ();
|
||||
if (now > start + 200) /* 2 ms */
|
||||
{
|
||||
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "Emojichooser populate", NULL);
|
||||
gdk_profiler_add_mark (start * 1000, (now - start) * 1000, "emojichooser", "populate");
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -771,7 +771,7 @@ populate_emoji_chooser (gpointer data)
|
||||
chooser->box = NULL;
|
||||
chooser->populate_idle = 0;
|
||||
|
||||
gdk_profiler_end_mark (start, "Emojichooser populate (finish)", NULL);
|
||||
gdk_profiler_end_mark (start, "emojichooser", "populate (finish)");
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2069,7 +2069,7 @@ ensure_valid_themes (GtkIconTheme *self,
|
||||
|
||||
load_themes (self);
|
||||
|
||||
gdk_profiler_end_mark (before, "Icon theme load", self->current_theme);
|
||||
gdk_profiler_end_mark (before, "icon theme load", self->current_theme);
|
||||
|
||||
if (was_valid)
|
||||
queue_theme_changed (self);
|
||||
@@ -3822,7 +3822,7 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
|
||||
/* Don't report quick (< 0.5 msec) parses */
|
||||
if (end - before > 500000 || !in_thread)
|
||||
{
|
||||
gdk_profiler_add_markf (before, (end - before), in_thread ? "Icon load (thread)" : "Icon load" ,
|
||||
gdk_profiler_add_markf (before, (end - before), in_thread ? "icon load (thread)" : "icon load" ,
|
||||
"%s size %d@%d", icon->filename, icon->desired_size, icon->desired_scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ init_compose_table_thread_cb (GTask *task,
|
||||
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
gdk_profiler_end_mark (before, "Compose table load (thread)", NULL);
|
||||
gdk_profiler_end_mark (before, "im compose table load (thread)", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -117,6 +117,7 @@ gtk_list_item_change_release (GtkListItemChange *change,
|
||||
if (!g_hash_table_replace (change->deleted_items, gtk_list_item_base_get_item (GTK_LIST_ITEM_BASE (widget)), widget))
|
||||
{
|
||||
g_warning ("Duplicate item detected in list. Picking one randomly.");
|
||||
gtk_list_item_change_recycle (change, widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,26 +968,10 @@ gtk_list_item_manager_add_items (GtkListItemManager *self,
|
||||
|
||||
if (section != NULL && section->type == GTK_LIST_TILE_HEADER)
|
||||
{
|
||||
guint start, end;
|
||||
GtkListTile *footer = gtk_list_tile_get_footer (self, section);
|
||||
GtkListTile *previous_footer = gtk_list_tile_get_previous_skip (section);
|
||||
|
||||
gtk_section_model_get_section (GTK_SECTION_MODEL (self->model), position, &start, &end);
|
||||
|
||||
if (previous_footer != NULL && previous_footer->type == GTK_LIST_TILE_FOOTER &&
|
||||
position > start && position < end)
|
||||
{
|
||||
gtk_list_item_change_clear_header (change, §ion->widget);
|
||||
gtk_list_tile_set_type (section, GTK_LIST_TILE_REMOVED);
|
||||
gtk_list_tile_set_type (previous_footer, GTK_LIST_TILE_REMOVED);
|
||||
|
||||
section = gtk_list_tile_get_header (self, previous_footer);
|
||||
}
|
||||
|
||||
gtk_list_item_change_clear_header (change, §ion->widget);
|
||||
gtk_list_tile_set_type (section,
|
||||
GTK_LIST_TILE_UNMATCHED_HEADER);
|
||||
gtk_list_tile_set_type (footer,
|
||||
gtk_list_tile_set_type (gtk_list_tile_get_footer (self, section),
|
||||
GTK_LIST_TILE_UNMATCHED_FOOTER);
|
||||
}
|
||||
}
|
||||
@@ -1625,7 +1610,7 @@ gtk_list_item_manager_model_sections_changed_cb (GListModel *model,
|
||||
gtk_list_item_change_clear_header (&change, &header->widget);
|
||||
gtk_list_tile_set_type (header, GTK_LIST_TILE_UNMATCHED_HEADER);
|
||||
|
||||
n_items += offset;
|
||||
n_items -= MIN (n_items, position - offset);
|
||||
while (n_items > 0)
|
||||
{
|
||||
switch (tile->type)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user