Compare commits
3 Commits
ebassi/iss
...
gpu-2d-typ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcf504905a | ||
|
|
b84150a580 | ||
|
|
415539b02f |
@@ -1,4 +1,4 @@
|
||||
# See https://www.apertis.org/policies/coding_conventions/#code-formatting
|
||||
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
|
||||
BasedOnStyle: GNU
|
||||
AlwaysBreakAfterDefinitionReturnType: All
|
||||
BreakBeforeBinaryOperators: None
|
||||
|
||||
@@ -78,7 +78,6 @@ style-check-diff:
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.node"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
|
||||
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
|
||||
@@ -210,52 +209,51 @@ msys2-mingw64:
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
|
||||
|
||||
macos:
|
||||
macos-x86_64:
|
||||
rules:
|
||||
# Do not run in forks as the runner is not available there.
|
||||
# (except for dehesselle who maintains the runner)
|
||||
- if: $CI_PROJECT_NAMESPACE != "GNOME" && $CI_PROJECT_NAMESPACE != "dehesselle"
|
||||
when: never
|
||||
- if: $RUNNER == "macosintel"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||
when: manual
|
||||
allow_failure: true
|
||||
- if: $RUNNER == "macosarm"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX11.3.sdk
|
||||
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
stage: build
|
||||
parallel:
|
||||
matrix:
|
||||
- RUNNER: [ "macosintel", "macosarm" ]
|
||||
tags:
|
||||
- ${RUNNER}
|
||||
- macosintel
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: ""
|
||||
BACKEND_FLAGS: "-Dx11-backend=false -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dmedia-gstreamer=disabled -Dintrospection=enabled -Dgobject-introspection:werror=false"
|
||||
MESON_FORCE_BACKTRACKE: 1
|
||||
TMPDIR: /Users/Shared/work/tmp
|
||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||
PIP_CACHE_DIR: /Users/Shared/build/cache
|
||||
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
|
||||
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
|
||||
EXTRA_MESON_FLAGS: "-Dgobject-introspection:werror=false"
|
||||
before_script:
|
||||
- .gitlab-ci/show-info-macos.sh
|
||||
- python3 -m venv .venv
|
||||
# Building the introspection feature requires pkg-config and bison.
|
||||
- curl -L $CI_API_V4_URL/projects/30437/packages/generic/pkgconfig/v0.29.2+10/pkg-config-0.29.2+10_$(uname -m).tar.xz | tar -C .venv -xJ
|
||||
- curl -L $CI_API_V4_URL/projects/30438/packages/generic/bison/v3.8.2+3/bison-3.8.2+3_$(uname -m).tar.xz | tar -C .venv -xJ
|
||||
# Not using ccache on purpose as it accelerates the build so much that it
|
||||
# can trigger race conditions in the gobject-introspection subproject.
|
||||
- bash .gitlab-ci/show-info-osx.sh
|
||||
- /opt/macports/bin/python3.10 -m venv .venv
|
||||
- ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
|
||||
- ln -s /opt/pkg-config/bin/pkg-config .venv/bin
|
||||
- ln -s /opt/bison/bin/bison .venv/bin
|
||||
- source .venv/bin/activate
|
||||
- pip3 install meson==1.3.2 ninja==1.11.1.1
|
||||
# We're not setting up ccache here on purpose as it accelerates the build
|
||||
# so much that it triggers race conditions in the gobject-introspection
|
||||
# subproject.
|
||||
- pip3 install meson==1.2.0
|
||||
- pip3 install ninja==1.11.1
|
||||
- pip3 install /Users/Shared/build/pkgs/PyGObject-3.44.0-cp310-cp310-macosx_10_13_x86_64.whl
|
||||
/Users/Shared/build/pkgs/pycairo-1.23.0-cp310-cp310-macosx_10_13_x86_64.whl
|
||||
script:
|
||||
- meson setup
|
||||
${COMMON_MESON_FLAGS}
|
||||
${EXTRA_MESON_FLAGS}
|
||||
${BACKEND_FLAGS}
|
||||
${FEATURE_FLAGS}
|
||||
-Dx11-backend=false
|
||||
-Dbroadway-backend=true
|
||||
-Dmacos-backend=true
|
||||
-Dmedia-gstreamer=disabled
|
||||
-Dintrospection=enabled
|
||||
-Dcpp_std=c++11
|
||||
-Dpixman:tests=disabled
|
||||
-Dlibjpeg-turbo:simd=disabled
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-tests=false
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-testsuite=false
|
||||
_build
|
||||
- meson compile -C _build
|
||||
artifacts:
|
||||
@@ -430,6 +428,13 @@ asan-build:
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
reference:
|
||||
image: $FEDORA_IMAGE
|
||||
@@ -479,4 +484,3 @@ publish-docs:
|
||||
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "main"
|
||||
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
set -eux -o pipefail
|
||||
|
||||
xcodebuild -version || :
|
||||
|
||||
if [ -z "$SDKROOT" ]; then
|
||||
xcodebuild -showsdks || :
|
||||
else
|
||||
echo "SDKROOT = $SDKROOT"
|
||||
fi
|
||||
xcodebuild -showsdks || :
|
||||
|
||||
system_profiler SPSoftwareDataType || :
|
||||
178
NEWS
178
NEWS
@@ -1,182 +1,6 @@
|
||||
Overview of Changes in 4.13.9, xx-xx-xxxx
|
||||
Overview of Changes in 4.13.6, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Note: The new renderers and dmabuf support are using graphics drivers
|
||||
in different ways than the old gl renderer, and trigger new driver bugs,
|
||||
(see for example https://gitlab.gnome.org/GNOME/gtk/-/issues/6418 and
|
||||
https://gitlab.gnome.org/GNOME/gtk/-/issues/6388). Therefore, it is
|
||||
recommended to use the latest mesa release (24.0) with the new renderers.
|
||||
|
||||
|
||||
Overview of Changes in 4.13.8, 20-02-2024
|
||||
=========================================
|
||||
|
||||
* Accessibility:
|
||||
- Add a GtkAccessibleText interface for allowing 3rd party
|
||||
text widgets (notably vte) to be accessible
|
||||
- Avoid duplicate accessible descriptions
|
||||
- Fix GetAccessibleAtPoint
|
||||
|
||||
* GSK:
|
||||
- Avoid offscreens for disjoint containers
|
||||
- Don't use the gpu renderers with llvmpipe
|
||||
- Fix various rendering issues found by tests
|
||||
- Allow unnormalized node bounds again
|
||||
- Fix a broken case of rounded-rect intersection
|
||||
- Fix handling of external textures in gpu renderers
|
||||
- Make gpu renderers work with WGL on Windows
|
||||
|
||||
* build:
|
||||
- Allow building without dmabuf support on (old) Linux
|
||||
|
||||
* X11:
|
||||
- Fix monitor enter/leave signals
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Czech
|
||||
Galician
|
||||
Georgian
|
||||
Hebrew
|
||||
Lithuanian
|
||||
Persian
|
||||
Russian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.13.7, 11-02-2024
|
||||
=========================================
|
||||
|
||||
* GtkFileChooser:
|
||||
- Speed up opening
|
||||
|
||||
* GtkCalendar:
|
||||
- Add some missing setters and getters
|
||||
|
||||
* Accessibility:
|
||||
- Add socket support for webkit accessibility
|
||||
- Implement AT-SPI text for GtkText
|
||||
- Implement AT-SPI component generically
|
||||
- Add an announce API
|
||||
|
||||
* GSK:
|
||||
- Make the ngl renderer work on macOS
|
||||
- Fix a crash in the vulkan renderer
|
||||
- Make nodeparser allow aliases for fonts again
|
||||
- Implement cache eviction for glyph and texture caches
|
||||
- Fix ngl shaders to work on GL < 4.0
|
||||
- Require GL 3.3 for the ngl renderer
|
||||
- Fix problems with scaled shadows
|
||||
- Fix problems with holes for underlaid subsurfaces
|
||||
- Improve handling of scales and glyph cache efficiency
|
||||
|
||||
* Media:
|
||||
- Support dmabufs in the gstreamer backend. This allows
|
||||
zero-copy video playback on Wayland when paired with
|
||||
hardware video decoding
|
||||
- Drop the experimental ffmpeg backend. It hasn't been
|
||||
building for a year
|
||||
|
||||
* Wayland:
|
||||
- Commit empty frames if and double-buffered state is pending
|
||||
- Fix monitor size information when using mutter without
|
||||
the scale-monitor-framebuffer setting
|
||||
- Clear the current tablet on tab leave, fixing a crash
|
||||
|
||||
* macOS:
|
||||
- Propagate unhandled input events back to the OS
|
||||
|
||||
* Tools:
|
||||
- Make the crash handling in gtk4-node-editor more robust
|
||||
|
||||
* Translation updates
|
||||
Galician
|
||||
Georgian
|
||||
Occitan
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.13.6, 25-01-2024
|
||||
=========================================
|
||||
|
||||
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
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* Lists/Selections
|
||||
* #Keywords: suggestion, completion
|
||||
*
|
||||
* The GtkDropDown widget is a modern alternative to GtkComboBox.
|
||||
* It uses list models instead of tree models, and the content is
|
||||
|
||||
@@ -68,9 +68,8 @@ struct _NodeEditorWindow
|
||||
|
||||
GArray *errors;
|
||||
|
||||
guint update_timeout;
|
||||
gboolean auto_reload;
|
||||
gboolean mark_as_safe_pending;
|
||||
gulong after_paint_handler;
|
||||
};
|
||||
|
||||
struct _NodeEditorWindowClass
|
||||
@@ -246,41 +245,6 @@ highlight_text (NodeEditorWindow *self)
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens", &start, &end);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_autosave_as_unsafe (void)
|
||||
{
|
||||
char *path1 = NULL;
|
||||
char *path2 = NULL;
|
||||
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
path2 = get_autosave_path (NULL);
|
||||
|
||||
g_rename (path2, path1);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_autosave_as_safe (void)
|
||||
{
|
||||
char *path1 = NULL;
|
||||
char *path2 = NULL;
|
||||
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
path2 = get_autosave_path (NULL);
|
||||
|
||||
g_rename (path1, path2);
|
||||
}
|
||||
|
||||
static void
|
||||
after_paint (GdkFrameClock *clock,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
if (self->mark_as_safe_pending)
|
||||
{
|
||||
self->mark_as_safe_pending = FALSE;
|
||||
mark_autosave_as_safe ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reload (NodeEditorWindow *self)
|
||||
{
|
||||
@@ -289,8 +253,6 @@ reload (NodeEditorWindow *self)
|
||||
float scale;
|
||||
GskRenderNode *big_node;
|
||||
|
||||
mark_autosave_as_unsafe ();
|
||||
|
||||
text = get_current_text (self->text_buffer);
|
||||
bytes = g_bytes_new_take (text, strlen (text));
|
||||
|
||||
@@ -352,8 +314,6 @@ reload (NodeEditorWindow *self)
|
||||
}
|
||||
|
||||
g_clear_pointer (&big_node, gsk_render_node_unref);
|
||||
|
||||
self->mark_as_safe_pending = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1165,6 +1125,9 @@ node_editor_window_finalize (GObject *object)
|
||||
{
|
||||
NodeEditorWindow *self = (NodeEditorWindow *)object;
|
||||
|
||||
if (self->update_timeout)
|
||||
g_source_remove (self->update_timeout);
|
||||
|
||||
g_array_free (self->errors, TRUE);
|
||||
|
||||
g_clear_pointer (&self->node, gsk_render_node_unref);
|
||||
@@ -1209,7 +1172,6 @@ static void
|
||||
node_editor_window_realize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
GdkFrameClock *frameclock;
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
|
||||
|
||||
@@ -1237,24 +1199,14 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_cairo_renderer_new (),
|
||||
"Cairo");
|
||||
|
||||
frameclock = gtk_widget_get_frame_clock (widget);
|
||||
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
|
||||
G_CALLBACK (after_paint), self);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_unrealize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
GdkFrameClock *frameclock;
|
||||
guint i;
|
||||
|
||||
frameclock = gtk_widget_get_frame_clock (widget);
|
||||
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
|
||||
self->after_paint_handler = 0;
|
||||
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
|
||||
{
|
||||
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
||||
@@ -1794,16 +1746,16 @@ set_initial_text (NodeEditorWindow *self)
|
||||
path = get_autosave_path (NULL);
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
|
||||
if (g_file_get_contents (path1, &initial_text, &len, NULL))
|
||||
if (g_file_get_contents (path, &initial_text, &len, NULL))
|
||||
{
|
||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
||||
g_free (initial_text);
|
||||
}
|
||||
else if (g_file_get_contents (path1, &initial_text, &len, NULL))
|
||||
{
|
||||
self->auto_reload = FALSE;
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), TRUE);
|
||||
|
||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
||||
g_free (initial_text);
|
||||
}
|
||||
else if (g_file_get_contents (path, &initial_text, &len, NULL))
|
||||
{
|
||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
||||
g_free (initial_text);
|
||||
}
|
||||
@@ -1854,6 +1806,41 @@ autosave_contents (NodeEditorWindow *self)
|
||||
g_free (contents);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_autosave_as_safe (void)
|
||||
{
|
||||
char *path1 = NULL;
|
||||
char *path2 = NULL;
|
||||
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
path2 = get_autosave_path (NULL);
|
||||
|
||||
g_rename (path1, path2);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_timeout_cb (gpointer data)
|
||||
{
|
||||
NodeEditorWindow *self = data;
|
||||
|
||||
self->update_timeout = 0;
|
||||
|
||||
mark_autosave_as_safe ();
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
initiate_autosave (NodeEditorWindow *self)
|
||||
{
|
||||
autosave_contents (self);
|
||||
|
||||
if (self->update_timeout != 0)
|
||||
g_source_remove (self->update_timeout);
|
||||
|
||||
self->update_timeout = g_timeout_add (100, update_timeout_cb, self);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_init (NodeEditorWindow *self)
|
||||
{
|
||||
@@ -1918,7 +1905,7 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
|
||||
set_initial_text (self);
|
||||
|
||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
|
||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (initiate_autosave), self);
|
||||
|
||||
if (g_getenv ("GSK_RENDERER"))
|
||||
{
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<attribute name="action">app.help</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<attribute name="action">app.help</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Inspector</attribute>
|
||||
<attribute name="action">app.inspector</attribute>
|
||||
@@ -209,7 +213,6 @@
|
||||
<property name="halign">1</property>
|
||||
<property name="label" translatable="1">The application may have crashed.
|
||||
As a precaution, auto-loading has been turned off.
|
||||
You can turn it back on in the menu.
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -234,7 +234,7 @@ By default, GTK will try to build with support for the Vulkan graphics
|
||||
API in addition to cairo and OpenGL. This option can be used to explicitly
|
||||
control whether Vulkan should be used.
|
||||
|
||||
### `media-gstreamer`
|
||||
### `media-gstreamer` and `media-ffmpeg`
|
||||
|
||||
By default, GTK will try to build the gstreamer backend for
|
||||
media playback support. These options can be used to explicitly
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -126,8 +126,8 @@ available on the system.
|
||||
### `GTK_MEDIA`
|
||||
|
||||
Specifies what backend to load for [class@Gtk.MediaFile]. The possible values
|
||||
depend on what options GTK was built with, and can include 'gstreamer'
|
||||
and 'none'. If set to 'none', media playback will be unavailable.
|
||||
depend on what options GTK was built with, and can include 'gstreamer',
|
||||
'ffmpeg' and 'none'. If set to 'none', media playback will be unavailable.
|
||||
The special value 'help' can be used to obtain a list of all supported
|
||||
media backends.
|
||||
|
||||
@@ -220,8 +220,8 @@ A number of options affect behavior instead of logging:
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-no-fractional`
|
||||
: Disable fractional scaling for OpenGL.
|
||||
`gl-fractional`
|
||||
: Enable fractional scaling for OpenGL. This is experimental
|
||||
|
||||
`gl-debug`
|
||||
: Insert debugging information in OpenGL
|
||||
@@ -460,13 +460,6 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
### `GSK_CACHE_TIMEOUT`
|
||||
|
||||
Overrides the timeout for cache GC in the "ngl" and "vulkan" renderers.
|
||||
The value can be -1 to disable GC entirely, 0 to force GC to happen
|
||||
before every frame, or a positive number to do GC in a timeout every
|
||||
n seconds. The default timeout is 15 seconds.
|
||||
|
||||
### `GSK_MAX_TEXTURE_SIZE`
|
||||
|
||||
Limit texture size to the minimum of this value and the OpenGL limit
|
||||
|
||||
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 |
@@ -123,7 +123,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
||||
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef enum {
|
||||
GDK_DEBUG_PORTALS = 1 << 14,
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||
GDK_DEBUG_GL_FRACTIONAL = 1 << 17,
|
||||
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||
|
||||
@@ -77,7 +77,6 @@ enum
|
||||
PROP_0,
|
||||
PROP_COMPOSITED,
|
||||
PROP_RGBA,
|
||||
PROP_SHADOW_WIDTH,
|
||||
PROP_INPUT_SHAPES,
|
||||
PROP_DMABUF_FORMATS,
|
||||
LAST_PROP
|
||||
@@ -112,7 +111,6 @@ struct _GdkDisplayPrivate {
|
||||
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint shadow_width: 1;
|
||||
guint input_shapes : 1;
|
||||
|
||||
GdkDebugFlags debug_flags;
|
||||
@@ -146,10 +144,6 @@ gdk_display_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
||||
break;
|
||||
|
||||
case PROP_SHADOW_WIDTH:
|
||||
g_value_set_boolean (value, gdk_display_supports_shadow_width (display));
|
||||
break;
|
||||
|
||||
case PROP_INPUT_SHAPES:
|
||||
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
||||
break;
|
||||
@@ -249,18 +243,6 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:shadow-width: (attributes org.gtk.Property.get=gdk_display_supports_shadow_width)
|
||||
*
|
||||
* %TRUE if the display supports extensible frames.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_SHADOW_WIDTH] =
|
||||
g_param_spec_boolean ("shadow-width", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:input-shapes: (attributes org.gtk.Property.get=gdk_display_supports_input_shapes)
|
||||
*
|
||||
@@ -272,7 +254,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:dmabuf-formats: (attributes org.gtk.Property.get=gdk_display_get_dmabuf_formats)
|
||||
* GdkDisplay:dmabuf-formats:
|
||||
*
|
||||
* The dma-buf formats that are supported on this display
|
||||
*
|
||||
@@ -409,7 +391,6 @@ gdk_display_init (GdkDisplay *display)
|
||||
|
||||
priv->composited = TRUE;
|
||||
priv->rgba = TRUE;
|
||||
priv->shadow_width = TRUE;
|
||||
priv->input_shapes = TRUE;
|
||||
}
|
||||
|
||||
@@ -2141,46 +2122,6 @@ gdk_display_set_rgba (GdkDisplay *display,
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_RGBA]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_shadow_width: (attributes org.gtk.Method.get_property=shadow-width)
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Returns whether it's possible for a surface to draw outside of the window area.
|
||||
*
|
||||
* If %TRUE is returned the application decides if it wants to draw shadows.
|
||||
* If %FALSE is returned, the compositor decides if it wants to draw shadows.
|
||||
*
|
||||
* Returns: %TRUE if surfaces can draw shadows or
|
||||
* %FALSE if the display does not support this functionality.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_supports_shadow_width (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return priv->shadow_width;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_set_shadow_width (GdkDisplay *display,
|
||||
gboolean shadow_width)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
if (priv->shadow_width == shadow_width)
|
||||
return;
|
||||
|
||||
priv->shadow_width = shadow_width;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_SHADOW_WIDTH]);
|
||||
}
|
||||
|
||||
static void
|
||||
device_removed_cb (GdkSeat *seat,
|
||||
GdkDevice *device,
|
||||
|
||||
@@ -63,8 +63,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_composited (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_rgba (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
gboolean gdk_display_supports_shadow_width (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
|
||||
|
||||
@@ -257,8 +257,6 @@ void gdk_display_set_composited (GdkDisplay *display
|
||||
gboolean composited);
|
||||
void gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
gboolean input_shapes);
|
||||
void gdk_display_set_shadow_width (GdkDisplay *display,
|
||||
gboolean shadow_width);
|
||||
|
||||
void gdk_display_add_seat (GdkDisplay *display,
|
||||
GdkSeat *seat);
|
||||
|
||||
@@ -2329,42 +2329,18 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
* @dmabuf: a sanitized GdkDmabuf
|
||||
*
|
||||
* A dmabuf is considered disjoint if it uses more than
|
||||
* 1 inode.
|
||||
* Multiple file descriptors may exist when the creator
|
||||
* of the dmabuf just dup()ed once for every plane...
|
||||
* 1 file descriptor.
|
||||
*
|
||||
* Returns: %TRUE if the dmabuf is disjoint
|
||||
**/
|
||||
gboolean
|
||||
gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
|
||||
{
|
||||
struct stat first_stat;
|
||||
unsigned i;
|
||||
|
||||
/* First, do a fast check */
|
||||
|
||||
for (i = 1; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
if (dmabuf->planes[0].fd != dmabuf->planes[i].fd)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == dmabuf->n_planes)
|
||||
return FALSE;
|
||||
|
||||
/* We have different fds, do the fancy check instead */
|
||||
|
||||
if (fstat (dmabuf->planes[0].fd, &first_stat) != 0)
|
||||
return TRUE;
|
||||
|
||||
for (i = 1; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
struct stat plane_stat;
|
||||
|
||||
if (fstat (dmabuf->planes[0].fd, &plane_stat) != 0)
|
||||
return TRUE;
|
||||
|
||||
if (first_stat.st_ino != plane_stat.st_ino)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
gboolean retval = FALSE;
|
||||
GError *error = NULL;
|
||||
GskRenderer *renderer;
|
||||
GdkGLContext *previous;
|
||||
|
||||
g_assert (display->egl_dmabuf_formats == NULL);
|
||||
g_assert (display->egl_external_formats == NULL);
|
||||
@@ -162,7 +161,6 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
if (!gdk_display_prepare_gl (display, NULL))
|
||||
return NULL;
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
@@ -174,11 +172,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||
|
||||
if (!retval)
|
||||
{
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
@@ -187,15 +181,10 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
|
||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,41 +217,3 @@ gdk_dmabuf_formats_peek_formats (GdkDmabufFormats *self)
|
||||
{
|
||||
return self->formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_formats_equal:
|
||||
* @formats1: (nullable): a `GdkDmabufFormats`
|
||||
* @formats2: (nullable): another `GdkDmabufFormats`
|
||||
*
|
||||
* Returns whether @formats1 and @formats2 contain the
|
||||
* same dmabuf formats, in the same order.
|
||||
*
|
||||
* Returns: `TRUE` if @formats1 and @formats2 are equal
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
gboolean
|
||||
gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
||||
const GdkDmabufFormats *formats2)
|
||||
{
|
||||
if (formats1 == formats2)
|
||||
return TRUE;
|
||||
|
||||
if (formats1 == NULL || formats2 == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (formats1->n_formats != formats2->n_formats)
|
||||
return FALSE;
|
||||
|
||||
for (gsize i = 0; i < formats1->n_formats; i++)
|
||||
{
|
||||
GdkDmabufFormat *f1 = &formats1->formats[i];
|
||||
GdkDmabufFormat *f2 = &formats2->formats[i];
|
||||
|
||||
if (f1->fourcc != f2->fourcc ||
|
||||
f1->modifier != f2->modifier)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,4 @@ gboolean gdk_dmabuf_formats_contains (GdkDmabufFormats *formats
|
||||
guint32 fourcc,
|
||||
guint64 modifier) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
||||
const GdkDmabufFormats *formats2);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_DRM_FOURCC_H
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/**
|
||||
* GdkDmabufTexture:
|
||||
*
|
||||
* A `GdkTexture` representing a DMA buffer.
|
||||
* A `GdkTexture` representing a dma-buf object.
|
||||
*
|
||||
* To create a `GdkDmabufTexture`, use the auxiliary
|
||||
* [class@Gdk.DmabufTextureBuilder] object.
|
||||
|
||||
@@ -477,18 +477,18 @@ check_event_sanity (GdkEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
void
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (!check_event_sanity (event))
|
||||
return FALSE;
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return TRUE;
|
||||
return;
|
||||
|
||||
return gdk_surface_handle_event (event);
|
||||
gdk_surface_handle_event (event);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
|
||||
@@ -619,16 +619,16 @@ typedef enum
|
||||
|
||||
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_event_emit (GdkEvent *event);
|
||||
GList* _gdk_event_queue_find_first (GdkDisplay *display);
|
||||
void _gdk_event_queue_remove_link (GdkDisplay *display,
|
||||
GList *node);
|
||||
GList* _gdk_event_queue_append (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
void _gdk_event_emit (GdkEvent *event);
|
||||
GList* _gdk_event_queue_find_first (GdkDisplay *display);
|
||||
void _gdk_event_queue_remove_link (GdkDisplay *display,
|
||||
GList *node);
|
||||
GList* _gdk_event_queue_append (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
|
||||
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
|
||||
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
|
||||
void _gdk_event_queue_flush (GdkDisplay *display);
|
||||
|
||||
double * gdk_event_dup_axes (GdkEvent *event);
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
@@ -99,6 +98,10 @@
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
@@ -590,7 +593,7 @@ gdk_gl_context_get_scale (GdkGLContext *self)
|
||||
scale = gdk_surface_get_scale (surface);
|
||||
|
||||
display = gdk_gl_context_get_display (self);
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_NO_FRACTIONAL)
|
||||
if (!(gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_FRACTIONAL))
|
||||
scale = ceil (scale);
|
||||
|
||||
return scale;
|
||||
@@ -1715,7 +1718,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
}
|
||||
|
||||
priv->has_half_float = gdk_gl_context_check_version (context, "3.0", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float");
|
||||
epoxy_has_gl_extension ("OES_vertex_half_float");
|
||||
|
||||
priv->has_sync = gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkrectangle.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* GdkMonitor:
|
||||
*
|
||||
@@ -48,7 +46,6 @@ enum {
|
||||
PROP_MODEL,
|
||||
PROP_CONNECTOR,
|
||||
PROP_SCALE_FACTOR,
|
||||
PROP_SCALE,
|
||||
PROP_GEOMETRY,
|
||||
PROP_WIDTH_MM,
|
||||
PROP_HEIGHT_MM,
|
||||
@@ -73,8 +70,6 @@ static void
|
||||
gdk_monitor_init (GdkMonitor *monitor)
|
||||
{
|
||||
monitor->scale_factor = 1;
|
||||
monitor->scale = 1.0;
|
||||
monitor->scale_set = FALSE;
|
||||
monitor->valid = TRUE;
|
||||
}
|
||||
|
||||
@@ -112,10 +107,6 @@ gdk_monitor_get_property (GObject *object,
|
||||
g_value_set_int (value, monitor->scale_factor);
|
||||
break;
|
||||
|
||||
case PROP_SCALE:
|
||||
g_value_set_double (value, monitor->scale);
|
||||
break;
|
||||
|
||||
case PROP_GEOMETRY:
|
||||
g_value_set_boxed (value, &monitor->geometry);
|
||||
break;
|
||||
@@ -242,28 +233,13 @@ gdk_monitor_class_init (GdkMonitorClass *class)
|
||||
* GdkMonitor:scale-factor: (attributes org.gtk.Property.get=gdk_monitor_get_scale_factor)
|
||||
*
|
||||
* The scale factor.
|
||||
*
|
||||
* The scale factor is the next larger integer,
|
||||
* compared to [property@Gdk.Surface:scale].
|
||||
*/
|
||||
props[PROP_SCALE_FACTOR] =
|
||||
g_param_spec_int ("scale-factor", NULL, NULL,
|
||||
1, G_MAXINT,
|
||||
0, G_MAXINT,
|
||||
1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:scale: (attributes org.gtk.Property.get=gdk_monitor_get_scale)
|
||||
*
|
||||
* The scale of the monitor.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
props[PROP_SCALE] =
|
||||
g_param_spec_double ("scale", NULL, NULL,
|
||||
1., G_MAXDOUBLE, 1.,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkMonitor:geometry: (attributes org.gtk.Property.get=gdk_monitor_get_geometry)
|
||||
*
|
||||
@@ -370,7 +346,7 @@ gdk_monitor_get_display (GdkMonitor *monitor)
|
||||
* display coordinate space.
|
||||
*
|
||||
* The returned geometry is in ”application pixels”, not in
|
||||
* ”device pixels” (see [method@Gdk.Monitor.get_scale]).
|
||||
* ”device pixels” (see [method@Gdk.Monitor.get_scale_factor]).
|
||||
*/
|
||||
void
|
||||
gdk_monitor_get_geometry (GdkMonitor *monitor,
|
||||
@@ -496,29 +472,6 @@ gdk_monitor_get_scale_factor (GdkMonitor *monitor)
|
||||
return monitor->scale_factor;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_scale: (attributes org.gtk.Method.get_property=scale)
|
||||
* @monitor: a `GdkMonitor`
|
||||
*
|
||||
* Gets the internal scale factor that maps from monitor coordinates
|
||||
* to device pixels.
|
||||
*
|
||||
* This can be used if you want to create pixel based data for a
|
||||
* particular monitor, but most of the time you’re drawing to a surface
|
||||
* where it is better to use [method@Gdk.Surface.get_scale] instead.
|
||||
*
|
||||
* Returns: the scale
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
double
|
||||
gdk_monitor_get_scale (GdkMonitor *monitor)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MONITOR (monitor), 1.);
|
||||
|
||||
return monitor->scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_monitor_get_refresh_rate: (attributes org.gtk.Method.get_property=refresh-rate)
|
||||
* @monitor: a `GdkMonitor`
|
||||
@@ -630,37 +583,12 @@ void
|
||||
gdk_monitor_set_scale_factor (GdkMonitor *monitor,
|
||||
int scale_factor)
|
||||
{
|
||||
g_return_if_fail (scale_factor >= 1);
|
||||
|
||||
if (monitor->scale_set)
|
||||
return;
|
||||
|
||||
if (monitor->scale_factor == scale_factor)
|
||||
return;
|
||||
|
||||
monitor->scale_factor = scale_factor;
|
||||
monitor->scale = scale_factor;
|
||||
|
||||
g_object_notify (G_OBJECT (monitor), "scale-factor");
|
||||
g_object_notify (G_OBJECT (monitor), "scale");
|
||||
}
|
||||
|
||||
void
|
||||
gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||
double scale)
|
||||
{
|
||||
g_return_if_fail (scale >= 1.);
|
||||
|
||||
monitor->scale_set = TRUE;
|
||||
|
||||
if (monitor->scale == scale)
|
||||
return;
|
||||
|
||||
monitor->scale = scale;
|
||||
monitor->scale_factor = (int) ceil (scale);
|
||||
|
||||
g_object_notify (G_OBJECT (monitor), "scale");
|
||||
g_object_notify (G_OBJECT (monitor), "scale-factor");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -77,8 +77,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
const char * gdk_monitor_get_connector (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_monitor_get_scale_factor (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
double gdk_monitor_get_scale (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_monitor_get_refresh_rate (GdkMonitor *monitor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -44,8 +44,6 @@ struct _GdkMonitor {
|
||||
int refresh_rate;
|
||||
GdkSubpixelLayout subpixel_layout;
|
||||
gboolean valid;
|
||||
double scale;
|
||||
gboolean scale_set;
|
||||
};
|
||||
|
||||
struct _GdkMonitorClass {
|
||||
@@ -66,9 +64,7 @@ void gdk_monitor_set_physical_size (GdkMonitor *monitor,
|
||||
int width_mm,
|
||||
int height_mm);
|
||||
void gdk_monitor_set_scale_factor (GdkMonitor *monitor,
|
||||
int scale_factor);
|
||||
void gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||
double scale);
|
||||
int scale);
|
||||
void gdk_monitor_set_refresh_rate (GdkMonitor *monitor,
|
||||
int refresh_rate);
|
||||
void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gsk/gskrectprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkSubsurface, gdk_subsurface, G_TYPE_OBJECT)
|
||||
|
||||
@@ -56,106 +55,19 @@ gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
||||
return subsurface->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_subsurface (GdkSubsurface *subsurface)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
|
||||
if (parent->subsurfaces_above == subsurface)
|
||||
parent->subsurfaces_above = subsurface->sibling_above;
|
||||
if (parent->subsurfaces_below == subsurface)
|
||||
parent->subsurfaces_below = subsurface->sibling_below;
|
||||
|
||||
if (subsurface->sibling_above)
|
||||
subsurface->sibling_above->sibling_below = subsurface->sibling_below;
|
||||
if (subsurface->sibling_below)
|
||||
subsurface->sibling_below->sibling_above = subsurface->sibling_above;
|
||||
|
||||
subsurface->sibling_above = NULL;
|
||||
subsurface->sibling_below = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
insert_subsurface (GdkSubsurface *subsurface,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
|
||||
subsurface->above_parent = sibling->above_parent;
|
||||
|
||||
if (above)
|
||||
{
|
||||
subsurface->sibling_above = sibling->sibling_above;
|
||||
sibling->sibling_above = subsurface;
|
||||
subsurface->sibling_below = sibling;
|
||||
if (subsurface->sibling_above)
|
||||
subsurface->sibling_above->sibling_below = subsurface;
|
||||
|
||||
if (parent->subsurfaces_below == sibling)
|
||||
parent->subsurfaces_below = subsurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
subsurface->sibling_below = sibling->sibling_below;
|
||||
sibling->sibling_below = subsurface;
|
||||
subsurface->sibling_above = sibling;
|
||||
if (subsurface->sibling_below)
|
||||
subsurface->sibling_below->sibling_above = subsurface;
|
||||
|
||||
if (parent->subsurfaces_above == sibling)
|
||||
parent->subsurfaces_above = subsurface;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
||||
g_return_val_if_fail (source != NULL &&
|
||||
gsk_rect_contains_rect (&GRAPHENE_RECT_INIT (0, 0,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture)),
|
||||
source), FALSE);
|
||||
g_return_val_if_fail (dest != NULL, FALSE);
|
||||
g_return_val_if_fail (sibling != subsurface, FALSE);
|
||||
g_return_val_if_fail (rect != NULL, FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
if (sibling)
|
||||
{
|
||||
insert_subsurface (subsurface, above, sibling);
|
||||
}
|
||||
else
|
||||
{
|
||||
sibling = above ? parent->subsurfaces_above : parent->subsurfaces_below;
|
||||
|
||||
if (sibling)
|
||||
{
|
||||
insert_subsurface (subsurface, !above, sibling);
|
||||
}
|
||||
else
|
||||
{
|
||||
subsurface->above_parent = above;
|
||||
|
||||
if (above)
|
||||
parent->subsurfaces_above = subsurface;
|
||||
else
|
||||
parent->subsurfaces_below = subsurface;
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, rect, above, sibling);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -163,8 +75,6 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||
}
|
||||
|
||||
@@ -177,23 +87,13 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source)
|
||||
gdk_subsurface_get_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (source != NULL);
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (dest != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -201,5 +101,5 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
||||
|
||||
return subsurface->above_parent;
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->is_above_parent (subsurface);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@ struct _GdkSubsurface
|
||||
GdkSurface *parent;
|
||||
|
||||
int ref_count;
|
||||
|
||||
gboolean above_parent;
|
||||
GdkSubsurface *sibling_above;
|
||||
GdkSubsurface *sibling_below;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,16 +50,14 @@ struct _GdkSubsurfaceClass
|
||||
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_source) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
void (* get_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean (* is_above_parent) (GdkSubsurface *subsurface);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
@@ -71,16 +65,13 @@ GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
void gdk_subsurface_get_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
|
||||
|
||||
|
||||
@@ -99,12 +99,6 @@ struct _GdkSurface
|
||||
GdkSeat *current_shortcuts_inhibited_seat;
|
||||
|
||||
GPtrArray *subsurfaces;
|
||||
|
||||
/* We keep the subsurfaces above and below the surface in two linked
|
||||
* lists, which start here.
|
||||
*/
|
||||
GdkSubsurface *subsurfaces_above;
|
||||
GdkSubsurface *subsurfaces_below;
|
||||
};
|
||||
|
||||
struct _GdkSurfaceClass
|
||||
@@ -351,6 +345,8 @@ void gdk_surface_request_motion (GdkSurface *surface);
|
||||
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
|
||||
|
||||
GdkSubsurface * gdk_surface_create_subsurface (GdkSurface *surface);
|
||||
void gdk_surface_destroy_subsurface (GdkSurface *surface,
|
||||
GdkSubsurface *subsurface);
|
||||
gsize gdk_surface_get_n_subsurfaces (GdkSurface *surface);
|
||||
GdkSubsurface * gdk_surface_get_subsurface (GdkSurface *surface,
|
||||
gsize idx);
|
||||
|
||||
@@ -142,9 +142,6 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
|
||||
* The shadow width corresponds to the part of the computed surface size
|
||||
* that would consist of the shadow margin surrounding the window, would
|
||||
* there be any.
|
||||
*
|
||||
* Shadow width should only be set if
|
||||
* [method@Gtk.Display.supports_shadow_width] is %TRUE.
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
|
||||
|
||||
@@ -593,8 +593,7 @@ physical_device_check_features (VkPhysicalDevice device,
|
||||
v12_features.shaderStorageBufferArrayNonUniformIndexing)
|
||||
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
|
||||
if (ycbcr_features.samplerYcbcrConversion ||
|
||||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
|
||||
if (ycbcr_features.samplerYcbcrConversion)
|
||||
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
@@ -1467,27 +1466,13 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING)
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_YCBCR)
|
||||
{
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_MAINTENANCE_1_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_BIND_MEMORY_2_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME);
|
||||
}
|
||||
if (features & GDK_VULKAN_FEATURE_DMABUF)
|
||||
{
|
||||
g_assert (features & GDK_VULKAN_FEATURE_YCBCR);
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||
}
|
||||
if (features & (GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT | GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT))
|
||||
{
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
|
||||
}
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
|
||||
if (features & GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT)
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
|
||||
|
||||
@@ -1628,12 +1613,6 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
have_debug_report = TRUE;
|
||||
}
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME);
|
||||
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME))
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
uint32_t n_layers;
|
||||
|
||||
@@ -398,7 +398,8 @@ typedef NSString *CALayerContentsGravity;
|
||||
* in from a display-side change. We need to request a layout in
|
||||
* addition to the configure event.
|
||||
*/
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface))
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface) &&
|
||||
GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated)
|
||||
gdk_surface_request_layout (GDK_SURFACE (gdk_surface));
|
||||
}
|
||||
|
||||
@@ -874,21 +875,12 @@ typedef NSString *CALayerContentsGravity;
|
||||
{
|
||||
NSWindowStyleMask style_mask = [self styleMask];
|
||||
|
||||
if (decorated)
|
||||
{
|
||||
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleVisible];
|
||||
}
|
||||
else
|
||||
{
|
||||
style_mask |= NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
[self setHasShadow:decorated];
|
||||
|
||||
[self setTitlebarAppearsTransparent:!decorated];
|
||||
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
|
||||
if (decorated)
|
||||
style_mask |= NSWindowStyleMaskTitled;
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskTitled;
|
||||
|
||||
[self setStyleMask:style_mask];
|
||||
}
|
||||
|
||||
@@ -271,11 +271,6 @@ _gdk_macos_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_surface_resized (GdkDrawContext *draw_context)
|
||||
{
|
||||
@@ -292,7 +287,6 @@ _gdk_macos_cairo_context_class_init (GdkMacosCairoContextClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = _gdk_macos_cairo_context_begin_frame;
|
||||
draw_context_class->end_frame = _gdk_macos_cairo_context_end_frame;
|
||||
draw_context_class->empty_frame = _gdk_macos_cairo_context_empty_frame;
|
||||
draw_context_class->surface_resized = _gdk_macos_cairo_context_surface_resized;
|
||||
|
||||
cairo_context_class->cairo_create = _gdk_macos_cairo_context_cairo_create;
|
||||
|
||||
@@ -625,7 +625,6 @@ gdk_macos_display_init (GdkMacosDisplay *self)
|
||||
gdk_display_set_composited (GDK_DISPLAY (self), TRUE);
|
||||
gdk_display_set_input_shapes (GDK_DISPLAY (self), FALSE);
|
||||
gdk_display_set_rgba (GDK_DISPLAY (self), TRUE);
|
||||
gdk_display_set_shadow_width (GDK_DISPLAY (self), FALSE);
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
|
||||
@@ -734,14 +734,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
||||
|
||||
if (event)
|
||||
{
|
||||
gboolean handled = _gdk_event_emit (event);
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
|
||||
if (nsevent != NULL)
|
||||
[NSApp sendEvent: nsevent];
|
||||
}
|
||||
_gdk_event_emit (event);
|
||||
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
@@ -545,11 +545,6 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_gl_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_gl_context_surface_resized (GdkDrawContext *draw_context)
|
||||
{
|
||||
@@ -672,7 +667,6 @@ gdk_macos_gl_context_class_init (GdkMacosGLContextClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = gdk_macos_gl_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_macos_gl_context_end_frame;
|
||||
draw_context_class->empty_frame = gdk_macos_gl_context_empty_frame;
|
||||
draw_context_class->surface_resized = gdk_macos_gl_context_surface_resized;
|
||||
|
||||
gl_class->get_damage = gdk_macos_gl_context_get_damage;
|
||||
|
||||
@@ -219,7 +219,7 @@ gdk_deps = [
|
||||
platform_gio_dep,
|
||||
pangocairo_dep,
|
||||
vulkan_dep,
|
||||
libdrm_dep,
|
||||
dmabuf_dep,
|
||||
png_dep,
|
||||
tiff_dep,
|
||||
jpeg_dep,
|
||||
|
||||
@@ -1795,7 +1795,7 @@ static TranslationEntry translations[] = {
|
||||
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
|
||||
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
|
||||
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contrast", G_TYPE_NONE, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contast", G_TYPE_NONE, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "show-status-shapes", "gtk-show-status-shapes", G_TYPE_BOOLEAN, { .b = FALSE } },
|
||||
/* Note, this setting doesn't exist, the portal and gsd fake it */
|
||||
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
|
||||
@@ -2430,47 +2430,15 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
|
||||
{
|
||||
GDK_DEBUG (MISC, "monitor %d changed position %d %d, size %d %d",
|
||||
monitor->id,
|
||||
monitor->output_geometry.x, monitor->output_geometry.y,
|
||||
monitor->output_geometry.width, monitor->output_geometry.height);
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height);
|
||||
|
||||
GdkRectangle logical_geometry;
|
||||
gboolean needs_scaling = FALSE;
|
||||
double scale;
|
||||
|
||||
if (monitor->xdg_output_done)
|
||||
{
|
||||
logical_geometry = monitor->xdg_output_geometry;
|
||||
needs_scaling =
|
||||
logical_geometry.width == monitor->output_geometry.width ||
|
||||
logical_geometry.height == monitor->output_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
logical_geometry = monitor->output_geometry;
|
||||
needs_scaling = TRUE;
|
||||
}
|
||||
|
||||
if (needs_scaling)
|
||||
{
|
||||
int scale_factor = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
logical_geometry.y /= scale_factor;
|
||||
logical_geometry.x /= scale_factor;
|
||||
logical_geometry.width /= scale_factor;
|
||||
logical_geometry.height /= scale_factor;
|
||||
|
||||
scale = scale_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = MAX (monitor->output_geometry.width / (double) logical_geometry.width,
|
||||
monitor->output_geometry.height / (double) logical_geometry.height);
|
||||
}
|
||||
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &logical_geometry);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor),
|
||||
&(GdkRectangle) {
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height });
|
||||
gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
|
||||
gdk_monitor_set_description (GDK_MONITOR (monitor), monitor->description);
|
||||
gdk_monitor_set_scale (GDK_MONITOR (monitor), scale);
|
||||
|
||||
monitor->wl_output_done = FALSE;
|
||||
monitor->xdg_output_done = FALSE;
|
||||
|
||||
@@ -2488,8 +2456,8 @@ xdg_output_handle_logical_position (void *data,
|
||||
GDK_DEBUG (MISC, "handle logical position xdg-output %d, position %d %d",
|
||||
monitor->id, x, y);
|
||||
|
||||
monitor->xdg_output_geometry.x = x;
|
||||
monitor->xdg_output_geometry.y = y;
|
||||
monitor->x = x;
|
||||
monitor->y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2503,8 +2471,8 @@ xdg_output_handle_logical_size (void *data,
|
||||
GDK_DEBUG (MISC, "handle logical size xdg-output %d, size %d %d",
|
||||
monitor->id, width, height);
|
||||
|
||||
monitor->xdg_output_geometry.width = width;
|
||||
monitor->xdg_output_geometry.height = height;
|
||||
monitor->width = width;
|
||||
monitor->height = height;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2590,8 +2558,8 @@ output_handle_geometry (void *data,
|
||||
make, model,
|
||||
transform_to_string (transform));
|
||||
|
||||
monitor->output_geometry.x = x;
|
||||
monitor->output_geometry.y = y;
|
||||
monitor->x = x;
|
||||
monitor->y = y;
|
||||
|
||||
switch (transform)
|
||||
{
|
||||
@@ -2635,12 +2603,28 @@ output_handle_scale (void *data,
|
||||
int32_t scale)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
||||
GdkRectangle previous_geometry;
|
||||
int previous_scale;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
GDK_DEBUG (MISC, "handle scale output %d, scale %d", monitor->id, scale);
|
||||
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry);
|
||||
previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
|
||||
/* Set the scale from wl_output protocol, regardless of xdg-output support */
|
||||
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
|
||||
|
||||
if (monitor_has_xdg_output (monitor))
|
||||
return;
|
||||
|
||||
width = previous_geometry.width * previous_scale;
|
||||
height = previous_geometry.height * previous_scale;
|
||||
|
||||
monitor->width = width / scale;
|
||||
monitor->height = height / scale;
|
||||
|
||||
if (should_update_monitor (monitor))
|
||||
apply_monitor_change (monitor);
|
||||
}
|
||||
@@ -2654,6 +2638,7 @@ output_handle_mode (void *data,
|
||||
int refresh)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
||||
int scale;
|
||||
|
||||
GDK_DEBUG (MISC, "handle mode output %d, size %d %d, rate %d",
|
||||
monitor->id, width, height, refresh);
|
||||
@@ -2661,8 +2646,9 @@ output_handle_mode (void *data,
|
||||
if ((flags & WL_OUTPUT_MODE_CURRENT) == 0)
|
||||
return;
|
||||
|
||||
monitor->output_geometry.width = width;
|
||||
monitor->output_geometry.height = height;
|
||||
scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
monitor->width = width / scale;
|
||||
monitor->height = height / scale;
|
||||
gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh);
|
||||
|
||||
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
|
||||
|
||||
@@ -87,8 +87,9 @@ static void
|
||||
gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (gdk_wayland_surface_needs_commit (surface))
|
||||
if (impl->has_pending_subsurface_commits)
|
||||
{
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
@@ -31,10 +31,11 @@ struct _GdkWaylandMonitor {
|
||||
gboolean added;
|
||||
|
||||
struct zxdg_output_v1 *xdg_output;
|
||||
/* Raw wl_output data */
|
||||
GdkRectangle output_geometry;
|
||||
/* Raw xdg_output data */
|
||||
GdkRectangle xdg_output_geometry;
|
||||
/* Size and position, can be either from wl_output or xdg_output */
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
char *name;
|
||||
char *description;
|
||||
gboolean wl_output_done;
|
||||
|
||||
@@ -129,7 +129,6 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
guint *next_image_delay);
|
||||
|
||||
void gdk_wayland_surface_sync (GdkSurface *surface);
|
||||
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
||||
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
||||
|
||||
@@ -3629,10 +3629,7 @@ tablet_pad_handle_leave (void *data,
|
||||
wp_tablet_pad, surface);
|
||||
|
||||
if (pad->current_tablet)
|
||||
{
|
||||
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
|
||||
pad->current_tablet = NULL;
|
||||
}
|
||||
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -22,11 +22,12 @@ struct _GdkWaylandSubsurface
|
||||
|
||||
GdkTexture *texture;
|
||||
cairo_rectangle_int_t dest;
|
||||
graphene_rect_t source;
|
||||
|
||||
struct wl_region *opaque_region;
|
||||
|
||||
struct wl_callback *frame_callback;
|
||||
|
||||
gboolean above_parent;
|
||||
};
|
||||
|
||||
struct _GdkWaylandSubsurfaceClass
|
||||
|
||||
@@ -152,8 +152,7 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
const graphene_rect_t *rect,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
@@ -167,8 +166,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
graphene_rect_t device_rect;
|
||||
cairo_rectangle_int_t device_dest;
|
||||
|
||||
if (sibling)
|
||||
will_be_above = sibling->above_parent;
|
||||
if (sib)
|
||||
will_be_above = sib->above_parent;
|
||||
else
|
||||
will_be_above = above;
|
||||
|
||||
@@ -178,37 +177,30 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->dest.x = dest->origin.x;
|
||||
self->dest.y = dest->origin.y;
|
||||
self->dest.width = dest->size.width;
|
||||
self->dest.height = dest->size.height;
|
||||
|
||||
self->source.origin.x = source->origin.x;
|
||||
self->source.origin.y = source->origin.y;
|
||||
self->source.size.width = source->size.width;
|
||||
self->source.size.height = source->size.height;
|
||||
self->dest.x = rect->origin.x;
|
||||
self->dest.y = rect->origin.y;
|
||||
self->dest.width = rect->size.width;
|
||||
self->dest.height = rect->size.height;
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->scale);
|
||||
|
||||
device_rect.origin.x = dest->origin.x * scale;
|
||||
device_rect.origin.y = dest->origin.y * scale;
|
||||
device_rect.size.width = dest->size.width * scale;
|
||||
device_rect.size.height = dest->size.height * scale;
|
||||
|
||||
device_rect.origin.x = rect->origin.x * scale;
|
||||
device_rect.origin.y = rect->origin.y * scale;
|
||||
device_rect.size.width = rect->size.width * scale;
|
||||
device_rect.size.height = rect->size.height * scale;
|
||||
device_dest.x = device_rect.origin.x;
|
||||
device_dest.y = device_rect.origin.y;
|
||||
device_dest.width = device_rect.size.width;
|
||||
device_dest.height = device_rect.size.height;
|
||||
|
||||
if (self->dest.x != dest->origin.x ||
|
||||
self->dest.y != dest->origin.y ||
|
||||
self->dest.width != dest->size.width ||
|
||||
self->dest.height != dest->size.height)
|
||||
if (self->dest.x != rect->origin.x ||
|
||||
self->dest.y != rect->origin.y ||
|
||||
self->dest.width != rect->size.width ||
|
||||
self->dest.height != rect->size.height)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
|
||||
dest->origin.x, dest->origin.y,
|
||||
dest->size.width, dest->size.height,
|
||||
rect->origin.x, rect->origin.y,
|
||||
rect->size.width, rect->size.height,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self);
|
||||
@@ -304,11 +296,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
{
|
||||
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
|
||||
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
|
||||
wp_viewport_set_source (self->viewport,
|
||||
wl_fixed_from_double (self->source.origin.x),
|
||||
wl_fixed_from_double (self->source.origin.y),
|
||||
wl_fixed_from_double (self->source.size.width),
|
||||
wl_fixed_from_double (self->source.size.height));
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
@@ -335,6 +322,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
wl_subsurface_place_above (self->subsurface, sib->surface);
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface, sib->surface);
|
||||
|
||||
self->above_parent = sib->above_parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -344,6 +333,7 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
else
|
||||
wl_subsurface_place_below (self->subsurface,
|
||||
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
|
||||
self->above_parent = above;
|
||||
}
|
||||
|
||||
wl_surface_commit (self->surface);
|
||||
@@ -383,27 +373,23 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
|
||||
graphene_rect_t *dest)
|
||||
gdk_wayland_subsurface_get_rect (GdkSubsurface *sub,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
dest->origin.x = self->dest.x;
|
||||
dest->origin.y = self->dest.y;
|
||||
dest->size.width = self->dest.width;
|
||||
dest->size.height = self->dest.height;
|
||||
rect->origin.x = self->dest.x;
|
||||
rect->origin.y = self->dest.y;
|
||||
rect->size.width = self->dest.width;
|
||||
rect->size.height = self->dest.height;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||
graphene_rect_t *source)
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_is_above_parent (GdkSubsurface *sub)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
GdkWaylandSubsurface *self = (GdkWaylandSubsurface *)sub;
|
||||
|
||||
source->origin.x = self->source.origin.x;
|
||||
source->origin.y = self->source.origin.y;
|
||||
source->size.width = self->source.size.width;
|
||||
source->size.height = self->source.size.height;
|
||||
return self->above_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -417,8 +403,8 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
|
||||
subsurface_class->attach = gdk_wayland_subsurface_attach;
|
||||
subsurface_class->detach = gdk_wayland_subsurface_detach;
|
||||
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
|
||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||
subsurface_class->get_rect = gdk_wayland_subsurface_get_rect;
|
||||
subsurface_class->is_above_parent = gdk_wayland_subsurface_is_above_parent;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -492,6 +478,8 @@ gdk_wayland_surface_create_subsurface (GdkSurface *surface)
|
||||
wl_region_add (sub->opaque_region, 0, 0, G_MAXINT, G_MAXINT);
|
||||
wl_surface_set_opaque_region (sub->surface, sub->opaque_region);
|
||||
|
||||
sub->above_parent = TRUE;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Subsurface %p of surface %p created", sub, impl);
|
||||
|
||||
return GDK_SUBSURFACE (sub);
|
||||
|
||||
@@ -199,20 +199,20 @@ get_egl_window_size (GdkSurface *surface,
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_NO_FRACTIONAL))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window", gdk_fractional_scale_to_int (&impl->scale));
|
||||
|
||||
*width = surface->width * gdk_fractional_scale_to_int (&impl->scale);
|
||||
*height = surface->height * gdk_fractional_scale_to_int (&impl->scale);
|
||||
}
|
||||
else
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_FRACTIONAL))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window", gdk_fractional_scale_to_double (&impl->scale));
|
||||
|
||||
*width = gdk_fractional_scale_scale (&impl->scale, surface->width),
|
||||
*height = gdk_fractional_scale_scale (&impl->scale, surface->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window", gdk_fractional_scale_to_int (&impl->scale));
|
||||
|
||||
*width = surface->width * gdk_fractional_scale_to_int (&impl->scale);
|
||||
*height = surface->height * gdk_fractional_scale_to_int (&impl->scale);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -646,12 +646,9 @@ gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
|
||||
cairo_region_t *region = cairo_region_copy (impl->opaque_region);
|
||||
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
|
||||
{
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *) subsurface;
|
||||
|
||||
if (subsurface->above_parent)
|
||||
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *)gdk_surface_get_subsurface (surface, i);
|
||||
if (sub->above_parent)
|
||||
continue;
|
||||
|
||||
if (sub->texture != NULL)
|
||||
cairo_region_subtract_rectangle (region, &sub->dest);
|
||||
}
|
||||
@@ -749,18 +746,6 @@ gdk_wayland_surface_sync (GdkSurface *surface)
|
||||
gdk_wayland_surface_sync_viewport (surface);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_wayland_surface_needs_commit (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
return self->has_pending_subsurface_commits ||
|
||||
self->opaque_region_dirty ||
|
||||
self->input_region_dirty ||
|
||||
self->buffer_scale_dirty ||
|
||||
self->viewport_dirty;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
|
||||
struct wp_fractional_scale_v1 *fractional_scale,
|
||||
|
||||
@@ -153,11 +153,6 @@ gdk_win32_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
g_clear_pointer (&self->window_surface, cairo_surface_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static cairo_t *
|
||||
gdk_win32_cairo_context_cairo_create (GdkCairoContext *context)
|
||||
{
|
||||
@@ -187,7 +182,6 @@ gdk_win32_cairo_context_class_init (GdkWin32CairoContextClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = gdk_win32_cairo_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_win32_cairo_context_end_frame;
|
||||
draw_context_class->empty_frame = gdk_win32_cairo_context_empty_frame;
|
||||
|
||||
cairo_context_class->cairo_create = gdk_win32_cairo_context_cairo_create;
|
||||
}
|
||||
|
||||
@@ -892,11 +892,11 @@ pixbuf_to_hicon (GdkPixbuf *pixbuf,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
HICON
|
||||
_gdk_win32_create_hicon_for_texture (GdkTexture *texture,
|
||||
gboolean is_icon,
|
||||
int x,
|
||||
int y)
|
||||
static GdkWin32HCursor *
|
||||
gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
|
||||
GdkTexture *texture,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -906,24 +906,13 @@ _gdk_win32_create_hicon_for_texture (GdkTexture *texture,
|
||||
surface = gdk_texture_download_surface (texture);
|
||||
width = cairo_image_surface_get_width (surface);
|
||||
height = cairo_image_surface_get_height (surface);
|
||||
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
||||
|
||||
icon = pixbuf_to_hicon (pixbuf, is_icon, x, y);
|
||||
|
||||
|
||||
icon = pixbuf_to_hicon (pixbuf, FALSE, x, y);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
static GdkWin32HCursor *
|
||||
gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
|
||||
GdkTexture *texture,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
HICON icon = _gdk_win32_create_hicon_for_texture (texture, FALSE, x, y);
|
||||
|
||||
|
||||
return gdk_win32_hcursor_new (display, (HCURSOR) icon, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1064,7 +1064,6 @@ gdk_win32_display_check_composited (GdkWin32Display *display)
|
||||
}
|
||||
|
||||
gdk_display_set_composited (GDK_DISPLAY (display), composited);
|
||||
gdk_display_set_shadow_width (GDK_DISPLAY (display), composited);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -117,11 +117,6 @@ gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, depth, update_area);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_egl_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_egl_class_init (GdkWin32GLContextClass *klass)
|
||||
{
|
||||
@@ -132,7 +127,6 @@ gdk_win32_gl_context_egl_class_init (GdkWin32GLContextClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = gdk_win32_gl_context_egl_begin_frame;
|
||||
draw_context_class->end_frame = gdk_win32_gl_context_egl_end_frame;
|
||||
draw_context_class->empty_frame = gdk_win32_gl_context_egl_empty_frame;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -116,11 +116,6 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
|
||||
SwapBuffers (hdc);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_wgl_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
|
||||
GdkMemoryDepth depth,
|
||||
@@ -131,7 +126,7 @@ gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, depth, update_area);
|
||||
}
|
||||
|
||||
#define PIXEL_ATTRIBUTES 21
|
||||
#define PIXEL_ATTRIBUTES 17
|
||||
|
||||
static int
|
||||
get_wgl_pfd (HDC hdc,
|
||||
@@ -176,19 +171,10 @@ get_wgl_pfd (HDC hdc,
|
||||
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
||||
pixelAttribs[i++] = 8;
|
||||
|
||||
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
|
||||
|
||||
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
||||
g_assert (i == PIXEL_ATTRIBUTES);
|
||||
g_assert (i <= PIXEL_ATTRIBUTES);
|
||||
|
||||
if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc,
|
||||
display_win32->dummy_context_wgl.hglrc))
|
||||
@@ -214,7 +200,7 @@ get_wgl_pfd (HDC hdc,
|
||||
pfd->iPixelType = PFD_TYPE_RGBA;
|
||||
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||
pfd->cAlphaBits = 8;
|
||||
pfd->iLayerType = PFD_MAIN_PLANE;
|
||||
pfd->dwLayerMask = PFD_MAIN_PLANE;
|
||||
|
||||
best_pf = ChoosePixelFormat (hdc, pfd);
|
||||
}
|
||||
@@ -613,7 +599,7 @@ set_wgl_pixformat_for_hdc (GdkWin32Display *display_win32,
|
||||
{
|
||||
gboolean skip_acquire = FALSE;
|
||||
gboolean set_pixel_format_result = FALSE;
|
||||
PIXELFORMATDESCRIPTOR pfd = {0};
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
/* one is only allowed to call SetPixelFormat(), and so ChoosePixelFormat()
|
||||
* one single time per window HDC
|
||||
@@ -823,8 +809,6 @@ gdk_win32_gl_context_wgl_class_init (GdkWin32GLContextWGLClass *klass)
|
||||
|
||||
draw_context_class->begin_frame = gdk_win32_gl_context_wgl_begin_frame;
|
||||
draw_context_class->end_frame = gdk_win32_gl_context_wgl_end_frame;
|
||||
draw_context_class->empty_frame = gdk_win32_gl_context_wgl_empty_frame;
|
||||
|
||||
gobject_class->dispose = gdk_win32_gl_context_wgl_dispose;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,11 +211,6 @@ Win32Cursor * win32_cursor_theme_get_cursor (Win32CursorTheme *theme,
|
||||
void win32_cursor_theme_destroy (Win32CursorTheme *theme);
|
||||
Win32CursorTheme *_gdk_win32_display_get_cursor_theme (GdkWin32Display *win32_display);
|
||||
|
||||
HICON _gdk_win32_create_hicon_for_texture (GdkTexture *texture,
|
||||
gboolean is_icon,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
|
||||
void _gdk_win32_display_queue_events (GdkDisplay *display);
|
||||
|
||||
|
||||
@@ -4308,82 +4308,6 @@ gdk_win32_surface_set_shadow_width (GdkSurface *window,
|
||||
impl->shadow_y = top + bottom;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_set_icon_list (GdkSurface *surface,
|
||||
GList *textures)
|
||||
{
|
||||
GdkTexture *texture, *big_texture, *small_texture;
|
||||
gint big_diff, small_diff;
|
||||
gint big_w, big_h, small_w, small_h;
|
||||
gint w, h;
|
||||
gint dw, dh, diff;
|
||||
HICON small_hicon, big_hicon;
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
|
||||
impl = GDK_WIN32_SURFACE (surface);
|
||||
|
||||
/* ideal sizes for small and large icons */
|
||||
big_w = GetSystemMetrics (SM_CXICON);
|
||||
big_h = GetSystemMetrics (SM_CYICON);
|
||||
small_w = GetSystemMetrics (SM_CXSMICON);
|
||||
small_h = GetSystemMetrics (SM_CYSMICON);
|
||||
|
||||
/* find closest sized icons in the list */
|
||||
big_texture = NULL;
|
||||
small_texture = NULL;
|
||||
big_diff = 0;
|
||||
small_diff = 0;
|
||||
while (textures)
|
||||
{
|
||||
texture = (GdkTexture*) textures->data;
|
||||
w = gdk_texture_get_width (texture);
|
||||
h = gdk_texture_get_height (texture);
|
||||
|
||||
dw = ABS (w - big_w);
|
||||
dh = ABS (h - big_h);
|
||||
diff = dw*dw + dh*dh;
|
||||
if (big_texture == NULL || diff < big_diff)
|
||||
{
|
||||
big_texture = texture;
|
||||
big_diff = diff;
|
||||
}
|
||||
|
||||
dw = ABS (w - small_w);
|
||||
dh = ABS (h - small_h);
|
||||
diff = dw*dw + dh*dh;
|
||||
if (small_texture == NULL || diff < small_diff)
|
||||
{
|
||||
small_texture = texture;
|
||||
small_diff = diff;
|
||||
}
|
||||
|
||||
textures = textures->next;
|
||||
}
|
||||
|
||||
if (big_texture == NULL || small_texture == NULL)
|
||||
return;
|
||||
|
||||
/* Create the icons */
|
||||
big_hicon = big_texture ? _gdk_win32_create_hicon_for_texture (big_texture, TRUE, 0, 0) : NULL;
|
||||
small_hicon = small_texture ? _gdk_win32_create_hicon_for_texture (small_texture, TRUE, 0, 0) : NULL;
|
||||
|
||||
/* Set the icons */
|
||||
SendMessage (GDK_SURFACE_HWND (surface), WM_SETICON, ICON_BIG,
|
||||
(LPARAM)big_hicon);
|
||||
SendMessage (GDK_SURFACE_HWND (surface), WM_SETICON, ICON_SMALL,
|
||||
(LPARAM)small_hicon);
|
||||
|
||||
/* Store the icons, destroying any previous icons */
|
||||
if (impl->hicon_big)
|
||||
GDI_CALL (DestroyIcon, (impl->hicon_big));
|
||||
impl->hicon_big = big_hicon;
|
||||
if (impl->hicon_small)
|
||||
GDI_CALL (DestroyIcon, (impl->hicon_small));
|
||||
impl->hicon_small = small_hicon;
|
||||
}
|
||||
|
||||
double
|
||||
_gdk_win32_surface_get_scale (GdkSurface *surface)
|
||||
@@ -4814,8 +4738,6 @@ gdk_win32_toplevel_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
|
||||
gdk_win32_surface_set_icon_list (surface, g_value_get_pointer (value));
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
||||
break;
|
||||
|
||||
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
|
||||
|
||||
@@ -74,11 +74,6 @@ gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, depth, update_area);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_vulkan_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_vulkan_context_class_init (GdkWin32VulkanContextClass *klass)
|
||||
{
|
||||
@@ -87,7 +82,6 @@ gdk_win32_vulkan_context_class_init (GdkWin32VulkanContextClass *klass)
|
||||
|
||||
context_class->create_surface = gdk_win32_vulkan_context_create_surface;
|
||||
draw_context_class->begin_frame = gdk_win32_vulkan_context_begin_frame;
|
||||
draw_context_class->empty_frame = gdk_win32_vulkan_context_empty_frame;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1429,7 +1429,6 @@ gdk_x11_display_open (const char *display_name)
|
||||
int ignore;
|
||||
int maj, min;
|
||||
char *cm_name;
|
||||
gboolean frame_extents;
|
||||
|
||||
XInitThreads ();
|
||||
|
||||
@@ -1644,10 +1643,6 @@ gdk_x11_display_open (const char *display_name)
|
||||
gdk_x11_get_xatom_by_name_for_display (display, cm_name)) != None);
|
||||
g_free (cm_name);
|
||||
|
||||
frame_extents = gdk_x11_screen_supports_net_wm_hint (gdk_x11_display_get_screen (display),
|
||||
g_intern_static_string ("_GTK_FRAME_EXTENTS"));
|
||||
gdk_display_set_shadow_width (display, frame_extents);
|
||||
|
||||
gdk_display_emit_opened (display);
|
||||
|
||||
return display;
|
||||
|
||||
@@ -316,10 +316,7 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
{
|
||||
cairo_region_destroy (damage);
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
}
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
|
||||
cairo_region_union (damage, context->old_updated_area[i]);
|
||||
}
|
||||
|
||||
@@ -2655,7 +2655,6 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
|
||||
{
|
||||
GdkX11Surface *impl;
|
||||
Window root;
|
||||
Window child;
|
||||
int tx;
|
||||
int ty;
|
||||
guint twidth;
|
||||
@@ -2670,11 +2669,7 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
|
||||
XGetGeometry (GDK_SURFACE_XDISPLAY (surface),
|
||||
GDK_SURFACE_XID (surface),
|
||||
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
|
||||
|
||||
XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface),
|
||||
GDK_SURFACE_XID (surface),
|
||||
root, 0, 0, &tx, &ty, &child);
|
||||
|
||||
|
||||
if (x)
|
||||
*x = tx / impl->surface_scale;
|
||||
if (y)
|
||||
|
||||
479
gsk/boxprivate.h
Normal file
479
gsk/boxprivate.h
Normal file
@@ -0,0 +1,479 @@
|
||||
#pragma once
|
||||
|
||||
#include <graphene.h>
|
||||
#include <math.h>
|
||||
#include "gsktypesprivate.h"
|
||||
#include "scaleprivate.h"
|
||||
#include "pointprivate.h"
|
||||
|
||||
#ifndef USE_SIMD
|
||||
|
||||
struct _Box
|
||||
{
|
||||
float x0, y0, x1, y1;
|
||||
};
|
||||
|
||||
static inline float
|
||||
box_x0 (const Box box)
|
||||
{
|
||||
return box.x0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y0 (const Box box)
|
||||
{
|
||||
return box.y0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_x1 (const Box box)
|
||||
{
|
||||
return box.x1;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y1 (const Box box)
|
||||
{
|
||||
return box.y1;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_width (const Box box)
|
||||
{
|
||||
return box.x1 - box.x0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_height (const Box box)
|
||||
{
|
||||
return box.y1 - box.y0;
|
||||
}
|
||||
|
||||
/* Assumes x0 <= x1 && y0 <= y1 */
|
||||
static inline Box
|
||||
box (float x0,
|
||||
float y0,
|
||||
float x1,
|
||||
float y1)
|
||||
{
|
||||
return (Box) { .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1 };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_rect (float x,
|
||||
float y,
|
||||
float w,
|
||||
float h)
|
||||
{
|
||||
return box (x, y, x + w, y + h);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_graphene (const graphene_rect_t *rect)
|
||||
{
|
||||
return box_from_rect (rect->origin.x,
|
||||
rect->origin.y,
|
||||
rect->size.width,
|
||||
rect->size.height);
|
||||
}
|
||||
|
||||
/* Assumes p0.x <= p1.x && p0.y <= p1.y */
|
||||
static inline Box
|
||||
box_from_points (Point p0,
|
||||
Point p1)
|
||||
{
|
||||
return box (p0.x, p0.y, p1.x, p1.y);
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_origin (const Box box)
|
||||
{
|
||||
return point (box.x0, box.y0);
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_opposite (const Box box)
|
||||
{
|
||||
return point (box.x1, box.y1);
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_to_float (const Box box,
|
||||
float v[4])
|
||||
{
|
||||
v[0] = box.x0;
|
||||
v[1] = box.y0;
|
||||
v[2] = box.x1 - box.x0;
|
||||
v[3] = box.y1 - box.y0;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_inset (const Box box,
|
||||
float dx,
|
||||
float dy)
|
||||
{
|
||||
return (Box) { .x0 = box.x0 + dx, .y0 = box.y0 + dy,
|
||||
.x1 = box.x1 - dx, .y1 = box.y1 - dy };
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_intersect (const Box box1,
|
||||
const Box box2,
|
||||
Box *box)
|
||||
{
|
||||
Box b;
|
||||
|
||||
b.x0 = MAX (box1.x0, box2.x0);
|
||||
b.y0 = MAX (box1.y0, box2.y0);
|
||||
b.x1 = MIN (box1.x1, box2.x1);
|
||||
b.y1 = MIN (box1.y1, box2.y1);
|
||||
|
||||
if (b.x0 <= b.x1 && b.y0 <= b.x1)
|
||||
{
|
||||
if (box)
|
||||
*box = b;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_equal (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
return memcmp (&box1, &box2, sizeof (Box)) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_contains (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
Box box;
|
||||
|
||||
if (box_intersect (box1, box2, &box))
|
||||
return box_equal (box, box2);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_empty (const Box box)
|
||||
{
|
||||
return box.x0 == box.x1 || box.y0 == box.y1;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_add (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .x0 = box.x0 + offset.x, .y0 = box.y0 + offset.y,
|
||||
.x1 = box.x1 + offset.x, .y1 = box.y1 + offset.y };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_sub (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .x0 = box.x0 - offset.x, .y0 = box.y0 - offset.y,
|
||||
.x1 = box.x1 - offset.x, .y1 = box.y1 - offset.y };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_mul (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
Box b = (Box) { .x0 = box.x0 * scale.x, .y0 = box.y0 * scale.y,
|
||||
.x1 = box.x1 * scale.x, .y1 = box.y1 * scale.y };
|
||||
|
||||
if (G_UNLIKELY (scale.x < 0 || scale.y < 0))
|
||||
return (Box) { .x0 = MIN (b.x0, b.x1), .y0 = MIN (b.y0, b.y1),
|
||||
.x1 = MAX (b.x0, b.x1), .y1 = MAX (b.y0, b.y1) };
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_div (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
return box_mul (box, scale_inv (scale));
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_offset_to_float (const Box box,
|
||||
const Point offset,
|
||||
float v[4])
|
||||
{
|
||||
box_to_float (box_add (box, offset), v);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_round_larger (const Box box)
|
||||
{
|
||||
return (Box) { .x0 = floorf (box.x0), .y0 = floorf (box.y0),
|
||||
.x1 = ceilf (box.x1), .y1 = ceilf (box.y1) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_round_to_pixels (const Box box,
|
||||
const Scale scale,
|
||||
const Point offset)
|
||||
{
|
||||
return box_sub (box_div (box_round_larger (box_mul (box_add (box, offset), scale)), scale), offset);
|
||||
}
|
||||
|
||||
#else /* USE_SIMD */
|
||||
|
||||
struct _Box
|
||||
{
|
||||
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
|
||||
};
|
||||
|
||||
static inline float
|
||||
box_x0 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_x (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y0 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_y (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_x1 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_z (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y1 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_w (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_width (const Box box)
|
||||
{
|
||||
return box_x1 (box) - box_x0 (box);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_height (const Box box)
|
||||
{
|
||||
return box_y1 (box) - box_y0 (box);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box (float x0,
|
||||
float y0,
|
||||
float x1,
|
||||
float y1)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_init (x0, y0, x1, y1) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_rect (float x,
|
||||
float y,
|
||||
float w,
|
||||
float h)
|
||||
{
|
||||
return box (x, y, x + w, y + h);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_graphene (const graphene_rect_t *rect)
|
||||
{
|
||||
return box_from_rect (rect->origin.x,
|
||||
rect->origin.y,
|
||||
rect->size.width,
|
||||
rect->size.height);
|
||||
}
|
||||
|
||||
/* { a[0], a[1], b[0], b[1] } */
|
||||
# define graphene_simd4f_splat_xyxy(a,b) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_shuffle_ps ((a), (b), _MM_SHUFFLE (1, 0, 1, 0)); \
|
||||
}))
|
||||
|
||||
static inline Box
|
||||
box_from_points (Point p0,
|
||||
Point p1)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_splat_xyxy (p0.v, p1.v) };
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_origin (const Box box)
|
||||
{
|
||||
return (Point) { .v = graphene_simd4f_zero_zw (box.v) };
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_opposite (const Box box)
|
||||
{
|
||||
return (Point) { .v = graphene_simd4f_zero_zw (graphene_simd4f_shuffle_zwxy (box.v)) };
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_to_float (const Box box,
|
||||
float v[4])
|
||||
{
|
||||
graphene_simd4f_dup_4f (box.v, v);
|
||||
v[2] -= v[0];
|
||||
v[3] -= v[1];
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_inset (const Box box,
|
||||
float dx,
|
||||
float dy)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_add (box.v, graphene_simd4f_init (dx, dy, -dx, -dy)) };
|
||||
}
|
||||
|
||||
/* return a[0] < b[0] && a[1] < b[1] */
|
||||
#ifndef graphene_simd4f_cmple_xy
|
||||
# define graphene_simd4f_cmple_xy(a,b) \
|
||||
(__extension__ ({ \
|
||||
__m128i __res = (__m128i) _mm_cmple_ps ((a), (b)); \
|
||||
(bool) ((_mm_movemask_epi8 (__res) & 0xff) == 0xff); \
|
||||
}))
|
||||
#endif
|
||||
|
||||
static inline gboolean
|
||||
box_intersect (const Box box1,
|
||||
const Box box2,
|
||||
Box *box)
|
||||
{
|
||||
graphene_simd4f_t s, t, t1;
|
||||
|
||||
s = graphene_simd4f_max (box1.v, box2.v);
|
||||
t = graphene_simd4f_min (box1.v, box2.v);
|
||||
t1 = graphene_simd4f_shuffle_zwxy (t);
|
||||
|
||||
if (graphene_simd4f_cmple_xy (s, t1))
|
||||
{
|
||||
if (box)
|
||||
box->v = graphene_simd4f_splat_xyxy (s, t);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_equal (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
return (gboolean) !!graphene_simd4f_cmp_eq (box1.v, box2.v);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_contains (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
Box box;
|
||||
|
||||
if (box_intersect (box1, box2, &box))
|
||||
return box_equal (box, box2);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_empty (const Box box)
|
||||
{
|
||||
/* FIXME simd */
|
||||
return box_x0 (box) == box_x1 (box) || box_y0 (box) == box_y1 (box);
|
||||
}
|
||||
|
||||
/* a splat variation */
|
||||
#ifndef graphene_simd4f_shuffle_xyxy
|
||||
# define graphene_simd4f_shuffle_xyxy(v) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_shuffle_ps ((v), (v), _MM_SHUFFLE (1, 0, 1, 0)); \
|
||||
}))
|
||||
#endif
|
||||
|
||||
static inline Box
|
||||
box_add (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_add (box.v, graphene_simd4f_shuffle_xyxy (offset.v)) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_sub (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_sub (box.v, graphene_simd4f_shuffle_xyxy (offset.v)) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_mul (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
Box b = (Box) { .v = graphene_simd4f_mul (box.v, graphene_simd4f_shuffle_xyxy (scale.v)) };
|
||||
|
||||
if (G_UNLIKELY (!graphene_simd4f_cmple_xy (graphene_simd4f_init (0, 0, 0, 0), scale.v)))
|
||||
{
|
||||
graphene_simd4f_t v = graphene_simd4f_shuffle_zwxy (b.v);
|
||||
graphene_simd4f_t s = graphene_simd4f_min (b.v, v);
|
||||
graphene_simd4f_t t = graphene_simd4f_max (b.v, v);
|
||||
|
||||
return (Box) { .v = graphene_simd4f_splat_xyxy (s, t) };
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_div (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
return box_mul (box, scale_inv (scale));
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_offset_to_float (const Box box,
|
||||
const Point offset,
|
||||
float v[4])
|
||||
{
|
||||
box_to_float (box_add (box, offset), v);
|
||||
}
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
|
||||
static inline Box
|
||||
box_round_larger (const Box box)
|
||||
{
|
||||
return { (Box) .v = graphene_simd4f_splat_xyxy (graphene_simd4f_floor (b.v), graphene_simd4f_ceil (b.v)) };
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline Box
|
||||
box_round_larger (const Box b)
|
||||
{
|
||||
return box (floorf (box_x0 (b)),
|
||||
floorf (box_y0 (b)),
|
||||
ceilf (box_x1 (b)),
|
||||
ceilf (box_y1 (b)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline Box
|
||||
box_round_to_pixels (const Box box,
|
||||
const Scale scale,
|
||||
const Point offset)
|
||||
{
|
||||
return box_sub (box_div (box_round_larger (box_mul (box_add (box, offset), scale)), scale), offset);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1066,7 +1066,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
gsk_gl_profiler_begin_gpu_region (self->gl_profiler);
|
||||
gsk_profiler_timer_begin (self->profiler, self->metrics.cpu_time);
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
|
||||
/* Pre-multiplied alpha */
|
||||
glEnable (GL_BLEND);
|
||||
|
||||
@@ -4322,7 +4322,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
|
||||
gsk_gl_render_job_push_modelview (job, transform);
|
||||
gsk_transform_unref (transform);
|
||||
gsk_gl_render_job_transform_bounds (job, offscreen->bounds, &viewport);
|
||||
gsk_rect_scale (&viewport, downscale_x, downscale_y, &viewport);
|
||||
graphene_rect_scale (&viewport, downscale_x, downscale_y, &viewport);
|
||||
}
|
||||
|
||||
if (downscale_x == 1)
|
||||
@@ -4416,7 +4416,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
|
||||
float scale_x = flipped_x ? - downscale_x : downscale_x;
|
||||
float scale_y = flipped_y ? - downscale_y : downscale_y;
|
||||
|
||||
gsk_rect_scale (&job->current_clip->rect.bounds, scale_x, scale_y, &new_clip.bounds);
|
||||
graphene_rect_scale (&job->current_clip->rect.bounds, scale_x, scale_y, &new_clip.bounds);
|
||||
rounded_rect_scale_corners (&job->current_clip->rect, &new_clip, scale_x, scale_y);
|
||||
gsk_gl_render_job_push_clip (job, &new_clip);
|
||||
reset_clip = TRUE;
|
||||
|
||||
@@ -125,12 +125,6 @@ gsk_gl_device_create_atlas_image (GskGpuDevice *device,
|
||||
height);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_device_make_current (GskGpuDevice *device)
|
||||
{
|
||||
gdk_gl_context_make_current (gdk_display_get_gl_context (gsk_gpu_device_get_display (device)));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_device_finalize (GObject *object)
|
||||
{
|
||||
@@ -157,7 +151,6 @@ gsk_gl_device_class_init (GskGLDeviceClass *klass)
|
||||
gpu_device_class->create_atlas_image = gsk_gl_device_create_atlas_image;
|
||||
gpu_device_class->create_upload_image = gsk_gl_device_create_upload_image;
|
||||
gpu_device_class->create_download_image = gsk_gl_device_create_download_image;
|
||||
gpu_device_class->make_current = gsk_gl_device_make_current;
|
||||
|
||||
object_class->finalize = gsk_gl_device_finalize;
|
||||
}
|
||||
@@ -242,7 +235,7 @@ gsk_gl_device_get_for_display (GdkDisplay *display,
|
||||
if (!gdk_gl_context_check_version (context, "3.0", "3.0"))
|
||||
{
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("OpenGL ES 3.0 is not supported by this renderer."));
|
||||
_("OpenGL ES 2.0 is not supported by this renderer."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,8 @@ gsk_gl_frame_submit (GskGpuFrame *frame,
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glEnable (GL_BLEND);
|
||||
|
||||
if (vertex_buffer)
|
||||
|
||||
@@ -43,7 +43,7 @@ gsk_gl_image_finalize (GObject *object)
|
||||
{
|
||||
GskGLImage *self = GSK_GL_IMAGE (object);
|
||||
|
||||
if (self->texture_id && self->framebuffer_id)
|
||||
if (self->framebuffer_id)
|
||||
glDeleteFramebuffers (1, &self->framebuffer_id);
|
||||
|
||||
if (self->owns_texture)
|
||||
@@ -70,7 +70,6 @@ gsk_gl_image_init (GskGLImage *self)
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gl_image_new_backbuffer (GskGLDevice *device,
|
||||
GdkGLContext *context,
|
||||
GdkMemoryFormat format,
|
||||
gsize width,
|
||||
gsize height)
|
||||
@@ -96,13 +95,6 @@ gsk_gl_image_new_backbuffer (GskGLDevice *device,
|
||||
|
||||
/* texture_id == 0 means backbuffer */
|
||||
|
||||
/* Check for non-standard framebuffer binding as we might not be using
|
||||
* the default framebuffer on systems like macOS where we've bound an
|
||||
* IOSurface to a GL_TEXTURE_RECTANGLE. Otherwise, no scissor clip will
|
||||
* be applied in the command queue causing overdrawing.
|
||||
*/
|
||||
self->framebuffer_id = GDK_GL_CONTEXT_GET_CLASS (context)->get_default_framebuffer (context);
|
||||
|
||||
return GSK_GPU_IMAGE (self);
|
||||
}
|
||||
|
||||
@@ -195,8 +187,6 @@ gsk_gl_image_new_for_texture (GskGLDevice *device,
|
||||
if (format != real_format)
|
||||
flags = GSK_GPU_IMAGE_NO_BLIT |
|
||||
(gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT ? GSK_GPU_IMAGE_STRAIGHT_ALPHA : 0);
|
||||
else
|
||||
flags &= ~(GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_MIPMAP);
|
||||
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self),
|
||||
flags | extra_flags,
|
||||
|
||||
@@ -11,7 +11,6 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (GskGLImage, gsk_gl_image, GSK, GL_IMAGE, GskGpuImage)
|
||||
|
||||
GskGpuImage * gsk_gl_image_new_backbuffer (GskGLDevice *device,
|
||||
GdkGLContext *context,
|
||||
GdkMemoryFormat format,
|
||||
gsize width,
|
||||
gsize height);
|
||||
|
||||
@@ -28,7 +28,6 @@ gsk_gpu_blend_mode_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuBlendmodeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "blend-mode");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->bottom_id);
|
||||
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
|
||||
|
||||
@@ -36,9 +36,6 @@ gsk_gpu_blend_op_print (GskGpuOp *op,
|
||||
case GSK_GPU_BLEND_ADD:
|
||||
gsk_gpu_print_string (string, "add");
|
||||
break;
|
||||
case GSK_GPU_BLEND_CLEAR:
|
||||
gsk_gpu_print_string (string, "clear");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
@@ -75,9 +72,6 @@ gsk_gpu_blend_op_gl_command (GskGpuOp *op,
|
||||
case GSK_GPU_BLEND_ADD:
|
||||
glBlendFunc (GL_ONE, GL_ONE);
|
||||
break;
|
||||
case GSK_GPU_BLEND_CLEAR:
|
||||
glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
|
||||
@@ -85,6 +85,7 @@ gsk_gpu_blit_op_vk_command (GskGpuOp *op,
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case GSK_GPU_BLIT_LINEAR:
|
||||
filter = VK_FILTER_LINEAR;
|
||||
break;
|
||||
@@ -159,6 +160,7 @@ gsk_gpu_blit_op_gl_command (GskGpuOp *op,
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case GSK_GPU_BLIT_LINEAR:
|
||||
filter = GL_LINEAR;
|
||||
break;
|
||||
|
||||
@@ -31,8 +31,6 @@ gsk_gpu_blur_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuBlurInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "blur");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
g_string_append_printf (string, "%g,%g ", instance->blur_direction[0], instance->blur_direction[1]);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
|
||||
@@ -36,7 +36,6 @@ gsk_gpu_border_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuBorderInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "border");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rounded_rect (string, instance->outline);
|
||||
|
||||
gsk_gpu_print_rgba (string, (const float *) &instance->border_colors[0]);
|
||||
|
||||
@@ -31,7 +31,6 @@ gsk_gpu_box_shadow_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuBoxshadowInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, shader->variation & VARIATION_INSET ? "inset-shadow" : "outset-shadow");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rounded_rect (string, instance->outline);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
g_string_append_printf (string, "%g %g %g %g ",
|
||||
|
||||
@@ -301,3 +301,42 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
return GSK_GPU_SHADER_CLIP_ROUNDED;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsk_gpu_clip_contains_box (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box)
|
||||
{
|
||||
Box b = box_add (*box, *offset);
|
||||
|
||||
switch (self->type)
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
case GSK_GPU_CLIP_ALL_CLIPPED:
|
||||
return FALSE;
|
||||
|
||||
case GSK_GPU_CLIP_NONE:
|
||||
case GSK_GPU_CLIP_CONTAINED:
|
||||
case GSK_GPU_CLIP_RECT:
|
||||
return box_contains (box_from_graphene (&self->rect.bounds), b);
|
||||
|
||||
case GSK_GPU_CLIP_ROUNDED:
|
||||
return gsk_rounded_rect_contains_rect (&self->rect, &GRAPHENE_RECT_INIT (box_x0 (b), box_y0 (b), box_width (b), box_height (b)));
|
||||
}
|
||||
}
|
||||
|
||||
GskGpuShaderClip
|
||||
gsk_gpu_clip_get_shader_clip2 (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box)
|
||||
{
|
||||
if (self->type == GSK_GPU_CLIP_NONE ||
|
||||
self->type == GSK_GPU_CLIP_CONTAINED ||
|
||||
gsk_gpu_clip_contains_box (self, offset, box))
|
||||
return GSK_GPU_SHADER_CLIP_NONE;
|
||||
else if (self->type == GSK_GPU_CLIP_RECT)
|
||||
return GSK_GPU_SHADER_CLIP_RECT;
|
||||
else
|
||||
return GSK_GPU_SHADER_CLIP_ROUNDED;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <graphene.h>
|
||||
#include <gsk/gskroundedrect.h>
|
||||
#include "boxprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -65,9 +66,16 @@ gboolean gsk_gpu_clip_contains_rect (const G
|
||||
gboolean gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *rect);
|
||||
|
||||
gboolean gsk_gpu_clip_contains_box (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip2 (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ gsk_gpu_colorize_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuColorizeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "colorize");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
|
||||
@@ -27,7 +27,6 @@ gsk_gpu_color_matrix_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuColormatrixInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "color-matrix");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
|
||||
@@ -28,7 +28,6 @@ gsk_gpu_color_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuColorInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "color");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
gsk_gpu_print_newline (string);
|
||||
|
||||
@@ -29,7 +29,6 @@ gsk_gpu_conic_gradient_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuConicgradientInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "conic-gradient");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ gsk_gpu_cross_fade_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuCrossfadeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "cross-fade");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->start_id);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->end_id);
|
||||
|
||||
@@ -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,13 +14,6 @@
|
||||
|
||||
#define MAX_ATLAS_ITEM_SIZE 256
|
||||
|
||||
#define MAX_DEAD_PIXELS (ATLAS_SIZE * ATLAS_SIZE / 2)
|
||||
|
||||
#define CACHE_TIMEOUT 15 /* seconds */
|
||||
|
||||
G_STATIC_ASSERT (MAX_ATLAS_ITEM_SIZE < ATLAS_SIZE);
|
||||
G_STATIC_ASSERT (MAX_DEAD_PIXELS < ATLAS_SIZE * ATLAS_SIZE);
|
||||
|
||||
typedef struct _GskGpuCached GskGpuCached;
|
||||
typedef struct _GskGpuCachedClass GskGpuCachedClass;
|
||||
typedef struct _GskGpuCachedAtlas GskGpuCachedAtlas;
|
||||
@@ -40,14 +29,11 @@ struct _GskGpuDevicePrivate
|
||||
GskGpuCached *first_cached;
|
||||
GskGpuCached *last_cached;
|
||||
guint cache_gc_source;
|
||||
int cache_timeout; /* in seconds, or -1 to disable gc */
|
||||
|
||||
GHashTable *texture_cache;
|
||||
GHashTable *glyph_cache;
|
||||
|
||||
GskGpuCachedAtlas *current_atlas;
|
||||
|
||||
/* atomic */ gsize dead_texture_pixels;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GskGpuDevice, gsk_gpu_device, G_TYPE_OBJECT)
|
||||
@@ -68,34 +54,12 @@ struct _GskGpuCachedClass
|
||||
struct _GskGpuCached
|
||||
{
|
||||
const GskGpuCachedClass *class;
|
||||
|
||||
|
||||
GskGpuCachedAtlas *atlas;
|
||||
GskGpuCached *next;
|
||||
GskGpuCached *prev;
|
||||
|
||||
gint64 timestamp;
|
||||
gboolean stale;
|
||||
guint pixels; /* For glyphs and textures, 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)
|
||||
@@ -111,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);
|
||||
}
|
||||
|
||||
@@ -152,21 +114,7 @@ gsk_gpu_cached_use (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
cached->timestamp = timestamp;
|
||||
mark_as_stale (cached, FALSE);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gsk_gpu_cached_is_old (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
|
||||
|
||||
if (priv->cache_timeout < 0)
|
||||
return FALSE;
|
||||
else
|
||||
return timestamp - cached->timestamp > priv->cache_timeout * G_TIME_SPAN_SECOND;
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -189,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);
|
||||
}
|
||||
|
||||
@@ -214,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 =
|
||||
@@ -242,14 +178,7 @@ struct _GskGpuCachedTexture
|
||||
{
|
||||
GskGpuCached parent;
|
||||
|
||||
/* atomic */ int use_count; /* We count the use by the device (via the linked
|
||||
* list) and by the texture (via render data or
|
||||
* weak ref.
|
||||
*/
|
||||
|
||||
gsize *dead_pixels_counter;
|
||||
|
||||
GdkTexture *texture;
|
||||
/* atomic */ GdkTexture *texture;
|
||||
GskGpuImage *image;
|
||||
};
|
||||
|
||||
@@ -257,37 +186,14 @@ static void
|
||||
gsk_gpu_cached_texture_free (GskGpuDevice *device,
|
||||
GskGpuCached *cached)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
|
||||
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
|
||||
gpointer key, value;
|
||||
gboolean texture_still_alive;
|
||||
|
||||
g_clear_object (&self->image);
|
||||
|
||||
if (g_hash_table_steal_extended (priv->texture_cache, self->texture, &key, &value))
|
||||
{
|
||||
/* If the texture has been reused already, we put the entry back */
|
||||
if ((GskGpuCached *) value != cached)
|
||||
g_hash_table_insert (priv->texture_cache, key, value);
|
||||
}
|
||||
|
||||
/* If the cached item itself is still in use by the texture, we leave
|
||||
* it to the weak ref or render data to free it.
|
||||
*/
|
||||
if (g_atomic_int_dec_and_test (&self->use_count))
|
||||
{
|
||||
g_free (self);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gsk_gpu_cached_texture_is_invalid (GskGpuCachedTexture *self)
|
||||
{
|
||||
/* If the use count is less than 2, the orignal texture has died,
|
||||
* and the memory may have been reused for a new texture, so we
|
||||
* can't hand out the image that is for the original texture.
|
||||
*/
|
||||
return g_atomic_int_get (&self->use_count) < 2;
|
||||
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
|
||||
g_object_unref (self->image);
|
||||
|
||||
if (!texture_still_alive)
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -295,10 +201,8 @@ gsk_gpu_cached_texture_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
|
||||
|
||||
return gsk_gpu_cached_is_old (device, cached, timestamp) ||
|
||||
gsk_gpu_cached_texture_is_invalid (self);
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
|
||||
@@ -308,19 +212,16 @@ static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
|
||||
gsk_gpu_cached_texture_should_collect
|
||||
};
|
||||
|
||||
/* Note: this function can run in an arbitrary thread, so it can
|
||||
* only access things atomically
|
||||
*/
|
||||
static void
|
||||
gsk_gpu_cached_texture_destroy_cb (gpointer data)
|
||||
{
|
||||
GskGpuCachedTexture *self = data;
|
||||
GskGpuCachedTexture *cache = data;
|
||||
gboolean cache_still_alive;
|
||||
|
||||
if (!gsk_gpu_cached_texture_is_invalid (self))
|
||||
g_atomic_pointer_add (self->dead_pixels_counter, ((GskGpuCached *) self)->pixels);
|
||||
cache_still_alive = g_atomic_pointer_exchange (&cache->texture, NULL) != NULL;
|
||||
|
||||
if (g_atomic_int_dec_and_test (&self->use_count))
|
||||
g_free (self);
|
||||
if (!cache_still_alive)
|
||||
g_free (cache);
|
||||
}
|
||||
|
||||
static GskGpuCachedTexture *
|
||||
@@ -334,19 +235,18 @@ gsk_gpu_cached_texture_new (GskGpuDevice *device,
|
||||
if (gdk_texture_get_render_data (texture, device))
|
||||
gdk_texture_clear_render_data (texture);
|
||||
else if ((self = g_hash_table_lookup (priv->texture_cache, texture)))
|
||||
g_hash_table_remove (priv->texture_cache, texture);
|
||||
{
|
||||
g_hash_table_remove (priv->texture_cache, texture);
|
||||
g_object_weak_unref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
|
||||
}
|
||||
|
||||
self = gsk_gpu_cached_new (device, &GSK_GPU_CACHED_TEXTURE_CLASS, NULL);
|
||||
self->texture = texture;
|
||||
self->image = g_object_ref (image);
|
||||
((GskGpuCached *)self)->pixels = gsk_gpu_image_get_width (image) * gsk_gpu_image_get_height (image);
|
||||
self->dead_pixels_counter = &priv->dead_texture_pixels;
|
||||
self->use_count = 2;
|
||||
|
||||
if (!gdk_texture_set_render_data (texture, device, self, gsk_gpu_cached_texture_destroy_cb))
|
||||
{
|
||||
g_object_weak_ref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
|
||||
|
||||
g_hash_table_insert (priv->texture_cache, texture, self);
|
||||
}
|
||||
|
||||
@@ -374,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);
|
||||
|
||||
@@ -390,15 +287,7 @@ gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
if (gsk_gpu_cached_is_old (device, cached, timestamp))
|
||||
{
|
||||
if (cached->atlas)
|
||||
mark_as_stale (cached, TRUE);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Glyphs are only collected when their atlas is freed */
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -436,127 +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 (%u in hash)\n"
|
||||
" atlases: %5u%s",
|
||||
glyphs, stale_glyphs,
|
||||
textures, g_hash_table_size (priv->texture_cache),
|
||||
atlases, ratios->str);
|
||||
|
||||
g_string_free (ratios, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
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;
|
||||
|
||||
gsk_gpu_device_make_current (self);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
g_atomic_pointer_set (&priv->dead_texture_pixels, 0);
|
||||
|
||||
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
|
||||
print_cache_stats (self);
|
||||
|
||||
gdk_profiler_end_mark (before, "Glyph cache GC", NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cache_gc_cb (gpointer data)
|
||||
{
|
||||
GskGpuDevice *self = data;
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
GSK_DEBUG (GLYPH_CACHE, "Periodic GC");
|
||||
|
||||
gsk_gpu_device_gc (self, g_get_monotonic_time ());
|
||||
|
||||
priv->cache_gc_source = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_device_maybe_gc (GskGpuDevice *self)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
gsize dead_texture_pixels;
|
||||
|
||||
if (priv->cache_timeout < 0)
|
||||
return;
|
||||
|
||||
dead_texture_pixels = GPOINTER_TO_SIZE (g_atomic_pointer_get (&priv->dead_texture_pixels));
|
||||
|
||||
if (priv->cache_timeout == 0 || dead_texture_pixels > 1000000)
|
||||
{
|
||||
GSK_DEBUG (GLYPH_CACHE, "Pre-frame GC (%lu dead pixels)", dead_texture_pixels);
|
||||
gsk_gpu_device_gc (self, g_get_monotonic_time ());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_device_queue_gc (GskGpuDevice *self)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
if (priv->cache_timeout > 0 && !priv->cache_gc_source)
|
||||
priv->cache_gc_source = g_timeout_add_seconds (priv->cache_timeout, cache_gc_cb, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -576,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);
|
||||
}
|
||||
@@ -592,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);
|
||||
}
|
||||
@@ -634,38 +413,9 @@ gsk_gpu_device_setup (GskGpuDevice *self,
|
||||
gsize max_image_size)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
const char *str;
|
||||
|
||||
priv->display = g_object_ref (display);
|
||||
priv->max_image_size = max_image_size;
|
||||
priv->cache_timeout = CACHE_TIMEOUT;
|
||||
|
||||
str = g_getenv ("GSK_CACHE_TIMEOUT");
|
||||
if (str != NULL)
|
||||
{
|
||||
gint64 value;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_ascii_string_to_signed (str, 10, -1, G_MAXINT, &value, &error))
|
||||
{
|
||||
g_warning ("Failed to parse GSK_CACHE_TIMEOUT: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->cache_timeout = (int) value;
|
||||
}
|
||||
}
|
||||
|
||||
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
|
||||
{
|
||||
if (priv->cache_timeout < 0)
|
||||
gdk_debug_message ("Cache GC disabled");
|
||||
else if (priv->cache_timeout == 0)
|
||||
gdk_debug_message ("Cache GC before every frame");
|
||||
else
|
||||
gdk_debug_message ("Cache GC timeout: %d seconds", priv->cache_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
@@ -704,12 +454,6 @@ gsk_gpu_device_create_upload_image (GskGpuDevice *self,
|
||||
return GSK_GPU_DEVICE_GET_CLASS (self)->create_upload_image (self, with_mipmap, format, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_device_make_current (GskGpuDevice *self)
|
||||
{
|
||||
GSK_GPU_DEVICE_GET_CLASS (self)->make_current (self);
|
||||
}
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gpu_device_create_download_image (GskGpuDevice *self,
|
||||
GdkMemoryDepth depth,
|
||||
@@ -803,7 +547,8 @@ gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
|
||||
|
||||
static void
|
||||
gsk_gpu_device_ensure_atlas (GskGpuDevice *self,
|
||||
gboolean recreate)
|
||||
gboolean recreate,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
@@ -818,13 +563,14 @@ gsk_gpu_device_get_atlas_image (GskGpuDevice *self)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE);
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE, g_get_monotonic_time ());
|
||||
|
||||
return priv->current_atlas->image;
|
||||
}
|
||||
|
||||
static GskGpuImage *
|
||||
gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
|
||||
gint64 timestamp,
|
||||
gsize width,
|
||||
gsize height,
|
||||
gsize *out_x,
|
||||
@@ -835,15 +581,21 @@ gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
|
||||
if (width > MAX_ATLAS_ITEM_SIZE || height > MAX_ATLAS_ITEM_SIZE)
|
||||
return NULL;
|
||||
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE);
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE, timestamp);
|
||||
|
||||
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
|
||||
{
|
||||
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_device_ensure_atlas (self, TRUE);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -860,12 +612,12 @@ gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
||||
if (cache == NULL)
|
||||
cache = g_hash_table_lookup (priv->texture_cache, texture);
|
||||
|
||||
if (!cache || !cache->image || gsk_gpu_cached_texture_is_invalid (cache))
|
||||
return NULL;
|
||||
if (cache)
|
||||
{
|
||||
return g_object_ref (cache->image);
|
||||
}
|
||||
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
|
||||
|
||||
return g_object_ref (cache->image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -926,6 +678,7 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
padding = 1;
|
||||
|
||||
image = gsk_gpu_device_add_atlas_image (self,
|
||||
gsk_gpu_frame_get_timestamp (frame),
|
||||
rect.size.width + 2 * padding, rect.size.height + 2 * padding,
|
||||
&atlas_x, &atlas_y);
|
||||
if (image)
|
||||
@@ -944,15 +697,14 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
cache = gsk_gpu_cached_new (self, &GSK_GPU_CACHED_GLYPH_CLASS, NULL);
|
||||
}
|
||||
|
||||
cache->font = g_object_ref (font);
|
||||
cache->glyph = glyph;
|
||||
cache->flags = flags;
|
||||
cache->scale = scale;
|
||||
cache->bounds = rect;
|
||||
cache->image = image;
|
||||
cache->font = g_object_ref (font),
|
||||
cache->glyph = glyph,
|
||||
cache->flags = flags,
|
||||
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);
|
||||
|
||||
gsk_gpu_upload_glyph_op (frame,
|
||||
cache->image,
|
||||
|
||||
@@ -41,8 +41,6 @@ struct _GskGpuDeviceClass
|
||||
GdkMemoryDepth depth,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void (* make_current) (GskGpuDevice *self);
|
||||
|
||||
};
|
||||
|
||||
GType gsk_gpu_device_get_type (void) G_GNUC_CONST;
|
||||
@@ -50,8 +48,9 @@ GType gsk_gpu_device_get_type (void) G
|
||||
void gsk_gpu_device_setup (GskGpuDevice *self,
|
||||
GdkDisplay *display,
|
||||
gsize max_image_size);
|
||||
void gsk_gpu_device_maybe_gc (GskGpuDevice *self);
|
||||
void gsk_gpu_device_queue_gc (GskGpuDevice *self);
|
||||
void gsk_gpu_device_gc (GskGpuDevice *self,
|
||||
gint64 timestamp);
|
||||
|
||||
GdkDisplay * gsk_gpu_device_get_display (GskGpuDevice *self);
|
||||
gsize gsk_gpu_device_get_max_image_size (GskGpuDevice *self);
|
||||
GskGpuImage * gsk_gpu_device_get_atlas_image (GskGpuDevice *self);
|
||||
@@ -70,7 +69,7 @@ GskGpuImage * gsk_gpu_device_create_download_image (GskGpuD
|
||||
GdkMemoryDepth depth,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void gsk_gpu_device_make_current (GskGpuDevice *self);
|
||||
|
||||
GskGpuImage * gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
||||
GdkTexture *texture,
|
||||
gint64 timestamp);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -32,13 +32,7 @@ gsk_gpu_globals_op_print (GskGpuOp *op,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskGpuGlobalsOp *globals = (GskGpuGlobalsOp *) op;
|
||||
GskGpuGlobalsInstance *instance = &globals->instance;
|
||||
|
||||
gsk_gpu_print_op (string, indent, "globals");
|
||||
g_string_append_printf (string, "scale %g %g ", instance->scale[0], instance->scale[1]);
|
||||
g_string_append (string, "clip ");
|
||||
gsk_gpu_print_rounded_rect (string, instance->clip);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ gsk_gpu_linear_gradient_op_print (GskGpuOp *op,
|
||||
gsk_gpu_print_op (string, indent, "repeating-linear-gradient");
|
||||
else
|
||||
gsk_gpu_print_op (string, indent, "linear-gradient");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ gsk_gpu_mask_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuMaskInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "mask");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->source_id);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->mask_id);
|
||||
|
||||
@@ -129,8 +129,8 @@ gsk_gpu_mipmap_op_vk_command (GskGpuOp *op,
|
||||
.z = 0,
|
||||
},
|
||||
{
|
||||
.x = MAX (1, width / 2),
|
||||
.y = MAX (1, height / 2),
|
||||
.x = width / 2,
|
||||
.y = height / 2,
|
||||
.z = 1,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -42,12 +42,10 @@
|
||||
#include "gsktransformprivate.h"
|
||||
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
#include "gdk/gdksubsurfaceprivate.h"
|
||||
|
||||
/* the epsilon we allow pixels to be off due to rounding errors.
|
||||
* Chosen rather randomly.
|
||||
*/
|
||||
#define EPSILON 0.001
|
||||
#include "scaleprivate.h"
|
||||
#include "pointprivate.h"
|
||||
#include "boxprivate.h"
|
||||
|
||||
/* A note about coordinate systems
|
||||
*
|
||||
@@ -344,8 +342,8 @@ gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
|
||||
|
||||
area.x = 0;
|
||||
area.y = 0;
|
||||
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width - EPSILON);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height - EPSILON);
|
||||
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height);
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
@@ -504,6 +502,18 @@ gsk_gpu_pattern_writer_append_rect (GskGpuPatternWriter *self,
|
||||
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gpu_pattern_writer_append_box (GskGpuPatternWriter *self,
|
||||
const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
float f[4];
|
||||
|
||||
box_offset_to_float (box, offset, f);
|
||||
|
||||
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gpu_pattern_writer_append_rgba (GskGpuPatternWriter *self,
|
||||
const GdkRGBA *rgba)
|
||||
@@ -568,6 +578,7 @@ extract_scale_from_transform (GskTransform *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;
|
||||
@@ -738,30 +749,6 @@ gsk_gpu_node_processor_image_op (GskGpuNodeProcessor *self,
|
||||
}
|
||||
}
|
||||
|
||||
static GskGpuImage *
|
||||
gsk_gpu_node_processor_create_offscreen (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GskGpuNodeProcessor self;
|
||||
GskGpuImage *image;
|
||||
|
||||
image = gsk_gpu_node_processor_init_draw (&self,
|
||||
frame,
|
||||
gsk_render_node_get_preferred_depth (node),
|
||||
scale,
|
||||
viewport);
|
||||
if (image == NULL)
|
||||
return NULL;
|
||||
|
||||
gsk_gpu_node_processor_add_node (&self, node);
|
||||
|
||||
gsk_gpu_node_processor_finish_draw (&self, image);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/*
|
||||
* gsk_gpu_get_node_as_image:
|
||||
* @frame: frame to render in
|
||||
@@ -791,6 +778,7 @@ gsk_gpu_get_node_as_image (GskGpuFrame *frame,
|
||||
GskRenderNode *node,
|
||||
graphene_rect_t *out_bounds)
|
||||
{
|
||||
graphene_rect_t clipped;
|
||||
GskGpuImage *result;
|
||||
|
||||
switch ((guint) gsk_render_node_get_node_type (node))
|
||||
@@ -813,29 +801,37 @@ gsk_gpu_get_node_as_image (GskGpuFrame *frame,
|
||||
}
|
||||
|
||||
case GSK_CAIRO_NODE:
|
||||
gsk_rect_intersection (clip_bounds, &node->bounds, &clipped);
|
||||
if (gsk_rect_is_empty (&clipped))
|
||||
return NULL;
|
||||
|
||||
result = gsk_gpu_upload_cairo_op (frame,
|
||||
scale,
|
||||
clip_bounds,
|
||||
&clipped,
|
||||
(GskGpuCairoFunc) gsk_render_node_draw_fallback,
|
||||
gsk_render_node_ref (node),
|
||||
(GDestroyNotify) gsk_render_node_unref);
|
||||
|
||||
g_object_ref (result);
|
||||
|
||||
*out_bounds = *clip_bounds;
|
||||
*out_bounds = clipped;
|
||||
return result;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GSK_DEBUG (FALLBACK, "Offscreening node '%s'", g_type_name_from_instance ((GTypeInstance *) node));
|
||||
result = gsk_gpu_node_processor_create_offscreen (frame,
|
||||
scale,
|
||||
clip_bounds,
|
||||
node);
|
||||
gsk_rect_intersection (clip_bounds, &node->bounds, &clipped);
|
||||
if (gsk_rect_is_empty (&clipped))
|
||||
return NULL;
|
||||
|
||||
*out_bounds = *clip_bounds;
|
||||
GSK_DEBUG (FALLBACK, "Offscreening node '%s'", g_type_name_from_instance ((GTypeInstance *) node));
|
||||
result = gsk_gpu_render_pass_op_offscreen (frame,
|
||||
scale,
|
||||
&clipped,
|
||||
node);
|
||||
|
||||
*out_bounds = clipped;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -956,13 +952,9 @@ gsk_gpu_node_processor_get_node_as_image (GskGpuNodeProcessor *self,
|
||||
{
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip))
|
||||
return NULL;
|
||||
clip_bounds = &clip;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gsk_rect_intersection (clip_bounds, &node->bounds, &clip))
|
||||
return NULL;
|
||||
}
|
||||
rect_round_to_pixels (&clip, &self->scale, &self->offset, &clip);
|
||||
rect_round_to_pixels (clip_bounds, &self->scale, &self->offset, &clip);
|
||||
|
||||
image = gsk_gpu_get_node_as_image (self->frame,
|
||||
&clip,
|
||||
@@ -1007,25 +999,36 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
graphene_vec2_t direction;
|
||||
graphene_rect_t clip_rect, intermediate_rect;
|
||||
graphene_point_t real_offset;
|
||||
int width, height;
|
||||
float clip_radius;
|
||||
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (blur_radius / 2.0);
|
||||
|
||||
/* FIXME: Handle clip radius growing the clip too much */
|
||||
gsk_gpu_node_processor_get_clip_bounds (self, &clip_rect);
|
||||
clip_rect.origin.x -= shadow_offset->x;
|
||||
clip_rect.origin.y -= shadow_offset->y;
|
||||
graphene_rect_inset (&clip_rect, 0.f, -clip_radius);
|
||||
if (!gsk_rect_intersection (rect, &clip_rect, &intermediate_rect))
|
||||
return;
|
||||
|
||||
rect_round_to_pixels (&intermediate_rect, &self->scale, &self->offset, &intermediate_rect);
|
||||
width = ceilf (graphene_vec2_get_x (&self->scale) * intermediate_rect.size.width);
|
||||
height = ceilf (graphene_vec2_get_y (&self->scale) * intermediate_rect.size.height);
|
||||
|
||||
intermediate = gsk_gpu_node_processor_init_draw (&other,
|
||||
self->frame,
|
||||
source_depth,
|
||||
&self->scale,
|
||||
&intermediate_rect);
|
||||
intermediate = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (self->frame),
|
||||
FALSE,
|
||||
source_depth,
|
||||
width, height);
|
||||
|
||||
gsk_gpu_node_processor_init (&other,
|
||||
self->frame,
|
||||
source_desc,
|
||||
intermediate,
|
||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||
&intermediate_rect);
|
||||
|
||||
gsk_gpu_render_pass_begin_op (other.frame,
|
||||
intermediate,
|
||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||
GSK_RENDER_PASS_OFFSCREEN);
|
||||
|
||||
gsk_gpu_node_processor_sync_globals (&other, 0);
|
||||
|
||||
@@ -1039,7 +1042,11 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
source_rect,
|
||||
&direction);
|
||||
|
||||
gsk_gpu_node_processor_finish_draw (&other, intermediate);
|
||||
gsk_gpu_render_pass_end_op (other.frame,
|
||||
intermediate,
|
||||
GSK_RENDER_PASS_OFFSCREEN);
|
||||
|
||||
gsk_gpu_node_processor_finish (&other);
|
||||
|
||||
real_offset = GRAPHENE_POINT_INIT (self->offset.x + shadow_offset->x,
|
||||
self->offset.y + shadow_offset->y);
|
||||
@@ -1327,8 +1334,7 @@ gsk_gpu_node_processor_add_node_clipped (GskGpuNodeProcessor *self,
|
||||
gsk_gpu_clip_init_copy (&self->clip, &old_clip);
|
||||
return;
|
||||
}
|
||||
else if (self->clip.type == GSK_GPU_CLIP_RECT &&
|
||||
gsk_rect_contains_rect (&self->clip.rect.bounds, &clip))
|
||||
else if (self->clip.type == GSK_GPU_CLIP_RECT)
|
||||
{
|
||||
self->clip.type = GSK_GPU_CLIP_NONE;
|
||||
}
|
||||
@@ -2062,21 +2068,13 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
|
||||
GskGpuImage *offscreen;
|
||||
graphene_rect_t clip_bounds;
|
||||
|
||||
gsk_gpu_node_processor_get_clip_bounds (self, &clip_bounds);
|
||||
/* first round to pixel boundaries, so we make sure the full pixels are covered */
|
||||
rect_round_to_pixels (&clip_bounds, &self->scale, &self->offset, &clip_bounds);
|
||||
/* then expand by half a pixel so that pixels needed for eventual linear
|
||||
* filtering are available */
|
||||
graphene_rect_inset (&clip_bounds, -0.5, -0.5);
|
||||
/* finally, round to full pixels */
|
||||
gsk_rect_round_larger (&clip_bounds);
|
||||
/* now intersect with actual node bounds */
|
||||
if (!gsk_rect_intersection (&clip_bounds, &node->bounds, &clip_bounds))
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
offscreen = gsk_gpu_node_processor_create_offscreen (self->frame,
|
||||
graphene_vec2_one (),
|
||||
&clip_bounds,
|
||||
node);
|
||||
gsk_rect_round_larger (&clip_bounds);
|
||||
offscreen = gsk_gpu_render_pass_op_offscreen (self->frame,
|
||||
graphene_vec2_one (),
|
||||
&clip_bounds,
|
||||
node);
|
||||
descriptor = gsk_gpu_node_processor_add_image (self, offscreen, GSK_GPU_SAMPLER_DEFAULT);
|
||||
gsk_gpu_texture_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
@@ -2992,9 +2990,9 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
GskGpuDevice *device;
|
||||
const PangoGlyphInfo *glyphs;
|
||||
PangoFont *font;
|
||||
graphene_point_t offset;
|
||||
Point offset;
|
||||
Scale scale, s4, pango_scale;
|
||||
guint i, num_glyphs;
|
||||
float scale, inv_scale;
|
||||
GdkRGBA color;
|
||||
gboolean glyph_align;
|
||||
|
||||
@@ -3013,31 +3011,33 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
font = gsk_text_node_get_font (node);
|
||||
offset = *gsk_text_node_get_offset (node);
|
||||
offset.x += self->offset.x;
|
||||
offset.y += self->offset.y;
|
||||
|
||||
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
|
||||
inv_scale = 1.f / scale;
|
||||
offset = point_add (point_from_graphene (gsk_text_node_get_offset (node)),
|
||||
point_from_graphene (&self->offset));
|
||||
scale = scale_max (scale_from_graphene (&self->scale));
|
||||
s4 = scale_mul (scale, scale_from_float (4));
|
||||
pango_scale = scale_from_float (PANGO_SCALE);
|
||||
|
||||
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_rect_t glyph_bds;
|
||||
graphene_point_t glyph_ofs;
|
||||
Box glyph_bounds, glyph_tex_rect;
|
||||
Point g_ofs, glyph_origin;
|
||||
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);
|
||||
glyph_origin = point_add (offset, point_div (point (glyphs[i].geometry.x_offset, glyphs[i].geometry.y_offset), pango_scale));
|
||||
|
||||
if (glyph_align)
|
||||
{
|
||||
glyph_origin.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;
|
||||
glyph_origin = point_round (point_mul (glyph_origin, s4));
|
||||
|
||||
flags = ((int) point_x (glyph_origin) & 3) |
|
||||
(((int) point_y (glyph_origin) & 3) << 2);
|
||||
|
||||
glyph_origin = point_div (glyph_origin, s4);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3049,34 +3049,37 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
flags,
|
||||
scale,
|
||||
&glyph_bounds,
|
||||
&glyph_offset);
|
||||
scale_x (scale),
|
||||
&glyph_bds,
|
||||
&glyph_ofs);
|
||||
|
||||
glyph_tex_rect = box_div (box_from_rect (-glyph_bds.origin.x, -glyph_bds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), scale);
|
||||
|
||||
glyph_bounds = box_div (box_from_rect (0, 0, glyph_bds.size.width, glyph_bds.size.height), scale);
|
||||
|
||||
g_ofs = point_from_graphene (&glyph_ofs);
|
||||
glyph_origin = point_sub (glyph_origin, point_div (g_ofs, scale));
|
||||
|
||||
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);
|
||||
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_clip2 (&self->clip, &g_ofs, &glyph_bounds),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&glyph_bounds,
|
||||
&glyph_origin,
|
||||
&glyph_tex_rect);
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_bounds), box_y0 (glyph_bounds), box_width (glyph_bounds), box_height (glyph_bounds)),
|
||||
&GRAPHENE_POINT_INIT (point_x (glyph_origin), point_y (glyph_origin)),
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_tex_rect), box_y0 (glyph_tex_rect), box_width (glyph_tex_rect), box_height (glyph_tex_rect)));
|
||||
else
|
||||
gsk_gpu_colorize_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
|
||||
gsk_gpu_clip_get_shader_clip2 (&self->clip, &g_ofs, &glyph_bounds),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&glyph_bounds,
|
||||
&glyph_origin,
|
||||
&glyph_tex_rect,
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_bounds), box_y0 (glyph_bounds), box_width (glyph_bounds), box_height (glyph_bounds)),
|
||||
&GRAPHENE_POINT_INIT (point_x (glyph_origin), point_y (glyph_origin)),
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_tex_rect), box_y0 (glyph_tex_rect), box_width (glyph_tex_rect), box_height (glyph_tex_rect)),
|
||||
&color);
|
||||
|
||||
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
|
||||
offset = point_add (offset, point (glyphs[i].geometry.width / (float)PANGO_SCALE, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3089,10 +3092,10 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
PangoFont *font;
|
||||
guint num_glyphs;
|
||||
gsize i;
|
||||
float scale, inv_scale;
|
||||
Scale scale, pango_scale;
|
||||
guint32 tex_id;
|
||||
GskGpuImage *last_image;
|
||||
graphene_point_t offset;
|
||||
Point offset;
|
||||
|
||||
if (gsk_text_node_has_color_glyphs (node))
|
||||
return FALSE;
|
||||
@@ -3101,12 +3104,11 @@ 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;
|
||||
|
||||
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
|
||||
inv_scale = 1.f / scale;
|
||||
offset = point_add (point_from_graphene (gsk_text_node_get_offset (node)),
|
||||
point_from_graphene (&self->offset));
|
||||
scale = scale_max (scale_from_graphene (&self->scale));
|
||||
pango_scale = scale_from_float (PANGO_SCALE);
|
||||
|
||||
gsk_gpu_pattern_writer_append_uint (self, GSK_GPU_PATTERN_GLYPHS);
|
||||
gsk_gpu_pattern_writer_append_rgba (self, gsk_text_node_get_color (node));
|
||||
@@ -3116,17 +3118,20 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
for (i = 0; i < num_glyphs; i++)
|
||||
{
|
||||
GskGpuImage *image;
|
||||
graphene_rect_t glyph_bounds;
|
||||
graphene_point_t glyph_offset;
|
||||
graphene_rect_t glyph_bds;
|
||||
graphene_point_t glyph_ofs;
|
||||
Point glyph_offset;
|
||||
Box glyph_bounds;
|
||||
Box glyph_tex_rect;
|
||||
|
||||
image = gsk_gpu_device_lookup_glyph_image (device,
|
||||
self->frame,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
0,
|
||||
scale,
|
||||
&glyph_bounds,
|
||||
&glyph_offset);
|
||||
scale_x (scale),
|
||||
&glyph_bds,
|
||||
&glyph_ofs);
|
||||
|
||||
if (image != last_image)
|
||||
{
|
||||
@@ -3136,28 +3141,15 @@ 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);
|
||||
glyph_offset = point_add (point_sub (offset, point_div (glyph_offset, scale)), point_div (point (glyphs[i].geometry.x_offset, glyphs[i].geometry.y_offset), pango_scale));
|
||||
|
||||
glyph_bounds = box_div (box_from_rect (0, 0, glyph_bds.size.width, glyph_bds.size.height), scale);
|
||||
glyph_tex_rect = box_div (box_from_rect (-glyph_bds.origin.x, - glyph_bds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), scale);
|
||||
gsk_gpu_pattern_writer_append_uint (self, tex_id);
|
||||
gsk_gpu_pattern_writer_append_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);
|
||||
gsk_gpu_pattern_writer_append_box (self, glyph_bounds, glyph_offset);
|
||||
gsk_gpu_pattern_writer_append_box (self, glyph_tex_rect, glyph_offset);
|
||||
|
||||
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
|
||||
offset = point_add (offset, point (glyphs[i].geometry.width / (float)PANGO_SCALE, 0));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -3269,10 +3261,10 @@ gsk_gpu_node_processor_repeat_tile (GskGpuNodeProcessor *self,
|
||||
}
|
||||
|
||||
GSK_DEBUG (FALLBACK, "Offscreening node '%s' for tiling", g_type_name_from_instance ((GTypeInstance *) child));
|
||||
image = gsk_gpu_node_processor_create_offscreen (self->frame,
|
||||
&self->scale,
|
||||
&clipped_child_bounds,
|
||||
child);
|
||||
image = gsk_gpu_render_pass_op_offscreen (self->frame,
|
||||
&self->scale,
|
||||
&clipped_child_bounds,
|
||||
child);
|
||||
|
||||
g_return_if_fail (image);
|
||||
|
||||
@@ -3691,42 +3683,22 @@ gsk_gpu_node_processor_add_subsurface_node (GskGpuNodeProcessor *self,
|
||||
|
||||
if (!gdk_subsurface_is_above_parent (subsurface))
|
||||
{
|
||||
cairo_rectangle_int_t int_clipped;
|
||||
graphene_rect_t rect, clipped;
|
||||
cairo_rectangle_int_t int_rect;
|
||||
|
||||
graphene_rect_offset_r (&node->bounds,
|
||||
self->offset.x, self->offset.y,
|
||||
&rect);
|
||||
gsk_rect_intersection (&self->clip.rect.bounds, &rect, &clipped);
|
||||
|
||||
if (gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_CLEAR) &&
|
||||
node->bounds.size.width * node->bounds.size.height > 100 * 100 && /* not worth the effort for small images */
|
||||
(self->clip.type != GSK_GPU_CLIP_ROUNDED ||
|
||||
gsk_gpu_clip_contains_rect (&self->clip, &GRAPHENE_POINT_INIT(0,0), &clipped)) &&
|
||||
gsk_gpu_node_processor_rect_is_integer (self, &clipped, &int_clipped))
|
||||
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 (gdk_rectangle_intersect (&int_clipped, &self->scissor, &int_clipped))
|
||||
{
|
||||
gsk_gpu_clear_op (self->frame,
|
||||
&int_clipped,
|
||||
&GDK_RGBA_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self->blend = GSK_GPU_BLEND_CLEAR;
|
||||
self->pending_globals |= GSK_GPU_GLOBAL_BLEND;
|
||||
gsk_gpu_node_processor_sync_globals (self, 0);
|
||||
|
||||
gsk_gpu_color_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
&node->bounds,
|
||||
&self->offset,
|
||||
&GDK_RGBA_WHITE);
|
||||
|
||||
self->blend = GSK_GPU_BLEND_OVER;
|
||||
self->pending_globals |= GSK_GPU_GLOBAL_BLEND;
|
||||
g_warning ("FIXME: non-integer aligned subsurface?!");
|
||||
}
|
||||
gsk_gpu_clear_op (self->frame,
|
||||
&int_rect,
|
||||
&GDK_RGBA_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3745,12 +3717,6 @@ static void
|
||||
gsk_gpu_node_processor_add_container_node (GskGpuNodeProcessor *self,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
if (self->opacity < 1.0 && !gsk_container_node_is_disjoint (node))
|
||||
{
|
||||
gsk_gpu_node_processor_add_without_opacity (self, node);
|
||||
return;
|
||||
}
|
||||
|
||||
for (guint i = 0; i < gsk_container_node_get_n_children (node); i++)
|
||||
gsk_gpu_node_processor_add_node (self, gsk_container_node_get_child (node, i));
|
||||
}
|
||||
@@ -3790,7 +3756,7 @@ static const struct
|
||||
},
|
||||
[GSK_CONTAINER_NODE] = {
|
||||
GSK_GPU_GLOBAL_MATRIX | GSK_GPU_GLOBAL_SCALE | GSK_GPU_GLOBAL_CLIP | GSK_GPU_GLOBAL_SCISSOR,
|
||||
GSK_GPU_HANDLE_OPACITY,
|
||||
0,
|
||||
gsk_gpu_node_processor_add_container_node,
|
||||
NULL,
|
||||
},
|
||||
@@ -3977,11 +3943,9 @@ gsk_gpu_node_processor_add_node (GskGpuNodeProcessor *self,
|
||||
GskRenderNodeType node_type;
|
||||
|
||||
/* This catches the corner cases of empty nodes, so after this check
|
||||
* there's quaranteed to be at least 1 pixel that needs to be drawn
|
||||
*/
|
||||
* 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;
|
||||
|
||||
@@ -4026,12 +3990,6 @@ gsk_gpu_node_processor_create_node_pattern (GskGpuPatternWriter *self,
|
||||
if (!gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_UBER))
|
||||
return FALSE;
|
||||
|
||||
/* This catches the corner cases of empty nodes, so after this check
|
||||
* 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 TRUE;
|
||||
|
||||
node_type = gsk_render_node_get_node_type (node);
|
||||
if (node_type >= G_N_ELEMENTS (nodes_vtable))
|
||||
{
|
||||
|
||||
@@ -12,27 +12,6 @@ gsk_gpu_print_indent (GString *string,
|
||||
g_string_append_printf (string, "%*s", 2 * indent, "");
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_print_shader_info (GString *string,
|
||||
GskGpuShaderClip clip)
|
||||
{
|
||||
switch (clip)
|
||||
{
|
||||
case GSK_GPU_SHADER_CLIP_NONE:
|
||||
g_string_append (string, "🞨 ");
|
||||
break;
|
||||
case GSK_GPU_SHADER_CLIP_RECT:
|
||||
g_string_append (string, "□ ");
|
||||
break;
|
||||
case GSK_GPU_SHADER_CLIP_ROUNDED:
|
||||
g_string_append (string, "▢ ");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_print_op (GString *string,
|
||||
guint indent,
|
||||
|
||||
@@ -17,8 +17,6 @@ void gsk_gpu_print_newline (GString
|
||||
|
||||
void gsk_gpu_print_string (GString *string,
|
||||
const char *s);
|
||||
void gsk_gpu_print_shader_info (GString *string,
|
||||
GskGpuShaderClip clip);
|
||||
void gsk_gpu_print_enum (GString *string,
|
||||
GType type,
|
||||
int value);
|
||||
|
||||
@@ -33,7 +33,6 @@ gsk_gpu_radial_gradient_op_print (GskGpuOp *op,
|
||||
gsk_gpu_print_op (string, indent, "repeating-radial-gradient");
|
||||
else
|
||||
gsk_gpu_print_op (string, indent, "radial-gradient");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_newline (string);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ gsk_gpu_renderer_dmabuf_downloader_download (GdkDmabufDownloader *downloader,
|
||||
frame = gsk_gpu_renderer_create_frame (self);
|
||||
|
||||
gsk_gpu_frame_download_texture (frame,
|
||||
g_get_monotonic_time (),
|
||||
g_get_monotonic_time(),
|
||||
GDK_TEXTURE (texture),
|
||||
format,
|
||||
data,
|
||||
@@ -301,7 +301,7 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
|
||||
|
||||
frame = gsk_gpu_renderer_create_frame (self);
|
||||
gsk_gpu_frame_render (frame,
|
||||
g_get_monotonic_time (),
|
||||
g_get_monotonic_time(),
|
||||
image,
|
||||
NULL,
|
||||
root,
|
||||
@@ -343,8 +343,6 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
||||
GdkTexture *texture;
|
||||
graphene_rect_t rounded_viewport;
|
||||
|
||||
gsk_gpu_device_maybe_gc (priv->device);
|
||||
|
||||
gsk_gpu_renderer_make_current (self);
|
||||
|
||||
rounded_viewport = GRAPHENE_RECT_INIT (viewport->origin.x,
|
||||
@@ -355,7 +353,6 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
||||
gsk_render_node_get_preferred_depth (root),
|
||||
rounded_viewport.size.width,
|
||||
rounded_viewport.size.height);
|
||||
|
||||
if (image == NULL)
|
||||
return gsk_gpu_renderer_fallback_render_texture (self, root, &rounded_viewport);
|
||||
|
||||
@@ -363,7 +360,7 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
texture = NULL;
|
||||
gsk_gpu_frame_render (frame,
|
||||
g_get_monotonic_time (),
|
||||
g_get_monotonic_time(),
|
||||
image,
|
||||
NULL,
|
||||
root,
|
||||
@@ -373,8 +370,6 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
||||
g_object_unref (frame);
|
||||
g_object_unref (image);
|
||||
|
||||
gsk_gpu_device_queue_gc (priv->device);
|
||||
|
||||
/* check that callback setting texture was actually called, as its technically async */
|
||||
g_assert (texture);
|
||||
|
||||
@@ -391,7 +386,7 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
|
||||
GskGpuFrame *frame;
|
||||
GskGpuImage *backbuffer;
|
||||
cairo_region_t *render_region;
|
||||
double scale;
|
||||
GdkSurface *surface;
|
||||
|
||||
if (cairo_region_is_empty (region))
|
||||
{
|
||||
@@ -403,30 +398,26 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
|
||||
gsk_render_node_get_preferred_depth (root),
|
||||
region);
|
||||
|
||||
gsk_gpu_device_maybe_gc (priv->device);
|
||||
|
||||
gsk_gpu_renderer_make_current (self);
|
||||
|
||||
backbuffer = GSK_GPU_RENDERER_GET_CLASS (self)->get_backbuffer (self);
|
||||
|
||||
frame = gsk_gpu_renderer_get_frame (self);
|
||||
render_region = get_render_region (self);
|
||||
scale = gsk_gpu_renderer_get_scale (self);
|
||||
surface = gdk_draw_context_get_surface (priv->context);
|
||||
|
||||
gsk_gpu_frame_render (frame,
|
||||
g_get_monotonic_time (),
|
||||
g_get_monotonic_time(),
|
||||
backbuffer,
|
||||
render_region,
|
||||
root,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0, 0,
|
||||
gsk_gpu_image_get_width (backbuffer) / scale,
|
||||
gsk_gpu_image_get_height (backbuffer) / scale
|
||||
gdk_surface_get_width (surface),
|
||||
gdk_surface_get_height (surface)
|
||||
),
|
||||
NULL);
|
||||
|
||||
gsk_gpu_device_queue_gc (priv->device);
|
||||
|
||||
gdk_draw_context_end_frame (priv->context);
|
||||
|
||||
g_clear_pointer (&render_region, cairo_region_destroy);
|
||||
|
||||
@@ -54,6 +54,7 @@ gsk_gpu_render_pass_type_to_vk_image_layout (GskRenderPassType type)
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case GSK_RENDER_PASS_PRESENT:
|
||||
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
case GSK_RENDER_PASS_OFFSCREEN:
|
||||
@@ -332,3 +333,38 @@ gsk_gpu_render_pass_end_op (GskGpuFrame *frame,
|
||||
self->target = g_object_ref (image);
|
||||
self->pass_type = pass_type;
|
||||
}
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gpu_render_pass_op_offscreen (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *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);
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
gsk_render_node_get_preferred_depth (node),
|
||||
width, height);
|
||||
|
||||
gsk_gpu_render_pass_begin_op (frame,
|
||||
image,
|
||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||
GSK_RENDER_PASS_OFFSCREEN);
|
||||
|
||||
gsk_gpu_node_processor_process (frame,
|
||||
image,
|
||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||
node,
|
||||
viewport);
|
||||
|
||||
gsk_gpu_render_pass_end_op (frame,
|
||||
image,
|
||||
GSK_RENDER_PASS_OFFSCREEN);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -23,5 +23,10 @@ void gsk_gpu_render_pass_end_op (GskGpuF
|
||||
GskGpuImage *image,
|
||||
GskRenderPassType pass_type);
|
||||
|
||||
GskGpuImage * gsk_gpu_render_pass_op_offscreen (GskGpuFrame *frame,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ gsk_gpu_rounded_color_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuRoundedcolorInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "rounded-color");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rounded_rect (string, instance->outline);
|
||||
gsk_gpu_print_rgba (string, instance->color);
|
||||
gsk_gpu_print_newline (string);
|
||||
|
||||
@@ -30,7 +30,6 @@ gsk_gpu_straight_alpha_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuStraightalphaInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "straight-alpha");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
|
||||
@@ -27,7 +27,6 @@ gsk_gpu_texture_op_print (GskGpuOp *op,
|
||||
instance = (GskGpuTextureInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
|
||||
|
||||
gsk_gpu_print_op (string, indent, "texture");
|
||||
gsk_gpu_print_shader_info (string, shader->clip);
|
||||
gsk_gpu_print_rect (string, instance->rect);
|
||||
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
|
||||
gsk_gpu_print_newline (string);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user