Compare commits
459 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c476c45007 | |||
| 5d05270ca7 | |||
| 34fb85afd1 | |||
| 05bc4a86c7 | |||
| 93302cc42d | |||
| 976f45e614 | |||
| befccc943a | |||
| ee5afdf919 | |||
| 49a6b5d50a | |||
| dd7a0cbeb7 | |||
| 38d808f3e2 | |||
| 16a608b9e5 | |||
| f1ff37e970 | |||
| 71c68f5f36 | |||
| 0d3265edc7 | |||
| 854e40c60c | |||
| 06f3b5dfd4 | |||
| 05acb70d1c | |||
| 7b380b2ffc | |||
| f6e4b964b7 | |||
| 0b2d08f076 | |||
| 1ad1a9fe4a | |||
| fe15db92bd | |||
| 682b7773fc | |||
| 9055b6c6e5 | |||
| 9fd56dc5ad | |||
| 1ec7f2bbcd | |||
| 4eb7208e35 | |||
| 1ad88f7662 | |||
| 96b30073cf | |||
| 456956a2bd | |||
| 4c794505da | |||
| f627c9443e | |||
| 06fa9befe0 | |||
| a95dc5d609 | |||
| 2abe588e91 | |||
| ecdee288a7 | |||
| e363fcca3c | |||
| f46fb7c6fc | |||
| 985d964a34 | |||
| 2a0286c19c | |||
| 9a05af61e8 | |||
| 68d2e9c068 | |||
| 89ba937fd3 | |||
| 840cd6f10f | |||
| cccfc1a38d | |||
| ff26aa2fa7 | |||
| 7192e67a6f | |||
| 5354b91e64 | |||
| c9c6b7bb2a | |||
| c93fa922dc | |||
| 8d7bfa2628 | |||
| e6a4cc8ba2 | |||
| 7926ee68b8 | |||
| 239d47791d | |||
| 33f210bc85 | |||
| 021aae84dd | |||
| e8508762f5 | |||
| a0bbdfbeee | |||
| f6561fc401 | |||
| dfe56c8b70 | |||
| 7f29b466be | |||
| 8f5a185ae5 | |||
| 309b28fa2c | |||
| e9f311e6b6 | |||
| 045262282b | |||
| a44701faa2 | |||
| eeee3151b6 | |||
| 0cd077e80f | |||
| 0e9b098f4e | |||
| 40b5002338 | |||
| 28fd3fbf50 | |||
| 10c782b106 | |||
| 5dd1803288 | |||
| 7e9f2e2311 | |||
| 610a5d6c0d | |||
| 5453628491 | |||
| 6e0596e122 | |||
| 0ca8d74842 | |||
| 04f8170841 | |||
| 1124793702 | |||
| 8d4b0f05da | |||
| ca8ba8ce87 | |||
| 849e3403cd | |||
| 02a7a30978 | |||
| 79568d2944 | |||
| ae45be7875 | |||
| 73e8b39bc6 | |||
| 72b2938e43 | |||
| 785aaa8c03 | |||
| 1d7983da05 | |||
| cb652c7f0f | |||
| a2b84fc98a | |||
| 0d9bbc9d64 | |||
| 6fd5e5f61c | |||
| b7285bd688 | |||
| 938e50c876 | |||
| e76bfcf2f6 | |||
| d828f2477e | |||
| 4d2bad4c11 | |||
| ed14df9738 | |||
| d75abc9104 | |||
| bc83969f6b | |||
| dff8e34bc9 | |||
| 6d9662cf8d | |||
| 2e6b32083e | |||
| b4b42a462a | |||
| a48a2a3dc9 | |||
| 9628599620 | |||
| 3a4d5ff5c3 | |||
| e7fa2571ca | |||
| ad719a9c47 | |||
| 0c4ea9bc7c | |||
| 24de5ffd4e | |||
| 4933bc505f | |||
| ecbee35f93 | |||
| 5552b5c0ec | |||
| 2baa899e32 | |||
| aaaddd1b47 | |||
| d4d4c7e119 | |||
| ea33264a87 | |||
| 4054f33221 | |||
| b6767d2eef | |||
| 90d84a2af8 | |||
| eb34311c2c | |||
| ea7ddc031c | |||
| 1ff17f1a7e | |||
| 8232ab4440 | |||
| bb82e3e1fb | |||
| 1702cdaff6 | |||
| a4583b03a1 | |||
| b12169776e | |||
| 85f85bbec8 | |||
| afc7b46264 | |||
| 86db9e2ce0 | |||
| 1afc7a9210 | |||
| cb6c720d37 | |||
| 35eae8751f | |||
| a246d1a995 | |||
| 718d68eccd | |||
| fb4023af22 | |||
| 370ecd5d15 | |||
| fdff21ae13 | |||
| 69500f356e | |||
| 3b794c4951 | |||
| 72614fdb67 | |||
| 230ee92857 | |||
| c6c952477a | |||
| fd4f22bba5 | |||
| 1e8d7c7891 | |||
| 73316a83c4 | |||
| b2d22d8125 | |||
| afb75bedfe | |||
| ee34781a13 | |||
| 9fc80a0bd5 | |||
| d4203d147a | |||
| a1dda0ec3c | |||
| f9b66dff8b | |||
| dbbc16947f | |||
| dc47abc60e | |||
| ca9ba3cc80 | |||
| 59f6218426 | |||
| f533d08537 | |||
| 230aa7899e | |||
| cc51604267 | |||
| 3b2622267d | |||
| 4fc05e7c64 | |||
| 4e680cae48 | |||
| d957e40a63 | |||
| d1bc8e580d | |||
| 5dadee1591 | |||
| ea7a61a763 | |||
| 8bd6927daf | |||
| 67912c1051 | |||
| 6314a5240d | |||
| e7f55d8706 | |||
| 671756cb13 | |||
| 7cf567b4f9 | |||
| 82e695d94a | |||
| 2104d7b062 | |||
| 6c4739a2f1 | |||
| f858daeca4 | |||
| efa0033fb4 | |||
| 546378e65c | |||
| a997dea414 | |||
| e75af999dc | |||
| e8dcbbe86f | |||
| 3c048caa30 | |||
| 925d2ba9ae | |||
| 645070ef7f | |||
| 2fe1f47e6d | |||
| db8f87d539 | |||
| a75d97c788 | |||
| ea9e414ad6 | |||
| c1bcbcdee5 | |||
| 8f293f3153 | |||
| 70380661fe | |||
| d91d0f1c0a | |||
| 1db696be79 | |||
| 9a30ea1f69 | |||
| 0495359eca | |||
| 1995b9d92c | |||
| 29c0babdda | |||
| 5b55456b75 | |||
| 70205f59a4 | |||
| df7889d7f3 | |||
| 26c25cc6b7 | |||
| 2cf90b6158 | |||
| f8e89f2224 | |||
| 30afac9a6b | |||
| dac56dd757 | |||
| e4ca3a285e | |||
| 30b5a33444 | |||
| e647ebae87 | |||
| 0b34af438f | |||
| a9949a102b | |||
| 90296dab76 | |||
| ed605f01a2 | |||
| bed3c6f807 | |||
| f6221835ef | |||
| 7e9ce1b266 | |||
| c40f29cb54 | |||
| d7afa91023 | |||
| 9bd6d431af | |||
| f126986c2b | |||
| 865564b32f | |||
| 3ae6da10b1 | |||
| 1b9002afd3 | |||
| 9e72260c3b | |||
| 9d52b4e269 | |||
| 6ed4eece04 | |||
| cfaddb5d47 | |||
| 7c861d8b59 | |||
| 1c3457adfb | |||
| a2e46c4d39 | |||
| df1d024059 | |||
| e492dac7fe | |||
| fabe0516fa | |||
| 84971b9076 | |||
| 5efc33fe65 | |||
| 52c228fd9e | |||
| 674b5b808e | |||
| af62aa4497 | |||
| 137a7096c3 | |||
| 703e5ab9a8 | |||
| e2dc94d0e8 | |||
| b821103d1e | |||
| b40c9d8dcd | |||
| 87b66de109 | |||
| e934a8984d | |||
| fa3bbed200 | |||
| d08412aaa4 | |||
| 56e7c4ab50 | |||
| 3be03ea56f | |||
| ac65495434 | |||
| 3a26e29795 | |||
| 21f64b987a | |||
| da227386ad | |||
| 1ac82528d9 | |||
| 50fb19b10d | |||
| 7c38945abf | |||
| be2dcdd897 | |||
| 16f91fc5d2 | |||
| 46cb0c5fc8 | |||
| 49e0ae8742 | |||
| 933ce71ec6 | |||
| 149e884658 | |||
| 4b34c10d05 | |||
| e4ec066337 | |||
| b734614aed | |||
| 7880095fd8 | |||
| 53519d7da1 | |||
| d418b0984c | |||
| e20b0b2a35 | |||
| 28cec6c9a7 | |||
| 887d5307ca | |||
| f6c84a435e | |||
| bff31f58a8 | |||
| 3921398e66 | |||
| f30c3d8133 | |||
| 9c0ca8803d | |||
| 5b184a10a9 | |||
| 0bfd4b232b | |||
| 269662c888 | |||
| 9c87dd503a | |||
| f2ec3e336f | |||
| 691ea8f11a | |||
| f9ba19c4de | |||
| 1319f41d46 | |||
| da024cfc90 | |||
| 6c6577dd6b | |||
| bfdd738d0b | |||
| 3cce78d02c | |||
| 5cc952fa3f | |||
| 7271eff628 | |||
| 42bc89688c | |||
| a4ff25485c | |||
| 55f6517751 | |||
| cefa09f74f | |||
| 906661d40b | |||
| 32abe5b8bb | |||
| cb9de9a48e | |||
| d823502af7 | |||
| 62774c2e53 | |||
| b885d288cc | |||
| da36a6a5d2 | |||
| 09ac592114 | |||
| 19fccb13c3 | |||
| c654cb0f37 | |||
| 6dfa6fe442 | |||
| a61c7f7871 | |||
| 8e4a235f56 | |||
| 3cb1b9d4cb | |||
| eaf944938b | |||
| 930fb24053 | |||
| 12069d2b91 | |||
| d3666f7b28 | |||
| 67e50a6cfd | |||
| 9e05ce18d9 | |||
| a77598d6ec | |||
| 9a2ba3053b | |||
| 7e71f1197b | |||
| 4e091b1791 | |||
| dcebddc908 | |||
| 6f67991e0e | |||
| 9bc4585247 | |||
| 305ef51684 | |||
| 0c61610699 | |||
| 99dd6c579d | |||
| 8f3d85007b | |||
| 7823e8120d | |||
| 5ff7b37b61 | |||
| d3e4d310b2 | |||
| 77c115c224 | |||
| c76fd1548e | |||
| da142e02be | |||
| 8602745858 | |||
| 3e3eda416c | |||
| 140ad373f7 | |||
| 7e9c18c16e | |||
| 88b3e8552a | |||
| a6f9bab8f3 | |||
| 12e15c0ee0 | |||
| 9216779963 | |||
| 2e669099a6 | |||
| 2a3a5753c1 | |||
| 88bed27f85 | |||
| b49b055183 | |||
| 988c7d1626 | |||
| f9acf3bb20 | |||
| 1b0f2cfeb8 | |||
| 26a342279f | |||
| ed38d9b662 | |||
| e8b249281d | |||
| 5483821ea0 | |||
| 05e25557e1 | |||
| f80989332f | |||
| 8df8d0bd5d | |||
| ea6ad66ee3 | |||
| 5ceb9a7692 | |||
| 216dbf1e88 | |||
| ff4db4ed71 | |||
| 57dde7e877 | |||
| 9581d060d2 | |||
| b4069ba15b | |||
| 63e44a34ae | |||
| afbd7cfe55 | |||
| ead1b36afd | |||
| 1ffa01b38a | |||
| f93601ed2b | |||
| e1722777e5 | |||
| 24850dff0e | |||
| d790268031 | |||
| 89712fc750 | |||
| 9b62a5c931 | |||
| fbf3836502 | |||
| 8d80f97597 | |||
| e6ec8133a5 | |||
| 6b436fdbbb | |||
| 7b2b5469eb | |||
| 3fc325d799 | |||
| dee6742931 | |||
| d2097d0449 | |||
| c7f00d51eb | |||
| f5308dfbec | |||
| 1097e1349c | |||
| d577e4421e | |||
| 1bac8b439a | |||
| ee52e98b7d | |||
| 5e4eda15c9 | |||
| e861ea4bd2 | |||
| 8009ed3a3c | |||
| 1d95a171f6 | |||
| e0136b283a | |||
| 42867c7a3c | |||
| 40f20fee3d | |||
| 63e814a45f | |||
| c1270cf52b | |||
| f2ec2f2a58 | |||
| e67bb62b1f | |||
| c17ac8c599 | |||
| ee8a800763 | |||
| 746cfe48b0 | |||
| 3a93d52718 | |||
| 1994e1940c | |||
| d74855fe9f | |||
| 979749a3bc | |||
| 29c7725416 | |||
| 3abf6acb16 | |||
| df8cf0e030 | |||
| 7952b2a0bc | |||
| c98e568583 | |||
| f90e77d173 | |||
| 98e3fca284 | |||
| a7c98227e6 | |||
| f2856e494c | |||
| dc1f12682c | |||
| 502fb250ab | |||
| 7d7d3ff35c | |||
| 9fb449793d | |||
| 3d88c44803 | |||
| b05000d8bd | |||
| 4b45adaf39 | |||
| 6f2d33369b | |||
| e08727fa47 | |||
| 7624e6621a | |||
| cdddb6cb96 | |||
| f6c01a7674 | |||
| ffa5bf1b7d | |||
| 4c6e623ec5 | |||
| 621ef0703a | |||
| f514caadb0 | |||
| 4d92093c67 | |||
| bd9ea05ebb | |||
| e8599bd36e | |||
| 1accd0c1ba | |||
| 14488041bc | |||
| c11b29583e | |||
| 9467243ac3 | |||
| 32f1f7280b | |||
| ff81104834 | |||
| 6e7893d527 | |||
| 6efe5eefd3 | |||
| d337eed643 | |||
| 296d44159b | |||
| 4ce9f9b3ac | |||
| 9fb37229a1 | |||
| c8299f5b3e | |||
| f019a325ef | |||
| f947aafc2e | |||
| 3e9f2aa4bb | |||
| a6ce506714 | |||
| 3b96cf3789 | |||
| 6d0cef41b4 | |||
| caf389c4e5 | |||
| 1237fd9ab5 | |||
| 1e5a9eb7b9 | |||
| 41fc0955f6 | |||
| f96c72c4b3 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
|
||||
# See https://www.apertis.org/policies/coding_conventions/#code-formatting
|
||||
BasedOnStyle: GNU
|
||||
AlwaysBreakAfterDefinitionReturnType: All
|
||||
BreakBeforeBinaryOperators: None
|
||||
|
||||
+32
-36
@@ -78,6 +78,7 @@ 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"
|
||||
@@ -209,51 +210,52 @@ msys2-mingw64:
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
|
||||
|
||||
macos-x86_64:
|
||||
macos:
|
||||
rules:
|
||||
# Do not run in forks as the runner is not available there.
|
||||
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
# (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
|
||||
stage: build
|
||||
parallel:
|
||||
matrix:
|
||||
- RUNNER: [ "macosintel", "macosarm" ]
|
||||
tags:
|
||||
- macosintel
|
||||
- ${RUNNER}
|
||||
needs: []
|
||||
variables:
|
||||
MESON_FORCE_BACKTRACKE: 1
|
||||
EXTRA_MESON_FLAGS: ""
|
||||
BACKEND_FLAGS: "-Dx11-backend=false -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dmedia-gstreamer=disabled -Dintrospection=enabled -Dgobject-introspection:werror=false"
|
||||
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:
|
||||
# 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
|
||||
- .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
|
||||
- source .venv/bin/activate
|
||||
- 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
|
||||
- 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.
|
||||
script:
|
||||
- meson setup
|
||||
${COMMON_MESON_FLAGS}
|
||||
${EXTRA_MESON_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
|
||||
${BACKEND_FLAGS}
|
||||
${FEATURE_FLAGS}
|
||||
_build
|
||||
- meson compile -C _build
|
||||
artifacts:
|
||||
@@ -428,13 +430,6 @@ 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
|
||||
@@ -484,3 +479,4 @@ 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,6 +3,11 @@
|
||||
set -eux -o pipefail
|
||||
|
||||
xcodebuild -version || :
|
||||
xcodebuild -showsdks || :
|
||||
|
||||
if [ -z "$SDKROOT" ]; then
|
||||
xcodebuild -showsdks || :
|
||||
else
|
||||
echo "SDKROOT = $SDKROOT"
|
||||
fi
|
||||
|
||||
system_profiler SPSoftwareDataType || :
|
||||
@@ -1,6 +1,182 @@
|
||||
Overview of Changes in 4.13.6, xx-xx-xxxx
|
||||
Overview of Changes in 4.13.9, 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,4 +1,5 @@
|
||||
/* 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,8 +68,9 @@ struct _NodeEditorWindow
|
||||
|
||||
GArray *errors;
|
||||
|
||||
guint update_timeout;
|
||||
gboolean auto_reload;
|
||||
gboolean mark_as_safe_pending;
|
||||
gulong after_paint_handler;
|
||||
};
|
||||
|
||||
struct _NodeEditorWindowClass
|
||||
@@ -245,6 +246,41 @@ 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)
|
||||
{
|
||||
@@ -253,6 +289,8 @@ 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));
|
||||
|
||||
@@ -314,6 +352,8 @@ reload (NodeEditorWindow *self)
|
||||
}
|
||||
|
||||
g_clear_pointer (&big_node, gsk_render_node_unref);
|
||||
|
||||
self->mark_as_safe_pending = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1125,9 +1165,6 @@ node_editor_window_finalize (GObject *object)
|
||||
{
|
||||
NodeEditorWindow *self = (NodeEditorWindow *)object;
|
||||
|
||||
if (self->update_timeout)
|
||||
g_source_remove (self->update_timeout);
|
||||
|
||||
g_array_free (self->errors, TRUE);
|
||||
|
||||
g_clear_pointer (&self->node, gsk_render_node_unref);
|
||||
@@ -1172,6 +1209,7 @@ 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);
|
||||
|
||||
@@ -1199,14 +1237,24 @@ 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);
|
||||
@@ -1746,16 +1794,16 @@ set_initial_text (NodeEditorWindow *self)
|
||||
path = get_autosave_path (NULL);
|
||||
path1 = get_autosave_path ("-unsafe");
|
||||
|
||||
if (g_file_get_contents (path, &initial_text, &len, NULL))
|
||||
{
|
||||
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
|
||||
g_free (initial_text);
|
||||
}
|
||||
else if (g_file_get_contents (path1, &initial_text, &len, NULL))
|
||||
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);
|
||||
}
|
||||
@@ -1806,41 +1854,6 @@ 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)
|
||||
{
|
||||
@@ -1905,7 +1918,7 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
|
||||
set_initial_text (self);
|
||||
|
||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (initiate_autosave), self);
|
||||
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
|
||||
|
||||
if (g_getenv ("GSK_RENDERER"))
|
||||
{
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
<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>
|
||||
@@ -213,6 +209,7 @@
|
||||
<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,6 +25,8 @@ 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,6 +24,8 @@ 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,6 +67,8 @@ 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,6 +36,8 @@ 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` and `media-ffmpeg`
|
||||
### `media-gstreamer`
|
||||
|
||||
By default, GTK will try to build the gstreamer backend for
|
||||
media playback support. These options can be used to explicitly
|
||||
|
||||
@@ -13,6 +13,7 @@ SYNOPSIS
|
||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||
@@ -75,7 +76,21 @@ and prints the runtimes.
|
||||
the execution of the commands on the GPU. It can be useful to use this flag to test
|
||||
command submission performance.
|
||||
|
||||
Compare
|
||||
^^^^^^^
|
||||
|
||||
The ``compare`` command compares the rendering of a node with a reference image,
|
||||
or the renderings of two nodes, or two images. If any differences are found, the
|
||||
exit code is 1. If the images are identical, it is 0.
|
||||
|
||||
``--renderer=RENDERER``
|
||||
|
||||
Use the given renderer.
|
||||
|
||||
``--output=FILE``
|
||||
|
||||
Save the differences as a png image in ``FILE``.
|
||||
|
||||
``--quiet``
|
||||
|
||||
Don't write results to stdout.`
|
||||
|
||||
@@ -85,6 +85,8 @@ 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',
|
||||
'ffmpeg' and 'none'. If set to 'none', media playback will be unavailable.
|
||||
depend on what options GTK was built with, and can include 'gstreamer'
|
||||
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-fractional`
|
||||
: Enable fractional scaling for OpenGL. This is experimental
|
||||
`gl-no-fractional`
|
||||
: Disable fractional scaling for OpenGL.
|
||||
|
||||
`gl-debug`
|
||||
: Insert debugging information in OpenGL
|
||||
@@ -460,6 +460,13 @@ 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.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,12 @@
|
||||
<?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>
|
||||
|
After 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-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
|
||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||
{ "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_FRACTIONAL = 1 << 17,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||
|
||||
+60
-1
@@ -77,6 +77,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_COMPOSITED,
|
||||
PROP_RGBA,
|
||||
PROP_SHADOW_WIDTH,
|
||||
PROP_INPUT_SHAPES,
|
||||
PROP_DMABUF_FORMATS,
|
||||
LAST_PROP
|
||||
@@ -111,6 +112,7 @@ struct _GdkDisplayPrivate {
|
||||
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint shadow_width: 1;
|
||||
guint input_shapes : 1;
|
||||
|
||||
GdkDebugFlags debug_flags;
|
||||
@@ -144,6 +146,10 @@ 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;
|
||||
@@ -243,6 +249,18 @@ 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)
|
||||
*
|
||||
@@ -254,7 +272,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:dmabuf-formats:
|
||||
* GdkDisplay:dmabuf-formats: (attributes org.gtk.Property.get=gdk_display_get_dmabuf_formats)
|
||||
*
|
||||
* The dma-buf formats that are supported on this display
|
||||
*
|
||||
@@ -391,6 +409,7 @@ gdk_display_init (GdkDisplay *display)
|
||||
|
||||
priv->composited = TRUE;
|
||||
priv->rgba = TRUE;
|
||||
priv->shadow_width = TRUE;
|
||||
priv->input_shapes = TRUE;
|
||||
}
|
||||
|
||||
@@ -2122,6 +2141,46 @@ 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,6 +63,8 @@ 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,6 +257,8 @@ 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);
|
||||
|
||||
+25
-1
@@ -2329,18 +2329,42 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
* @dmabuf: a sanitized GdkDmabuf
|
||||
*
|
||||
* A dmabuf is considered disjoint if it uses more than
|
||||
* 1 file descriptor.
|
||||
* 1 inode.
|
||||
* Multiple file descriptors may exist when the creator
|
||||
* of the dmabuf just dup()ed once for every plane...
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
+12
-1
@@ -154,6 +154,7 @@ 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);
|
||||
@@ -161,6 +162,7 @@ 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 ();
|
||||
|
||||
@@ -172,7 +174,11 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||
|
||||
if (!retval)
|
||||
return NULL;
|
||||
{
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
@@ -181,10 +187,15 @@ 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,3 +217,41 @@ 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,4 +51,8 @@ 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,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include "config.h"
|
||||
#ifdef HAVE_DRM_FOURCC_H
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/**
|
||||
* GdkDmabufTexture:
|
||||
*
|
||||
* A `GdkTexture` representing a dma-buf object.
|
||||
* A `GdkTexture` representing a DMA buffer.
|
||||
*
|
||||
* To create a `GdkDmabufTexture`, use the auxiliary
|
||||
* [class@Gdk.DmabufTextureBuilder] object.
|
||||
|
||||
+177
-42
@@ -309,67 +309,202 @@ typedef enum
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_R8G8B8A8_PREMULTIPLIED: 4 bytes; for red, green, blue, alpha
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_A8B8G8R8_PREMULTIPLIED: 4 bytes; for alpha, blue, green, red,
|
||||
* The color values are premultiplied with the alpha value. Since 4.14
|
||||
* @GDK_MEMORY_B8G8R8A8: 4 bytes; for blue, green, red, alpha.
|
||||
* @GDK_MEMORY_A8R8G8B8: 4 bytes; for alpha, red, green, blue.
|
||||
* @GDK_MEMORY_R8G8B8A8: 4 bytes; for red, green, blue, alpha.
|
||||
* @GDK_MEMORY_A8B8G8R8: 4 bytes; for alpha, blue, green, red.
|
||||
* @GDK_MEMORY_B8G8R8X8: 4 bytes; for blue, green, red, unused. Since 4.14
|
||||
* @GDK_MEMORY_X8R8G8B8: 4 bytes; for unused, red, green, blue. Since 4.14
|
||||
* @GDK_MEMORY_R8G8B8X8: 4 bytes; for red, green, blue, unused. Since 4.14
|
||||
* @GDK_MEMORY_X8B8G8R8: 4 bytes; for unused, blue, green, red. Since 4.14
|
||||
* @GDK_MEMORY_R8G8B8: 3 bytes; for red, green, blue. The data is opaque.
|
||||
* @GDK_MEMORY_B8G8R8: 3 bytes; for blue, green, red. The data is opaque.
|
||||
* @GDK_MEMORY_R16G16B16: 3 guint16 values; for red, green, blue. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_PREMULTIPLIED: 4 guint16 values; for red, green,
|
||||
* blue, alpha. The color values are premultiplied with the alpha value.
|
||||
* Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16: 4 guint16 values; for red, green, blue, alpha.
|
||||
* Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16_FLOAT: 3 half-float values; for red, green, blue.
|
||||
* The data is opaque. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED: 4 half-float values; for
|
||||
* red, green, blue and alpha. The color values are premultiplied with
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_FLOAT: 4 half-float values; for red, green,
|
||||
* blue and alpha. Since: 4.6
|
||||
* @GDK_MEMORY_B32G32R32_FLOAT: 3 float values; for blue, green, red.
|
||||
* The data is opaque. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: 4 float values; for
|
||||
* red, green, blue and alpha. The color values are premultiplied with
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
|
||||
* alpha. Since: 4.6
|
||||
* @GDK_MEMORY_G8A8_PREMULTIPLIED: 2 bytes; for grayscale, alpha. The color
|
||||
* values are premultiplied with the alpha value. Since: 4.12
|
||||
* @GDK_MEMORY_G8A8: 2 bytes; for grayscale, alpha. Since: 4.12
|
||||
* @GDK_MEMORY_G8: One byte; for grayscale. The data is opaque.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_G16A16_PREMULTIPLIED: 2 guint16 values; for grayscale, alpha.
|
||||
* The color values are premultiplied with the alpha value. Since: 4.12
|
||||
* @GDK_MEMORY_G16A16: 2 guint16 values; for grayscale, alpha. Since: 4.12
|
||||
* @GDK_MEMORY_G16: One guint16 value; for grayscale. The data is opaque.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_A8: One byte; for alpha.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_A16: One guint16 value; for alpha.
|
||||
* Since: 4.12
|
||||
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
|
||||
* more formats get added, so do not rely on its concrete integer.
|
||||
* @GDK_MEMORY_R32G32B32_FLOAT: 3 float values; for red, green, blue.
|
||||
*
|
||||
* `GdkMemoryFormat` describes formats that image data can have in memory.
|
||||
*
|
||||
* It describes formats by listing the contents of the memory passed to it.
|
||||
* So GDK_MEMORY_A8R8G8B8 will be 1 byte (8 bits) of alpha, followed by a
|
||||
* So `GDK_MEMORY_A8R8G8B8` will be 1 byte (8 bits) of alpha, followed by a
|
||||
* byte each of red, green and blue. It is not endian-dependent, so
|
||||
* CAIRO_FORMAT_ARGB32 is represented by different `GdkMemoryFormats`
|
||||
* `CAIRO_FORMAT_ARGB32` is represented by different `GdkMemoryFormats`
|
||||
* on architectures with different endiannesses.
|
||||
*
|
||||
* Its naming is modelled after
|
||||
* [VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat)
|
||||
* for details).
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A8B8G8R8_PREMULTIPLIED:
|
||||
*
|
||||
* 4 bytes; for alpha, blue, green, red, The color values are premultiplied with
|
||||
* the alpha value.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_B8G8R8X8:
|
||||
*
|
||||
* 4 bytes; for blue, green, red, unused.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_X8R8G8B8:
|
||||
*
|
||||
* 4 bytes; for unused, red, green, blue.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R8G8B8X8:
|
||||
*
|
||||
* 4 bytes; for red, green, blue, unused.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_X8B8G8R8:
|
||||
*
|
||||
* 4 bytes; for unused, blue, green, red.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16:
|
||||
*
|
||||
* 3 guint16 values; for red, green, blue.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16_PREMULTIPLIED:
|
||||
*
|
||||
* 4 guint16 values; for red, green, blue, alpha. The color values are
|
||||
* premultiplied with the alpha value.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16:
|
||||
*
|
||||
* 4 guint16 values; for red, green, blue, alpha.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16_FLOAT:
|
||||
*
|
||||
* 3 half-float values; for red, green, blue. The data is opaque.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED:
|
||||
*
|
||||
* 4 half-float values; for red, green, blue and alpha. The color values are
|
||||
* premultiplied with the alpha value.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R16G16B16A16_FLOAT:
|
||||
*
|
||||
* 4 half-float values; for red, green, blue and alpha.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_B32G32R32_FLOAT:
|
||||
*
|
||||
* 3 float values; for blue, green, red. The data is opaque.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED:
|
||||
*
|
||||
* 4 float values; for red, green, blue and alpha. The color values are
|
||||
* premultiplied with the alpha value.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_R32G32B32A32_FLOAT:
|
||||
*
|
||||
* 4 float values; for red, green, blue and alpha.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G8A8_PREMULTIPLIED:
|
||||
*
|
||||
* 2 bytes; for grayscale, alpha. The color values are premultiplied with the
|
||||
* alpha value.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G8A8:
|
||||
*
|
||||
* 2 bytes; for grayscale, alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G8:
|
||||
*
|
||||
* One byte; for grayscale. The data is opaque.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G16A16_PREMULTIPLIED:
|
||||
*
|
||||
* 2 guint16 values; for grayscale, alpha. The color values are premultiplied
|
||||
* with the alpha value.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G16A16:
|
||||
*
|
||||
* 2 guint16 values; for grayscale, alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_G16:
|
||||
*
|
||||
* One guint16 value; for grayscale. The data is opaque.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A8:
|
||||
*
|
||||
* One byte; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A16:
|
||||
*
|
||||
* One guint16 value; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A16_FLOAT:
|
||||
*
|
||||
* One half-float value; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
/**
|
||||
* GDK_MEMORY_A32_FLOAT:
|
||||
*
|
||||
* One float value; for alpha.
|
||||
*
|
||||
* Since: 4.12
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
|
||||
+4
-4
@@ -477,18 +477,18 @@ check_event_sanity (GdkEvent *event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
gboolean
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (!check_event_sanity (event))
|
||||
return;
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return;
|
||||
return TRUE;
|
||||
|
||||
gdk_surface_handle_event (event);
|
||||
return gdk_surface_handle_event (event);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
|
||||
@@ -619,16 +619,16 @@ typedef enum
|
||||
|
||||
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
|
||||
|
||||
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);
|
||||
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_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);
|
||||
|
||||
|
||||
+3
-6
@@ -79,6 +79,7 @@
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
@@ -98,10 +99,6 @@
|
||||
#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
|
||||
@@ -593,7 +590,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_FRACTIONAL))
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_NO_FRACTIONAL)
|
||||
scale = ceil (scale);
|
||||
|
||||
return scale;
|
||||
@@ -1718,7 +1715,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 ("OES_vertex_half_float");
|
||||
epoxy_has_gl_extension ("GL_OES_vertex_half_float");
|
||||
|
||||
priv->has_sync = gdk_gl_context_check_version (context, "3.2", "3.0") ||
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
|
||||
+74
-2
@@ -26,6 +26,8 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkrectangle.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* GdkMonitor:
|
||||
*
|
||||
@@ -46,6 +48,7 @@ enum {
|
||||
PROP_MODEL,
|
||||
PROP_CONNECTOR,
|
||||
PROP_SCALE_FACTOR,
|
||||
PROP_SCALE,
|
||||
PROP_GEOMETRY,
|
||||
PROP_WIDTH_MM,
|
||||
PROP_HEIGHT_MM,
|
||||
@@ -70,6 +73,8 @@ static void
|
||||
gdk_monitor_init (GdkMonitor *monitor)
|
||||
{
|
||||
monitor->scale_factor = 1;
|
||||
monitor->scale = 1.0;
|
||||
monitor->scale_set = FALSE;
|
||||
monitor->valid = TRUE;
|
||||
}
|
||||
|
||||
@@ -107,6 +112,10 @@ 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;
|
||||
@@ -233,13 +242,28 @@ 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,
|
||||
0, G_MAXINT,
|
||||
1, 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)
|
||||
*
|
||||
@@ -346,7 +370,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_factor]).
|
||||
* ”device pixels” (see [method@Gdk.Monitor.get_scale]).
|
||||
*/
|
||||
void
|
||||
gdk_monitor_get_geometry (GdkMonitor *monitor,
|
||||
@@ -472,6 +496,29 @@ 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`
|
||||
@@ -583,12 +630,37 @@ 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,6 +77,8 @@ 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,6 +44,8 @@ struct _GdkMonitor {
|
||||
int refresh_rate;
|
||||
GdkSubpixelLayout subpixel_layout;
|
||||
gboolean valid;
|
||||
double scale;
|
||||
gboolean scale_set;
|
||||
};
|
||||
|
||||
struct _GdkMonitorClass {
|
||||
@@ -64,7 +66,9 @@ void gdk_monitor_set_physical_size (GdkMonitor *monitor,
|
||||
int width_mm,
|
||||
int height_mm);
|
||||
void gdk_monitor_set_scale_factor (GdkMonitor *monitor,
|
||||
int scale);
|
||||
int scale_factor);
|
||||
void gdk_monitor_set_scale (GdkMonitor *monitor,
|
||||
double scale);
|
||||
void gdk_monitor_set_refresh_rate (GdkMonitor *monitor,
|
||||
int refresh_rate);
|
||||
void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
||||
|
||||
+108
-8
@@ -20,6 +20,7 @@
|
||||
#include "gdksubsurfaceprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gsk/gskrectprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkSubsurface, gdk_subsurface, G_TYPE_OBJECT)
|
||||
|
||||
@@ -55,19 +56,106 @@ 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 *rect,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
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 (rect != NULL, 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 (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, rect, above, sibling);
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -75,6 +163,8 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||
}
|
||||
|
||||
@@ -87,13 +177,23 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_subsurface_get_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (rect != NULL);
|
||||
g_return_if_fail (source != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_rect (subsurface, rect);
|
||||
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);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -101,5 +201,5 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->is_above_parent (subsurface);
|
||||
return subsurface->above_parent;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ struct _GdkSubsurface
|
||||
GdkSurface *parent;
|
||||
|
||||
int ref_count;
|
||||
|
||||
gboolean above_parent;
|
||||
GdkSubsurface *sibling_above;
|
||||
GdkSubsurface *sibling_below;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,14 +54,16 @@ struct _GdkSubsurfaceClass
|
||||
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean (* is_above_parent) (GdkSubsurface *subsurface);
|
||||
void (* get_source) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
@@ -65,13 +71,16 @@ 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 *rect,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
|
||||
|
||||
|
||||
@@ -99,6 +99,12 @@ 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
|
||||
@@ -345,8 +351,6 @@ 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,6 +142,9 @@ 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,
|
||||
|
||||
+23
-2
@@ -593,7 +593,8 @@ physical_device_check_features (VkPhysicalDevice device,
|
||||
v12_features.shaderStorageBufferArrayNonUniformIndexing)
|
||||
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
|
||||
|
||||
if (ycbcr_features.samplerYcbcrConversion)
|
||||
if (ycbcr_features.samplerYcbcrConversion ||
|
||||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
|
||||
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
@@ -1466,13 +1467,27 @@ 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);
|
||||
|
||||
@@ -1613,6 +1628,12 @@ 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,8 +398,7 @@ 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) &&
|
||||
GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated)
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface))
|
||||
gdk_surface_request_layout (GDK_SURFACE (gdk_surface));
|
||||
}
|
||||
|
||||
@@ -875,12 +874,21 @@ typedef NSString *CALayerContentsGravity;
|
||||
{
|
||||
NSWindowStyleMask style_mask = [self styleMask];
|
||||
|
||||
[self setHasShadow:decorated];
|
||||
|
||||
if (decorated)
|
||||
style_mask |= NSWindowStyleMaskTitled;
|
||||
{
|
||||
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleVisible];
|
||||
}
|
||||
else
|
||||
style_mask &= ~NSWindowStyleMaskTitled;
|
||||
{
|
||||
style_mask |= NSWindowStyleMaskFullSizeContentView;
|
||||
[self setTitleVisibility:NSWindowTitleHidden];
|
||||
}
|
||||
|
||||
[self setTitlebarAppearsTransparent:!decorated];
|
||||
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
|
||||
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
|
||||
|
||||
[self setStyleMask:style_mask];
|
||||
}
|
||||
|
||||
@@ -271,6 +271,11 @@ _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)
|
||||
{
|
||||
@@ -287,6 +292,7 @@ _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,6 +625,7 @@ 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,7 +734,14 @@ gdk_macos_event_source_dispatch (GSource *source,
|
||||
|
||||
if (event)
|
||||
{
|
||||
_gdk_event_emit (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_unref (event);
|
||||
}
|
||||
|
||||
@@ -545,6 +545,11 @@ 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)
|
||||
{
|
||||
@@ -667,6 +672,7 @@ 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;
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ gdk_deps = [
|
||||
platform_gio_dep,
|
||||
pangocairo_dep,
|
||||
vulkan_dep,
|
||||
dmabuf_dep,
|
||||
libdrm_dep,
|
||||
png_dep,
|
||||
tiff_dep,
|
||||
jpeg_dep,
|
||||
|
||||
@@ -266,10 +266,10 @@ _XcursorReadUInt (XcursorFile *file, XcursorUInt *u)
|
||||
|
||||
if ((*file->read) (file, bytes, 4) != 4)
|
||||
return XcursorFalse;
|
||||
*u = ((bytes[0] << 0) |
|
||||
(bytes[1] << 8) |
|
||||
(bytes[2] << 16) |
|
||||
(bytes[3] << 24));
|
||||
*u = ((((unsigned int)(bytes[0])) << 0) |
|
||||
(((unsigned int)(bytes[1])) << 8) |
|
||||
(((unsigned int)(bytes[2])) << 16) |
|
||||
(((unsigned int)(bytes[3])) << 24));
|
||||
return XcursorTrue;
|
||||
}
|
||||
|
||||
|
||||
@@ -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-contast", G_TYPE_NONE, { .b = FALSE } },
|
||||
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contrast", 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,15 +2430,49 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
|
||||
{
|
||||
GDK_DEBUG (MISC, "monitor %d changed position %d %d, size %d %d",
|
||||
monitor->id,
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height);
|
||||
monitor->output_geometry.x, monitor->output_geometry.y,
|
||||
monitor->output_geometry.width, monitor->output_geometry.height);
|
||||
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor),
|
||||
&(GdkRectangle) {
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height });
|
||||
GdkRectangle logical_geometry;
|
||||
gboolean needs_scaling = FALSE;
|
||||
double scale;
|
||||
|
||||
if (monitor_has_xdg_output (monitor) &&
|
||||
monitor->xdg_output_geometry.width != 0 &&
|
||||
monitor->xdg_output_geometry.height != 0)
|
||||
{
|
||||
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_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;
|
||||
|
||||
@@ -2456,8 +2490,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->x = x;
|
||||
monitor->y = y;
|
||||
monitor->xdg_output_geometry.x = x;
|
||||
monitor->xdg_output_geometry.y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2471,8 +2505,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->width = width;
|
||||
monitor->height = height;
|
||||
monitor->xdg_output_geometry.width = width;
|
||||
monitor->xdg_output_geometry.height = height;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2558,8 +2592,8 @@ output_handle_geometry (void *data,
|
||||
make, model,
|
||||
transform_to_string (transform));
|
||||
|
||||
monitor->x = x;
|
||||
monitor->y = y;
|
||||
monitor->output_geometry.x = x;
|
||||
monitor->output_geometry.y = y;
|
||||
|
||||
switch (transform)
|
||||
{
|
||||
@@ -2603,28 +2637,12 @@ 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);
|
||||
}
|
||||
@@ -2638,7 +2656,6 @@ 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);
|
||||
@@ -2646,9 +2663,8 @@ output_handle_mode (void *data,
|
||||
if ((flags & WL_OUTPUT_MODE_CURRENT) == 0)
|
||||
return;
|
||||
|
||||
scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
|
||||
monitor->width = width / scale;
|
||||
monitor->height = height / scale;
|
||||
monitor->output_geometry.width = width;
|
||||
monitor->output_geometry.height = height;
|
||||
gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh);
|
||||
|
||||
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
|
||||
|
||||
@@ -87,9 +87,8 @@ 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 (impl->has_pending_subsurface_commits)
|
||||
if (gdk_wayland_surface_needs_commit (surface))
|
||||
{
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
@@ -31,11 +31,10 @@ struct _GdkWaylandMonitor {
|
||||
gboolean added;
|
||||
|
||||
struct zxdg_output_v1 *xdg_output;
|
||||
/* Size and position, can be either from wl_output or xdg_output */
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
/* Raw wl_output data */
|
||||
GdkRectangle output_geometry;
|
||||
/* Raw xdg_output data */
|
||||
GdkRectangle xdg_output_geometry;
|
||||
char *name;
|
||||
char *description;
|
||||
gboolean wl_output_done;
|
||||
|
||||
@@ -129,6 +129,7 @@ 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,7 +3629,10 @@ 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->pads = g_list_remove (pad->current_tablet->pads, pad);
|
||||
pad->current_tablet = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -22,12 +22,11 @@ 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,7 +152,8 @@ get_wl_buffer (GdkWaylandSubsurface *self,
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
@@ -166,8 +167,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
graphene_rect_t device_rect;
|
||||
cairo_rectangle_int_t device_dest;
|
||||
|
||||
if (sib)
|
||||
will_be_above = sib->above_parent;
|
||||
if (sibling)
|
||||
will_be_above = sibling->above_parent;
|
||||
else
|
||||
will_be_above = above;
|
||||
|
||||
@@ -177,30 +178,37 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->dest.x = rect->origin.x;
|
||||
self->dest.y = rect->origin.y;
|
||||
self->dest.width = rect->size.width;
|
||||
self->dest.height = rect->size.height;
|
||||
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;
|
||||
|
||||
scale = gdk_fractional_scale_to_double (&parent->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_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_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 != rect->origin.x ||
|
||||
self->dest.y != rect->origin.y ||
|
||||
self->dest.width != rect->size.width ||
|
||||
self->dest.height != 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)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
|
||||
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
|
||||
rect->origin.x, rect->origin.y,
|
||||
rect->size.width, rect->size.height,
|
||||
dest->origin.x, dest->origin.y,
|
||||
dest->size.width, dest->size.height,
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture),
|
||||
self);
|
||||
@@ -296,6 +304,11 @@ 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)
|
||||
{
|
||||
@@ -322,8 +335,6 @@ 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
|
||||
{
|
||||
@@ -333,7 +344,6 @@ 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);
|
||||
@@ -373,23 +383,27 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_subsurface_get_rect (GdkSubsurface *sub,
|
||||
graphene_rect_t *rect)
|
||||
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
|
||||
graphene_rect_t *dest)
|
||||
{
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
rect->origin.x = self->dest.x;
|
||||
rect->origin.y = self->dest.y;
|
||||
rect->size.width = self->dest.width;
|
||||
rect->size.height = self->dest.height;
|
||||
dest->origin.x = self->dest.x;
|
||||
dest->origin.y = self->dest.y;
|
||||
dest->size.width = self->dest.width;
|
||||
dest->size.height = self->dest.height;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_subsurface_is_above_parent (GdkSubsurface *sub)
|
||||
static void
|
||||
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
|
||||
graphene_rect_t *source)
|
||||
{
|
||||
GdkWaylandSubsurface *self = (GdkWaylandSubsurface *)sub;
|
||||
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
|
||||
|
||||
return self->above_parent;
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -403,8 +417,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_rect = gdk_wayland_subsurface_get_rect;
|
||||
subsurface_class->is_above_parent = gdk_wayland_subsurface_is_above_parent;
|
||||
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
|
||||
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -478,8 +492,6 @@ 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_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
|
||||
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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -646,9 +646,12 @@ 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++)
|
||||
{
|
||||
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *)gdk_surface_get_subsurface (surface, i);
|
||||
if (sub->above_parent)
|
||||
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
|
||||
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *) subsurface;
|
||||
|
||||
if (subsurface->above_parent)
|
||||
continue;
|
||||
|
||||
if (sub->texture != NULL)
|
||||
cairo_region_subtract_rectangle (region, &sub->dest);
|
||||
}
|
||||
@@ -746,6 +749,18 @@ 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,6 +153,11 @@ 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)
|
||||
{
|
||||
@@ -182,6 +187,7 @@ 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;
|
||||
}
|
||||
|
||||
+21
-10
@@ -892,11 +892,11 @@ pixbuf_to_hicon (GdkPixbuf *pixbuf,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
static GdkWin32HCursor *
|
||||
gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
|
||||
GdkTexture *texture,
|
||||
int x,
|
||||
int y)
|
||||
HICON
|
||||
_gdk_win32_create_hicon_for_texture (GdkTexture *texture,
|
||||
gboolean is_icon,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -906,13 +906,24 @@ gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
|
||||
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, FALSE, x, y);
|
||||
|
||||
|
||||
icon = pixbuf_to_hicon (pixbuf, is_icon, 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,6 +1064,7 @@ 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,6 +117,11 @@ 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)
|
||||
{
|
||||
@@ -127,6 +132,7 @@ 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,6 +116,11 @@ 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,
|
||||
@@ -126,7 +131,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 17
|
||||
#define PIXEL_ATTRIBUTES 21
|
||||
|
||||
static int
|
||||
get_wgl_pfd (HDC hdc,
|
||||
@@ -171,10 +176,19 @@ 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))
|
||||
@@ -200,7 +214,7 @@ get_wgl_pfd (HDC hdc,
|
||||
pfd->iPixelType = PFD_TYPE_RGBA;
|
||||
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||
pfd->cAlphaBits = 8;
|
||||
pfd->dwLayerMask = PFD_MAIN_PLANE;
|
||||
pfd->iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
best_pf = ChoosePixelFormat (hdc, pfd);
|
||||
}
|
||||
@@ -599,7 +613,7 @@ set_wgl_pixformat_for_hdc (GdkWin32Display *display_win32,
|
||||
{
|
||||
gboolean skip_acquire = FALSE;
|
||||
gboolean set_pixel_format_result = FALSE;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
PIXELFORMATDESCRIPTOR pfd = {0};
|
||||
|
||||
/* one is only allowed to call SetPixelFormat(), and so ChoosePixelFormat()
|
||||
* one single time per window HDC
|
||||
@@ -809,6 +823,8 @@ 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,6 +211,11 @@ 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,6 +4308,82 @@ 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)
|
||||
@@ -4738,6 +4814,8 @@ 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,6 +74,11 @@ 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)
|
||||
{
|
||||
@@ -82,6 +87,7 @@ 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,6 +1429,9 @@ gdk_x11_display_open (const char *display_name)
|
||||
int ignore;
|
||||
int maj, min;
|
||||
char *cm_name;
|
||||
gboolean frame_extents;
|
||||
gboolean rgba;
|
||||
gboolean composited;
|
||||
|
||||
XInitThreads ();
|
||||
|
||||
@@ -1643,6 +1646,13 @@ 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"));
|
||||
rgba = gdk_display_is_rgba (display);
|
||||
composited = gdk_display_is_composited (display);
|
||||
|
||||
gdk_display_set_shadow_width (display, frame_extents && rgba && composited);
|
||||
|
||||
gdk_display_emit_opened (display);
|
||||
|
||||
return display;
|
||||
|
||||
@@ -316,7 +316,10 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
||||
for (i = 0; i < buffer_age - 1; i++)
|
||||
{
|
||||
if (context->old_updated_area[i] == NULL)
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
{
|
||||
cairo_region_destroy (damage);
|
||||
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,6 +2655,7 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
|
||||
{
|
||||
GdkX11Surface *impl;
|
||||
Window root;
|
||||
Window child;
|
||||
int tx;
|
||||
int ty;
|
||||
guint twidth;
|
||||
@@ -2669,7 +2670,11 @@ 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)
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <graphene.h>
|
||||
#include <math.h>
|
||||
#include "gsktypesprivate.h"
|
||||
#include "scaleprivate.h"
|
||||
#include "pointprivate.h"
|
||||
|
||||
#ifndef USE_SIMD
|
||||
|
||||
struct _Box
|
||||
{
|
||||
float x0, y0, x1, y1;
|
||||
};
|
||||
|
||||
static inline float
|
||||
box_x0 (const Box box)
|
||||
{
|
||||
return box.x0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y0 (const Box box)
|
||||
{
|
||||
return box.y0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_x1 (const Box box)
|
||||
{
|
||||
return box.x1;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y1 (const Box box)
|
||||
{
|
||||
return box.y1;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_width (const Box box)
|
||||
{
|
||||
return box.x1 - box.x0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_height (const Box box)
|
||||
{
|
||||
return box.y1 - box.y0;
|
||||
}
|
||||
|
||||
/* Assumes x0 <= x1 && y0 <= y1 */
|
||||
static inline Box
|
||||
box (float x0,
|
||||
float y0,
|
||||
float x1,
|
||||
float y1)
|
||||
{
|
||||
return (Box) { .x0 = x0, .y0 = y0, .x1 = x1, .y1 = y1 };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_rect (float x,
|
||||
float y,
|
||||
float w,
|
||||
float h)
|
||||
{
|
||||
return box (x, y, x + w, y + h);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_graphene (const graphene_rect_t *rect)
|
||||
{
|
||||
return box_from_rect (rect->origin.x,
|
||||
rect->origin.y,
|
||||
rect->size.width,
|
||||
rect->size.height);
|
||||
}
|
||||
|
||||
/* Assumes p0.x <= p1.x && p0.y <= p1.y */
|
||||
static inline Box
|
||||
box_from_points (Point p0,
|
||||
Point p1)
|
||||
{
|
||||
return box (p0.x, p0.y, p1.x, p1.y);
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_origin (const Box box)
|
||||
{
|
||||
return point (box.x0, box.y0);
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_opposite (const Box box)
|
||||
{
|
||||
return point (box.x1, box.y1);
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_to_float (const Box box,
|
||||
float v[4])
|
||||
{
|
||||
v[0] = box.x0;
|
||||
v[1] = box.y0;
|
||||
v[2] = box.x1 - box.x0;
|
||||
v[3] = box.y1 - box.y0;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_inset (const Box box,
|
||||
float dx,
|
||||
float dy)
|
||||
{
|
||||
return (Box) { .x0 = box.x0 + dx, .y0 = box.y0 + dy,
|
||||
.x1 = box.x1 - dx, .y1 = box.y1 - dy };
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_intersect (const Box box1,
|
||||
const Box box2,
|
||||
Box *box)
|
||||
{
|
||||
Box b;
|
||||
|
||||
b.x0 = MAX (box1.x0, box2.x0);
|
||||
b.y0 = MAX (box1.y0, box2.y0);
|
||||
b.x1 = MIN (box1.x1, box2.x1);
|
||||
b.y1 = MIN (box1.y1, box2.y1);
|
||||
|
||||
if (b.x0 <= b.x1 && b.y0 <= b.x1)
|
||||
{
|
||||
if (box)
|
||||
*box = b;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_equal (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
return memcmp (&box1, &box2, sizeof (Box)) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_contains (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
Box box;
|
||||
|
||||
if (box_intersect (box1, box2, &box))
|
||||
return box_equal (box, box2);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_empty (const Box box)
|
||||
{
|
||||
return box.x0 == box.x1 || box.y0 == box.y1;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_add (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .x0 = box.x0 + offset.x, .y0 = box.y0 + offset.y,
|
||||
.x1 = box.x1 + offset.x, .y1 = box.y1 + offset.y };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_sub (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .x0 = box.x0 - offset.x, .y0 = box.y0 - offset.y,
|
||||
.x1 = box.x1 - offset.x, .y1 = box.y1 - offset.y };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_mul (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
Box b = (Box) { .x0 = box.x0 * scale.x, .y0 = box.y0 * scale.y,
|
||||
.x1 = box.x1 * scale.x, .y1 = box.y1 * scale.y };
|
||||
|
||||
if (G_UNLIKELY (scale.x < 0 || scale.y < 0))
|
||||
return (Box) { .x0 = MIN (b.x0, b.x1), .y0 = MIN (b.y0, b.y1),
|
||||
.x1 = MAX (b.x0, b.x1), .y1 = MAX (b.y0, b.y1) };
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_div (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
return box_mul (box, scale_inv (scale));
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_offset_to_float (const Box box,
|
||||
const Point offset,
|
||||
float v[4])
|
||||
{
|
||||
box_to_float (box_add (box, offset), v);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_round_larger (const Box box)
|
||||
{
|
||||
return (Box) { .x0 = floorf (box.x0), .y0 = floorf (box.y0),
|
||||
.x1 = ceilf (box.x1), .y1 = ceilf (box.y1) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_round_to_pixels (const Box box,
|
||||
const Scale scale,
|
||||
const Point offset)
|
||||
{
|
||||
return box_sub (box_div (box_round_larger (box_mul (box_add (box, offset), scale)), scale), offset);
|
||||
}
|
||||
|
||||
#else /* USE_SIMD */
|
||||
|
||||
struct _Box
|
||||
{
|
||||
GRAPHENE_ALIGNED_DECL (graphene_simd4f_t v, 16);
|
||||
};
|
||||
|
||||
static inline float
|
||||
box_x0 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_x (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y0 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_y (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_x1 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_z (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_y1 (const Box box)
|
||||
{
|
||||
return graphene_simd4f_get_w (box.v);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_width (const Box box)
|
||||
{
|
||||
return box_x1 (box) - box_x0 (box);
|
||||
}
|
||||
|
||||
static inline float
|
||||
box_height (const Box box)
|
||||
{
|
||||
return box_y1 (box) - box_y0 (box);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box (float x0,
|
||||
float y0,
|
||||
float x1,
|
||||
float y1)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_init (x0, y0, x1, y1) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_rect (float x,
|
||||
float y,
|
||||
float w,
|
||||
float h)
|
||||
{
|
||||
return box (x, y, x + w, y + h);
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_from_graphene (const graphene_rect_t *rect)
|
||||
{
|
||||
return box_from_rect (rect->origin.x,
|
||||
rect->origin.y,
|
||||
rect->size.width,
|
||||
rect->size.height);
|
||||
}
|
||||
|
||||
/* { a[0], a[1], b[0], b[1] } */
|
||||
# define graphene_simd4f_splat_xyxy(a,b) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_shuffle_ps ((a), (b), _MM_SHUFFLE (1, 0, 1, 0)); \
|
||||
}))
|
||||
|
||||
static inline Box
|
||||
box_from_points (Point p0,
|
||||
Point p1)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_splat_xyxy (p0.v, p1.v) };
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_origin (const Box box)
|
||||
{
|
||||
return (Point) { .v = graphene_simd4f_zero_zw (box.v) };
|
||||
}
|
||||
|
||||
static inline Point
|
||||
box_opposite (const Box box)
|
||||
{
|
||||
return (Point) { .v = graphene_simd4f_zero_zw (graphene_simd4f_shuffle_zwxy (box.v)) };
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_to_float (const Box box,
|
||||
float v[4])
|
||||
{
|
||||
graphene_simd4f_dup_4f (box.v, v);
|
||||
v[2] -= v[0];
|
||||
v[3] -= v[1];
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_inset (const Box box,
|
||||
float dx,
|
||||
float dy)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_add (box.v, graphene_simd4f_init (dx, dy, -dx, -dy)) };
|
||||
}
|
||||
|
||||
/* return a[0] < b[0] && a[1] < b[1] */
|
||||
#ifndef graphene_simd4f_cmple_xy
|
||||
# define graphene_simd4f_cmple_xy(a,b) \
|
||||
(__extension__ ({ \
|
||||
__m128i __res = (__m128i) _mm_cmple_ps ((a), (b)); \
|
||||
(bool) ((_mm_movemask_epi8 (__res) & 0xff) == 0xff); \
|
||||
}))
|
||||
#endif
|
||||
|
||||
static inline gboolean
|
||||
box_intersect (const Box box1,
|
||||
const Box box2,
|
||||
Box *box)
|
||||
{
|
||||
graphene_simd4f_t s, t, t1;
|
||||
|
||||
s = graphene_simd4f_max (box1.v, box2.v);
|
||||
t = graphene_simd4f_min (box1.v, box2.v);
|
||||
t1 = graphene_simd4f_shuffle_zwxy (t);
|
||||
|
||||
if (graphene_simd4f_cmple_xy (s, t1))
|
||||
{
|
||||
if (box)
|
||||
box->v = graphene_simd4f_splat_xyxy (s, t);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_equal (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
return (gboolean) !!graphene_simd4f_cmp_eq (box1.v, box2.v);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_contains (const Box box1,
|
||||
const Box box2)
|
||||
{
|
||||
Box box;
|
||||
|
||||
if (box_intersect (box1, box2, &box))
|
||||
return box_equal (box, box2);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
box_empty (const Box box)
|
||||
{
|
||||
/* FIXME simd */
|
||||
return box_x0 (box) == box_x1 (box) || box_y0 (box) == box_y1 (box);
|
||||
}
|
||||
|
||||
/* a splat variation */
|
||||
#ifndef graphene_simd4f_shuffle_xyxy
|
||||
# define graphene_simd4f_shuffle_xyxy(v) \
|
||||
(__extension__ ({ \
|
||||
(graphene_simd4f_t) _mm_shuffle_ps ((v), (v), _MM_SHUFFLE (1, 0, 1, 0)); \
|
||||
}))
|
||||
#endif
|
||||
|
||||
static inline Box
|
||||
box_add (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_add (box.v, graphene_simd4f_shuffle_xyxy (offset.v)) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_sub (const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
return (Box) { .v = graphene_simd4f_sub (box.v, graphene_simd4f_shuffle_xyxy (offset.v)) };
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_mul (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
Box b = (Box) { .v = graphene_simd4f_mul (box.v, graphene_simd4f_shuffle_xyxy (scale.v)) };
|
||||
|
||||
if (G_UNLIKELY (!graphene_simd4f_cmple_xy (graphene_simd4f_init (0, 0, 0, 0), scale.v)))
|
||||
{
|
||||
graphene_simd4f_t v = graphene_simd4f_shuffle_zwxy (b.v);
|
||||
graphene_simd4f_t s = graphene_simd4f_min (b.v, v);
|
||||
graphene_simd4f_t t = graphene_simd4f_max (b.v, v);
|
||||
|
||||
return (Box) { .v = graphene_simd4f_splat_xyxy (s, t) };
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline Box
|
||||
box_div (const Box box,
|
||||
const Scale scale)
|
||||
{
|
||||
return box_mul (box, scale_inv (scale));
|
||||
}
|
||||
|
||||
static inline void
|
||||
box_offset_to_float (const Box box,
|
||||
const Point offset,
|
||||
float v[4])
|
||||
{
|
||||
box_to_float (box_add (box, offset), v);
|
||||
}
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
|
||||
static inline Box
|
||||
box_round_larger (const Box box)
|
||||
{
|
||||
return { (Box) .v = graphene_simd4f_splat_xyxy (graphene_simd4f_floor (b.v), graphene_simd4f_ceil (b.v)) };
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline Box
|
||||
box_round_larger (const Box b)
|
||||
{
|
||||
return box (floorf (box_x0 (b)),
|
||||
floorf (box_y0 (b)),
|
||||
ceilf (box_x1 (b)),
|
||||
ceilf (box_y1 (b)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline Box
|
||||
box_round_to_pixels (const Box box,
|
||||
const Scale scale,
|
||||
const Point offset)
|
||||
{
|
||||
return box_sub (box_div (box_round_larger (box_mul (box_add (box, offset), scale)), scale), offset);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1066,8 +1066,7 @@ 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);
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
|
||||
/* 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);
|
||||
graphene_rect_scale (&viewport, downscale_x, downscale_y, &viewport);
|
||||
gsk_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;
|
||||
|
||||
graphene_rect_scale (&job->current_clip->rect.bounds, scale_x, scale_y, &new_clip.bounds);
|
||||
gsk_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,6 +125,12 @@ 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)
|
||||
{
|
||||
@@ -151,6 +157,7 @@ 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;
|
||||
}
|
||||
@@ -235,7 +242,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 2.0 is not supported by this renderer."));
|
||||
_("OpenGL ES 3.0 is not supported by this renderer."));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,8 +144,7 @@ gsk_gl_frame_submit (GskGpuFrame *frame,
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glEnable (GL_BLEND);
|
||||
|
||||
if (vertex_buffer)
|
||||
|
||||
+11
-1
@@ -43,7 +43,7 @@ gsk_gl_image_finalize (GObject *object)
|
||||
{
|
||||
GskGLImage *self = GSK_GL_IMAGE (object);
|
||||
|
||||
if (self->framebuffer_id)
|
||||
if (self->texture_id && self->framebuffer_id)
|
||||
glDeleteFramebuffers (1, &self->framebuffer_id);
|
||||
|
||||
if (self->owns_texture)
|
||||
@@ -70,6 +70,7 @@ gsk_gl_image_init (GskGLImage *self)
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gl_image_new_backbuffer (GskGLDevice *device,
|
||||
GdkGLContext *context,
|
||||
GdkMemoryFormat format,
|
||||
gsize width,
|
||||
gsize height)
|
||||
@@ -95,6 +96,13 @@ 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);
|
||||
}
|
||||
|
||||
@@ -187,6 +195,8 @@ 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,6 +11,7 @@ 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,6 +28,7 @@ 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,6 +36,9 @@ 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;
|
||||
@@ -72,6 +75,9 @@ 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,7 +85,6 @@ 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;
|
||||
@@ -160,7 +159,6 @@ 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,6 +31,8 @@ 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,6 +36,7 @@ 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,6 +31,7 @@ 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,42 +301,3 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
return GSK_GPU_SHADER_CLIP_ROUNDED;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsk_gpu_clip_contains_box (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box)
|
||||
{
|
||||
Box b = box_add (*box, *offset);
|
||||
|
||||
switch (self->type)
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
case GSK_GPU_CLIP_ALL_CLIPPED:
|
||||
return FALSE;
|
||||
|
||||
case GSK_GPU_CLIP_NONE:
|
||||
case GSK_GPU_CLIP_CONTAINED:
|
||||
case GSK_GPU_CLIP_RECT:
|
||||
return box_contains (box_from_graphene (&self->rect.bounds), b);
|
||||
|
||||
case GSK_GPU_CLIP_ROUNDED:
|
||||
return gsk_rounded_rect_contains_rect (&self->rect, &GRAPHENE_RECT_INIT (box_x0 (b), box_y0 (b), box_width (b), box_height (b)));
|
||||
}
|
||||
}
|
||||
|
||||
GskGpuShaderClip
|
||||
gsk_gpu_clip_get_shader_clip2 (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box)
|
||||
{
|
||||
if (self->type == GSK_GPU_CLIP_NONE ||
|
||||
self->type == GSK_GPU_CLIP_CONTAINED ||
|
||||
gsk_gpu_clip_contains_box (self, offset, box))
|
||||
return GSK_GPU_SHADER_CLIP_NONE;
|
||||
else if (self->type == GSK_GPU_CLIP_RECT)
|
||||
return GSK_GPU_SHADER_CLIP_RECT;
|
||||
else
|
||||
return GSK_GPU_SHADER_CLIP_ROUNDED;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <graphene.h>
|
||||
#include <gsk/gskroundedrect.h>
|
||||
#include "boxprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -66,16 +65,9 @@ gboolean gsk_gpu_clip_contains_rect (const G
|
||||
gboolean gsk_gpu_clip_may_intersect_rect (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *rect) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
|
||||
const graphene_point_t *offset,
|
||||
const graphene_rect_t *rect);
|
||||
|
||||
gboolean gsk_gpu_clip_contains_box (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GskGpuShaderClip gsk_gpu_clip_get_shader_clip2 (const GskGpuClip *self,
|
||||
const Point *offset,
|
||||
const Box *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ 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,6 +27,7 @@ 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,6 +28,7 @@ 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,6 +29,7 @@ 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,6 +27,7 @@ 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);
|
||||
|
||||
+436
-95
@@ -3,10 +3,15 @@
|
||||
#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"
|
||||
#include "gsk/gskprivate.h"
|
||||
|
||||
#define MAX_SLICES_PER_ATLAS 64
|
||||
|
||||
@@ -14,6 +19,13 @@
|
||||
|
||||
#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;
|
||||
@@ -21,6 +33,37 @@ typedef struct _GskGpuCachedGlyph GskGpuCachedGlyph;
|
||||
typedef struct _GskGpuCachedTexture GskGpuCachedTexture;
|
||||
typedef struct _GskGpuDevicePrivate GskGpuDevicePrivate;
|
||||
|
||||
typedef struct {
|
||||
PangoFont *font;
|
||||
float scale;
|
||||
} FontCacheKey;
|
||||
|
||||
typedef struct {
|
||||
PangoGlyph glyph;
|
||||
GskGpuGlyphLookupFlags flags;
|
||||
} GlyphCacheKey;
|
||||
|
||||
typedef struct {
|
||||
FontCacheKey key;
|
||||
|
||||
GHashTable *cache;
|
||||
} FontGlyphCache;
|
||||
|
||||
static void
|
||||
font_glyph_cache_free (gpointer data)
|
||||
{
|
||||
FontGlyphCache *cache = data;
|
||||
|
||||
g_object_unref (cache->key.font);
|
||||
g_hash_table_unref (cache->cache);
|
||||
g_free (cache);
|
||||
}
|
||||
|
||||
static FontGlyphCache no_font_cache = {
|
||||
.key = { .font = NULL, .scale = -1 },
|
||||
.cache = NULL
|
||||
};
|
||||
|
||||
struct _GskGpuDevicePrivate
|
||||
{
|
||||
GdkDisplay *display;
|
||||
@@ -29,11 +72,15 @@ 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;
|
||||
FontGlyphCache *last_font_cache;
|
||||
|
||||
GskGpuCachedAtlas *current_atlas;
|
||||
|
||||
/* atomic */ gsize dead_texture_pixels;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GskGpuDevice, gsk_gpu_device, G_TYPE_OBJECT)
|
||||
@@ -54,12 +101,35 @@ struct _GskGpuCachedClass
|
||||
struct _GskGpuCached
|
||||
{
|
||||
const GskGpuCachedClass *class;
|
||||
|
||||
GskGpuCachedAtlas *atlas;
|
||||
GskGpuCached *next;
|
||||
GskGpuCached *prev;
|
||||
|
||||
gint64 timestamp;
|
||||
|
||||
unsigned int stale : 1;
|
||||
unsigned int pixels : 31; /* 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)
|
||||
@@ -75,6 +145,8 @@ gsk_gpu_cached_free (GskGpuDevice *device,
|
||||
else
|
||||
priv->first_cached = cached->next;
|
||||
|
||||
mark_as_stale (cached, TRUE);
|
||||
|
||||
cached->class->free (device, cached);
|
||||
}
|
||||
|
||||
@@ -114,7 +186,21 @@ gsk_gpu_cached_use (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
/* FIXME */
|
||||
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;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -137,10 +223,23 @@ 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);
|
||||
}
|
||||
|
||||
@@ -149,8 +248,7 @@ gsk_gpu_cached_atlas_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
return cached->pixels > MAX_DEAD_PIXELS;
|
||||
}
|
||||
|
||||
static const GskGpuCachedClass GSK_GPU_CACHED_ATLAS_CLASS =
|
||||
@@ -178,7 +276,14 @@ struct _GskGpuCachedTexture
|
||||
{
|
||||
GskGpuCached parent;
|
||||
|
||||
/* atomic */ GdkTexture *texture;
|
||||
/* 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;
|
||||
GskGpuImage *image;
|
||||
};
|
||||
|
||||
@@ -186,14 +291,37 @@ static void
|
||||
gsk_gpu_cached_texture_free (GskGpuDevice *device,
|
||||
GskGpuCached *cached)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
|
||||
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
|
||||
gboolean texture_still_alive;
|
||||
gpointer key, value;
|
||||
|
||||
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
|
||||
g_object_unref (self->image);
|
||||
|
||||
if (!texture_still_alive)
|
||||
g_free (self);
|
||||
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;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -201,8 +329,10 @@ gsk_gpu_cached_texture_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
|
||||
|
||||
return gsk_gpu_cached_is_old (device, cached, timestamp) ||
|
||||
gsk_gpu_cached_texture_is_invalid (self);
|
||||
}
|
||||
|
||||
static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
|
||||
@@ -212,16 +342,19 @@ 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 *cache = data;
|
||||
gboolean cache_still_alive;
|
||||
GskGpuCachedTexture *self = data;
|
||||
|
||||
cache_still_alive = g_atomic_pointer_exchange (&cache->texture, NULL) != NULL;
|
||||
if (!gsk_gpu_cached_texture_is_invalid (self))
|
||||
g_atomic_pointer_add (self->dead_pixels_counter, ((GskGpuCached *) self)->pixels);
|
||||
|
||||
if (!cache_still_alive)
|
||||
g_free (cache);
|
||||
if (g_atomic_int_dec_and_test (&self->use_count))
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
static GskGpuCachedTexture *
|
||||
@@ -235,18 +368,19 @@ 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_object_weak_unref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
|
||||
}
|
||||
g_hash_table_remove (priv->texture_cache, texture);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -260,10 +394,8 @@ struct _GskGpuCachedGlyph
|
||||
{
|
||||
GskGpuCached parent;
|
||||
|
||||
PangoFont *font;
|
||||
PangoGlyph glyph;
|
||||
GskGpuGlyphLookupFlags flags;
|
||||
float scale;
|
||||
FontGlyphCache *font_cache;
|
||||
GlyphCacheKey glyph_key;
|
||||
|
||||
GskGpuImage *image;
|
||||
graphene_rect_t bounds;
|
||||
@@ -274,9 +406,19 @@ static void
|
||||
gsk_gpu_cached_glyph_free (GskGpuDevice *device,
|
||||
GskGpuCached *cached)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
|
||||
GskGpuCachedGlyph *self = (GskGpuCachedGlyph *) cached;
|
||||
FontGlyphCache *font_cache;
|
||||
|
||||
font_cache = self->font_cache;
|
||||
g_hash_table_remove (font_cache->cache, self);
|
||||
if (g_hash_table_size (font_cache->cache) == 0)
|
||||
{
|
||||
if (priv->last_font_cache == font_cache)
|
||||
priv->last_font_cache = &no_font_cache;
|
||||
g_hash_table_remove (priv->glyph_cache, font_cache);
|
||||
}
|
||||
|
||||
g_object_unref (self->font);
|
||||
g_object_unref (self->image);
|
||||
|
||||
g_free (self);
|
||||
@@ -287,19 +429,47 @@ gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
|
||||
GskGpuCached *cached,
|
||||
gint64 timestamp)
|
||||
{
|
||||
/* FIXME */
|
||||
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 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static guint
|
||||
gsk_gpu_cached_font_hash (gconstpointer data)
|
||||
{
|
||||
const FontGlyphCache *cache = data;
|
||||
const FontCacheKey *key = &cache->key;
|
||||
|
||||
return GPOINTER_TO_UINT (key->font) ^ ((guint) key->scale * PANGO_SCALE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gsk_gpu_cached_font_equal (gconstpointer v1,
|
||||
gconstpointer v2)
|
||||
{
|
||||
const FontGlyphCache *c1 = v1;
|
||||
const FontCacheKey *key1 = &c1->key;
|
||||
const FontGlyphCache *c2 = v2;
|
||||
const FontCacheKey *key2 = &c2->key;
|
||||
|
||||
return key1->font == key2->font &&
|
||||
key1->scale == key2->scale;
|
||||
}
|
||||
|
||||
static guint
|
||||
gsk_gpu_cached_glyph_hash (gconstpointer data)
|
||||
{
|
||||
const GskGpuCachedGlyph *glyph = data;
|
||||
const GlyphCacheKey *key = &glyph->glyph_key;
|
||||
|
||||
return GPOINTER_TO_UINT (glyph->font) ^
|
||||
glyph->glyph ^
|
||||
(glyph->flags << 24) ^
|
||||
((guint) glyph->scale * PANGO_SCALE);
|
||||
return key->glyph ^ (key->flags << 24);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -308,11 +478,11 @@ gsk_gpu_cached_glyph_equal (gconstpointer v1,
|
||||
{
|
||||
const GskGpuCachedGlyph *glyph1 = v1;
|
||||
const GskGpuCachedGlyph *glyph2 = v2;
|
||||
const GlyphCacheKey *key1 = &glyph1->glyph_key;
|
||||
const GlyphCacheKey *key2 = &glyph2->glyph_key;
|
||||
|
||||
return glyph1->font == glyph2->font
|
||||
&& glyph1->glyph == glyph2->glyph
|
||||
&& glyph1->flags == glyph2->flags
|
||||
&& glyph1->scale == glyph2->scale;
|
||||
return key1->glyph == key2->glyph &&
|
||||
key1->flags == key2->flags;
|
||||
}
|
||||
|
||||
static const GskGpuCachedClass GSK_GPU_CACHED_GLYPH_CLASS =
|
||||
@@ -325,19 +495,127 @@ static const GskGpuCachedClass GSK_GPU_CACHED_GLYPH_CLASS =
|
||||
/* }}} */
|
||||
/* {{{ GskGpuDevice */
|
||||
|
||||
void
|
||||
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
|
||||
gsk_gpu_device_gc (GskGpuDevice *self,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
GskGpuCached *cached, *next;
|
||||
GskGpuCached *cached, *prev;
|
||||
gint64 before G_GNUC_UNUSED = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
for (cached = priv->first_cached; cached != NULL; 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)
|
||||
{
|
||||
next = cached->next;
|
||||
prev = cached->prev;
|
||||
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
|
||||
@@ -357,8 +635,9 @@ gsk_gpu_device_clear_cache (GskGpuDevice *self)
|
||||
g_assert (cached->next->prev == cached);
|
||||
}
|
||||
|
||||
while (priv->first_cached)
|
||||
gsk_gpu_cached_free (self, priv->first_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);
|
||||
|
||||
g_assert (priv->last_cached == NULL);
|
||||
}
|
||||
@@ -372,6 +651,7 @@ 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);
|
||||
}
|
||||
@@ -401,10 +681,13 @@ gsk_gpu_device_init (GskGpuDevice *self)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
priv->glyph_cache = g_hash_table_new (gsk_gpu_cached_glyph_hash,
|
||||
gsk_gpu_cached_glyph_equal);
|
||||
priv->glyph_cache = g_hash_table_new_full (gsk_gpu_cached_font_hash,
|
||||
gsk_gpu_cached_font_equal,
|
||||
NULL,
|
||||
font_glyph_cache_free);
|
||||
priv->texture_cache = g_hash_table_new (g_direct_hash,
|
||||
g_direct_equal);
|
||||
priv->last_font_cache = &no_font_cache;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -413,9 +696,38 @@ 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 *
|
||||
@@ -454,6 +766,12 @@ 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,
|
||||
@@ -547,8 +865,7 @@ gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
|
||||
|
||||
static void
|
||||
gsk_gpu_device_ensure_atlas (GskGpuDevice *self,
|
||||
gboolean recreate,
|
||||
gint64 timestamp)
|
||||
gboolean recreate)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
@@ -563,14 +880,13 @@ gsk_gpu_device_get_atlas_image (GskGpuDevice *self)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE, g_get_monotonic_time ());
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE);
|
||||
|
||||
return priv->current_atlas->image;
|
||||
}
|
||||
|
||||
static GskGpuImage *
|
||||
gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
|
||||
gint64 timestamp,
|
||||
gsize width,
|
||||
gsize height,
|
||||
gsize *out_x,
|
||||
@@ -581,21 +897,15 @@ 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, 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);
|
||||
gsk_gpu_device_ensure_atlas (self, FALSE);
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -612,12 +922,12 @@ gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
||||
if (cache == NULL)
|
||||
cache = g_hash_table_lookup (priv->texture_cache, texture);
|
||||
|
||||
if (cache)
|
||||
{
|
||||
return g_object_ref (cache->image);
|
||||
}
|
||||
if (!cache || !cache->image || gsk_gpu_cached_texture_is_invalid (cache))
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
|
||||
|
||||
return g_object_ref (cache->image);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -641,44 +951,74 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
GskGpuGlyphLookupFlags flags,
|
||||
float scale,
|
||||
graphene_rect_t *out_bounds,
|
||||
graphene_point_t *out_origin)
|
||||
graphene_point_t *out_origin,
|
||||
PangoFont **out_scaled_font)
|
||||
{
|
||||
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
|
||||
GskGpuCachedGlyph lookup = {
|
||||
.font = font,
|
||||
.glyph = glyph,
|
||||
.flags = flags,
|
||||
.scale = scale
|
||||
FontGlyphCache font_lookup = {
|
||||
.key = { .font = font, .scale = scale }
|
||||
};
|
||||
GskGpuCachedGlyph *cache;
|
||||
GskGpuCachedGlyph glyph_lookup = {
|
||||
.glyph_key = { .glyph = glyph, .flags = flags }
|
||||
};
|
||||
FontGlyphCache *font_cache = NULL;
|
||||
GskGpuCachedGlyph *cache = NULL;
|
||||
PangoRectangle ink_rect;
|
||||
graphene_rect_t rect;
|
||||
graphene_point_t origin;
|
||||
GskGpuImage *image;
|
||||
gsize atlas_x, atlas_y, padding;
|
||||
float subpixel_x, subpixel_y;
|
||||
PangoFont *scaled_font;
|
||||
|
||||
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
|
||||
if (cache)
|
||||
if (priv->last_font_cache->key.font == font &&
|
||||
priv->last_font_cache->key.scale == scale)
|
||||
font_cache = priv->last_font_cache;
|
||||
else
|
||||
font_cache = g_hash_table_lookup (priv->glyph_cache, &font_lookup);
|
||||
|
||||
if (font_cache)
|
||||
{
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
|
||||
cache = g_hash_table_lookup (font_cache->cache, &glyph_lookup);
|
||||
if (cache)
|
||||
{
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
|
||||
|
||||
*out_bounds = cache->bounds;
|
||||
*out_origin = cache->origin;
|
||||
return cache->image;
|
||||
*out_bounds = cache->bounds;
|
||||
*out_origin = cache->origin;
|
||||
|
||||
priv->last_font_cache = font_cache;
|
||||
|
||||
return cache->image;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
font_cache = g_new (FontGlyphCache, 1);
|
||||
font_cache->key.font = g_object_ref (font);
|
||||
font_cache->key.scale = scale;
|
||||
font_cache->cache = g_hash_table_new (gsk_gpu_cached_glyph_hash,
|
||||
gsk_gpu_cached_glyph_equal);
|
||||
g_hash_table_insert (priv->glyph_cache, font_cache, font_cache);
|
||||
}
|
||||
|
||||
priv->last_font_cache = font_cache;
|
||||
|
||||
if (*out_scaled_font)
|
||||
scaled_font = *out_scaled_font;
|
||||
else
|
||||
scaled_font = gsk_get_scaled_font (font, scale);
|
||||
|
||||
subpixel_x = (flags & 3) / 4.f;
|
||||
subpixel_y = ((flags >> 2) & 3) / 4.f;
|
||||
pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
|
||||
origin.x = floor (ink_rect.x * scale / PANGO_SCALE + subpixel_x);
|
||||
origin.y = floor (ink_rect.y * scale / PANGO_SCALE + subpixel_y);
|
||||
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * scale / PANGO_SCALE + subpixel_x) - origin.x;
|
||||
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * scale / PANGO_SCALE + subpixel_y) - origin.y;
|
||||
pango_font_get_glyph_extents (scaled_font, glyph, &ink_rect, NULL);
|
||||
origin.x = floor (ink_rect.x * 1.0 / PANGO_SCALE + subpixel_x);
|
||||
origin.y = floor (ink_rect.y * 1.0 / PANGO_SCALE + subpixel_y);
|
||||
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * 1.0 / PANGO_SCALE + subpixel_x) - origin.x;
|
||||
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * 1.0 / PANGO_SCALE + subpixel_y) - origin.y;
|
||||
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)
|
||||
@@ -697,18 +1037,18 @@ 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_cache = font_cache;
|
||||
cache->glyph_key.glyph = glyph;
|
||||
cache->glyph_key.flags = flags;
|
||||
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,
|
||||
font,
|
||||
scaled_font,
|
||||
glyph,
|
||||
&(cairo_rectangle_int_t) {
|
||||
.x = rect.origin.x - padding,
|
||||
@@ -716,15 +1056,16 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
|
||||
.width = rect.size.width + 2 * padding,
|
||||
.height = rect.size.height + 2 * padding,
|
||||
},
|
||||
scale,
|
||||
&GRAPHENE_POINT_INIT (cache->origin.x + padding,
|
||||
cache->origin.y + padding));
|
||||
|
||||
g_hash_table_insert (priv->glyph_cache, cache, cache);
|
||||
g_hash_table_insert (font_cache->cache, cache, cache);
|
||||
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
|
||||
|
||||
*out_bounds = cache->bounds;
|
||||
*out_origin = cache->origin;
|
||||
*out_scaled_font = scaled_font;
|
||||
|
||||
return cache->image;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ struct _GskGpuDeviceClass
|
||||
GdkMemoryDepth depth,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void (* make_current) (GskGpuDevice *self);
|
||||
|
||||
};
|
||||
|
||||
GType gsk_gpu_device_get_type (void) G_GNUC_CONST;
|
||||
@@ -48,9 +50,8 @@ 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_gc (GskGpuDevice *self,
|
||||
gint64 timestamp);
|
||||
|
||||
void gsk_gpu_device_maybe_gc (GskGpuDevice *self);
|
||||
void gsk_gpu_device_queue_gc (GskGpuDevice *self);
|
||||
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);
|
||||
@@ -69,7 +70,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);
|
||||
@@ -95,7 +96,8 @@ GskGpuImage * gsk_gpu_device_lookup_glyph_image (GskGpuD
|
||||
GskGpuGlyphLookupFlags flags,
|
||||
float scale,
|
||||
graphene_rect_t *out_bounds,
|
||||
graphene_point_t *out_origin);
|
||||
graphene_point_t *out_origin,
|
||||
PangoFont **out_scaled_font);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskGpuDevice, g_object_unref)
|
||||
|
||||
@@ -220,7 +220,7 @@ gsk_gpu_frame_seal_ops (GskGpuFrame *self)
|
||||
{
|
||||
GskGpuFramePrivate *priv = gsk_gpu_frame_get_instance_private (self);
|
||||
GskGpuOp *last, *op;
|
||||
guint i;
|
||||
gsize i;
|
||||
|
||||
priv->first_op = (GskGpuOp *) gsk_gpu_ops_index (&priv->ops, 0);
|
||||
|
||||
|
||||
@@ -32,7 +32,13 @@ 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,6 +33,7 @@ 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,6 +27,7 @@ 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 = width / 2,
|
||||
.y = height / 2,
|
||||
.x = MAX (1, width / 2),
|
||||
.y = MAX (1, height / 2),
|
||||
.z = 1,
|
||||
}
|
||||
},
|
||||
|
||||
+211
-146
@@ -42,10 +42,12 @@
|
||||
#include "gsktransformprivate.h"
|
||||
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
#include "gdk/gdksubsurfaceprivate.h"
|
||||
|
||||
#include "scaleprivate.h"
|
||||
#include "pointprivate.h"
|
||||
#include "boxprivate.h"
|
||||
/* the epsilon we allow pixels to be off due to rounding errors.
|
||||
* Chosen rather randomly.
|
||||
*/
|
||||
#define EPSILON 0.001
|
||||
|
||||
/* A note about coordinate systems
|
||||
*
|
||||
@@ -342,8 +344,8 @@ gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
|
||||
|
||||
area.x = 0;
|
||||
area.y = 0;
|
||||
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height);
|
||||
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width - EPSILON);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height - EPSILON);
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
@@ -502,18 +504,6 @@ gsk_gpu_pattern_writer_append_rect (GskGpuPatternWriter *self,
|
||||
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gpu_pattern_writer_append_box (GskGpuPatternWriter *self,
|
||||
const Box box,
|
||||
const Point offset)
|
||||
{
|
||||
float f[4];
|
||||
|
||||
box_offset_to_float (box, offset, f);
|
||||
|
||||
gsk_gpu_pattern_writer_append (self, G_ALIGNOF (float), (guchar *) f, sizeof (f));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gpu_pattern_writer_append_rgba (GskGpuPatternWriter *self,
|
||||
const GdkRGBA *rgba)
|
||||
@@ -578,7 +568,6 @@ 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;
|
||||
@@ -749,6 +738,30 @@ 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
|
||||
@@ -778,7 +791,6 @@ 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))
|
||||
@@ -801,37 +813,29 @@ 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,
|
||||
&clipped,
|
||||
clip_bounds,
|
||||
(GskGpuCairoFunc) gsk_render_node_draw_fallback,
|
||||
gsk_render_node_ref (node),
|
||||
(GDestroyNotify) gsk_render_node_unref);
|
||||
|
||||
g_object_ref (result);
|
||||
|
||||
*out_bounds = clipped;
|
||||
*out_bounds = *clip_bounds;
|
||||
return result;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gsk_rect_intersection (clip_bounds, &node->bounds, &clipped);
|
||||
if (gsk_rect_is_empty (&clipped))
|
||||
return NULL;
|
||||
|
||||
GSK_DEBUG (FALLBACK, "Offscreening node '%s'", g_type_name_from_instance ((GTypeInstance *) node));
|
||||
result = gsk_gpu_render_pass_op_offscreen (frame,
|
||||
scale,
|
||||
&clipped,
|
||||
node);
|
||||
result = gsk_gpu_node_processor_create_offscreen (frame,
|
||||
scale,
|
||||
clip_bounds,
|
||||
node);
|
||||
|
||||
*out_bounds = clipped;
|
||||
*out_bounds = *clip_bounds;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -952,9 +956,13 @@ 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;
|
||||
}
|
||||
rect_round_to_pixels (clip_bounds, &self->scale, &self->offset, &clip);
|
||||
else
|
||||
{
|
||||
if (!gsk_rect_intersection (clip_bounds, &node->bounds, &clip))
|
||||
return NULL;
|
||||
}
|
||||
rect_round_to_pixels (&clip, &self->scale, &self->offset, &clip);
|
||||
|
||||
image = gsk_gpu_get_node_as_image (self->frame,
|
||||
&clip,
|
||||
@@ -999,36 +1007,25 @@ 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;
|
||||
|
||||
width = ceilf (graphene_vec2_get_x (&self->scale) * intermediate_rect.size.width);
|
||||
height = ceilf (graphene_vec2_get_y (&self->scale) * intermediate_rect.size.height);
|
||||
rect_round_to_pixels (&intermediate_rect, &self->scale, &self->offset, &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);
|
||||
intermediate = gsk_gpu_node_processor_init_draw (&other,
|
||||
self->frame,
|
||||
source_depth,
|
||||
&self->scale,
|
||||
&intermediate_rect);
|
||||
|
||||
gsk_gpu_node_processor_sync_globals (&other, 0);
|
||||
|
||||
@@ -1042,11 +1039,7 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
|
||||
source_rect,
|
||||
&direction);
|
||||
|
||||
gsk_gpu_render_pass_end_op (other.frame,
|
||||
intermediate,
|
||||
GSK_RENDER_PASS_OFFSCREEN);
|
||||
|
||||
gsk_gpu_node_processor_finish (&other);
|
||||
gsk_gpu_node_processor_finish_draw (&other, intermediate);
|
||||
|
||||
real_offset = GRAPHENE_POINT_INIT (self->offset.x + shadow_offset->x,
|
||||
self->offset.y + shadow_offset->y);
|
||||
@@ -1334,7 +1327,8 @@ 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)
|
||||
else if (self->clip.type == GSK_GPU_CLIP_RECT &&
|
||||
gsk_rect_contains_rect (&self->clip.rect.bounds, &clip))
|
||||
{
|
||||
self->clip.type = GSK_GPU_CLIP_NONE;
|
||||
}
|
||||
@@ -2068,13 +2062,21 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
|
||||
GskGpuImage *offscreen;
|
||||
graphene_rect_t clip_bounds;
|
||||
|
||||
if (!gsk_gpu_node_processor_clip_node_bounds (self, node, &clip_bounds))
|
||||
return;
|
||||
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);
|
||||
offscreen = gsk_gpu_render_pass_op_offscreen (self->frame,
|
||||
graphene_vec2_one (),
|
||||
&clip_bounds,
|
||||
node);
|
||||
/* now intersect with actual node bounds */
|
||||
if (!gsk_rect_intersection (&clip_bounds, &node->bounds, &clip_bounds))
|
||||
return;
|
||||
offscreen = gsk_gpu_node_processor_create_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),
|
||||
@@ -2990,11 +2992,15 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
GskGpuDevice *device;
|
||||
const PangoGlyphInfo *glyphs;
|
||||
PangoFont *font;
|
||||
Point offset;
|
||||
Scale scale, s4, pango_scale;
|
||||
PangoFont *scaled_font = NULL;
|
||||
graphene_point_t offset;
|
||||
guint i, num_glyphs;
|
||||
float scale, inv_scale;
|
||||
GdkRGBA color;
|
||||
gboolean glyph_align;
|
||||
GskGpuImage *last_image;
|
||||
guint32 descriptor = 0;
|
||||
GskGpuClip old_clip;
|
||||
|
||||
if (self->opacity < 1.0 &&
|
||||
gsk_text_node_has_color_glyphs (node))
|
||||
@@ -3003,6 +3009,10 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
gsk_gpu_clip_init_copy (&old_clip, &self->clip);
|
||||
if (gsk_gpu_clip_contains_rect (&self->clip, &self->offset, &node->bounds))
|
||||
gsk_gpu_clip_init_contained (&self->clip, &node->bounds);
|
||||
|
||||
glyph_align = gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_GLYPH_ALIGN) &&
|
||||
gsk_transform_get_category (self->modelview) >= GSK_TRANSFORM_CATEGORY_2D;
|
||||
device = gsk_gpu_frame_get_device (self->frame);
|
||||
@@ -3011,33 +3021,31 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
font = gsk_text_node_get_font (node);
|
||||
offset = *gsk_text_node_get_offset (node);
|
||||
offset.x += self->offset.x;
|
||||
offset.y += self->offset.y;
|
||||
|
||||
offset = point_add (point_from_graphene (gsk_text_node_get_offset (node)),
|
||||
point_from_graphene (&self->offset));
|
||||
scale = scale_max (scale_from_graphene (&self->scale));
|
||||
s4 = scale_mul (scale, scale_from_float (4));
|
||||
pango_scale = scale_from_float (PANGO_SCALE);
|
||||
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
|
||||
inv_scale = 1.f / scale;
|
||||
|
||||
last_image = NULL;
|
||||
for (i = 0; i < num_glyphs; i++)
|
||||
{
|
||||
GskGpuImage *image;
|
||||
graphene_rect_t glyph_bds;
|
||||
graphene_point_t glyph_ofs;
|
||||
Box glyph_bounds, glyph_tex_rect;
|
||||
Point g_ofs, glyph_origin;
|
||||
guint32 descriptor;
|
||||
graphene_rect_t glyph_bounds, glyph_tex_rect;
|
||||
graphene_point_t glyph_offset, glyph_origin;
|
||||
GskGpuGlyphLookupFlags flags;
|
||||
|
||||
glyph_origin = point_add (offset, point_div (point (glyphs[i].geometry.x_offset, glyphs[i].geometry.y_offset), pango_scale));
|
||||
|
||||
glyph_origin = GRAPHENE_POINT_INIT (offset.x + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
offset.y + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
if (glyph_align)
|
||||
{
|
||||
glyph_origin = 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);
|
||||
glyph_origin.x = roundf (glyph_origin.x * scale * 4);
|
||||
glyph_origin.y = roundf (glyph_origin.y * scale * 4);
|
||||
flags = ((int) glyph_origin.x & 3) |
|
||||
(((int) glyph_origin.y & 3) << 2);
|
||||
glyph_origin.x = 0.25 * inv_scale * glyph_origin.x;
|
||||
glyph_origin.y = 0.25 * inv_scale * glyph_origin.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3049,38 +3057,46 @@ gsk_gpu_node_processor_add_glyph_node (GskGpuNodeProcessor *self,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
flags,
|
||||
scale_x (scale),
|
||||
&glyph_bds,
|
||||
&glyph_ofs);
|
||||
scale,
|
||||
&glyph_bounds,
|
||||
&glyph_offset,
|
||||
&scaled_font);
|
||||
|
||||
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_rect_scale (&GRAPHENE_RECT_INIT (-glyph_bounds.origin.x, -glyph_bounds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), inv_scale, inv_scale, &glyph_tex_rect);
|
||||
gsk_rect_scale (&GRAPHENE_RECT_INIT(0, 0, glyph_bounds.size.width, glyph_bounds.size.height), inv_scale, inv_scale, &glyph_bounds);
|
||||
glyph_origin = GRAPHENE_POINT_INIT (glyph_origin.x - glyph_offset.x * inv_scale,
|
||||
glyph_origin.y - glyph_offset.y * inv_scale);
|
||||
|
||||
glyph_bounds = box_div (box_from_rect (0, 0, glyph_bds.size.width, glyph_bds.size.height), scale);
|
||||
if (image != last_image)
|
||||
{
|
||||
descriptor = gsk_gpu_node_processor_add_image (self, image, GSK_GPU_SAMPLER_DEFAULT);
|
||||
last_image = image;
|
||||
}
|
||||
|
||||
g_ofs = point_from_graphene (&glyph_ofs);
|
||||
glyph_origin = point_sub (glyph_origin, point_div (g_ofs, scale));
|
||||
|
||||
descriptor = gsk_gpu_node_processor_add_image (self, image, GSK_GPU_SAMPLER_DEFAULT);
|
||||
if (glyphs[i].attr.is_color)
|
||||
gsk_gpu_texture_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip2 (&self->clip, &g_ofs, &glyph_bounds),
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_bounds), box_y0 (glyph_bounds), box_width (glyph_bounds), box_height (glyph_bounds)),
|
||||
&GRAPHENE_POINT_INIT (point_x (glyph_origin), point_y (glyph_origin)),
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_tex_rect), box_y0 (glyph_tex_rect), box_width (glyph_tex_rect), box_height (glyph_tex_rect)));
|
||||
&glyph_bounds,
|
||||
&glyph_origin,
|
||||
&glyph_tex_rect);
|
||||
else
|
||||
gsk_gpu_colorize_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip2 (&self->clip, &g_ofs, &glyph_bounds),
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &glyph_offset, &glyph_bounds),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_bounds), box_y0 (glyph_bounds), box_width (glyph_bounds), box_height (glyph_bounds)),
|
||||
&GRAPHENE_POINT_INIT (point_x (glyph_origin), point_y (glyph_origin)),
|
||||
&GRAPHENE_RECT_INIT (box_x0 (glyph_tex_rect), box_y0 (glyph_tex_rect), box_width (glyph_tex_rect), box_height (glyph_tex_rect)),
|
||||
&glyph_bounds,
|
||||
&glyph_origin,
|
||||
&glyph_tex_rect,
|
||||
&color);
|
||||
|
||||
offset = point_add (offset, point (glyphs[i].geometry.width / (float)PANGO_SCALE, 0));
|
||||
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
|
||||
}
|
||||
|
||||
g_clear_object (&scaled_font);
|
||||
|
||||
gsk_gpu_clip_init_copy (&self->clip, &old_clip);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -3090,12 +3106,13 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
GskGpuDevice *device;
|
||||
const PangoGlyphInfo *glyphs;
|
||||
PangoFont *font;
|
||||
PangoFont *scaled_font = NULL;
|
||||
guint num_glyphs;
|
||||
gsize i;
|
||||
Scale scale, pango_scale;
|
||||
float scale, inv_scale;
|
||||
guint32 tex_id;
|
||||
GskGpuImage *last_image;
|
||||
Point offset;
|
||||
graphene_point_t offset;
|
||||
|
||||
if (gsk_text_node_has_color_glyphs (node))
|
||||
return FALSE;
|
||||
@@ -3104,11 +3121,12 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
glyphs = gsk_text_node_get_glyphs (node, NULL);
|
||||
font = gsk_text_node_get_font (node);
|
||||
offset = *gsk_text_node_get_offset (node);
|
||||
offset.x += self->offset.x;
|
||||
offset.y += self->offset.y;
|
||||
|
||||
offset = point_add (point_from_graphene (gsk_text_node_get_offset (node)),
|
||||
point_from_graphene (&self->offset));
|
||||
scale = scale_max (scale_from_graphene (&self->scale));
|
||||
pango_scale = scale_from_float (PANGO_SCALE);
|
||||
scale = MAX (graphene_vec2_get_x (&self->scale), graphene_vec2_get_y (&self->scale));
|
||||
inv_scale = 1.f / scale;
|
||||
|
||||
gsk_gpu_pattern_writer_append_uint (self, GSK_GPU_PATTERN_GLYPHS);
|
||||
gsk_gpu_pattern_writer_append_rgba (self, gsk_text_node_get_color (node));
|
||||
@@ -3118,41 +3136,54 @@ gsk_gpu_node_processor_create_glyph_pattern (GskGpuPatternWriter *self,
|
||||
for (i = 0; i < num_glyphs; i++)
|
||||
{
|
||||
GskGpuImage *image;
|
||||
graphene_rect_t glyph_bds;
|
||||
graphene_point_t glyph_ofs;
|
||||
Point glyph_offset;
|
||||
Box glyph_bounds;
|
||||
Box glyph_tex_rect;
|
||||
graphene_rect_t glyph_bounds;
|
||||
graphene_point_t glyph_offset;
|
||||
|
||||
image = gsk_gpu_device_lookup_glyph_image (device,
|
||||
self->frame,
|
||||
font,
|
||||
glyphs[i].glyph,
|
||||
0,
|
||||
scale_x (scale),
|
||||
&glyph_bds,
|
||||
&glyph_ofs);
|
||||
scale,
|
||||
&glyph_bounds,
|
||||
&glyph_offset,
|
||||
&scaled_font);
|
||||
|
||||
if (image != last_image)
|
||||
{
|
||||
if (!gsk_gpu_pattern_writer_add_image (self, image, GSK_GPU_SAMPLER_DEFAULT, &tex_id))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
last_image = image;
|
||||
}
|
||||
|
||||
glyph_offset = point_add (point_sub (offset, point_div (glyph_offset, scale)), point_div (point (glyphs[i].geometry.x_offset, glyphs[i].geometry.y_offset), pango_scale));
|
||||
glyph_offset = GRAPHENE_POINT_INIT (offset.x - glyph_offset.x * inv_scale + (float) glyphs[i].geometry.x_offset / PANGO_SCALE,
|
||||
offset.y - glyph_offset.y * inv_scale + (float) glyphs[i].geometry.y_offset / PANGO_SCALE);
|
||||
|
||||
glyph_bounds = box_div (box_from_rect (0, 0, glyph_bds.size.width, glyph_bds.size.height), scale);
|
||||
glyph_tex_rect = box_div (box_from_rect (-glyph_bds.origin.x, - glyph_bds.origin.y, gsk_gpu_image_get_width (image), gsk_gpu_image_get_height (image)), scale);
|
||||
gsk_gpu_pattern_writer_append_uint (self, tex_id);
|
||||
gsk_gpu_pattern_writer_append_box (self, glyph_bounds, glyph_offset);
|
||||
gsk_gpu_pattern_writer_append_box (self, glyph_tex_rect, glyph_offset);
|
||||
gsk_gpu_pattern_writer_append_rect (self,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0,
|
||||
0,
|
||||
glyph_bounds.size.width * inv_scale,
|
||||
glyph_bounds.size.height * inv_scale
|
||||
),
|
||||
&glyph_offset);
|
||||
gsk_gpu_pattern_writer_append_rect (self,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
- glyph_bounds.origin.x * inv_scale,
|
||||
- glyph_bounds.origin.y * inv_scale,
|
||||
gsk_gpu_image_get_width (image) * inv_scale,
|
||||
gsk_gpu_image_get_height (image) * inv_scale
|
||||
),
|
||||
&glyph_offset);
|
||||
|
||||
offset = point_add (offset, point (glyphs[i].geometry.width / (float)PANGO_SCALE, 0));
|
||||
offset.x += (float) glyphs[i].geometry.width / PANGO_SCALE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
g_clear_object (&scaled_font);
|
||||
|
||||
return i == num_glyphs;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -3261,10 +3292,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_render_pass_op_offscreen (self->frame,
|
||||
&self->scale,
|
||||
&clipped_child_bounds,
|
||||
child);
|
||||
image = gsk_gpu_node_processor_create_offscreen (self->frame,
|
||||
&self->scale,
|
||||
&clipped_child_bounds,
|
||||
child);
|
||||
|
||||
g_return_if_fail (image);
|
||||
|
||||
@@ -3683,22 +3714,42 @@ gsk_gpu_node_processor_add_subsurface_node (GskGpuNodeProcessor *self,
|
||||
|
||||
if (!gdk_subsurface_is_above_parent (subsurface))
|
||||
{
|
||||
cairo_rectangle_int_t int_rect;
|
||||
cairo_rectangle_int_t int_clipped;
|
||||
graphene_rect_t rect, 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))
|
||||
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))
|
||||
{
|
||||
g_warning ("FIXME: non-integer aligned subsurface?!");
|
||||
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;
|
||||
}
|
||||
gsk_gpu_clear_op (self->frame,
|
||||
&int_rect,
|
||||
&GDK_RGBA_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3717,6 +3768,12 @@ 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));
|
||||
}
|
||||
@@ -3756,7 +3813,7 @@ static const struct
|
||||
},
|
||||
[GSK_CONTAINER_NODE] = {
|
||||
GSK_GPU_GLOBAL_MATRIX | GSK_GPU_GLOBAL_SCALE | GSK_GPU_GLOBAL_CLIP | GSK_GPU_GLOBAL_SCISSOR,
|
||||
0,
|
||||
GSK_GPU_HANDLE_OPACITY,
|
||||
gsk_gpu_node_processor_add_container_node,
|
||||
NULL,
|
||||
},
|
||||
@@ -3943,9 +4000,11 @@ 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;
|
||||
|
||||
@@ -3990,6 +4049,12 @@ 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,6 +12,27 @@ 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,6 +17,8 @@ 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,6 +33,7 @@ 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,6 +343,8 @@ 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,
|
||||
@@ -353,6 +355,7 @@ 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);
|
||||
|
||||
@@ -360,7 +363,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,
|
||||
@@ -370,6 +373,8 @@ 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);
|
||||
|
||||
@@ -386,7 +391,7 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
|
||||
GskGpuFrame *frame;
|
||||
GskGpuImage *backbuffer;
|
||||
cairo_region_t *render_region;
|
||||
GdkSurface *surface;
|
||||
double scale;
|
||||
|
||||
if (cairo_region_is_empty (region))
|
||||
{
|
||||
@@ -398,26 +403,30 @@ 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);
|
||||
surface = gdk_draw_context_get_surface (priv->context);
|
||||
scale = gsk_gpu_renderer_get_scale (self);
|
||||
|
||||
gsk_gpu_frame_render (frame,
|
||||
g_get_monotonic_time(),
|
||||
g_get_monotonic_time (),
|
||||
backbuffer,
|
||||
render_region,
|
||||
root,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0, 0,
|
||||
gdk_surface_get_width (surface),
|
||||
gdk_surface_get_height (surface)
|
||||
gsk_gpu_image_get_width (backbuffer) / scale,
|
||||
gsk_gpu_image_get_height (backbuffer) / scale
|
||||
),
|
||||
NULL);
|
||||
|
||||
gsk_gpu_device_queue_gc (priv->device);
|
||||
|
||||
gdk_draw_context_end_frame (priv->context);
|
||||
|
||||
g_clear_pointer (&render_region, cairo_region_destroy);
|
||||
|
||||
@@ -54,7 +54,6 @@ 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:
|
||||
@@ -333,38 +332,3 @@ 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,10 +23,5 @@ 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
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user