Compare commits
348 Commits
wip/carlos
...
wip/cherge
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3fc65185b | ||
|
|
629a4b4c21 | ||
|
|
be269d0992 | ||
|
|
84261d1db3 | ||
|
|
a0441ad666 | ||
|
|
67152916e1 | ||
|
|
b98ebe60b2 | ||
|
|
ad8ba69423 | ||
|
|
bf24b816c2 | ||
|
|
a9b1134dfb | ||
|
|
6fb6a23389 | ||
|
|
2da27720ca | ||
|
|
f9326cfa3d | ||
|
|
963108a9a6 | ||
|
|
b8355a6686 | ||
|
|
4c421959dc | ||
|
|
aedcfcd010 | ||
|
|
d7c7311ceb | ||
|
|
41d72e86e0 | ||
|
|
282b09c17e | ||
|
|
c5d2fc856a | ||
|
|
f5a28aa9e4 | ||
|
|
6206511846 | ||
|
|
a209a14898 | ||
|
|
3e6a55aff0 | ||
|
|
704fea6323 | ||
|
|
8c1e6ebde0 | ||
|
|
81512ad0dc | ||
|
|
d122b66abc | ||
|
|
44ae38599f | ||
|
|
df642eb150 | ||
|
|
722ae2b77a | ||
|
|
54194e67e3 | ||
|
|
c0c74484bc | ||
|
|
5149e1e43a | ||
|
|
ac2c870177 | ||
|
|
f21595687f | ||
|
|
e51279dcf0 | ||
|
|
9b58033375 | ||
|
|
0bf9727a31 | ||
|
|
d053ccfb18 | ||
|
|
7cc02cf24e | ||
|
|
e07478f8bc | ||
|
|
efe1bc2e59 | ||
|
|
41992757e0 | ||
|
|
445af61a68 | ||
|
|
03ef335a70 | ||
|
|
b4226daadb | ||
|
|
b70611e3cf | ||
|
|
35fe6a40ed | ||
|
|
4f8e518d42 | ||
|
|
d2953e0d33 | ||
|
|
b45b03b063 | ||
|
|
c06fae4741 | ||
|
|
76e0d7293d | ||
|
|
0e0afa240e | ||
|
|
560055fc97 | ||
|
|
3e1db33967 | ||
|
|
aceadfe305 | ||
|
|
ae344a606d | ||
|
|
8b70232d25 | ||
|
|
1ecfdb1748 | ||
|
|
f7646af810 | ||
|
|
586723eb44 | ||
|
|
5c704e3f81 | ||
|
|
1981449776 | ||
|
|
98d7a542b0 | ||
|
|
438f75e6b3 | ||
|
|
f3cdc9906c | ||
|
|
ae00f5653e | ||
|
|
7c3172a0af | ||
|
|
73dcb9fa22 | ||
|
|
3ace2b9a28 | ||
|
|
01bab81727 | ||
|
|
c1fc46e3db | ||
|
|
4abec2f8e7 | ||
|
|
ee854ed7ab | ||
|
|
ec9d7145c8 | ||
|
|
3a8c545b32 | ||
|
|
6c1e9b51f9 | ||
|
|
851024f730 | ||
|
|
b23fc99655 | ||
|
|
0f58c98386 | ||
|
|
ebc07871eb | ||
|
|
840c50b00d | ||
|
|
e76ff8530b | ||
|
|
c273f74025 | ||
|
|
9ff4f29bac | ||
|
|
dcba7c5044 | ||
|
|
5b1620475e | ||
|
|
934a829a57 | ||
|
|
264f68858a | ||
|
|
56ce25360c | ||
|
|
d8b7905662 | ||
|
|
ae1768bf4f | ||
|
|
cbef49fd74 | ||
|
|
bcbb44fdea | ||
|
|
0d185b21fd | ||
|
|
e4d5cb72ee | ||
|
|
c37e2523ac | ||
|
|
c4f8b93357 | ||
|
|
06dae3a8cc | ||
|
|
76240e24f7 | ||
|
|
9b0392e988 | ||
|
|
aa0aa89a1e | ||
|
|
b91d66bf98 | ||
|
|
832c0fb0ea | ||
|
|
2fbbf657d5 | ||
|
|
81de2c2913 | ||
|
|
ffad55c66f | ||
|
|
2212a44cc2 | ||
|
|
98040e67a2 | ||
|
|
e7928ce6ee | ||
|
|
b41094ef5f | ||
|
|
d699c80ac2 | ||
|
|
35316a034f | ||
|
|
c05019e232 | ||
|
|
861e5caf8c | ||
|
|
8e6821bc65 | ||
|
|
05301d280c | ||
|
|
c1bdaba5ac | ||
|
|
640ad4718e | ||
|
|
985b3b32ce | ||
|
|
795491c80a | ||
|
|
f5e2310dc7 | ||
|
|
c5a936e0e8 | ||
|
|
600dd155ce | ||
|
|
99043e2af2 | ||
|
|
e0d2e1096d | ||
|
|
136c09585d | ||
|
|
15b46a6f88 | ||
|
|
c27fc3537b | ||
|
|
6cc748cce9 | ||
|
|
afd645193a | ||
|
|
09af21cd0b | ||
|
|
2731be6929 | ||
|
|
5257c6ecc2 | ||
|
|
5723bd8ec7 | ||
|
|
1e9682b417 | ||
|
|
9da275cf73 | ||
|
|
f1d4d687f3 | ||
|
|
e9fbbd5853 | ||
|
|
d3160d095d | ||
|
|
873449d0f9 | ||
|
|
4413b86a30 | ||
|
|
f8fa86f9db | ||
|
|
f55d4f33af | ||
|
|
4761c4ee1c | ||
|
|
7644ddeddc | ||
|
|
6dfd2ffcef | ||
|
|
835f12043e | ||
|
|
7afbc01fe8 | ||
|
|
1c689b83f9 | ||
|
|
8d0527f674 | ||
|
|
bc7ba8c875 | ||
|
|
34ce39f8dc | ||
|
|
9be4f98c73 | ||
|
|
1fc021c3c6 | ||
|
|
9aba37f70f | ||
|
|
5bb3d86884 | ||
|
|
1611979fa8 | ||
|
|
467e94f858 | ||
|
|
88fb003cdc | ||
|
|
a382698acc | ||
|
|
8b3bc1f97d | ||
|
|
5618e41cea | ||
|
|
f97930eaf5 | ||
|
|
5e07478843 | ||
|
|
1ce933e281 | ||
|
|
1000ebe203 | ||
|
|
c0321c7b21 | ||
|
|
7dbb4bc3f5 | ||
|
|
9d390ee49f | ||
|
|
403466c0db | ||
|
|
f2f89d9b46 | ||
|
|
30bf588a38 | ||
|
|
090a6ad409 | ||
|
|
a6c195b05c | ||
|
|
c1df48befd | ||
|
|
102c07d5e5 | ||
|
|
abc58f7b9d | ||
|
|
66fe6d85d0 | ||
|
|
a63e80ec64 | ||
|
|
9feda1c58b | ||
|
|
51733ca499 | ||
|
|
f0c92646eb | ||
|
|
d28a640960 | ||
|
|
b3fbc26340 | ||
|
|
612b622689 | ||
|
|
ccd33ce17f | ||
|
|
f447a053bb | ||
|
|
545fcb3dbf | ||
|
|
65401ed3f9 | ||
|
|
b30a29f830 | ||
|
|
b6c824dd16 | ||
|
|
03ac7b1821 | ||
|
|
f409dddb54 | ||
|
|
fe76e6a228 | ||
|
|
40408150f0 | ||
|
|
fea6abb4f0 | ||
|
|
94992ffff6 | ||
|
|
d7c9042c78 | ||
|
|
5b1ff5935e | ||
|
|
347619a85f | ||
|
|
282eab45f7 | ||
|
|
35f21c5bc0 | ||
|
|
9f2662c7f8 | ||
|
|
71a2ba7a98 | ||
|
|
3f2ad5a50a | ||
|
|
abd094d135 | ||
|
|
737763112e | ||
|
|
ce3409b2b7 | ||
|
|
7733f88168 | ||
|
|
c0038f6dac | ||
|
|
4d5a86327a | ||
|
|
d7a7af1ff2 | ||
|
|
aa017383ac | ||
|
|
c3c54e8ce6 | ||
|
|
53fce8e988 | ||
|
|
4ae9953607 | ||
|
|
10796e6726 | ||
|
|
845157c111 | ||
|
|
bac188b568 | ||
|
|
6d15231f10 | ||
|
|
3e90070b88 | ||
|
|
f0df07cba3 | ||
|
|
fe7bece31e | ||
|
|
3969285e5c | ||
|
|
60ebf19c9e | ||
|
|
fcfe90aa9f | ||
|
|
76ee026caa | ||
|
|
6e5ac0b585 | ||
|
|
17e20619ec | ||
|
|
c4fa30ac7d | ||
|
|
84ea4ad990 | ||
|
|
64685f4b20 | ||
|
|
bf594e9fb6 | ||
|
|
3958e75ed2 | ||
|
|
802309caf9 | ||
|
|
468b09c01e | ||
|
|
c13ea4f48d | ||
|
|
1e7285b2bb | ||
|
|
a8cb84c711 | ||
|
|
9075a5bf1e | ||
|
|
bd4ebd23f4 | ||
|
|
31c7bcac29 | ||
|
|
d3b1168e26 | ||
|
|
674f52ba74 | ||
|
|
498264959a | ||
|
|
e89cea8e5a | ||
|
|
e32e20521d | ||
|
|
9d5092cef5 | ||
|
|
68d0c11d88 | ||
|
|
fdf830940b | ||
|
|
10daade1c0 | ||
|
|
9a3a6dc212 | ||
|
|
f9599b64d0 | ||
|
|
a46fd33460 | ||
|
|
d5a70c7669 | ||
|
|
573ba108d9 | ||
|
|
9325bd9d8e | ||
|
|
420fb28d3f | ||
|
|
5613f4f7f4 | ||
|
|
02db9ee577 | ||
|
|
4aab814c37 | ||
|
|
a48206e827 | ||
|
|
99cc435730 | ||
|
|
67d9995280 | ||
|
|
82233cce65 | ||
|
|
2e97ba316d | ||
|
|
7186d09085 | ||
|
|
4fccc903b5 | ||
|
|
06fa131235 | ||
|
|
132fbf49d7 | ||
|
|
d02c124e1d | ||
|
|
554644f9e0 | ||
|
|
cc444d4991 | ||
|
|
4bf5b7d78d | ||
|
|
cb91f44ba4 | ||
|
|
f7e256e9a1 | ||
|
|
bbec8abb68 | ||
|
|
d60d671fec | ||
|
|
8dc730e5ca | ||
|
|
0cf98c5641 | ||
|
|
4bacb3621b | ||
|
|
aef865afc4 | ||
|
|
d70ddc65ea | ||
|
|
832a522cce | ||
|
|
79491df2b8 | ||
|
|
9f50b2cef2 | ||
|
|
96e1883361 | ||
|
|
0d1c18a4ce | ||
|
|
40205d8f1b | ||
|
|
4ede6ea8c5 | ||
|
|
77b3c0d670 | ||
|
|
3819291cb7 | ||
|
|
30964051fe | ||
|
|
ae4ae61a5f | ||
|
|
a91138c8f8 | ||
|
|
27b6d1892f | ||
|
|
2a8f0c2801 | ||
|
|
9e2e44c0c2 | ||
|
|
5e117b3f5a | ||
|
|
294b4eda4c | ||
|
|
7faf9f91db | ||
|
|
4b5abdc988 | ||
|
|
629dc4c770 | ||
|
|
3f65837e0d | ||
|
|
549f60fe49 | ||
|
|
26147afb08 | ||
|
|
fd0ce66ac1 | ||
|
|
c621d4d571 | ||
|
|
6f30cf0004 | ||
|
|
8c7ec44681 | ||
|
|
8329c6b069 | ||
|
|
f11170fecb | ||
|
|
48e6fccc95 | ||
|
|
61026d181b | ||
|
|
5145b33e01 | ||
|
|
8ce3b3d99e | ||
|
|
e696f639ab | ||
|
|
9c43b12206 | ||
|
|
78a7c93802 | ||
|
|
5c68596744 | ||
|
|
61b1ead1a2 | ||
|
|
138907c480 | ||
|
|
66f02ae93d | ||
|
|
455535128a | ||
|
|
53431fce2a | ||
|
|
339372ac99 | ||
|
|
cb9d6b79ef | ||
|
|
e8e5ccf82d | ||
|
|
3f2a6f58eb | ||
|
|
98c0fe934b | ||
|
|
49c8d42317 | ||
|
|
5c986060f0 | ||
|
|
404e713227 | ||
|
|
542bad60ba | ||
|
|
6f4c7d66a4 | ||
|
|
c843102eec | ||
|
|
b753213f9b | ||
|
|
599d8e3287 | ||
|
|
1c89fce30e | ||
|
|
0247d35e5a | ||
|
|
427670cc63 | ||
|
|
4af4b79123 | ||
|
|
5582d7b3be | ||
|
|
4cccba5cac |
@@ -1,8 +1,8 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
#
|
||||
|
||||
FROM fedora:31
|
||||
@@ -11,6 +11,7 @@ RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
dnf -y update && dnf -y upgrade && \
|
||||
|
||||
dnf builddep -y mutter && \
|
||||
@@ -26,4 +27,6 @@ RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
|
||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||
|
||||
dnf upgrade -y 'pkgconfig(libpipewire-0.3)' && \
|
||||
|
||||
dnf clean all
|
||||
|
||||
55
.gitlab/issue_templates/Bug.md
Normal file
55
.gitlab/issue_templates/Bug.md
Normal file
@@ -0,0 +1,55 @@
|
||||
<!--
|
||||
Please read https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines
|
||||
first to ensure that you create a clear and specific issue.
|
||||
-->
|
||||
|
||||
### Affected version
|
||||
|
||||
<!--
|
||||
Provide at least the following information:
|
||||
* Your OS and version
|
||||
* Affected Mutter version
|
||||
* Does this issue appear in XOrg and/or Wayland
|
||||
-->
|
||||
|
||||
### Bug summary
|
||||
|
||||
<!--
|
||||
Provide a short summary of the bug you encountered.
|
||||
-->
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
<!--
|
||||
1. Step one
|
||||
2. Step two
|
||||
3. ...
|
||||
-->
|
||||
|
||||
### What happened
|
||||
|
||||
<!--
|
||||
What did Mutter do that was unexpected?
|
||||
-->
|
||||
|
||||
### What did you expect to happen
|
||||
|
||||
<!--
|
||||
What did you expect Mutter to do?
|
||||
-->
|
||||
|
||||
### Relevant logs, screenshots, screencasts etc.
|
||||
|
||||
<!--
|
||||
If you have further information, such as technical documentation, logs,
|
||||
screenshots or screencasts related, please provide them here.
|
||||
|
||||
If the bug is a crash, please obtain a stack trace with installed debug
|
||||
symbols (at least for GNOME Shell and Mutter) and attach it to
|
||||
this issue following the instructions on
|
||||
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces.
|
||||
-->
|
||||
|
||||
|
||||
<!-- Do not remove the following line. -->
|
||||
/label ~"1. Bug"
|
||||
30
.gitlab/issue_templates/Feature.md
Normal file
30
.gitlab/issue_templates/Feature.md
Normal file
@@ -0,0 +1,30 @@
|
||||
<!--
|
||||
Please read https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines
|
||||
first to ensure that you create a clear and specific issue.
|
||||
-->
|
||||
|
||||
### Feature summary
|
||||
|
||||
<!--
|
||||
Describe what you would like to be able to do with Mutter
|
||||
that you currently cannot do.
|
||||
-->
|
||||
|
||||
### How would you like it to work
|
||||
|
||||
<!--
|
||||
If you can think of a way Mutter might be able to do this,
|
||||
let us know here.
|
||||
-->
|
||||
|
||||
### Relevant links, screenshots, screencasts etc.
|
||||
|
||||
<!--
|
||||
If you have further information, such as technical documentation,
|
||||
code, mockups or a similar feature in another window managers,
|
||||
please provide them here.
|
||||
-->
|
||||
|
||||
|
||||
<!-- Do not remove the following line. -->
|
||||
/label ~"1. Feature"
|
||||
119
NEWS
119
NEWS
@@ -1,3 +1,122 @@
|
||||
3.35.91
|
||||
=======
|
||||
* Honor accelerometer orientation on monitor config changes [Hans; !959]
|
||||
* Enable culling for integer-scaled actors [Robert; !1036]
|
||||
* Add ClutterSeat::touch-mode property [Carlos; !1044]
|
||||
* Fix mis-scaling when streaming windows [Olivier; !1022]
|
||||
* Make the cursor renderer use the transactional KMS API [Jonas; !930]
|
||||
* Advertise MetaMonitor as wl_output [Olivier; !994]
|
||||
* Fix culling of XWayland windows [Robert; !1049]
|
||||
* Only consider enabled effects when disabling culling [Robert; !1052]
|
||||
* Misc. bug fixes and cleanups [Olivier, Sergio, Adam, Carlos, Björn; !1040,
|
||||
#985, !1024, !1039, !1051]
|
||||
|
||||
Contributors:
|
||||
Sergio Costas, Björn Daase, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Adam Jackson, Robert Mader, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
sicklylife [ja]
|
||||
|
||||
3.35.90
|
||||
=======
|
||||
* Cull out clip region [Robert; !985]
|
||||
* Always enable tap-to-click/drag on opaque Wacom tablets [Carlos; !968]
|
||||
* Fix visual glitches with offscreen effects applied [Georges; !992]
|
||||
* Fix "sticky corner" in multi-head setups [Jonas D.; #774]
|
||||
* Fix black shadows around XWayland windows during resizes [Ray, Olivier; #858]
|
||||
* Zero-copy path for GPU-less secondary GPUs [Pekka; !810]
|
||||
* Cancel DND on Esc [Carlos; #1020]
|
||||
* Sync XWayland window shadows to frame during resizes [Olivier; !1009]
|
||||
* Add support for per-monitor workareas [Alberts; !370]
|
||||
* Ensure newly mapped wayland windows receive ENTER event [Olivier; !1026]
|
||||
* Add ClutterSeat object [Carlos; !852]
|
||||
* Honour CLUTTER_ACTOR_NO_LAYOUT flag more efficiently [Daniel; !575]
|
||||
* Fix interoperation with wl_data_device_manager v1 [Carlos; #965]
|
||||
* Favor text over images in clipboard manager [Carlos; #919]
|
||||
* Apply monitor scale after background texture creation [Daniel; !1004]
|
||||
* Plugged memory leaks [Sebastian, Adam; !991, #1000, !1011, !1020, !1030,
|
||||
!1001, !1033]
|
||||
* Fixed crashes [Jonas Å., Florian, Olivier; !961, #1029, !1037]
|
||||
* Misc. bug fixes and cleanups [Björn, Jonas Å., Adam, Sebastian, Jonas D.,
|
||||
Daniel, Carlos, Corentin, Sebastian, Robert, Daniel; #385, !998, !1007, !995,
|
||||
!1016, !1018, !1017, !1005, !1019, !1025, !1028, !1029, !1031, !1015, !1032,
|
||||
!1034, #1025]
|
||||
|
||||
Contributors:
|
||||
Björn Daase, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho, Adam Jackson,
|
||||
Sebastian Keller, Robert Mader, Alberts Muktupāvels, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Ray Strode,
|
||||
Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
sicklylife [ja], Umarzuki Bin Mochlis Moktar [ms]
|
||||
|
||||
3.35.3
|
||||
======
|
||||
* backends/native: Correct dy value in pinch gesture event [Yariv; !974]
|
||||
* Upload clipping rectangles in parallel [Daniel; !969]
|
||||
* More cogl API cleanups [Adam; !978, !977, !973]
|
||||
* Fix window recording on HiDPI [Pascal; !976]
|
||||
* Fix top-left pixel being insensitive to clicks [Sebastian; #893]
|
||||
* Misc. bug fixes and cleanups [Daniel, Adam; !979, !980]
|
||||
|
||||
Contributors:
|
||||
Yariv Barkan, Adam Jackson, Sebastian Keller, Pascal Nowack, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Fran Dieguez [gl], Dz Chen [zh_CN]
|
||||
|
||||
3.35.2
|
||||
======
|
||||
* Don't emit focus event after destruction [Marco; gnome-shell#1704, !860]
|
||||
* Add a notion of pixel format planes [Niels; !858]
|
||||
* Replace various Cogl/Clutter types with Graphene [Georges; !458]
|
||||
* Improve CoglJournal [Georges, Jasper; !402]
|
||||
* Split pick and paint [Georges; !865]
|
||||
* Remove deprecated/unused cogl/clutter APIs [Adam; !866, !878, !879, !880,
|
||||
!885, !900, !902, !904, !896, !913, !922, !883, !903, !921, !933, !819]
|
||||
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
|
||||
* Allow changing Clutter debug flags at runtime [Georges; !862]
|
||||
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas; !886]
|
||||
* Fix triggering popups from stylus devices o wayland [Carlos; #886]
|
||||
* Fix fallback to GLES2 [Adam; #635]
|
||||
* Fix buffer age checks on multiple monitors [Carlos; !906]
|
||||
* Adjust to Sysprof API change [Christian; !908]
|
||||
* Improve support for (X11) fullscreen games under wayland [Hans; !739]
|
||||
* Support shadow framebuffers for offscreen rendering [Olivier; !877]
|
||||
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
|
||||
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
|
||||
* Respect NET_WM_TRANSIENT_FOR for override-redirect windows [Marco; !920]
|
||||
* Kill window effects on destroy [Robert; !924]
|
||||
* Remove deprecated ClutterTexture [Jonas; !932]
|
||||
* Use regions instead of bounding box for clipping and culling [Carlos; !867]
|
||||
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
|
||||
* Do not stack transients underneath their always-on-top parent [Florian; #587]
|
||||
* Add explicit paint/pick contexts [Jonas; !935]
|
||||
* Fix KMS freeze after pageflip fallback [Pekka; !953]
|
||||
* Fixed crashes [Robert, Carlos, Jonas, Marco, Hans, Tim; !856, !869, !912,
|
||||
!895, !928, #591, !823, !960]
|
||||
* Plugged memory leaks [Niels, Robert, Carlos, Marco; !847, !868, !873, #908]
|
||||
* Misc. bug fixes and cleanups [Niels, Robert, Jonas, Marco, Carlos, Daniel,
|
||||
Jan, Adam, Cosimo, Florian, Thomas, Georges, Hans, Corentin, Christian,
|
||||
Benjamin; !853, !822, !451, !854, !816, !857, !859, !734, !844, !851, #876,
|
||||
!874, !673, !692, !888, !889, !894, !901, !905, !872, !898, !911, !918, !863,
|
||||
#878, !811, !893, !925, !926, !890, !931, !927, !934, !938, !940, !947, !941,
|
||||
!929, !949, !952, !871, !955, !956, !958, !907, !965, !964, !966]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jan Alexander Steffens (heftig),
|
||||
Thomas Hindoe Paaboel Andersen, Benjamin Berg, Cosimo Cecchi, Tim Crawford,
|
||||
Piotr Drąg, Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Niels De Graef, Christian Hergert, Adam Jackson, Robert Mader,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Corentin Noël,
|
||||
Pekka Paalanen, Jasper St. Pierre, Christian Rauch, Daniel van Vugt,
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Bruce Cowan [en_GB]
|
||||
|
||||
3.35.1
|
||||
======
|
||||
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
|
||||
|
||||
@@ -600,10 +600,11 @@ cally_actor_real_remove_actor (ClutterActor *container,
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
||||
|
||||
atk_parent = ATK_OBJECT (data);
|
||||
atk_child = clutter_actor_get_accessible (actor);
|
||||
|
||||
if (atk_child)
|
||||
if (clutter_actor_has_accessible (actor))
|
||||
{
|
||||
atk_child = clutter_actor_get_accessible (actor);
|
||||
|
||||
g_value_init (&values.old_value, G_TYPE_POINTER);
|
||||
g_value_set_pointer (&values.old_value, atk_parent);
|
||||
|
||||
|
||||
@@ -315,7 +315,6 @@ void _clutter_actor_queue_relayout_on_clones
|
||||
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
||||
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
|
||||
|
||||
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
|
||||
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
|
||||
float *resource_scale);
|
||||
|
||||
|
||||
@@ -631,7 +631,7 @@
|
||||
#include "clutter-color-static.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-constraint-private.h"
|
||||
#include "clutter-container.h"
|
||||
#include "clutter-container-private.h"
|
||||
#include "clutter-content-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-easing.h"
|
||||
@@ -643,6 +643,7 @@
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-nodes.h"
|
||||
#include "clutter-paint-node-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
@@ -1286,10 +1287,12 @@ clutter_actor_verify_map_state (ClutterActor *self)
|
||||
static gboolean
|
||||
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
ClutterStage *stage,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box,
|
||||
graphene_point_t vertices[4])
|
||||
{
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_pick_context_get_framebuffer (pick_context);
|
||||
CoglMatrix stage_transform, inv_stage_transform;
|
||||
CoglMatrix modelview, transform_to_stage;
|
||||
int v;
|
||||
@@ -1330,6 +1333,7 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
/**
|
||||
* clutter_actor_pick_box:
|
||||
* @self: The #ClutterActor being "pick" painted.
|
||||
* @pick_context: The #ClutterPickContext
|
||||
* @box: A rectangle in the actor's own local coordinates.
|
||||
*
|
||||
* Logs (does a virtual paint of) a rectangle for picking. Note that @box is
|
||||
@@ -1340,6 +1344,7 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
*/
|
||||
void
|
||||
clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@@ -1353,12 +1358,14 @@ clutter_actor_pick_box (ClutterActor *self,
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
|
||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices))
|
||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||
box, vertices))
|
||||
clutter_stage_log_pick (stage, vertices, self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_clutter_actor_push_pick_clip (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *clip)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@@ -1366,7 +1373,8 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
|
||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices))
|
||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||
clip, vertices))
|
||||
return FALSE;
|
||||
|
||||
clutter_stage_push_pick_clip (stage, vertices);
|
||||
@@ -1770,6 +1778,15 @@ clutter_actor_unmap (ClutterActor *self)
|
||||
clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNMAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_queue_shallow_relayout (ClutterActor *self)
|
||||
{
|
||||
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
|
||||
|
||||
if (stage != NULL)
|
||||
clutter_stage_queue_actor_relayout (CLUTTER_STAGE (stage), self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_show (ClutterActor *self)
|
||||
{
|
||||
@@ -1803,6 +1820,11 @@ clutter_actor_real_show (ClutterActor *self)
|
||||
|
||||
clutter_actor_queue_relayout (self);
|
||||
}
|
||||
else /* but still don't leave the actor un-allocated before showing it */
|
||||
{
|
||||
clutter_actor_queue_shallow_relayout (self);
|
||||
clutter_actor_queue_redraw (self);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -2321,7 +2343,8 @@ _clutter_actor_rerealize (ClutterActor *self,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_pick (ClutterActor *self)
|
||||
clutter_actor_real_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
if (clutter_actor_should_pick_paint (self))
|
||||
{
|
||||
@@ -2332,7 +2355,7 @@ clutter_actor_real_pick (ClutterActor *self)
|
||||
.y2 = clutter_actor_get_height (self),
|
||||
};
|
||||
|
||||
clutter_actor_pick_box (self, &box);
|
||||
clutter_actor_pick_box (self, pick_context, &box);
|
||||
}
|
||||
|
||||
/* XXX - this thoroughly sucks, but we need to maintain compatibility
|
||||
@@ -2349,7 +2372,7 @@ clutter_actor_real_pick (ClutterActor *self)
|
||||
for (iter = self->priv->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->priv->next_sibling)
|
||||
clutter_actor_pick (iter);
|
||||
clutter_actor_pick (iter, pick_context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2855,9 +2878,23 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
|
||||
memset (priv->height_requests, 0,
|
||||
N_CACHED_SIZE_REQUESTS * sizeof (SizeRequest));
|
||||
|
||||
/* We need to go all the way up the hierarchy */
|
||||
/* We may need to go all the way up the hierarchy */
|
||||
if (priv->parent != NULL)
|
||||
_clutter_actor_queue_only_relayout (priv->parent);
|
||||
{
|
||||
if (priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)
|
||||
{
|
||||
clutter_actor_queue_shallow_relayout (self);
|
||||
|
||||
/* The above might have invalidated the parent's paint volume if self
|
||||
* has moved or resized. DnD seems to require this...
|
||||
*/
|
||||
priv->parent->priv->needs_paint_volume_update = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_clutter_actor_queue_only_relayout (priv->parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3437,8 +3474,8 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
|
||||
cogl_pipeline_set_color (outline, &cogl_color);
|
||||
|
||||
pipeline_node = clutter_pipeline_node_new (outline);
|
||||
clutter_paint_node_set_name (pipeline_node,
|
||||
"ClutterActor (paint volume outline)");
|
||||
clutter_paint_node_set_static_name (pipeline_node,
|
||||
"ClutterActor (paint volume outline)");
|
||||
clutter_paint_node_add_primitive (pipeline_node, prim);
|
||||
clutter_paint_node_add_child (node, pipeline_node);
|
||||
cogl_object_unref (prim);
|
||||
@@ -3452,8 +3489,8 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
|
||||
pango_layout_set_text (layout, label, -1);
|
||||
|
||||
text_node = clutter_text_node_new (layout, color);
|
||||
clutter_paint_node_set_name (text_node,
|
||||
"ClutterActor (paint volume label)");
|
||||
clutter_paint_node_set_static_name (text_node,
|
||||
"ClutterActor (paint volume label)");
|
||||
clutter_paint_node_add_rectangle (text_node,
|
||||
&(ClutterActorBox) {
|
||||
.x1 = pv->vertices[0].x,
|
||||
@@ -3549,8 +3586,8 @@ _clutter_actor_paint_cull_result (ClutterActor *self,
|
||||
pango_layout_set_text (layout, label, -1);
|
||||
|
||||
text_node = clutter_text_node_new (layout, &color);
|
||||
clutter_paint_node_set_name (text_node,
|
||||
"ClutterActor (paint volume text)");
|
||||
clutter_paint_node_set_static_name (text_node,
|
||||
"ClutterActor (paint volume text)");
|
||||
clutter_paint_node_add_rectangle (text_node,
|
||||
&(ClutterActorBox) {
|
||||
.x1 = 0.f,
|
||||
@@ -3591,8 +3628,9 @@ in_clone_paint (void)
|
||||
* means there's no point in trying to cull descendants of the current
|
||||
* node. */
|
||||
static gboolean
|
||||
cull_actor (ClutterActor *self,
|
||||
ClutterCullResult *result_out)
|
||||
cull_actor (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterCullResult *result_out)
|
||||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterStage *stage;
|
||||
@@ -3619,10 +3657,10 @@ cull_actor (ClutterActor *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage))
|
||||
if (clutter_paint_context_is_drawing_off_stage (paint_context))
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
|
||||
"Current framebuffer doesn't correspond to stage",
|
||||
"Drawing off stage",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3705,7 +3743,13 @@ needs_flatten_effect (ClutterActor *self)
|
||||
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT))
|
||||
return FALSE;
|
||||
|
||||
if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ALWAYS)
|
||||
/* We need to enable the effect immediately even in ON_IDLE because that can
|
||||
* only be implemented efficiently within the effect itself.
|
||||
* If it was implemented here using just priv->is_dirty then we would lose
|
||||
* the ability to animate opacity without repaints.
|
||||
*/
|
||||
if ((priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ALWAYS) ||
|
||||
(priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE))
|
||||
return TRUE;
|
||||
else if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY)
|
||||
{
|
||||
@@ -3760,7 +3804,8 @@ add_or_remove_flatten_effect (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_paint (ClutterActor *actor)
|
||||
clutter_actor_real_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorPrivate *priv = actor->priv;
|
||||
ClutterActor *iter;
|
||||
@@ -3777,21 +3822,19 @@ clutter_actor_real_paint (ClutterActor *actor)
|
||||
iter->priv->allocation.x2 - iter->priv->allocation.x1,
|
||||
iter->priv->allocation.y2 - iter->priv->allocation.y1);
|
||||
|
||||
clutter_actor_paint (iter);
|
||||
clutter_actor_paint (iter, paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_actor_paint_node (ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
clutter_actor_paint_node (ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorPrivate *priv = actor->priv;
|
||||
ClutterActorBox box;
|
||||
ClutterColor bg_color;
|
||||
|
||||
if (root == NULL)
|
||||
return FALSE;
|
||||
|
||||
box.x1 = 0.f;
|
||||
box.y1 = 0.f;
|
||||
box.x2 = clutter_actor_box_get_width (&priv->allocation);
|
||||
@@ -3805,7 +3848,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
CoglFramebuffer *fb;
|
||||
CoglBufferBit clear_flags;
|
||||
|
||||
fb = _clutter_stage_get_active_framebuffer (CLUTTER_STAGE (actor));
|
||||
fb = clutter_paint_context_get_base_framebuffer (paint_context);
|
||||
|
||||
if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
|
||||
{
|
||||
@@ -3825,7 +3868,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
clear_flags = COGL_BUFFER_BIT_DEPTH;
|
||||
|
||||
node = clutter_root_node_new (fb, &bg_color, clear_flags);
|
||||
clutter_paint_node_set_name (node, "stageClear");
|
||||
clutter_paint_node_set_static_name (node, "stageClear");
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
@@ -3840,14 +3883,14 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
/ 255;
|
||||
|
||||
node = clutter_color_node_new (&bg_color);
|
||||
clutter_paint_node_set_name (node, "backgroundColor");
|
||||
clutter_paint_node_set_static_name (node, "backgroundColor");
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
}
|
||||
|
||||
if (priv->content != NULL)
|
||||
_clutter_content_paint_content (priv->content, actor, root);
|
||||
_clutter_content_paint_content (priv->content, actor, root, paint_context);
|
||||
|
||||
if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL)
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root);
|
||||
@@ -3863,7 +3906,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
clutter_paint_node_paint (root);
|
||||
clutter_paint_node_paint (root, paint_context);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3887,7 +3930,8 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
* unless it is performing a pick paint.
|
||||
*/
|
||||
void
|
||||
clutter_actor_paint (ClutterActor *self)
|
||||
clutter_actor_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_autoptr (ClutterPaintNode) actor_node = NULL;
|
||||
g_autoptr (ClutterPaintNode) root_node = NULL;
|
||||
@@ -3959,11 +4003,14 @@ clutter_actor_paint (ClutterActor *self)
|
||||
|
||||
clutter_actor_get_transform (self, &transform);
|
||||
|
||||
transform_node = clutter_transform_node_new (&transform);
|
||||
clutter_paint_node_add_child (transform_node, root_node);
|
||||
clutter_paint_node_unref (root_node);
|
||||
if (!cogl_matrix_is_identity (&transform))
|
||||
{
|
||||
transform_node = clutter_transform_node_new (&transform);
|
||||
clutter_paint_node_add_child (transform_node, root_node);
|
||||
clutter_paint_node_unref (root_node);
|
||||
|
||||
root_node = g_steal_pointer (&transform_node);
|
||||
root_node = g_steal_pointer (&transform_node);
|
||||
}
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
/* Catch when out-of-band transforms have been made by actors not as part
|
||||
@@ -4052,7 +4099,7 @@ clutter_actor_paint (ClutterActor *self)
|
||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
|
||||
_clutter_actor_update_last_paint_volume (self);
|
||||
|
||||
success = cull_actor (self, &result);
|
||||
success = cull_actor (self, paint_context, &result);
|
||||
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
|
||||
_clutter_actor_paint_cull_result (self, success, result, actor_node);
|
||||
@@ -4069,7 +4116,7 @@ clutter_actor_paint (ClutterActor *self)
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
|
||||
_clutter_actor_draw_paint_volume (self, actor_node);
|
||||
|
||||
clutter_paint_node_paint (root_node);
|
||||
clutter_paint_node_paint (root_node, paint_context);
|
||||
|
||||
/* If we make it here then the actor has run through a complete
|
||||
paint run including all the effects so it's no longer dirty */
|
||||
@@ -4089,7 +4136,8 @@ clutter_actor_paint (ClutterActor *self)
|
||||
* Since: 1.8
|
||||
*/
|
||||
void
|
||||
clutter_actor_continue_paint (ClutterActor *self)
|
||||
clutter_actor_continue_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@@ -4109,6 +4157,7 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
actual actor */
|
||||
if (priv->next_effect_to_paint == NULL)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterPaintNode *dummy;
|
||||
|
||||
/* XXX - this will go away in 2.0, when we can get rid of this
|
||||
@@ -4116,21 +4165,22 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
* for the entire frame, starting from the Stage; the paint()
|
||||
* virtual function can then be called directly.
|
||||
*/
|
||||
dummy = _clutter_dummy_node_new (self);
|
||||
clutter_paint_node_set_name (dummy, "Root");
|
||||
framebuffer = clutter_paint_context_get_base_framebuffer (paint_context);
|
||||
dummy = _clutter_dummy_node_new (self, framebuffer);
|
||||
clutter_paint_node_set_static_name (dummy, "Root");
|
||||
|
||||
/* XXX - for 1.12, we use the return value of paint_node() to
|
||||
* decide whether we should emit the ::paint signal.
|
||||
*/
|
||||
clutter_actor_paint_node (self, dummy);
|
||||
clutter_actor_paint_node (self, dummy, paint_context);
|
||||
clutter_paint_node_unref (dummy);
|
||||
|
||||
/* XXX:2.0 - Call the paint() virtual directly */
|
||||
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
|
||||
0, TRUE))
|
||||
g_signal_emit (self, actor_signals[PAINT], 0);
|
||||
g_signal_emit (self, actor_signals[PAINT], 0, paint_context);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self, paint_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4157,7 +4207,12 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
|
||||
}
|
||||
|
||||
_clutter_effect_paint (priv->current_effect, run_flags);
|
||||
if (priv->current_effect == priv->flatten_effect &&
|
||||
priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE &&
|
||||
run_flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY)
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_BYPASS_EFFECT;
|
||||
|
||||
_clutter_effect_paint (priv->current_effect, paint_context, run_flags);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
@@ -4170,9 +4225,11 @@ clutter_actor_continue_paint (ClutterActor *self)
|
||||
* Asks @actor to perform a pick.
|
||||
*/
|
||||
void
|
||||
clutter_actor_pick (ClutterActor *actor)
|
||||
clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterActorBox clip;
|
||||
gboolean clip_set = FALSE;
|
||||
|
||||
@@ -4192,15 +4249,16 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
/* mark that we are in the paint process */
|
||||
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||
|
||||
cogl_push_matrix ();
|
||||
framebuffer = clutter_pick_context_get_framebuffer (pick_context);
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
|
||||
if (priv->enable_model_view_transform)
|
||||
{
|
||||
CoglMatrix matrix;
|
||||
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||
_clutter_actor_apply_modelview_transform (actor, &matrix);
|
||||
cogl_set_modelview_matrix (&matrix);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &matrix);
|
||||
}
|
||||
|
||||
if (priv->has_clip)
|
||||
@@ -4221,7 +4279,7 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
}
|
||||
|
||||
if (clip_set)
|
||||
clip_set = _clutter_actor_push_pick_clip (actor, &clip);
|
||||
clip_set = _clutter_actor_push_pick_clip (actor, pick_context, &clip);
|
||||
|
||||
priv->next_effect_to_paint = NULL;
|
||||
if (priv->effects)
|
||||
@@ -4230,12 +4288,12 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
_clutter_meta_group_peek_metas (priv->effects);
|
||||
}
|
||||
|
||||
clutter_actor_continue_pick (actor);
|
||||
clutter_actor_continue_pick (actor, pick_context);
|
||||
|
||||
if (clip_set)
|
||||
_clutter_actor_pop_pick_clip (actor);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
|
||||
/* paint sequence complete */
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||
@@ -4252,7 +4310,8 @@ clutter_actor_pick (ClutterActor *actor)
|
||||
* is the last effect in the chain.
|
||||
*/
|
||||
void
|
||||
clutter_actor_continue_pick (ClutterActor *actor)
|
||||
clutter_actor_continue_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@@ -4278,9 +4337,9 @@ clutter_actor_continue_pick (ClutterActor *actor)
|
||||
*/
|
||||
if (g_signal_has_handler_pending (actor, actor_signals[PICK],
|
||||
0, TRUE))
|
||||
g_signal_emit (actor, actor_signals[PICK], 0);
|
||||
g_signal_emit (actor, actor_signals[PICK], 0, pick_context);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor);
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor, pick_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4294,7 +4353,7 @@ clutter_actor_continue_pick (ClutterActor *actor)
|
||||
priv->current_effect = priv->next_effect_to_paint->data;
|
||||
priv->next_effect_to_paint = priv->next_effect_to_paint->next;
|
||||
|
||||
_clutter_effect_pick (priv->current_effect);
|
||||
_clutter_effect_pick (priv->current_effect, pick_context);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
@@ -4523,7 +4582,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
||||
|
||||
/* we need to emit the signal before dropping the reference */
|
||||
if (emit_actor_removed)
|
||||
g_signal_emit_by_name (self, "actor-removed", child);
|
||||
_clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child);
|
||||
|
||||
if (notify_first_last)
|
||||
{
|
||||
@@ -6585,7 +6644,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
g_param_spec_float ("width",
|
||||
P_("Width"),
|
||||
P_("Width of the actor"),
|
||||
0.0, G_MAXFLOAT,
|
||||
-1.0f, G_MAXFLOAT,
|
||||
0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
@@ -6604,7 +6663,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
g_param_spec_float ("height",
|
||||
P_("Height"),
|
||||
P_("Height of the actor"),
|
||||
0.0, G_MAXFLOAT,
|
||||
-1.0f, G_MAXFLOAT,
|
||||
0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
@@ -8534,6 +8593,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
/**
|
||||
* ClutterActor::paint:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* The ::paint signal is emitted each time an actor is being painted.
|
||||
*
|
||||
@@ -8561,7 +8621,8 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
G_SIGNAL_DEPRECATED,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, paint),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PAINT_CONTEXT);
|
||||
/**
|
||||
* ClutterActor::realize:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
@@ -8604,6 +8665,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
/**
|
||||
* ClutterActor::pick:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
* @pick_context: a #ClutterPickContext
|
||||
*
|
||||
* The ::pick signal is emitted each time an actor is being painted
|
||||
* in "pick mode". The pick mode is used to identify the actor during
|
||||
@@ -8625,7 +8687,8 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, pick),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PICK_CONTEXT);
|
||||
|
||||
/**
|
||||
* ClutterActor::allocation-changed:
|
||||
@@ -9704,6 +9767,23 @@ clutter_actor_get_preferred_width (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the request mode is CONTENT_SIZE we simply return the content width */
|
||||
if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
{
|
||||
float content_width = 0.f;
|
||||
|
||||
if (priv->content != NULL)
|
||||
clutter_content_get_preferred_size (priv->content, &content_width, NULL);
|
||||
|
||||
if (min_width_p != NULL)
|
||||
*min_width_p = content_width;
|
||||
|
||||
if (natural_width_p != NULL)
|
||||
*natural_width_p = content_width;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
|
||||
|
||||
/* the remaining cases are:
|
||||
@@ -9852,6 +9932,23 @@ clutter_actor_get_preferred_height (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the request mode is CONTENT_SIZE we simply return the content height */
|
||||
if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
{
|
||||
float content_height = 0.f;
|
||||
|
||||
if (priv->content != NULL)
|
||||
clutter_content_get_preferred_size (priv->content, NULL, &content_height);
|
||||
|
||||
if (min_height_p != NULL)
|
||||
*min_height_p = content_height;
|
||||
|
||||
if (natural_height_p != NULL)
|
||||
*natural_height_p = content_height;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
|
||||
|
||||
/* the remaining cases are:
|
||||
@@ -13129,7 +13226,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
||||
}
|
||||
|
||||
if (emit_actor_added)
|
||||
g_signal_emit_by_name (self, "actor-added", child);
|
||||
_clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
|
||||
|
||||
if (notify_first_last)
|
||||
{
|
||||
@@ -15660,7 +15757,7 @@ update_pango_context (ClutterBackend *backend,
|
||||
* stored by the #ClutterBackend change.
|
||||
*
|
||||
* You can use the returned #PangoContext to create a #PangoLayout
|
||||
* and render text using cogl_pango_render_layout() to reuse the
|
||||
* and render text using cogl_pango_show_layout() to reuse the
|
||||
* glyphs cache also used by Clutter.
|
||||
*
|
||||
* Return value: (transfer none): the #PangoContext for a #ClutterActor.
|
||||
@@ -19182,8 +19279,8 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
gboolean call_restore = FALSE;
|
||||
TransitionClosure *clos;
|
||||
va_list var_args;
|
||||
GValue initial = G_VALUE_INIT;
|
||||
GValue final = G_VALUE_INIT;
|
||||
g_auto (GValue) initial = G_VALUE_INIT;
|
||||
g_auto (GValue) final = G_VALUE_INIT;
|
||||
GType ptype;
|
||||
char *error;
|
||||
|
||||
@@ -19232,7 +19329,6 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
if (error != NULL)
|
||||
{
|
||||
g_critical ("%s: %s", G_STRLOC, error);
|
||||
g_value_unset (&initial);
|
||||
g_free (error);
|
||||
goto out;
|
||||
}
|
||||
@@ -19254,9 +19350,6 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
&final,
|
||||
pspec);
|
||||
|
||||
g_value_unset (&initial);
|
||||
g_value_unset (&final);
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -19304,9 +19397,6 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
|
||||
/* the actor now owns the transition */
|
||||
g_object_unref (res);
|
||||
|
||||
g_value_unset (&initial);
|
||||
g_value_unset (&final);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -20793,32 +20883,6 @@ clutter_actor_has_mapped_clones (ClutterActor *self)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
_clutter_actor_get_active_framebuffer (ClutterActor *self)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
|
||||
if (!CLUTTER_ACTOR_IN_PAINT (self))
|
||||
{
|
||||
g_critical ("The active framebuffer of actor '%s' can only be "
|
||||
"retrieved during the paint sequence. Please, check "
|
||||
"your code.",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
|
||||
if (stage == NULL)
|
||||
{
|
||||
g_critical ("The active framebuffer of actor '%s' is only available "
|
||||
"if the actor is associated to a ClutterStage.",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _clutter_stage_get_active_framebuffer (stage);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_child_model__items_changed (GListModel *model,
|
||||
guint position,
|
||||
@@ -21107,7 +21171,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
color.alpha = clutter_actor_get_paint_opacity_internal (self);
|
||||
|
||||
node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
|
||||
clutter_paint_node_set_name (node, "Texture");
|
||||
clutter_paint_node_set_static_name (node, "Texture");
|
||||
|
||||
if (priv->content_repeat == CLUTTER_REPEAT_NONE)
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
@@ -21128,3 +21192,14 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_actor_has_accessible (ClutterActor *actor)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
||||
|
||||
if (CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible)
|
||||
return CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible (actor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-pick-context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -228,12 +230,14 @@ struct _ClutterActorClass
|
||||
void (* unrealize) (ClutterActor *self);
|
||||
void (* map) (ClutterActor *self);
|
||||
void (* unmap) (ClutterActor *self);
|
||||
void (* paint) (ClutterActor *self);
|
||||
void (* paint) (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* parent_set) (ClutterActor *actor,
|
||||
ClutterActor *old_parent);
|
||||
|
||||
void (* destroy) (ClutterActor *self);
|
||||
void (* pick) (ClutterActor *actor);
|
||||
void (* pick) (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
@@ -295,10 +299,11 @@ struct _ClutterActorClass
|
||||
|
||||
gboolean (* touch_event) (ClutterActor *self,
|
||||
ClutterTouchEvent *event);
|
||||
gboolean (* has_accessible) (ClutterActor *self);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[26];
|
||||
gpointer _padding_dummy[25];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -349,13 +354,17 @@ void clutter_actor_map
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_unmap (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_paint (ClutterActor *self);
|
||||
void clutter_actor_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_paint (ClutterActor *self);
|
||||
void clutter_actor_continue_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick (ClutterActor *actor);
|
||||
void clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_pick (ClutterActor *actor);
|
||||
void clutter_actor_continue_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@@ -372,6 +381,8 @@ CLUTTER_EXPORT
|
||||
const gchar * clutter_actor_get_name (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
AtkObject * clutter_actor_get_accessible (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_accessible (ClutterActor *self);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_is_visible (ClutterActor *self);
|
||||
@@ -907,6 +918,7 @@ void clutter_actor_bind_model_with_properties
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -90,6 +90,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
|
||||
|
||||
@@ -129,9 +129,6 @@ gfloat _clutter_backend_get_units_per_em (Clutter
|
||||
PangoFontDescription *font_desc);
|
||||
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
|
||||
|
||||
void clutter_set_allowed_drivers (const char *drivers);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
||||
@@ -970,27 +970,6 @@ clutter_wayland_set_compositor_display (void *display)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
|
||||
{
|
||||
if (backend->dummy_onscreen == NULL)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
|
||||
|
||||
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
|
||||
&internal_error))
|
||||
{
|
||||
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_set_allowed_drivers (const char *drivers)
|
||||
{
|
||||
|
||||
@@ -144,6 +144,55 @@ source_destroyed (ClutterActor *actor,
|
||||
bind->source = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bind_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterOrientation direction,
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size)
|
||||
{
|
||||
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
|
||||
float source_min, source_nat;
|
||||
|
||||
if (bind->source == NULL)
|
||||
return;
|
||||
|
||||
/* only these bindings affect the preferred size */
|
||||
if (!(bind->coordinate == CLUTTER_BIND_WIDTH ||
|
||||
bind->coordinate == CLUTTER_BIND_HEIGHT ||
|
||||
bind->coordinate == CLUTTER_BIND_SIZE ||
|
||||
bind->coordinate == CLUTTER_BIND_ALL))
|
||||
return;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case CLUTTER_ORIENTATION_HORIZONTAL:
|
||||
if (bind->coordinate != CLUTTER_BIND_HEIGHT)
|
||||
{
|
||||
clutter_actor_get_preferred_width (bind->source, for_size,
|
||||
&source_min,
|
||||
&source_nat);
|
||||
|
||||
*minimum_size = source_min;
|
||||
*natural_size = source_nat;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLUTTER_ORIENTATION_VERTICAL:
|
||||
if (bind->coordinate != CLUTTER_BIND_WIDTH)
|
||||
{
|
||||
clutter_actor_get_preferred_height (bind->source, for_size,
|
||||
&source_min,
|
||||
&source_nat);
|
||||
|
||||
*minimum_size = source_min;
|
||||
*natural_size = source_nat;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
@@ -328,6 +377,8 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
|
||||
meta_class->set_actor = clutter_bind_constraint_set_actor;
|
||||
|
||||
constraint_class->update_allocation = clutter_bind_constraint_update_allocation;
|
||||
constraint_class->update_preferred_size = clutter_bind_constraint_update_preferred_size;
|
||||
|
||||
/**
|
||||
* ClutterBindConstraint:source:
|
||||
*
|
||||
|
||||
@@ -99,7 +99,8 @@ G_DEFINE_TYPE (ClutterBlurEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -124,7 +125,7 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -157,10 +158,12 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
guint8 paint_opacity;
|
||||
|
||||
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
|
||||
|
||||
@@ -121,16 +121,17 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
|
||||
static gboolean
|
||||
will_have_no_effect (ClutterBrightnessContrastEffect *self)
|
||||
{
|
||||
return (self->brightness_red == no_change &&
|
||||
self->brightness_green == no_change &&
|
||||
self->brightness_blue == no_change &&
|
||||
self->contrast_red == no_change &&
|
||||
self->contrast_green == no_change &&
|
||||
self->contrast_blue == no_change);
|
||||
return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -156,7 +157,7 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
|
||||
parent_class =
|
||||
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -175,10 +176,12 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
@@ -494,9 +497,9 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
if (red == effect->brightness_red &&
|
||||
green == effect->brightness_green &&
|
||||
blue == effect->brightness_blue)
|
||||
if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
effect->brightness_red = red;
|
||||
@@ -584,9 +587,9 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
|
||||
|
||||
if (red == effect->contrast_red &&
|
||||
green == effect->contrast_green &&
|
||||
blue == effect->contrast_blue)
|
||||
if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) &&
|
||||
G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON))
|
||||
return;
|
||||
|
||||
effect->contrast_red = red;
|
||||
|
||||
@@ -328,9 +328,10 @@ clutter_canvas_init (ClutterCanvas *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterCanvas *self = CLUTTER_CANVAS (content);
|
||||
ClutterCanvasPrivate *priv = self->priv;
|
||||
@@ -351,7 +352,7 @@ clutter_canvas_paint_content (ClutterContent *content,
|
||||
return;
|
||||
|
||||
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
||||
clutter_paint_node_set_name (node, "Canvas Content");
|
||||
clutter_paint_node_set_static_name (node, "Canvas Content");
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
|
||||
|
||||
@@ -152,7 +152,8 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clone_paint (ClutterActor *actor)
|
||||
clutter_clone_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterClone *self = CLUTTER_CLONE (actor);
|
||||
ClutterClonePrivate *priv = self->priv;
|
||||
@@ -189,7 +190,7 @@ clutter_clone_paint (ClutterActor *actor)
|
||||
if (clutter_actor_is_realized (priv->clone_source))
|
||||
{
|
||||
_clutter_actor_push_clone_paint ();
|
||||
clutter_actor_paint (priv->clone_source);
|
||||
clutter_actor_paint (priv->clone_source, paint_context);
|
||||
_clutter_actor_pop_clone_paint ();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,8 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -126,7 +127,7 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -145,10 +146,12 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
|
||||
@@ -30,13 +30,6 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterActorBox *allocation);
|
||||
|
||||
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterOrientation direction,
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
|
||||
|
||||
@@ -222,6 +222,17 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
return !clutter_actor_box_equal (allocation, &old_alloc);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_constraint_update_preferred_size:
|
||||
* @constraint: a #ClutterConstraint
|
||||
* @actor: a #ClutterActor
|
||||
* @direction: a #ClutterOrientation
|
||||
* @for_size: the size in the opposite direction
|
||||
* @minimum_size: (inout): the minimum size to modify
|
||||
* @natural_size: (inout): the natural size to modify
|
||||
*
|
||||
* Asks the @constraint to update the size request of a #ClutterActor.
|
||||
*/
|
||||
void
|
||||
clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
|
||||
@@ -99,6 +99,14 @@ struct _ClutterConstraintClass
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_constraint_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterOrientation direction,
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size);
|
||||
|
||||
/* ClutterActor API */
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_add_constraint (ClutterActor *self,
|
||||
|
||||
36
clutter/clutter/clutter-container-private.h
Normal file
36
clutter/clutter/clutter-container-private.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright 2020 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
#define __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
|
||||
#include <clutter/clutter-container.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_container_emit_actor_added (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void _clutter_container_emit_actor_removed (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTAINER_PRIVATE_H__ */
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-child-meta.h"
|
||||
#include "clutter-container-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
@@ -1250,3 +1251,23 @@ clutter_container_child_notify (ClutterContainer *container,
|
||||
child,
|
||||
pspec);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_container_emit_actor_added (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
g_signal_emit (container, container_signals[ACTOR_ADDED], 0, actor);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_container_emit_actor_removed (ClutterContainer *container,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
g_signal_emit (container, container_signals[ACTOR_REMOVED], 0, actor);
|
||||
}
|
||||
|
||||
@@ -34,9 +34,10 @@ void _clutter_content_attached (ClutterContent *conte
|
||||
void _clutter_content_detached (ClutterContent *content,
|
||||
ClutterActor *actor);
|
||||
|
||||
void _clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node);
|
||||
void _clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -96,9 +96,10 @@ clutter_content_real_invalidate_size (ClutterContent *content)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *context)
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *context,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -300,7 +301,8 @@ _clutter_content_detached (ClutterContent *content,
|
||||
* _clutter_content_paint_content:
|
||||
* @content: a #ClutterContent
|
||||
* @actor: a #ClutterActor
|
||||
* @context: a #ClutterPaintNode
|
||||
* @node: a #ClutterPaintNode
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* Creates the render tree for the @content and @actor.
|
||||
*
|
||||
@@ -308,11 +310,13 @@ _clutter_content_detached (ClutterContent *content,
|
||||
* virtual function.
|
||||
*/
|
||||
void
|
||||
_clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node)
|
||||
_clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node);
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node,
|
||||
paint_context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,9 +65,10 @@ struct _ClutterContentInterface
|
||||
gboolean (* get_preferred_size) (ClutterContent *content,
|
||||
gfloat *width,
|
||||
gfloat *height);
|
||||
void (* paint_content) (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node);
|
||||
void (* paint_content) (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
void (* attached) (ClutterContent *content,
|
||||
ClutterActor *actor);
|
||||
|
||||
@@ -166,14 +166,16 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
CoglHandle material;
|
||||
CoglPipeline *pipeline;
|
||||
CoglDepthState depth_state;
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
if (priv->is_dirty)
|
||||
{
|
||||
|
||||
@@ -112,7 +112,8 @@ G_DEFINE_TYPE (ClutterDesaturateEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -133,7 +134,7 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect))
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -152,10 +153,12 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterActor *actor;
|
||||
CoglHandle texture;
|
||||
guint8 paint_opacity;
|
||||
|
||||
@@ -5,14 +5,18 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
|
||||
void _clutter_effect_post_paint (ClutterEffect *effect);
|
||||
gboolean _clutter_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void _clutter_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume);
|
||||
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
|
||||
void _clutter_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void _clutter_effect_pick (ClutterEffect *effect);
|
||||
void _clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -177,13 +177,15 @@ G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
|
||||
CLUTTER_TYPE_ACTOR_META);
|
||||
|
||||
static gboolean
|
||||
clutter_effect_real_pre_paint (ClutterEffect *effect)
|
||||
clutter_effect_real_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_post_paint (ClutterEffect *effect)
|
||||
clutter_effect_real_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -196,6 +198,7 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
|
||||
|
||||
static void
|
||||
clutter_effect_real_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
@@ -206,23 +209,24 @@ clutter_effect_real_paint (ClutterEffect *effect,
|
||||
effects that haven't migrated to use the 'paint' virtual yet. This
|
||||
just calls the old pre and post virtuals before chaining on */
|
||||
|
||||
pre_paint_succeeded = _clutter_effect_pre_paint (effect);
|
||||
pre_paint_succeeded = _clutter_effect_pre_paint (effect, paint_context);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_paint (actor);
|
||||
clutter_actor_continue_paint (actor, paint_context);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
_clutter_effect_post_paint (effect);
|
||||
_clutter_effect_post_paint (effect, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_pick (ClutterEffect *effect)
|
||||
clutter_effect_real_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
ClutterActor *actor;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_pick (actor);
|
||||
clutter_actor_continue_pick (actor, pick_context);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -262,36 +266,40 @@ clutter_effect_init (ClutterEffect *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_effect_pre_paint (ClutterEffect *effect)
|
||||
_clutter_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
|
||||
|
||||
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect);
|
||||
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect, paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_post_paint (ClutterEffect *effect)
|
||||
_clutter_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect, paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, flags);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, paint_context, flags);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_pick (ClutterEffect *effect)
|
||||
_clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-actor-meta.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-pick-context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -74,15 +76,19 @@ struct _ClutterEffectClass
|
||||
ClutterActorMetaClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* pre_paint) (ClutterEffect *effect);
|
||||
void (* post_paint) (ClutterEffect *effect);
|
||||
gboolean (* pre_paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* post_paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
gboolean (* modify_paint_volume) (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume);
|
||||
|
||||
void (* paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void (* pick) (ClutterEffect *effect);
|
||||
void (* pick) (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_effect4) (void);
|
||||
|
||||
@@ -535,9 +535,13 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
|
||||
* ClutterOffscreenRedirect:
|
||||
* @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect
|
||||
* the actor if it is semi-transparent and its has_overlaps()
|
||||
* virtual returns %TRUE. This is the default.
|
||||
* virtual returns %TRUE.
|
||||
* @CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: Always redirect the actor to an
|
||||
* offscreen buffer even if it is fully opaque.
|
||||
* @CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE: Only redirect the actor if it is the
|
||||
* most efficient thing to do based on its recent repaint behaviour. That
|
||||
* means when its contents are changing less frequently than it's being used
|
||||
* on stage.
|
||||
*
|
||||
* Possible flags to pass to clutter_actor_set_offscreen_redirect().
|
||||
*
|
||||
@@ -545,8 +549,9 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
|
||||
{
|
||||
CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1<<0,
|
||||
CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1<<1
|
||||
CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1 << 0,
|
||||
CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1 << 1,
|
||||
CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
|
||||
} ClutterOffscreenRedirect;
|
||||
|
||||
/**
|
||||
@@ -673,12 +678,15 @@ typedef enum /*< prefix=CLUTTER_BIND >*/
|
||||
* has queued a redraw before this paint. This implies that the effect
|
||||
* should call clutter_actor_continue_paint() to chain to the next
|
||||
* effect and can not cache any results from a previous paint.
|
||||
* @CLUTTER_EFFECT_PAINT_BYPASS_EFFECT: The effect should not be used
|
||||
* on this frame, but it will be asked to paint the actor still.
|
||||
*
|
||||
* Flags passed to the ‘paint’ or ‘pick’ method of #ClutterEffect.
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_EFFECT_PAINT >*/
|
||||
{
|
||||
CLUTTER_EFFECT_PAINT_ACTOR_DIRTY = (1 << 0)
|
||||
CLUTTER_EFFECT_PAINT_ACTOR_DIRTY = (1 << 0),
|
||||
CLUTTER_EFFECT_PAINT_BYPASS_EFFECT = (1 << 1)
|
||||
} ClutterEffectPaintFlags;
|
||||
|
||||
/**
|
||||
|
||||
@@ -118,9 +118,10 @@ clutter_image_init (ClutterImage *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_image_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
clutter_image_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
|
||||
ClutterPaintNode *node;
|
||||
@@ -129,7 +130,7 @@ clutter_image_paint_content (ClutterContent *content,
|
||||
return;
|
||||
|
||||
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
||||
clutter_paint_node_set_name (node, "Image Content");
|
||||
clutter_paint_node_set_static_name (node, "Image Content");
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ typedef struct _ClutterAxisInfo
|
||||
{
|
||||
ClutterInputAxis axis;
|
||||
|
||||
gdouble min_axis;
|
||||
gdouble max_axis;
|
||||
double min_axis;
|
||||
double max_axis;
|
||||
|
||||
gdouble min_value;
|
||||
gdouble max_value;
|
||||
double min_value;
|
||||
double max_value;
|
||||
|
||||
gdouble resolution;
|
||||
double resolution;
|
||||
} ClutterAxisInfo;
|
||||
|
||||
typedef struct _ClutterKeyInfo
|
||||
@@ -55,9 +55,9 @@ typedef struct _ClutterScrollInfo
|
||||
{
|
||||
guint axis_id;
|
||||
ClutterScrollDirection direction;
|
||||
gdouble increment;
|
||||
double increment;
|
||||
|
||||
gdouble last_value;
|
||||
double last_value;
|
||||
guint last_value_valid : 1;
|
||||
} ClutterScrollInfo;
|
||||
|
||||
@@ -66,8 +66,8 @@ typedef struct _ClutterTouchInfo
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterActor *actor;
|
||||
|
||||
gfloat current_x;
|
||||
gfloat current_y;
|
||||
float current_x;
|
||||
float current_y;
|
||||
} ClutterTouchInfo;
|
||||
|
||||
typedef struct _ClutterPtrA11yData
|
||||
@@ -91,12 +91,12 @@ struct _ClutterInputDevice
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
gint id;
|
||||
int id;
|
||||
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputMode device_mode;
|
||||
|
||||
gchar *device_name;
|
||||
char *device_name;
|
||||
|
||||
ClutterSeat *seat;
|
||||
|
||||
@@ -118,26 +118,26 @@ struct _ClutterInputDevice
|
||||
GHashTable *inv_sequence_grab_actors;
|
||||
|
||||
/* the current click count */
|
||||
gint click_count;
|
||||
int click_count;
|
||||
|
||||
/* the stage the device is on */
|
||||
ClutterStage *stage;
|
||||
|
||||
/* the current state */
|
||||
gfloat current_x;
|
||||
gfloat current_y;
|
||||
guint32 current_time;
|
||||
gint current_button_number;
|
||||
float current_x;
|
||||
float current_y;
|
||||
uint32_t current_time;
|
||||
int current_button_number;
|
||||
ClutterModifierType current_state;
|
||||
|
||||
/* the current touch points states */
|
||||
GHashTable *touch_sequences_info;
|
||||
|
||||
/* the previous state, used for click count generation */
|
||||
gint previous_x;
|
||||
gint previous_y;
|
||||
guint32 previous_time;
|
||||
gint previous_button_number;
|
||||
int previous_x;
|
||||
int previous_y;
|
||||
uint32_t previous_time;
|
||||
int previous_button_number;
|
||||
ClutterModifierType previous_state;
|
||||
|
||||
GArray *axes;
|
||||
@@ -147,15 +147,15 @@ struct _ClutterInputDevice
|
||||
|
||||
GArray *scroll_info;
|
||||
|
||||
gchar *vendor_id;
|
||||
gchar *product_id;
|
||||
gchar *node_path;
|
||||
char *vendor_id;
|
||||
char *product_id;
|
||||
char *node_path;
|
||||
|
||||
GPtrArray *tools;
|
||||
|
||||
gint n_rings;
|
||||
gint n_strips;
|
||||
gint n_mode_groups;
|
||||
int n_rings;
|
||||
int n_strips;
|
||||
int n_mode_groups;
|
||||
|
||||
ClutterInputDeviceMapping mapping_mode;
|
||||
|
||||
@@ -200,9 +200,10 @@ void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterActor *actor,
|
||||
gboolean emit_crossing);
|
||||
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event);
|
||||
|
||||
@@ -96,6 +96,7 @@ clutter_input_device_dispose (GObject *gobject)
|
||||
g_clear_pointer (&device->device_name, g_free);
|
||||
g_clear_pointer (&device->vendor_id, g_free);
|
||||
g_clear_pointer (&device->product_id, g_free);
|
||||
g_clear_pointer (&device->node_path, g_free);
|
||||
|
||||
if (device->associated != NULL)
|
||||
{
|
||||
@@ -797,7 +798,7 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
|
||||
*
|
||||
* Sets the actor under the pointer coordinates of @device
|
||||
*
|
||||
* This function is called by _clutter_input_device_update()
|
||||
* This function is called by clutter_input_device_update()
|
||||
* and it will:
|
||||
*
|
||||
* - queue a %CLUTTER_LEAVE event on the previous pointer actor
|
||||
@@ -1015,7 +1016,7 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
}
|
||||
|
||||
/*
|
||||
* _clutter_input_device_update:
|
||||
* clutter_input_device_update:
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Updates the input @device by determining the #ClutterActor underneath the
|
||||
@@ -1029,9 +1030,9 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterActor *
|
||||
_clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing)
|
||||
clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
ClutterActor *new_cursor_actor;
|
||||
|
||||
@@ -1523,7 +1523,7 @@ event_click_count_generate (ClutterEvent *event)
|
||||
previous_y = event->button.y;
|
||||
previous_time = event->button.time;
|
||||
|
||||
/* fallthrough */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
event->button.click_count = click_count;
|
||||
break;
|
||||
@@ -1776,7 +1776,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
|
||||
emit_crossing_event (event, device);
|
||||
|
||||
actor = _clutter_input_device_update (device, NULL, FALSE);
|
||||
actor = clutter_input_device_update (device, NULL, FALSE);
|
||||
if (actor != stage)
|
||||
{
|
||||
ClutterEvent *crossing;
|
||||
@@ -1834,12 +1834,10 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (device))
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
core_pointer = clutter_event_get_device (event);
|
||||
_clutter_input_pointer_a11y_on_motion_event (core_pointer, x, y);
|
||||
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
|
||||
}
|
||||
}
|
||||
#endif /* CLUTTER_WINDOWING_X11 */
|
||||
@@ -1870,7 +1868,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
break;
|
||||
}
|
||||
|
||||
/* fallthrough from motion */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
@@ -1878,10 +1876,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_event_get_device (event);
|
||||
_clutter_input_pointer_a11y_on_button_event (core_pointer,
|
||||
_clutter_input_pointer_a11y_on_button_event (device,
|
||||
event->button.button,
|
||||
event->type == CLUTTER_BUTTON_PRESS);
|
||||
}
|
||||
@@ -1940,7 +1935,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
* get the actor underneath
|
||||
*/
|
||||
if (device != NULL)
|
||||
actor = _clutter_input_device_update (device, NULL, TRUE);
|
||||
actor = clutter_input_device_update (device, NULL, TRUE);
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "No device found: picking");
|
||||
@@ -2013,7 +2008,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
break;
|
||||
}
|
||||
|
||||
/* fallthrough from motion */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
case CLUTTER_TOUCH_END:
|
||||
@@ -2057,7 +2052,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
}
|
||||
|
||||
if (device != NULL)
|
||||
actor = _clutter_input_device_update (device, sequence, TRUE);
|
||||
actor = clutter_input_device_update (device, sequence, TRUE);
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "No device found: picking");
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
@@ -117,11 +118,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
||||
meta_class->set_actor (meta, actor);
|
||||
|
||||
/* clear out the previous state */
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
/* we keep a back pointer here, to avoid going through the ActorMeta */
|
||||
priv->actor = clutter_actor_meta_get_actor (meta);
|
||||
@@ -197,17 +194,8 @@ update_fbo (ClutterEffect *effect,
|
||||
ensure_pipeline_filter_for_scale (self, resource_scale);
|
||||
}
|
||||
|
||||
if (priv->texture != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->texture);
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
priv->texture =
|
||||
clutter_offscreen_effect_create_texture (self, target_width, target_height);
|
||||
@@ -237,7 +225,8 @@ update_fbo (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
@@ -248,6 +237,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
CoglColor transparent;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat target_width = -1, target_height = -1;
|
||||
CoglFramebuffer *framebuffer;
|
||||
gfloat resource_scale;
|
||||
gfloat ceiled_resource_scale;
|
||||
graphene_point3d_t local_offset;
|
||||
@@ -312,10 +302,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
if (!update_fbo (effect, target_width, target_height, resource_scale))
|
||||
return FALSE;
|
||||
|
||||
cogl_get_modelview_matrix (&old_modelview);
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
|
||||
|
||||
/* let's draw offscreen */
|
||||
cogl_push_framebuffer (priv->offscreen);
|
||||
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen);
|
||||
|
||||
/* We don't want the FBO contents to be transformed. That could waste memory
|
||||
* (e.g. during zoom), or result in something that's not rectangular (clipped
|
||||
@@ -325,7 +315,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
* contents on screen...
|
||||
*/
|
||||
clutter_actor_get_transform (priv->stage, &modelview);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview);
|
||||
|
||||
/* Save the original viewport for calculating priv->position */
|
||||
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
|
||||
@@ -337,10 +327,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
/* Set up the viewport so that it has the same size as the stage (avoid
|
||||
* distortion), but translated to account for the FBO offset...
|
||||
*/
|
||||
cogl_set_viewport (-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
cogl_framebuffer_set_viewport (priv->offscreen,
|
||||
-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
|
||||
/* Copy the stage's projection matrix across to the framebuffer */
|
||||
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
|
||||
@@ -357,14 +348,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
&priv->position,
|
||||
1);
|
||||
|
||||
cogl_set_projection_matrix (&projection);
|
||||
cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection);
|
||||
|
||||
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
|
||||
cogl_clear (&transparent,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH);
|
||||
cogl_framebuffer_clear (priv->offscreen,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH,
|
||||
&transparent);
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_framebuffer_push_matrix (priv->offscreen);
|
||||
|
||||
/* Override the actor's opacity to fully opaque - we paint the offscreen
|
||||
* texture with the actor's paint opacity, so we need to do this to avoid
|
||||
@@ -378,10 +370,12 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv = effect->priv;
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
guint8 paint_opacity;
|
||||
|
||||
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
|
||||
@@ -407,18 +401,21 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
|
||||
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv = effect->priv;
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglMatrix modelview;
|
||||
float resource_scale;
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
|
||||
/* The current modelview matrix is *almost* perfect already. It's only
|
||||
* missing a correction for the expanded FBO and offset rendering within...
|
||||
*/
|
||||
cogl_get_modelview_matrix (&modelview);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
|
||||
|
||||
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
|
||||
resource_scale != 1.0f)
|
||||
@@ -431,21 +428,23 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
|
||||
priv->fbo_offset_x,
|
||||
priv->fbo_offset_y,
|
||||
0.0f);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
|
||||
|
||||
/* paint the target material; this is virtualized for
|
||||
* sub-classes that require special hand-holding
|
||||
*/
|
||||
clutter_offscreen_effect_paint_target (effect);
|
||||
clutter_offscreen_effect_paint_target (effect, paint_context);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_post_paint (ClutterEffect *effect)
|
||||
clutter_offscreen_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
if (priv->offscreen == NULL ||
|
||||
priv->target == NULL ||
|
||||
@@ -455,31 +454,60 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect)
|
||||
/* Restore the previous opacity override */
|
||||
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_pop_framebuffer ();
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
clutter_offscreen_effect_paint_texture (self, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
|
||||
if (flags & CLUTTER_EFFECT_PAINT_BYPASS_EFFECT)
|
||||
{
|
||||
clutter_actor_continue_paint (priv->actor, paint_context);
|
||||
cogl_clear_object (&priv->offscreen);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we've already got a cached image and the actor hasn't been redrawn
|
||||
* then we can just use the cached image in the FBO.
|
||||
*/
|
||||
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
|
||||
{
|
||||
/* Chain up to the parent paint method which will call the pre and
|
||||
post paint functions to update the image */
|
||||
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
|
||||
paint (effect, flags);
|
||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
|
||||
gboolean pre_paint_succeeded;
|
||||
|
||||
pre_paint_succeeded = effect_class->pre_paint (effect, paint_context);
|
||||
|
||||
clutter_actor_continue_paint (priv->actor, paint_context);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
effect_class->post_paint (effect, paint_context);
|
||||
else
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
}
|
||||
else
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
clutter_offscreen_effect_paint_texture (self, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
|
||||
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -488,14 +516,9 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
|
||||
if (priv->offscreen)
|
||||
cogl_object_unref (priv->offscreen);
|
||||
|
||||
if (priv->target)
|
||||
cogl_object_unref (priv->target);
|
||||
|
||||
if (priv->texture)
|
||||
cogl_object_unref (priv->texture);
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
g_clear_pointer (&priv->target, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||
}
|
||||
@@ -517,6 +540,7 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
|
||||
effect_class->paint = clutter_offscreen_effect_paint;
|
||||
|
||||
gobject_class->finalize = clutter_offscreen_effect_finalize;
|
||||
gobject_class->notify = clutter_offscreen_effect_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -582,17 +606,20 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
|
||||
/**
|
||||
* clutter_offscreen_effect_paint_target:
|
||||
* @effect: a #ClutterOffscreenEffect
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* Calls the paint_target() virtual function of the @effect
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect));
|
||||
|
||||
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect);
|
||||
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect,
|
||||
paint_context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,8 @@ struct _ClutterOffscreenEffectClass
|
||||
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_offscreen1) (void);
|
||||
@@ -101,7 +102,8 @@ CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
|
||||
29
clutter/clutter/clutter-paint-context-private.h
Normal file
29
clutter/clutter/clutter-paint-context-private.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_PRIVATE_H
|
||||
#define CLUTTER_PAINT_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "clutter-paint-context.h"
|
||||
|
||||
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view);
|
||||
|
||||
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
||||
|
||||
CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */
|
||||
161
clutter/clutter/clutter-paint-context.c
Normal file
161
clutter/clutter/clutter-paint-context.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
struct _ClutterPaintContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
GList *framebuffers;
|
||||
|
||||
ClutterStageView *view;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
|
||||
clutter_paint_context_ref,
|
||||
clutter_paint_context_unref)
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->view = view;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||
*/
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_ref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_ref_count_inc (&paint_context->ref_count);
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_context_dispose (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_list_free_full (paint_context->framebuffers,
|
||||
cogl_object_unref);
|
||||
paint_context->framebuffers = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_unref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
if (g_ref_count_dec (&paint_context->ref_count))
|
||||
{
|
||||
clutter_paint_context_dispose (paint_context);
|
||||
g_free (paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_destroy (ClutterPaintContext *paint_context)
|
||||
{
|
||||
clutter_paint_context_dispose (paint_context);
|
||||
clutter_paint_context_unref (paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
paint_context->framebuffers = g_list_prepend (paint_context->framebuffers,
|
||||
cogl_object_ref (framebuffer));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (paint_context->framebuffers);
|
||||
|
||||
cogl_object_unref (paint_context->framebuffers->data);
|
||||
paint_context->framebuffers =
|
||||
g_list_delete_link (paint_context->framebuffers,
|
||||
paint_context->framebuffers);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_framebuffer:
|
||||
* @paint_context: The #ClutterPaintContext
|
||||
*
|
||||
* Returns: (transfer none): The #CoglFramebuffer used for drawing
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_val_if_fail (paint_context->framebuffers, NULL);
|
||||
|
||||
return paint_context->framebuffers->data;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return g_list_last (paint_context->framebuffers)->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_stage_view: (skip)
|
||||
*/
|
||||
ClutterStageView *
|
||||
clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return paint_context->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_is_drawing_off_stage: (skip)
|
||||
*
|
||||
* Return %TRUE if the paint context is currently drawing off stage.
|
||||
* This happens if there are any framebuffers pushed, and the base framebuffer
|
||||
* comes from the stage view.
|
||||
*/
|
||||
gboolean
|
||||
clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
|
||||
{
|
||||
if (g_list_length (paint_context->framebuffers) > 1)
|
||||
return TRUE;
|
||||
|
||||
return !paint_context->view;
|
||||
}
|
||||
62
clutter/clutter/clutter-paint-context.h
Normal file
62
clutter/clutter/clutter-paint-context.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_H
|
||||
#define CLUTTER_PAINT_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPaintContext ClutterPaintContext;
|
||||
|
||||
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_paint_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_unref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_H */
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <json-glib/json-glib.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-paint-node.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -48,11 +49,11 @@ struct _ClutterPaintNode
|
||||
ClutterPaintNode *next_sibling;
|
||||
ClutterPaintNode *last_child;
|
||||
|
||||
guint n_children;
|
||||
|
||||
GArray *operations;
|
||||
|
||||
gchar *name;
|
||||
const gchar *name;
|
||||
|
||||
guint n_children;
|
||||
|
||||
volatile int ref_count;
|
||||
};
|
||||
@@ -63,9 +64,12 @@ struct _ClutterPaintNodeClass
|
||||
|
||||
void (* finalize) (ClutterPaintNode *node);
|
||||
|
||||
gboolean (* pre_draw) (ClutterPaintNode *node);
|
||||
void (* draw) (ClutterPaintNode *node);
|
||||
void (* post_draw) (ClutterPaintNode *node);
|
||||
gboolean (* pre_draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* post_draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
JsonNode*(* serialize) (ClutterPaintNode *node);
|
||||
|
||||
@@ -111,7 +115,8 @@ void _clutter_paint_node_init_types (void);
|
||||
gpointer _clutter_paint_node_create (GType gtype);
|
||||
|
||||
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor,
|
||||
CoglFramebuffer *framebuffer);
|
||||
|
||||
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
|
||||
|
||||
|
||||
@@ -171,8 +171,6 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPaintNode *iter;
|
||||
|
||||
g_free (node->name);
|
||||
|
||||
if (node->operations != NULL)
|
||||
{
|
||||
guint i;
|
||||
@@ -202,18 +200,21 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_paint_node_real_pre_draw (ClutterPaintNode *node)
|
||||
clutter_paint_node_real_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_node_real_draw (ClutterPaintNode *node)
|
||||
clutter_paint_node_real_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_node_real_post_draw (ClutterPaintNode *node)
|
||||
clutter_paint_node_real_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -294,7 +295,8 @@ clutter_paint_node_get_type (void)
|
||||
*
|
||||
* The @name will be used for debugging purposes.
|
||||
*
|
||||
* The @node will copy the passed string.
|
||||
* The @node will intern @name using g_intern_string(). If you have access to a
|
||||
* static string, use clutter_paint_node_set_static_name() instead.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
@@ -304,8 +306,22 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
||||
|
||||
g_free (node->name);
|
||||
node->name = g_strdup (name);
|
||||
node->name = g_intern_string (name);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_node_set_static_name: (skip)
|
||||
*
|
||||
* Like clutter_paint_node_set_name() but uses a static or interned string
|
||||
* containing the name.
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_set_static_name (ClutterPaintNode *node,
|
||||
const char *name)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
||||
|
||||
node->name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -997,29 +1013,30 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
||||
* its children, if any.
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_paint (ClutterPaintNode *node)
|
||||
clutter_paint_node_paint (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
|
||||
ClutterPaintNode *iter;
|
||||
gboolean res;
|
||||
|
||||
res = klass->pre_draw (node);
|
||||
res = klass->pre_draw (node, paint_context);
|
||||
|
||||
if (res)
|
||||
{
|
||||
klass->draw (node);
|
||||
klass->draw (node, paint_context);
|
||||
}
|
||||
|
||||
for (iter = node->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->next_sibling)
|
||||
{
|
||||
clutter_paint_node_paint (iter);
|
||||
clutter_paint_node_paint (iter, paint_context);
|
||||
}
|
||||
|
||||
if (res)
|
||||
{
|
||||
klass->post_draw (node);
|
||||
klass->post_draw (node, paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1199,9 +1216,10 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
|
||||
* @node: a #ClutterPaintNode
|
||||
*
|
||||
* Retrieves the #CoglFramebuffer that @node will draw
|
||||
* into.
|
||||
* into, if it the root node has a custom framebuffer set.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglFramebuffer
|
||||
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
|
||||
* set.
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
|
||||
@@ -1209,12 +1227,9 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
|
||||
ClutterPaintNode *root = clutter_paint_node_get_root (node);
|
||||
ClutterPaintNodeClass *klass;
|
||||
|
||||
if (root == NULL)
|
||||
return NULL;
|
||||
|
||||
klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
|
||||
if (klass->get_framebuffer != NULL)
|
||||
return klass->get_framebuffer (root);
|
||||
|
||||
return cogl_get_draw_framebuffer ();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -50,11 +50,15 @@ CLUTTER_EXPORT
|
||||
void clutter_paint_node_unref (ClutterPaintNode *node);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node);
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_set_name (ClutterPaintNode *node,
|
||||
const char *name);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_set_static_name (ClutterPaintNode *node,
|
||||
const char *name);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
#include "clutter-paint-nodes.h"
|
||||
|
||||
@@ -103,11 +104,12 @@ struct _ClutterRootNode
|
||||
G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_root_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterRootNode *rnode = (ClutterRootNode *) node;
|
||||
|
||||
cogl_push_framebuffer (rnode->framebuffer);
|
||||
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
|
||||
|
||||
cogl_framebuffer_clear (rnode->framebuffer,
|
||||
rnode->clear_flags,
|
||||
@@ -117,9 +119,10 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
cogl_pop_framebuffer ();
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -163,6 +166,8 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
{
|
||||
ClutterRootNode *res;
|
||||
|
||||
g_return_val_if_fail (framebuffer, NULL);
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
|
||||
|
||||
cogl_color_init_from_4ub (&res->clear_color,
|
||||
@@ -172,11 +177,7 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
clear_color->alpha);
|
||||
cogl_color_premultiply (&res->clear_color);
|
||||
|
||||
if (G_LIKELY (framebuffer != NULL))
|
||||
res->framebuffer = cogl_object_ref (framebuffer);
|
||||
else
|
||||
res->framebuffer = cogl_object_ref (cogl_get_draw_framebuffer ());
|
||||
|
||||
res->framebuffer = cogl_object_ref (framebuffer);
|
||||
res->clear_flags = clear_flags;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
@@ -201,10 +202,12 @@ struct _ClutterTransformNodeClass
|
||||
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
cogl_framebuffer_push_matrix (fb);
|
||||
cogl_framebuffer_transform (fb, &transform_node->transform);
|
||||
@@ -213,9 +216,11 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
cogl_framebuffer_pop_matrix (fb);
|
||||
}
|
||||
@@ -278,7 +283,8 @@ struct _ClutterDummyNode
|
||||
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_dummy_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_dummy_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -315,6 +321,16 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
|
||||
return dnode->framebuffer;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_dummy_node_finalize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterDummyNode *dnode = (ClutterDummyNode *) node;
|
||||
|
||||
cogl_clear_object (&dnode->framebuffer);
|
||||
|
||||
CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
|
||||
{
|
||||
@@ -323,6 +339,7 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
|
||||
node_class->pre_draw = clutter_dummy_node_pre_draw;
|
||||
node_class->serialize = clutter_dummy_node_serialize;
|
||||
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
|
||||
node_class->finalize = clutter_dummy_node_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -331,7 +348,8 @@ clutter_dummy_node_init (ClutterDummyNode *self)
|
||||
}
|
||||
|
||||
ClutterPaintNode *
|
||||
_clutter_dummy_node_new (ClutterActor *actor)
|
||||
_clutter_dummy_node_new (ClutterActor *actor,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterPaintNode *res;
|
||||
ClutterDummyNode *dnode;
|
||||
@@ -340,7 +358,7 @@ _clutter_dummy_node_new (ClutterActor *actor)
|
||||
|
||||
dnode = (ClutterDummyNode *) res;
|
||||
dnode->actor = actor;
|
||||
dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
|
||||
dnode->framebuffer = cogl_object_ref (framebuffer);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -383,22 +401,34 @@ clutter_pipeline_node_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_pipeline_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
|
||||
|
||||
if (node->operations != NULL &&
|
||||
pnode->pipeline != NULL)
|
||||
{
|
||||
cogl_push_source (pnode->pipeline);
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static CoglFramebuffer *
|
||||
get_target_framebuffer (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
framebuffer = clutter_paint_node_get_framebuffer (node);
|
||||
if (framebuffer)
|
||||
return framebuffer;
|
||||
|
||||
return clutter_paint_context_get_framebuffer (paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
|
||||
CoglFramebuffer *fb;
|
||||
@@ -410,7 +440,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -424,18 +454,20 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
break;
|
||||
|
||||
case PAINT_OP_TEX_RECT:
|
||||
cogl_rectangle_with_texture_coords (op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
@@ -446,7 +478,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_path_fill (op->op.path);
|
||||
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
@@ -459,9 +491,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pipeline_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_pipeline_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
cogl_pop_source ();
|
||||
}
|
||||
|
||||
static JsonNode *
|
||||
@@ -780,7 +812,8 @@ clutter_text_node_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_text_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_text_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
|
||||
|
||||
@@ -788,7 +821,8 @@ clutter_text_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_node_draw (ClutterPaintNode *node)
|
||||
clutter_text_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
|
||||
PangoRectangle extents;
|
||||
@@ -798,7 +832,7 @@ clutter_text_node_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
|
||||
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
|
||||
|
||||
@@ -831,11 +865,11 @@ clutter_text_node_draw (ClutterPaintNode *node)
|
||||
clipped = TRUE;
|
||||
}
|
||||
|
||||
cogl_pango_render_layout (tnode->layout,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
&tnode->color,
|
||||
0);
|
||||
cogl_pango_show_layout (fb,
|
||||
tnode->layout,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
&tnode->color);
|
||||
|
||||
if (clipped)
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
@@ -974,7 +1008,8 @@ struct _ClutterClipNodeClass
|
||||
G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
CoglFramebuffer *fb;
|
||||
@@ -983,7 +1018,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return FALSE;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1018,7 +1053,8 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clip_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_clip_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *fb;
|
||||
guint i;
|
||||
@@ -1026,7 +1062,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node)
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1100,7 +1136,8 @@ struct _ClutterActorNodeClass
|
||||
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
@@ -1110,15 +1147,17 @@ clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_draw (ClutterPaintNode *node)
|
||||
clutter_actor_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
clutter_actor_continue_paint (actor_node->actor);
|
||||
clutter_actor_continue_paint (actor_node->actor, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
@@ -1143,6 +1182,7 @@ clutter_actor_node_serialize (ClutterPaintNode *node)
|
||||
|
||||
return json_builder_get_root (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
|
||||
{
|
||||
@@ -1217,9 +1257,11 @@ struct _ClutterLayerNodeClass
|
||||
G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
clutter_layer_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterLayerNode *lnode = (ClutterLayerNode *) node;
|
||||
CoglFramebuffer *framebuffer;
|
||||
CoglMatrix matrix;
|
||||
|
||||
/* if we were unable to create an offscreen buffer for this node, then
|
||||
@@ -1235,9 +1277,10 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
/* copy the same modelview from the current framebuffer to the one we
|
||||
* are going to use
|
||||
*/
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||
|
||||
cogl_push_framebuffer (lnode->offscreen);
|
||||
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
|
||||
|
||||
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
|
||||
|
||||
@@ -1255,7 +1298,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
|
||||
0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_framebuffer_push_matrix (lnode->offscreen);
|
||||
|
||||
/* every draw operation after this point will happen an offscreen
|
||||
* framebuffer
|
||||
@@ -1265,17 +1308,18 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
clutter_layer_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
|
||||
CoglFramebuffer *fb;
|
||||
guint i;
|
||||
|
||||
/* switch to the previous framebuffer */
|
||||
cogl_pop_matrix ();
|
||||
cogl_pop_framebuffer ();
|
||||
cogl_framebuffer_pop_matrix (lnode->offscreen);
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1289,20 +1333,20 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
|
||||
case PAINT_OP_TEX_RECT:
|
||||
/* now we need to paint the texture */
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_rectangle_with_texture_coords (op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_pop_source ();
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
@@ -1313,9 +1357,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_path_fill (op->op.path);
|
||||
cogl_pop_source ();
|
||||
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
|
||||
25
clutter/clutter/clutter-pick-context-private.h
Normal file
25
clutter/clutter/clutter-pick-context-private.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PICK_CONTEXT_PRIVATE_H
|
||||
#define CLUTTER_PICK_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "clutter-pick-context.h"
|
||||
|
||||
ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view);
|
||||
|
||||
#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */
|
||||
83
clutter/clutter/clutter-pick-context.c
Normal file
83
clutter/clutter/clutter-pick-context.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-pick-context-private.h"
|
||||
|
||||
struct _ClutterPickContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
CoglFramebuffer *framebuffer;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
|
||||
clutter_pick_context_ref,
|
||||
clutter_pick_context_unref)
|
||||
|
||||
ClutterPickContext *
|
||||
clutter_pick_context_new_for_view (ClutterStageView *view)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
pick_context = g_new0 (ClutterPickContext, 1);
|
||||
g_ref_count_init (&pick_context->ref_count);
|
||||
pick_context->framebuffer =
|
||||
cogl_object_ref (clutter_stage_view_get_framebuffer (view));
|
||||
|
||||
return pick_context;
|
||||
}
|
||||
|
||||
ClutterPickContext *
|
||||
clutter_pick_context_ref (ClutterPickContext *pick_context)
|
||||
{
|
||||
g_ref_count_inc (&pick_context->ref_count);
|
||||
return pick_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pick_context_dispose (ClutterPickContext *pick_context)
|
||||
{
|
||||
g_clear_pointer (&pick_context->framebuffer, cogl_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_context_unref (ClutterPickContext *pick_context)
|
||||
{
|
||||
if (g_ref_count_dec (&pick_context->ref_count))
|
||||
{
|
||||
clutter_pick_context_dispose (pick_context);
|
||||
g_free (pick_context);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_context_destroy (ClutterPickContext *pick_context)
|
||||
{
|
||||
clutter_pick_context_dispose (pick_context);
|
||||
clutter_pick_context_unref (pick_context);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_pick_context_get_framebuffer: (skip)
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context)
|
||||
{
|
||||
return pick_context->framebuffer;
|
||||
}
|
||||
49
clutter/clutter/clutter-pick-context.h
Normal file
49
clutter/clutter/clutter-pick-context.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PICK_CONTEXT_H
|
||||
#define CLUTTER_PICK_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPickContext ClutterPickContext;
|
||||
|
||||
#define CLUTTER_TYPE_PICK_CONTEXT (clutter_pick_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_pick_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPickContext * clutter_pick_context_ref (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_unref (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_destroy (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context);
|
||||
|
||||
#endif /* CLUTTER_PICK_CONTEXT_H */
|
||||
@@ -41,6 +41,7 @@ enum
|
||||
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
|
||||
PTR_A11Y_TIMEOUT_STARTED,
|
||||
PTR_A11Y_TIMEOUT_STOPPED,
|
||||
IS_UNFOCUS_INHIBITED_CHANGED,
|
||||
N_SIGNALS,
|
||||
};
|
||||
|
||||
@@ -50,6 +51,7 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BACKEND,
|
||||
PROP_TOUCH_MODE,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@@ -61,6 +63,8 @@ struct _ClutterSeatPrivate
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
|
||||
unsigned int inhibit_unfocus_count;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
|
||||
@@ -84,6 +88,7 @@ clutter_seat_set_property (GObject *object,
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_TOUCH_MODE:
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -103,6 +108,9 @@ clutter_seat_get_property (GObject *object,
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, priv->backend);
|
||||
break;
|
||||
case PROP_TOUCH_MODE:
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -132,25 +140,17 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
g_signal_new (I_("device-added"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
g_signal_set_va_marshaller (signals[DEVICE_ADDED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
g_cclosure_marshal_VOID__OBJECTv);
|
||||
|
||||
signals[DEVICE_REMOVED] =
|
||||
g_signal_new (I_("device-removed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
g_signal_set_va_marshaller (signals[DEVICE_REMOVED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
g_cclosure_marshal_VOID__OBJECTv);
|
||||
signals[TOOL_CHANGED] =
|
||||
g_signal_new (I_("tool-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
@@ -223,13 +223,9 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__FLAGS,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
|
||||
g_signal_set_va_marshaller (signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
g_cclosure_marshal_VOID__FLAGSv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::ptr-a11y-timeout-started:
|
||||
@@ -282,6 +278,22 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEANv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::is-unfocus-inhibited-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
*
|
||||
* The ::is-unfocus-inhibited-changed signal is emitted when the
|
||||
* property to inhibit the unsetting of the focus-surface of the
|
||||
* #ClutterSeat changed. To get the current state of this property,
|
||||
* use clutter_seat_is_unfocus_inhibited().
|
||||
*/
|
||||
signals[IS_UNFOCUS_INHIBITED_CHANGED] =
|
||||
g_signal_new (I_("is-unfocus-inhibited-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
P_("Backend"),
|
||||
@@ -289,6 +301,19 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
CLUTTER_TYPE_BACKEND,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
* ClutterSeat:touch-mode:
|
||||
*
|
||||
* The current touch-mode of the #ClutterSeat, it is set to %TRUE if the
|
||||
* requirements documented in clutter_seat_get_touch_mode() are fulfilled.
|
||||
**/
|
||||
props[PROP_TOUCH_MODE] =
|
||||
g_param_spec_boolean ("touch-mode",
|
||||
P_("Touch mode"),
|
||||
P_("Touch mode"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
}
|
||||
|
||||
@@ -335,7 +360,10 @@ clutter_seat_get_keyboard (ClutterSeat *seat)
|
||||
*
|
||||
* Returns the list of HW devices
|
||||
*
|
||||
* Returns: (transfer container) (element-type Clutter.InputDevice): A list of #ClutterInputDevice
|
||||
* Returns: (transfer container) (element-type Clutter.InputDevice): A list
|
||||
* of #ClutterInputDevice. The elements of the returned list are owned by
|
||||
* Clutter and may not be freed, the returned list should be freed using
|
||||
* g_list_free() when done.
|
||||
**/
|
||||
GList *
|
||||
clutter_seat_list_devices (ClutterSeat *seat)
|
||||
@@ -505,6 +533,85 @@ clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat
|
||||
priv->pointer_a11y_settings.dwell_click_type = click_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_inhibit_unfocus:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Inhibits unsetting of the pointer focus-surface for the #ClutterSeat @seat,
|
||||
* this allows to keep using the pointer even when it's hidden.
|
||||
*
|
||||
* This property is refcounted, so clutter_seat_uninhibit_unfocus() must be
|
||||
* called the exact same number of times as clutter_seat_inhibit_unfocus()
|
||||
* was called before.
|
||||
**/
|
||||
void
|
||||
clutter_seat_inhibit_unfocus (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
priv->inhibit_unfocus_count++;
|
||||
|
||||
if (priv->inhibit_unfocus_count == 1)
|
||||
g_signal_emit (G_OBJECT (seat), signals[IS_UNFOCUS_INHIBITED_CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_uninhibit_unfocus:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Disables the inhibiting of unsetting of the pointer focus-surface
|
||||
* previously enabled by calling clutter_seat_inhibit_unfocus().
|
||||
*
|
||||
* This property is refcounted, so clutter_seat_uninhibit_unfocus() must be
|
||||
* called the exact same number of times as clutter_seat_inhibit_unfocus()
|
||||
* was called before.
|
||||
**/
|
||||
void
|
||||
clutter_seat_uninhibit_unfocus (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
if (priv->inhibit_unfocus_count == 0)
|
||||
{
|
||||
g_warning ("Called clutter_seat_uninhibit_unfocus without inhibiting before");
|
||||
return;
|
||||
}
|
||||
|
||||
priv->inhibit_unfocus_count--;
|
||||
|
||||
if (priv->inhibit_unfocus_count == 0)
|
||||
g_signal_emit (G_OBJECT (seat), signals[IS_UNFOCUS_INHIBITED_CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_is_unfocus_inhibited:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Gets whether unsetting of the pointer focus-surface is inhibited
|
||||
* for the #ClutterSeat @seat.
|
||||
*
|
||||
* Returns: %TRUE if unsetting is inhibited, %FALSE otherwise
|
||||
**/
|
||||
gboolean
|
||||
clutter_seat_is_unfocus_inhibited (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
|
||||
|
||||
priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
return priv->inhibit_unfocus_count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_create_virtual_device:
|
||||
* @seat: a #ClutterSeat
|
||||
@@ -551,10 +658,9 @@ clutter_seat_compress_motion (ClutterSeat *seat,
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
if (!seat_class->compress_motion)
|
||||
return;
|
||||
|
||||
seat_class->compress_motion (seat, event, to_discard);
|
||||
if (seat_class->compress_motion)
|
||||
seat_class->compress_motion (seat, event, to_discard);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -566,3 +672,30 @@ clutter_seat_warp_pointer (ClutterSeat *seat,
|
||||
|
||||
CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_get_touch_mode:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Gets the current touch-mode state of the #ClutterSeat @seat.
|
||||
* The #ClutterSeat:touch-mode property is set to %TRUE if the following
|
||||
* requirements are fulfilled:
|
||||
*
|
||||
* - A touchscreen is available
|
||||
* - No external keyboard is attached to the device
|
||||
* - A tablet mode switch, if present, is enabled
|
||||
*
|
||||
* Returns: %TRUE if the device is a tablet that doesn't have an external
|
||||
* keyboard attached, %FALSE otherwise.
|
||||
**/
|
||||
gboolean
|
||||
clutter_seat_get_touch_mode (ClutterSeat *seat)
|
||||
{
|
||||
gboolean touch_mode;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
|
||||
|
||||
g_object_get (G_OBJECT (seat), "touch-mode", &touch_mode, NULL);
|
||||
|
||||
return touch_mode;
|
||||
}
|
||||
|
||||
@@ -159,6 +159,16 @@ void clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
|
||||
ClutterPointerA11yDwellClickType click_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_inhibit_unfocus (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_uninhibit_unfocus (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_seat_is_unfocus_inhibited (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat *seat,
|
||||
ClutterInputDeviceType device_type);
|
||||
@@ -174,5 +184,7 @@ CLUTTER_EXPORT
|
||||
void clutter_seat_warp_pointer (ClutterSeat *seat,
|
||||
int x,
|
||||
int y);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
|
||||
|
||||
#endif /* CLUTTER_SEAT_H */
|
||||
|
||||
@@ -367,24 +367,12 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||
|
||||
cogl_shader_compile (class_priv->shader);
|
||||
class_priv->program = cogl_create_program ();
|
||||
|
||||
if (cogl_shader_is_compiled (class_priv->shader))
|
||||
{
|
||||
class_priv->program = cogl_create_program ();
|
||||
cogl_program_attach_shader (class_priv->program,
|
||||
class_priv->shader);
|
||||
|
||||
cogl_program_attach_shader (class_priv->program,
|
||||
class_priv->shader);
|
||||
|
||||
cogl_program_link (class_priv->program);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *log_buf = cogl_shader_get_info_log (class_priv->shader);
|
||||
|
||||
g_warning (G_STRLOC ": Unable to compile the GLSL shader: %s", log_buf);
|
||||
g_free (log_buf);
|
||||
}
|
||||
cogl_program_link (class_priv->program);
|
||||
}
|
||||
|
||||
priv->shader = cogl_object_ref (class_priv->shader);
|
||||
@@ -395,7 +383,8 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
|
||||
ClutterShaderEffectPrivate *priv = self->priv;
|
||||
@@ -425,7 +414,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
out:
|
||||
/* paint the offscreen buffer */
|
||||
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
|
||||
parent->paint_target (effect);
|
||||
parent->paint_target (effect, paint_context);
|
||||
|
||||
}
|
||||
|
||||
@@ -901,23 +890,11 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||
|
||||
cogl_shader_compile (priv->shader);
|
||||
priv->program = cogl_create_program ();
|
||||
|
||||
if (cogl_shader_is_compiled (priv->shader))
|
||||
{
|
||||
priv->program = cogl_create_program ();
|
||||
cogl_program_attach_shader (priv->program, priv->shader);
|
||||
|
||||
cogl_program_attach_shader (priv->program, priv->shader);
|
||||
|
||||
cogl_program_link (priv->program);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *log_buf = cogl_shader_get_info_log (priv->shader);
|
||||
|
||||
g_warning (G_STRLOC ": Unable to compile the GLSL shader: %s", log_buf);
|
||||
g_free (log_buf);
|
||||
}
|
||||
cogl_program_link (priv->program);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -104,8 +104,6 @@ ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (Clut
|
||||
const ClutterPaintVolume *clip);
|
||||
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry);
|
||||
|
||||
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
|
||||
|
||||
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
ClutterActor *actor);
|
||||
@@ -143,6 +141,9 @@ void _clutter_stage_presented (ClutterStage *stag
|
||||
|
||||
GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
|
||||
|
||||
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
||||
|
||||
@@ -33,5 +33,7 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
cairo_rectangle_int_t *clip);
|
||||
|
||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||
|
||||
@@ -68,7 +68,9 @@
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-pick-context-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
@@ -118,10 +120,10 @@ struct _ClutterStagePrivate
|
||||
|
||||
ClutterPlane current_clip_planes[4];
|
||||
|
||||
GHashTable *pending_relayouts;
|
||||
unsigned int pending_relayouts_version;
|
||||
GList *pending_queue_redraws;
|
||||
|
||||
CoglFramebuffer *active_framebuffer;
|
||||
|
||||
gint sync_delay;
|
||||
|
||||
GTimer *fps_timer;
|
||||
@@ -146,7 +148,6 @@ struct _ClutterStagePrivate
|
||||
|
||||
int update_freeze_count;
|
||||
|
||||
guint relayout_pending : 1;
|
||||
guint redraw_pending : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint throttle_motion_events : 1;
|
||||
@@ -443,9 +444,9 @@ is_inside_axis_aligned_rectangle (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
float min_x = FLT_MAX;
|
||||
float max_x = FLT_MIN;
|
||||
float max_x = -FLT_MAX;
|
||||
float min_y = FLT_MAX;
|
||||
float max_y = FLT_MIN;
|
||||
float max_y = -FLT_MAX;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
@@ -838,20 +839,6 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
|
||||
graphene_vec3_normalize (&plane->n, &plane->n);
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_stage_update_active_framebuffer (ClutterStage *stage,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
/* We track the CoglFramebuffer that corresponds to the stage itself
|
||||
* so, for example, we can disable culling when rendering to an
|
||||
* offscreen framebuffer.
|
||||
*/
|
||||
|
||||
priv->active_framebuffer = framebuffer;
|
||||
}
|
||||
|
||||
/* XXX: Instead of having a toplevel 2D clip region, it might be
|
||||
* better to have a clip volume within the view frustum. This could
|
||||
* allow us to avoid projecting actors into window coordinates to
|
||||
@@ -863,7 +850,6 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cairo_rectangle_int_t view_layout;
|
||||
float clip_poly[8];
|
||||
float viewport[4];
|
||||
@@ -914,7 +900,6 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
priv->current_clip_planes);
|
||||
|
||||
_clutter_stage_paint_volume_stack_free_all (stage);
|
||||
_clutter_stage_update_active_framebuffer (stage, framebuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -922,8 +907,13 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = clutter_paint_context_new_for_view (view);
|
||||
|
||||
setup_view_for_pick_or_paint (stage, view, clip);
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage));
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
|
||||
clutter_paint_context_destroy (paint_context);
|
||||
}
|
||||
|
||||
/* This provides a common point of entry for painting the scenegraph
|
||||
@@ -963,18 +953,20 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
|
||||
* respect the Z order as it uses our empty sort_depth_order.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_paint (ClutterActor *self)
|
||||
clutter_stage_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_paint (child);
|
||||
clutter_actor_paint (child, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_pick (ClutterActor *self)
|
||||
clutter_stage_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
@@ -985,7 +977,7 @@ clutter_stage_pick (ClutterActor *self)
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_pick (child);
|
||||
clutter_actor_pick (child, pick_context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1296,7 +1288,26 @@ _clutter_stage_needs_update (ClutterStage *stage)
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
return priv->relayout_pending || priv->redraw_pending;
|
||||
return priv->redraw_pending || g_hash_table_size (priv->pending_relayouts) > 0;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
if (g_hash_table_contains (priv->pending_relayouts, stage))
|
||||
return;
|
||||
|
||||
if (g_hash_table_size (priv->pending_relayouts) == 0)
|
||||
_clutter_stage_schedule_update (stage);
|
||||
|
||||
if (actor == (ClutterActor *) stage)
|
||||
g_hash_table_remove_all (priv->pending_relayouts);
|
||||
|
||||
g_hash_table_add (priv->pending_relayouts, g_object_ref (actor));
|
||||
priv->pending_relayouts_version++;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1304,41 +1315,58 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
|
||||
{
|
||||
ClutterStage *stage = CLUTTER_STAGE (actor);
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
gfloat natural_width, natural_height;
|
||||
ClutterActorBox box = { 0, };
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
int count = 0;
|
||||
|
||||
if (!priv->relayout_pending)
|
||||
/* No work to do? Avoid the extraneous debug log messages too. */
|
||||
if (g_hash_table_size (priv->pending_relayouts) == 0)
|
||||
return;
|
||||
|
||||
/* avoid reentrancy */
|
||||
if (!CLUTTER_ACTOR_IN_RELAYOUT (stage))
|
||||
CLUTTER_NOTE (ACTOR, ">>> Recomputing layout");
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->pending_relayouts);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
{
|
||||
priv->relayout_pending = FALSE;
|
||||
priv->stage_was_relayout = TRUE;
|
||||
g_autoptr (ClutterActor) queued_actor = key;
|
||||
unsigned int old_version;
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "Recomputing layout");
|
||||
g_hash_table_iter_steal (&iter);
|
||||
priv->pending_relayouts_version++;
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
|
||||
if (CLUTTER_ACTOR_IN_RELAYOUT (queued_actor)) /* avoid reentrancy */
|
||||
continue;
|
||||
|
||||
natural_width = natural_height = 0;
|
||||
clutter_actor_get_preferred_size (CLUTTER_ACTOR (stage),
|
||||
NULL, NULL,
|
||||
&natural_width, &natural_height);
|
||||
/* An actor may have been destroyed or hidden between queuing and now */
|
||||
if (clutter_actor_get_stage (queued_actor) != actor)
|
||||
continue;
|
||||
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = natural_width;
|
||||
box.y2 = natural_height;
|
||||
if (queued_actor == actor)
|
||||
CLUTTER_NOTE (ACTOR, " Deep relayout of stage %s",
|
||||
_clutter_actor_get_debug_name (queued_actor));
|
||||
else
|
||||
CLUTTER_NOTE (ACTOR, " Shallow relayout of actor %s",
|
||||
_clutter_actor_get_debug_name (queued_actor));
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage",
|
||||
(int) natural_width,
|
||||
(int) natural_height);
|
||||
CLUTTER_SET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
||||
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (stage),
|
||||
&box, CLUTTER_ALLOCATION_NONE);
|
||||
old_version = priv->pending_relayouts_version;
|
||||
clutter_actor_allocate_preferred_size (queued_actor,
|
||||
CLUTTER_ALLOCATION_NONE);
|
||||
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
||||
|
||||
count++;
|
||||
|
||||
/* Prevent using an iterator that's been invalidated */
|
||||
if (old_version != priv->pending_relayouts_version)
|
||||
g_hash_table_iter_init (&iter, priv->pending_relayouts);
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "<<< Completed recomputing layout of %d subtrees", count);
|
||||
|
||||
if (count)
|
||||
priv->stage_was_relayout = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1507,7 +1535,7 @@ _clutter_stage_do_update (ClutterStage *stage)
|
||||
|
||||
while (pointers)
|
||||
{
|
||||
_clutter_input_device_update (pointers->data, NULL, TRUE);
|
||||
clutter_input_device_update (pointers->data, NULL, TRUE);
|
||||
pointers = g_slist_delete_link (pointers, pointers);
|
||||
}
|
||||
|
||||
@@ -1520,14 +1548,9 @@ static void
|
||||
clutter_stage_real_queue_relayout (ClutterActor *self)
|
||||
{
|
||||
ClutterStage *stage = CLUTTER_STAGE (self);
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
ClutterActorClass *parent_class;
|
||||
|
||||
if (!priv->relayout_pending)
|
||||
{
|
||||
_clutter_stage_schedule_update (stage);
|
||||
priv->relayout_pending = TRUE;
|
||||
}
|
||||
clutter_stage_queue_actor_relayout (stage, self);
|
||||
|
||||
/* chain up */
|
||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
|
||||
@@ -1640,24 +1663,25 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
int i;
|
||||
|
||||
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
|
||||
|
||||
if (mode != priv->cached_pick_mode)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
_clutter_stage_clear_pick_stack (stage);
|
||||
|
||||
cogl_push_framebuffer (fb);
|
||||
pick_context = clutter_pick_context_new_for_view (view);
|
||||
|
||||
context->pick_mode = mode;
|
||||
setup_view_for_pick_or_paint (stage, view, NULL);
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage));
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
|
||||
context->pick_mode = CLUTTER_PICK_NONE;
|
||||
priv->cached_pick_mode = mode;
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
clutter_pick_context_destroy (pick_context);
|
||||
|
||||
add_pick_stack_weak_refs (stage);
|
||||
}
|
||||
@@ -1920,6 +1944,8 @@ clutter_stage_dispose (GObject *object)
|
||||
(GDestroyNotify) free_queue_redraw_entry);
|
||||
priv->pending_queue_redraws = NULL;
|
||||
|
||||
g_clear_pointer (&priv->pending_relayouts, g_hash_table_destroy);
|
||||
|
||||
/* this will release the reference on the stage */
|
||||
stage_manager = clutter_stage_manager_get_default ();
|
||||
_clutter_stage_manager_remove_stage (stage_manager, stage);
|
||||
@@ -2167,6 +2193,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
/**
|
||||
* ClutterStage::after-paint:
|
||||
* @stage: the stage that received the event
|
||||
* @paint_Context: the paint context
|
||||
*
|
||||
* The ::after-paint signal is emitted after the stage is painted,
|
||||
* but before the results are displayed on the screen.
|
||||
@@ -2278,7 +2305,11 @@ clutter_stage_init (ClutterStage *self)
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (self),
|
||||
&default_stage_color);
|
||||
|
||||
priv->relayout_pending = TRUE;
|
||||
priv->pending_relayouts = g_hash_table_new_full (NULL,
|
||||
NULL,
|
||||
g_object_unref,
|
||||
NULL);
|
||||
clutter_stage_queue_actor_relayout (self, CLUTTER_ACTOR (self));
|
||||
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
||||
clutter_stage_set_title (self, g_get_prgname ());
|
||||
@@ -2778,7 +2809,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
return NULL;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
clutter_stage_do_paint_view (stage, view, &clip_rect);
|
||||
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
@@ -2793,8 +2823,6 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
pixels);
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
@@ -3356,10 +3384,9 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
if (!priv->relayout_pending && !priv->redraw_pending)
|
||||
if (!_clutter_stage_needs_update (stage))
|
||||
_clutter_stage_schedule_update (stage);
|
||||
|
||||
priv->relayout_pending = TRUE;
|
||||
priv->redraw_pending = TRUE;
|
||||
|
||||
master_clock = _clutter_master_clock_get_default ();
|
||||
@@ -4014,18 +4041,6 @@ clutter_stage_get_motion_events_enabled (ClutterStage *stage)
|
||||
return stage->priv->motion_events_enabled;
|
||||
}
|
||||
|
||||
/* NB: The presumption shouldn't be that a stage can't be comprised
|
||||
* of multiple internal framebuffers, so instead of simply naming
|
||||
* this function _clutter_stage_get_framebuffer(), the "active"
|
||||
* infix is intended to clarify that it gets the framebuffer that
|
||||
* is currently in use/being painted.
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
_clutter_stage_get_active_framebuffer (ClutterStage *stage)
|
||||
{
|
||||
return stage->priv->active_framebuffer;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
@@ -4435,7 +4450,6 @@ capture_view_into (ClutterStage *stage,
|
||||
|
||||
if (paint)
|
||||
{
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||
clutter_stage_do_paint_view (stage, view, rect);
|
||||
}
|
||||
@@ -4460,9 +4474,6 @@ capture_view_into (ClutterStage *stage,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
bitmap);
|
||||
|
||||
if (paint)
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cogl_object_unref (bitmap);
|
||||
}
|
||||
|
||||
|
||||
@@ -1998,7 +1998,7 @@ selection_paint (ClutterText *self,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
|
||||
cogl_pango_render_layout (layout, priv->text_x, 0, &cogl_color, 0);
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
@@ -2555,7 +2555,8 @@ clutter_text_compute_layout_offsets (ClutterText *self,
|
||||
#define TEXT_PADDING 2
|
||||
|
||||
static void
|
||||
clutter_text_paint (ClutterActor *self)
|
||||
clutter_text_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (self);
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
@@ -2573,7 +2574,7 @@ clutter_text_paint (ClutterActor *self)
|
||||
float alloc_height;
|
||||
float resource_scale;
|
||||
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
/* Note that if anything in this paint method changes it needs to be
|
||||
reflected in the get_paint_volume implementation which is tightly
|
||||
@@ -2761,7 +2762,7 @@ clutter_text_paint (ClutterActor *self)
|
||||
priv->text_color.green,
|
||||
priv->text_color.blue,
|
||||
real_opacity);
|
||||
cogl_pango_render_layout (layout, priv->text_x, priv->text_y, &color, 0);
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
|
||||
|
||||
selection_paint (text, fb);
|
||||
|
||||
|
||||
@@ -1038,15 +1038,15 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
|
||||
* to correpondingly reduce elapsed_time_delta to reflect the correct
|
||||
* range of times */
|
||||
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
|
||||
end_msecs = priv->elapsed_time;
|
||||
|
||||
@@ -1756,12 +1756,12 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
if (msecs != 0)
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
priv->last_frame_time += msecs;
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -691,7 +691,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
gboolean do_swap_buffer;
|
||||
gboolean swap_with_damage;
|
||||
ClutterActor *wrapper;
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_region_t *redraw_clip = NULL;
|
||||
cairo_region_t *fb_clip_region;
|
||||
cairo_region_t *swap_region;
|
||||
cairo_rectangle_int_t redraw_rect;
|
||||
@@ -782,6 +782,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
{
|
||||
cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
|
||||
fb_clip_region = cairo_region_create_rectangle (&rect);
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
redraw_clip = cairo_region_copy (fb_clip_region);
|
||||
}
|
||||
|
||||
@@ -869,7 +870,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (fb);
|
||||
if (use_clipped_redraw && clip_region_empty)
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
||||
@@ -960,7 +960,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
cairo_region_destroy (view_region);
|
||||
}
|
||||
}
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cairo_region_get_extents (redraw_clip, &redraw_rect);
|
||||
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-stage-window.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -277,28 +277,30 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_paint (ClutterActor *actor)
|
||||
clutter_group_real_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'",
|
||||
_clutter_actor_get_debug_name (actor));
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, paint_context);
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'",
|
||||
_clutter_actor_get_debug_name (actor));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_pick (ClutterActor *actor)
|
||||
clutter_group_real_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
/* Chain up so we get a bounding box pained (if we are reactive) */
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick_context);
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, pick_context);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -78,10 +78,12 @@ static const ClutterColor default_border_color = { 0, 0, 0, 255 };
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
clutter_rectangle_paint (ClutterActor *self)
|
||||
clutter_rectangle_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
static CoglPipeline *default_color_pipeline = NULL;
|
||||
CoglPipeline *content_pipeline;
|
||||
ClutterActorBox alloc;
|
||||
|
||||
@@ -233,7 +233,7 @@ clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native)
|
||||
GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
|
||||
GSettingsSchema *schema = g_settings_schema_source_lookup (source,
|
||||
xsettings_path,
|
||||
FALSE);
|
||||
TRUE);
|
||||
|
||||
if (!schema)
|
||||
{
|
||||
|
||||
@@ -37,12 +37,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter-egl-headers.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
|
||||
@@ -57,11 +57,13 @@ clutter_headers = [
|
||||
'clutter-mutter.h',
|
||||
'clutter-offscreen-effect.h',
|
||||
'clutter-page-turn-effect.h',
|
||||
'clutter-paint-context.h',
|
||||
'clutter-paint-nodes.h',
|
||||
'clutter-paint-node.h',
|
||||
'clutter-pan-action.h',
|
||||
'clutter-path-constraint.h',
|
||||
'clutter-path.h',
|
||||
'clutter-pick-context.h',
|
||||
'clutter-property-transition.h',
|
||||
'clutter-rotate-action.h',
|
||||
'clutter-script.h',
|
||||
@@ -145,11 +147,13 @@ clutter_sources = [
|
||||
'clutter-master-clock-default.c',
|
||||
'clutter-offscreen-effect.c',
|
||||
'clutter-page-turn-effect.c',
|
||||
'clutter-paint-context.c',
|
||||
'clutter-paint-nodes.c',
|
||||
'clutter-paint-node.c',
|
||||
'clutter-pan-action.c',
|
||||
'clutter-path-constraint.c',
|
||||
'clutter-path.c',
|
||||
'clutter-pick-context.c',
|
||||
'clutter-property-transition.c',
|
||||
'clutter-rotate-action.c',
|
||||
'clutter-script.c',
|
||||
@@ -200,6 +204,7 @@ clutter_private_headers = [
|
||||
'clutter-master-clock.h',
|
||||
'clutter-master-clock-default.h',
|
||||
'clutter-offscreen-effect-private.h',
|
||||
'clutter-paint-context-private.h',
|
||||
'clutter-paint-node-private.h',
|
||||
'clutter-paint-volume-private.h',
|
||||
'clutter-private.h',
|
||||
|
||||
@@ -454,34 +454,6 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout_subpixel (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags)
|
||||
{
|
||||
cogl_pango_show_layout (cogl_get_draw_framebuffer (),
|
||||
layout,
|
||||
x / (float) PANGO_SCALE,
|
||||
y / (float) PANGO_SCALE,
|
||||
color);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags)
|
||||
{
|
||||
cogl_pango_render_layout_subpixel (layout,
|
||||
x * PANGO_SCALE,
|
||||
y * PANGO_SCALE,
|
||||
color,
|
||||
flags);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||
PangoLayoutLine *line,
|
||||
@@ -519,19 +491,6 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||
priv->display_list = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout_line (PangoLayoutLine *line,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color)
|
||||
{
|
||||
cogl_pango_show_layout_line (cogl_get_draw_framebuffer (),
|
||||
line,
|
||||
x / (float) PANGO_SCALE,
|
||||
y / (float) PANGO_SCALE,
|
||||
color);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer)
|
||||
{
|
||||
|
||||
@@ -229,71 +229,6 @@ typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
|
||||
|
||||
GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout_subpixel:
|
||||
* @layout: a #PangoLayout
|
||||
* @x: X coordinate (in Pango units) to render the layout at
|
||||
* @y: Y coordinate (in Pango units) to render the layout at
|
||||
* @color: color to use when rendering the layout
|
||||
* @flags:
|
||||
*
|
||||
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
||||
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
|
||||
* space.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
|
||||
void
|
||||
cogl_pango_render_layout_subpixel (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout:
|
||||
* @layout: a #PangoLayout
|
||||
* @x: X coordinate to render the layout at
|
||||
* @y: Y coordinate to render the layout at
|
||||
* @color: color to use when rendering the layout
|
||||
* @flags:
|
||||
*
|
||||
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
||||
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
|
||||
* space.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
|
||||
void
|
||||
cogl_pango_render_layout (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout_line:
|
||||
* @line: a #PangoLayoutLine
|
||||
* @x: X coordinate to render the line at
|
||||
* @y: Y coordinate to render the line at
|
||||
* @color: color to use when rendering the line
|
||||
*
|
||||
* Renders @line at the given coordinates using the given color.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout_line)
|
||||
void
|
||||
cogl_pango_render_layout_line (PangoLayoutLine *line,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PANGO_H__ */
|
||||
|
||||
@@ -7,6 +7,3 @@ cogl_pango_font_map_new
|
||||
cogl_pango_font_map_set_resolution
|
||||
cogl_pango_font_map_set_use_mipmapping
|
||||
cogl_pango_renderer_get_type
|
||||
cogl_pango_render_layout
|
||||
cogl_pango_render_layout_line
|
||||
cogl_pango_render_layout_subpixel
|
||||
|
||||
@@ -422,26 +422,6 @@ cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule);
|
||||
CoglPathFillRule
|
||||
cogl_path_get_fill_rule (CoglPath *path);
|
||||
|
||||
#define cogl_path_fill cogl2_path_fill
|
||||
/**
|
||||
* cogl_path_fill:
|
||||
*
|
||||
* Fills the interior of the constructed shape using the current
|
||||
* drawing color.
|
||||
*
|
||||
* The interior of the shape is determined using the fill rule of the
|
||||
* path. See %CoglPathFillRule for details.
|
||||
*
|
||||
* <note>The result of referencing sliced textures in your current
|
||||
* pipeline when filling a path are undefined. You should pass
|
||||
* the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
|
||||
* use while filling a path.</note>
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_fill (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_fill_path:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
@@ -466,19 +446,6 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPath *path);
|
||||
|
||||
#define cogl_path_stroke cogl2_path_stroke
|
||||
/**
|
||||
* cogl_path_stroke:
|
||||
*
|
||||
* Strokes the constructed shape using the current drawing color and a
|
||||
* width of 1 pixel (regardless of the current transformation
|
||||
* matrix).
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_stroke (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_stroke_path:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
@@ -513,22 +480,6 @@ void
|
||||
cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
CoglPath *path);
|
||||
|
||||
#define cogl_clip_push_from_path cogl2_clip_push_from_path
|
||||
/**
|
||||
* cogl_clip_push_from_path:
|
||||
* @path: The path to clip with.
|
||||
*
|
||||
* Sets a new clipping area using the silhouette of the specified,
|
||||
* filled @path. The clipping area is intersected with the previous
|
||||
* clipping area. To restore the previous clipping area, call
|
||||
* call cogl_clip_pop().
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: Unstable
|
||||
*/
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PATH_FUNCTIONS_H__ */
|
||||
|
||||
@@ -385,38 +385,6 @@ _cogl_path_fill_nodes (CoglPath *path,
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Update to the protoype used in the Cogl master branch.
|
||||
* This is experimental API but not in sync with the cogl_path_fill()
|
||||
* api in Cogl master which takes explicit framebuffer and pipeline
|
||||
* arguments */
|
||||
void
|
||||
cogl2_path_fill (CoglPath *path)
|
||||
{
|
||||
g_return_if_fail (cogl_is_path (path));
|
||||
|
||||
_cogl_path_fill_nodes (path,
|
||||
cogl_get_draw_framebuffer (),
|
||||
cogl_get_source (),
|
||||
0 /* flags */);
|
||||
}
|
||||
|
||||
/* TODO: Update to the protoype used in the Cogl master branch.
|
||||
* This is experimental API but not in sync with the cogl_path_fill()
|
||||
* api in Cogl master which takes explicit framebuffer and pipeline
|
||||
* arguments */
|
||||
void
|
||||
cogl2_path_stroke (CoglPath *path)
|
||||
{
|
||||
g_return_if_fail (cogl_is_path (path));
|
||||
|
||||
if (path->data->path_nodes->len == 0)
|
||||
return;
|
||||
|
||||
_cogl_path_stroke_nodes (path,
|
||||
cogl_get_draw_framebuffer (),
|
||||
cogl_get_source ());
|
||||
}
|
||||
|
||||
void
|
||||
cogl2_path_move_to (CoglPath *path,
|
||||
float x,
|
||||
@@ -1504,12 +1472,6 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
COGL_FRAMEBUFFER_STATE_CLIP;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path)
|
||||
{
|
||||
cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_path_build_stroke_attribute_buffer (CoglPath *path)
|
||||
{
|
||||
|
||||
@@ -252,16 +252,14 @@ _cogl_atlas_texture_foreach_sub_texture_in_region (
|
||||
static void
|
||||
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
|
||||
GLenum wrap_mode_s,
|
||||
GLenum wrap_mode_t,
|
||||
GLenum wrap_mode_p)
|
||||
GLenum wrap_mode_t)
|
||||
{
|
||||
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
|
||||
|
||||
/* Forward on to the sub texture */
|
||||
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture,
|
||||
wrap_mode_s,
|
||||
wrap_mode_t,
|
||||
wrap_mode_p);
|
||||
wrap_mode_t);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -90,17 +90,16 @@ typedef enum
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2,
|
||||
COGL_DRAW_SKIP_LEGACY_STATE = 1 << 3,
|
||||
/* By default the vertex attribute drawing code will assume that if
|
||||
there is a color attribute array enabled then we can't determine
|
||||
if the colors will be opaque so we need to enabling
|
||||
blending. However when drawing from the journal we know what the
|
||||
contents of the color array is so we can override this by passing
|
||||
this flag. */
|
||||
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 4,
|
||||
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 3,
|
||||
/* This forcibly disables the debug option to divert all drawing to
|
||||
* wireframes */
|
||||
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5
|
||||
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 4
|
||||
} CoglDrawFlags;
|
||||
|
||||
/* During CoglContext initialization we register the "cogl_color_in"
|
||||
|
||||
@@ -168,35 +168,6 @@ validate_n_components (const CoglAttributeNameState *name_state,
|
||||
{
|
||||
switch (name_state->name_id)
|
||||
{
|
||||
case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY:
|
||||
if (G_UNLIKELY (n_components == 1))
|
||||
{
|
||||
g_critical ("glVertexPointer doesn't allow 1 component vertex "
|
||||
"positions so we currently only support \"cogl_vertex\" "
|
||||
"attributes where n_components == 2, 3 or 4");
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
|
||||
if (G_UNLIKELY (n_components != 3 && n_components != 4))
|
||||
{
|
||||
g_critical ("glColorPointer expects 3 or 4 component colors so we "
|
||||
"currently only support \"cogl_color\" attributes where "
|
||||
"n_components == 3 or 4");
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY:
|
||||
break;
|
||||
case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY:
|
||||
if (G_UNLIKELY (n_components != 3))
|
||||
{
|
||||
g_critical ("glNormalPointer expects 3 component normals so we "
|
||||
"currently only support \"cogl_normal\" attributes "
|
||||
"where n_components == 3");
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY:
|
||||
if (G_UNLIKELY (n_components != 1))
|
||||
{
|
||||
@@ -205,6 +176,10 @@ validate_n_components (const CoglAttributeNameState *name_state,
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY:
|
||||
case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
|
||||
case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY:
|
||||
case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY:
|
||||
case COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY:
|
||||
return TRUE;
|
||||
}
|
||||
@@ -650,15 +625,6 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
|
||||
* when the framebuffer really does get drawn to. */
|
||||
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer);
|
||||
|
||||
if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) &&
|
||||
G_UNLIKELY (ctx->legacy_state_set) &&
|
||||
_cogl_get_enable_legacy_state ())
|
||||
{
|
||||
copy = cogl_pipeline_copy (pipeline);
|
||||
pipeline = copy;
|
||||
_cogl_pipeline_apply_legacy_state (pipeline);
|
||||
}
|
||||
|
||||
ctx->driver_vtable->flush_attributes_state (framebuffer,
|
||||
pipeline,
|
||||
&layers_state,
|
||||
|
||||
@@ -509,7 +509,7 @@ parse_argument (const char *string, /* original user string */
|
||||
if (parsing_factor)
|
||||
arg->factor.is_color = TRUE;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_ARG_STATE_SCRAPING_COLOR_SRC_NAME:
|
||||
if (!is_symbol_char (*p))
|
||||
{
|
||||
@@ -540,7 +540,7 @@ parse_argument (const char *string, /* original user string */
|
||||
else
|
||||
continue;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_ARG_STATE_MAYBE_COLOR_MASK:
|
||||
if (*p != '[')
|
||||
{
|
||||
@@ -554,7 +554,7 @@ parse_argument (const char *string, /* original user string */
|
||||
state = PARSER_ARG_STATE_SCRAPING_MASK;
|
||||
mark = p;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_ARG_STATE_SCRAPING_MASK:
|
||||
if (*p == ']')
|
||||
{
|
||||
@@ -687,7 +687,7 @@ parse_argument (const char *string, /* original user string */
|
||||
arg->factor.is_one = TRUE;
|
||||
state = PARSER_ARG_STATE_EXPECT_END;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_ARG_STATE_EXPECT_END:
|
||||
if (*p != ',' && *p != ')')
|
||||
{
|
||||
@@ -787,7 +787,7 @@ _cogl_blend_string_compile (const char *string,
|
||||
mark = p;
|
||||
state = PARSER_STATE_SCRAPING_DEST_CHANNELS;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_STATE_SCRAPING_DEST_CHANNELS:
|
||||
if (*p != '=')
|
||||
continue;
|
||||
@@ -810,7 +810,7 @@ _cogl_blend_string_compile (const char *string,
|
||||
mark = p;
|
||||
state = PARSER_STATE_SCRAPING_FUNCTION_NAME;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_STATE_SCRAPING_FUNCTION_NAME:
|
||||
if (*p != '(')
|
||||
{
|
||||
@@ -832,7 +832,7 @@ _cogl_blend_string_compile (const char *string,
|
||||
current_arg = 0;
|
||||
state = PARSER_STATE_EXPECT_ARG_START;
|
||||
|
||||
/* fall through */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case PARSER_STATE_EXPECT_ARG_START:
|
||||
if (*p != '(' && *p != ',')
|
||||
continue;
|
||||
|
||||
@@ -139,9 +139,6 @@ _cogl_buffer_fini (CoglBuffer *buffer);
|
||||
CoglBufferUsageHint
|
||||
_cogl_buffer_get_usage_hint (CoglBuffer *buffer);
|
||||
|
||||
GLenum
|
||||
_cogl_buffer_access_to_gl_enum (CoglBufferAccess access);
|
||||
|
||||
CoglBuffer *
|
||||
_cogl_buffer_immutable_ref (CoglBuffer *buffer);
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "cogl-clip-stack.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-framebuffer-private.h"
|
||||
#include "cogl-journal-private.h"
|
||||
|
||||
@@ -34,12 +34,7 @@
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-flags.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include "cogl-xlib-private.h"
|
||||
#endif
|
||||
|
||||
#include "cogl-display-private.h"
|
||||
#include "cogl-primitives.h"
|
||||
#include "cogl-clip-stack.h"
|
||||
#include "cogl-matrix-stack.h"
|
||||
#include "cogl-pipeline-private.h"
|
||||
@@ -109,15 +104,11 @@ struct _CoglContext
|
||||
GArray *attribute_name_index_map;
|
||||
int n_attribute_names;
|
||||
|
||||
CoglBitmask enabled_builtin_attributes;
|
||||
CoglBitmask enabled_texcoord_attributes;
|
||||
CoglBitmask enabled_custom_attributes;
|
||||
|
||||
/* These are temporary bitmasks that are used when disabling
|
||||
* builtin,texcoord and custom attribute arrays. They are here just
|
||||
* builtin and custom attribute arrays. They are here just
|
||||
* to avoid allocating new ones each time */
|
||||
CoglBitmask enable_builtin_attributes_tmp;
|
||||
CoglBitmask enable_texcoord_attributes_tmp;
|
||||
CoglBitmask enable_custom_attributes_tmp;
|
||||
CoglBitmask changed_bits_tmp;
|
||||
|
||||
@@ -127,10 +118,6 @@ struct _CoglContext
|
||||
CoglMatrix identity_matrix;
|
||||
CoglMatrix y_flip_matrix;
|
||||
|
||||
/* Value that was last used when calling glMatrixMode to avoid
|
||||
calling it multiple times */
|
||||
CoglMatrixMode flushed_matrix_mode;
|
||||
|
||||
/* The matrix stack entries that should be flushed during the next
|
||||
* pipeline state flush */
|
||||
CoglMatrixEntry *current_projection_entry;
|
||||
@@ -146,16 +133,12 @@ struct _CoglContext
|
||||
GArray *texture_units;
|
||||
int active_texture_unit;
|
||||
|
||||
/* Pipelines */
|
||||
CoglPipeline *opaque_color_pipeline; /* used for set_source_color */
|
||||
CoglPipeline *blended_color_pipeline; /* used for set_source_color */
|
||||
CoglPipeline *texture_pipeline; /* used for set_source_texture */
|
||||
/* Only used for comparing other pipelines when reading pixels. */
|
||||
CoglPipeline *opaque_color_pipeline;
|
||||
|
||||
GString *codegen_header_buffer;
|
||||
GString *codegen_source_buffer;
|
||||
GString *codegen_boilerplate_buffer;
|
||||
GList *source_stack;
|
||||
|
||||
int legacy_state_set;
|
||||
|
||||
CoglPipelineCache *pipeline_cache;
|
||||
|
||||
@@ -192,8 +175,6 @@ struct _CoglContext
|
||||
CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
|
||||
|
||||
/* Framebuffers */
|
||||
GSList *framebuffer_stack;
|
||||
CoglFramebuffer *window_buffer;
|
||||
unsigned long current_draw_buffer_state_flushed;
|
||||
unsigned long current_draw_buffer_changes;
|
||||
CoglFramebuffer *current_draw_buffer;
|
||||
@@ -247,8 +228,6 @@ struct _CoglContext
|
||||
GLint max_activateable_texture_units;
|
||||
|
||||
/* Fragment processing programs */
|
||||
CoglHandle current_program;
|
||||
|
||||
GLuint current_gl_program;
|
||||
|
||||
gboolean current_gl_dither_enabled;
|
||||
@@ -280,18 +259,6 @@ struct _CoglContext
|
||||
|
||||
CoglSamplerCache *sampler_cache;
|
||||
|
||||
/* FIXME: remove these when we remove the last xlib based clutter
|
||||
* backend. they should be tracked as part of the renderer but e.g.
|
||||
* the eglx backend doesn't yet have a corresponding Cogl winsys
|
||||
* and so we wont have a renderer in that case. */
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
/* List of callback functions that will be given every Xlib event */
|
||||
GSList *event_filters;
|
||||
/* Current top of the XError trap state stack. The actual memory for
|
||||
these is expected to be allocated on the stack by the caller */
|
||||
CoglXlibTrapState *trap_state;
|
||||
#endif
|
||||
|
||||
unsigned long winsys_features
|
||||
[COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_WINSYS_FEATURE_N_FEATURES)];
|
||||
void *winsys;
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
#include "cogl1-context.h"
|
||||
#include "cogl-gpu-info-private.h"
|
||||
#include "cogl-gtype-private.h"
|
||||
#include "driver/gl/cogl-pipeline-opengl-private.h"
|
||||
#include "driver/gl/cogl-util-gl-private.h"
|
||||
#include "winsys/cogl-winsys-private.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -104,6 +102,12 @@ _cogl_context_get_winsys (CoglContext *context)
|
||||
return context->display->renderer->winsys_vtable;
|
||||
}
|
||||
|
||||
static const CoglDriverVtable *
|
||||
_cogl_context_get_driver (CoglContext *context)
|
||||
{
|
||||
return context->driver_vtable;
|
||||
}
|
||||
|
||||
/* For reference: There was some deliberation over whether to have a
|
||||
* constructor that could throw an exception but looking at standard
|
||||
* practices with several high level OO languages including python, C++,
|
||||
@@ -207,6 +211,13 @@ cogl_context_new (CoglDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!context->driver_vtable->context_init (context, error))
|
||||
{
|
||||
cogl_object_unref (display);
|
||||
g_free (context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
context->attribute_name_states_hash =
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
context->attribute_name_index_map = NULL;
|
||||
@@ -241,28 +252,11 @@ cogl_context_new (CoglDisplay *display,
|
||||
cogl_matrix_init_identity (&context->y_flip_matrix);
|
||||
cogl_matrix_scale (&context->y_flip_matrix, 1, -1, 1);
|
||||
|
||||
context->flushed_matrix_mode = COGL_MATRIX_MODELVIEW;
|
||||
|
||||
context->texture_units =
|
||||
g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
|
||||
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ANY_GL))
|
||||
{
|
||||
/* See cogl-pipeline.c for more details about why we leave texture unit 1
|
||||
* active by default... */
|
||||
context->active_texture_unit = 1;
|
||||
GE (context, glActiveTexture (GL_TEXTURE1));
|
||||
}
|
||||
|
||||
context->opaque_color_pipeline = cogl_pipeline_new (context);
|
||||
context->blended_color_pipeline = cogl_pipeline_new (context);
|
||||
context->texture_pipeline = cogl_pipeline_new (context);
|
||||
|
||||
context->codegen_header_buffer = g_string_new ("");
|
||||
context->codegen_source_buffer = g_string_new ("");
|
||||
context->codegen_boilerplate_buffer = g_string_new ("");
|
||||
context->source_stack = NULL;
|
||||
|
||||
context->legacy_state_set = 0;
|
||||
|
||||
context->default_gl_texture_2d_tex = NULL;
|
||||
|
||||
@@ -288,10 +282,6 @@ cogl_context_new (CoglDisplay *display,
|
||||
context->current_pipeline_changes_since_flush = 0;
|
||||
context->current_pipeline_with_color_attrib = FALSE;
|
||||
|
||||
_cogl_bitmask_init (&context->enabled_builtin_attributes);
|
||||
_cogl_bitmask_init (&context->enable_builtin_attributes_tmp);
|
||||
_cogl_bitmask_init (&context->enabled_texcoord_attributes);
|
||||
_cogl_bitmask_init (&context->enable_texcoord_attributes_tmp);
|
||||
_cogl_bitmask_init (&context->enabled_custom_attributes);
|
||||
_cogl_bitmask_init (&context->enable_custom_attributes_tmp);
|
||||
_cogl_bitmask_init (&context->changed_bits_tmp);
|
||||
@@ -318,9 +308,6 @@ cogl_context_new (CoglDisplay *display,
|
||||
for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
|
||||
context->current_buffer[i] = NULL;
|
||||
|
||||
context->window_buffer = NULL;
|
||||
context->framebuffer_stack = _cogl_create_framebuffer_stack ();
|
||||
|
||||
context->current_path = NULL;
|
||||
context->stencil_pipeline = cogl_pipeline_new (context);
|
||||
|
||||
@@ -335,31 +322,6 @@ cogl_context_new (CoglDisplay *display,
|
||||
context->texture_download_pipeline = NULL;
|
||||
context->blit_texture_pipeline = NULL;
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST))
|
||||
/* The default for GL_ALPHA_TEST is to always pass which is equivalent to
|
||||
* the test being disabled therefore we assume that for all drivers there
|
||||
* will be no performance impact if we always leave the test enabled which
|
||||
* makes things a bit simpler for us. Under GLES2 the alpha test is
|
||||
* implemented in the fragment shader so there is no enable for it
|
||||
*/
|
||||
GE (context, glEnable (GL_ALPHA_TEST));
|
||||
|
||||
if (context->driver == COGL_DRIVER_GL3)
|
||||
{
|
||||
GLuint vertex_array;
|
||||
|
||||
/* In a forward compatible context, GL 3 doesn't support rendering
|
||||
* using the default vertex array object. Cogl doesn't use vertex
|
||||
* array objects yet so for now we just create a dummy array
|
||||
* object that we will use as our own default object. Eventually
|
||||
* it could be good to attach the vertex array objects to
|
||||
* CoglPrimitives */
|
||||
context->glGenVertexArrays (1, &vertex_array);
|
||||
context->glBindVertexArray (vertex_array);
|
||||
}
|
||||
#endif
|
||||
|
||||
context->current_modelview_entry = NULL;
|
||||
context->current_projection_entry = NULL;
|
||||
_cogl_matrix_entry_identity_init (&context->identity_entry);
|
||||
@@ -375,24 +337,12 @@ cogl_context_new (CoglDisplay *display,
|
||||
white_pixel,
|
||||
NULL); /* abort on error */
|
||||
|
||||
cogl_push_source (context->opaque_color_pipeline);
|
||||
|
||||
context->atlases = NULL;
|
||||
g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook));
|
||||
|
||||
context->buffer_map_fallback_array = g_byte_array_new ();
|
||||
context->buffer_map_fallback_in_use = FALSE;
|
||||
|
||||
/* As far as I can tell, GL_POINT_SPRITE doesn't have any effect
|
||||
unless GL_COORD_REPLACE is enabled for an individual layer.
|
||||
Therefore it seems like it should be ok to just leave it enabled
|
||||
all the time instead of having to have a set property on each
|
||||
pipeline to track whether any layers have point sprite coords
|
||||
enabled. We don't need to do this for GL3 or GLES2 because point
|
||||
sprites are handled using a builtin varying in the shader. */
|
||||
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_GL_FIXED))
|
||||
GE (context, glEnable (GL_POINT_SPRITE));
|
||||
|
||||
_cogl_list_init (&context->fences);
|
||||
|
||||
return context;
|
||||
@@ -402,11 +352,10 @@ static void
|
||||
_cogl_context_free (CoglContext *context)
|
||||
{
|
||||
const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context);
|
||||
const CoglDriverVtable *driver = _cogl_context_get_driver (context);
|
||||
|
||||
winsys->context_deinit (context);
|
||||
|
||||
_cogl_free_framebuffer_stack (context->framebuffer_stack);
|
||||
|
||||
if (context->current_path)
|
||||
cogl_object_unref (context->current_path);
|
||||
|
||||
@@ -415,10 +364,6 @@ _cogl_context_free (CoglContext *context)
|
||||
|
||||
if (context->opaque_color_pipeline)
|
||||
cogl_object_unref (context->opaque_color_pipeline);
|
||||
if (context->blended_color_pipeline)
|
||||
cogl_object_unref (context->blended_color_pipeline);
|
||||
if (context->texture_pipeline)
|
||||
cogl_object_unref (context->texture_pipeline);
|
||||
|
||||
if (context->blit_texture_pipeline)
|
||||
cogl_object_unref (context->blit_texture_pipeline);
|
||||
@@ -460,10 +405,6 @@ _cogl_context_free (CoglContext *context)
|
||||
g_slist_free (context->atlases);
|
||||
g_hook_list_clear (&context->atlas_reorganize_callbacks);
|
||||
|
||||
_cogl_bitmask_destroy (&context->enabled_builtin_attributes);
|
||||
_cogl_bitmask_destroy (&context->enable_builtin_attributes_tmp);
|
||||
_cogl_bitmask_destroy (&context->enabled_texcoord_attributes);
|
||||
_cogl_bitmask_destroy (&context->enable_texcoord_attributes_tmp);
|
||||
_cogl_bitmask_destroy (&context->enabled_custom_attributes);
|
||||
_cogl_bitmask_destroy (&context->enable_custom_attributes_tmp);
|
||||
_cogl_bitmask_destroy (&context->changed_bits_tmp);
|
||||
@@ -479,8 +420,6 @@ _cogl_context_free (CoglContext *context)
|
||||
|
||||
_cogl_sampler_cache_free (context->sampler_cache);
|
||||
|
||||
_cogl_destroy_texture_units ();
|
||||
|
||||
g_ptr_array_free (context->uniform_names, TRUE);
|
||||
g_hash_table_destroy (context->uniform_name_hash);
|
||||
|
||||
@@ -489,6 +428,8 @@ _cogl_context_free (CoglContext *context)
|
||||
|
||||
g_byte_array_free (context->buffer_map_fallback_array, TRUE);
|
||||
|
||||
driver->context_deinit (context);
|
||||
|
||||
cogl_object_unref (context->display);
|
||||
|
||||
g_free (context);
|
||||
|
||||
@@ -102,7 +102,7 @@ G_BEGIN_DECLS
|
||||
GType cogl_context_get_gtype (void);
|
||||
|
||||
/**
|
||||
* cogl_context_new: (constructor)
|
||||
* cogl_context_new: (constructor) (skip)
|
||||
* @display: (allow-none): A #CoglDisplay pointer
|
||||
* @error: A GError return location.
|
||||
*
|
||||
@@ -118,7 +118,7 @@ cogl_context_new (CoglDisplay *display,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_context_get_display:
|
||||
* cogl_context_get_display: (skip)
|
||||
* @context: A #CoglContext pointer
|
||||
*
|
||||
* Retrieves the #CoglDisplay that is internally associated with the
|
||||
@@ -136,7 +136,7 @@ CoglDisplay *
|
||||
cogl_context_get_display (CoglContext *context);
|
||||
|
||||
/**
|
||||
* cogl_context_get_renderer:
|
||||
* cogl_context_get_renderer: (skip)
|
||||
* @context: A #CoglContext pointer
|
||||
*
|
||||
* Retrieves the #CoglRenderer that is internally associated with the
|
||||
|
||||
@@ -40,6 +40,12 @@ typedef struct _CoglDriverVtable CoglDriverVtable;
|
||||
|
||||
struct _CoglDriverVtable
|
||||
{
|
||||
gboolean
|
||||
(* context_init) (CoglContext *context, GError **error);
|
||||
|
||||
void
|
||||
(* context_deinit) (CoglContext *context);
|
||||
|
||||
/* TODO: factor this out since this is OpenGL specific and
|
||||
* so can be ignored by non-OpenGL drivers. */
|
||||
gboolean
|
||||
|
||||
@@ -41,15 +41,6 @@
|
||||
#include "cogl-gl-header.h"
|
||||
#include "cogl-clip-stack.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef COGL_HAS_GLX_SUPPORT
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#endif
|
||||
|
||||
typedef enum _CoglFramebufferType {
|
||||
COGL_FRAMEBUFFER_TYPE_ONSCREEN,
|
||||
COGL_FRAMEBUFFER_TYPE_OFFSCREEN
|
||||
@@ -268,9 +259,7 @@ _cogl_framebuffer_mark_clear_clip_dirty (CoglFramebuffer *framebuffer);
|
||||
* _cogl_framebuffer_get_clip_stack:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
*
|
||||
* Gets a pointer to the current clip stack. This can be used to later
|
||||
* return to the same clip stack state with
|
||||
* _cogl_framebuffer_set_clip_stack(). A reference is not taken on the
|
||||
* Gets a pointer to the current clip stack. A reference is not taken on the
|
||||
* stack so if you want to keep it you should call
|
||||
* _cogl_clip_stack_ref().
|
||||
*
|
||||
@@ -279,17 +268,6 @@ _cogl_framebuffer_mark_clear_clip_dirty (CoglFramebuffer *framebuffer);
|
||||
CoglClipStack *
|
||||
_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer);
|
||||
|
||||
/*
|
||||
* _cogl_framebuffer_set_clip_stack:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
* @stack: a pointer to the replacement clip stack
|
||||
*
|
||||
* Replaces the @framebuffer clip stack with @stack.
|
||||
*/
|
||||
void
|
||||
_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer,
|
||||
CoglClipStack *stack);
|
||||
|
||||
CoglMatrixStack *
|
||||
_cogl_framebuffer_get_modelview_stack (CoglFramebuffer *framebuffer);
|
||||
|
||||
@@ -300,9 +278,6 @@ void
|
||||
_cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer,
|
||||
CoglFramebuffer *dependency);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_flush_journal (CoglFramebuffer *framebuffer);
|
||||
|
||||
@@ -341,27 +316,6 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
|
||||
CoglOffscreenFlags create_flags,
|
||||
int level);
|
||||
|
||||
/*
|
||||
* _cogl_push_framebuffers:
|
||||
* @draw_buffer: A pointer to the buffer used for drawing
|
||||
* @read_buffer: A pointer to the buffer used for reading back pixels
|
||||
*
|
||||
* Redirects drawing and reading to the specified framebuffers as in
|
||||
* cogl_push_framebuffer() except that it allows the draw and read
|
||||
* buffer to be different. The buffers are pushed as a pair so that
|
||||
* they can later both be restored with a single call to
|
||||
* cogl_pop_framebuffer().
|
||||
*/
|
||||
void
|
||||
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
|
||||
CoglFramebuffer *read_buffer);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_pop_projection (CoglFramebuffer *framebuffer);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_save_clip_stack (CoglFramebuffer *framebuffer);
|
||||
|
||||
@@ -395,18 +349,6 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
gboolean
|
||||
_cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx,
|
||||
CoglTexture *texture,
|
||||
int texture_level,
|
||||
int texture_level_width,
|
||||
int texture_level_height,
|
||||
CoglTexture *depth_texture,
|
||||
CoglFramebufferConfig *config,
|
||||
CoglOffscreenAllocateFlags flags,
|
||||
CoglGLFramebuffer *gl_framebuffer);
|
||||
|
||||
|
||||
void
|
||||
cogl_framebuffer_set_viewport4fv (CoglFramebuffer *framebuffer,
|
||||
float *viewport);
|
||||
|
||||
@@ -463,15 +463,6 @@ _cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer)
|
||||
return framebuffer->clip_stack;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer,
|
||||
CoglClipStack *stack)
|
||||
{
|
||||
_cogl_clip_stack_ref (stack);
|
||||
_cogl_clip_stack_unref (framebuffer->clip_stack);
|
||||
framebuffer->clip_stack = stack;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_set_viewport4fv (CoglFramebuffer *framebuffer,
|
||||
float *viewport)
|
||||
@@ -580,16 +571,6 @@ _cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer,
|
||||
g_list_prepend (framebuffer->deps, cogl_object_ref (dependency));
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
GList *l;
|
||||
for (l = framebuffer->deps; l; l = l->next)
|
||||
cogl_object_unref (l->data);
|
||||
g_list_free (framebuffer->deps);
|
||||
framebuffer->deps = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_flush_journal (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
@@ -602,7 +583,10 @@ _cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer)
|
||||
GList *l;
|
||||
for (l = framebuffer->deps; l; l = l->next)
|
||||
_cogl_framebuffer_flush_journal (l->data);
|
||||
_cogl_framebuffer_remove_all_dependencies (framebuffer);
|
||||
for (l = framebuffer->deps; l; l = l->next)
|
||||
cogl_object_unref (l->data);
|
||||
g_list_free (framebuffer->deps);
|
||||
framebuffer->deps = NULL;
|
||||
}
|
||||
|
||||
CoglOffscreen *
|
||||
@@ -1599,30 +1583,6 @@ cogl_framebuffer_orthographic (CoglFramebuffer *framebuffer,
|
||||
COGL_FRAMEBUFFER_STATE_PROJECTION;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
CoglMatrixStack *projection_stack =
|
||||
_cogl_framebuffer_get_projection_stack (framebuffer);
|
||||
cogl_matrix_stack_push (projection_stack);
|
||||
|
||||
if (framebuffer->context->current_draw_buffer == framebuffer)
|
||||
framebuffer->context->current_draw_buffer_changes |=
|
||||
COGL_FRAMEBUFFER_STATE_PROJECTION;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_pop_projection (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
CoglMatrixStack *projection_stack =
|
||||
_cogl_framebuffer_get_projection_stack (framebuffer);
|
||||
cogl_matrix_stack_pop (projection_stack);
|
||||
|
||||
if (framebuffer->context->current_draw_buffer == framebuffer)
|
||||
framebuffer->context->current_draw_buffer_changes |=
|
||||
COGL_FRAMEBUFFER_STATE_PROJECTION;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_get_modelview_matrix (CoglFramebuffer *framebuffer,
|
||||
CoglMatrix *matrix)
|
||||
@@ -2172,8 +2132,7 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPrimitive *primitive)
|
||||
{
|
||||
_cogl_primitive_draw (primitive, framebuffer, pipeline,
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
_cogl_primitive_draw (primitive, framebuffer, pipeline, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2199,8 +2158,7 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
&rect,
|
||||
1,
|
||||
TRUE);
|
||||
1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2231,8 +2189,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
&rect,
|
||||
1,
|
||||
TRUE);
|
||||
1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2260,8 +2217,7 @@ cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
&rect,
|
||||
1,
|
||||
TRUE);
|
||||
1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2290,8 +2246,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
rects,
|
||||
n_rectangles,
|
||||
TRUE);
|
||||
n_rectangles);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2320,6 +2275,5 @@ cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer,
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (framebuffer,
|
||||
pipeline,
|
||||
rects,
|
||||
n_rectangles,
|
||||
TRUE);
|
||||
n_rectangles);
|
||||
}
|
||||
|
||||
@@ -987,7 +987,7 @@ cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_get_context: (skip)
|
||||
* cogl_framebuffer_get_context:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
*
|
||||
* Can be used to query the #CoglContext a given @framebuffer was
|
||||
@@ -1065,8 +1065,8 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
|
||||
* @pipeline.
|
||||
*
|
||||
* <note>This api doesn't support any of the legacy global state options such
|
||||
* as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
|
||||
* cogl_program_use()</note>
|
||||
* as cogl_set_depth_test_enabled() or
|
||||
* cogl_set_backface_culling_enabled().</note>
|
||||
*
|
||||
* Stability: unstable
|
||||
* Since: 1.10
|
||||
@@ -1463,19 +1463,6 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
|
||||
CoglPixelFormat format,
|
||||
uint8_t *pixels);
|
||||
|
||||
/**
|
||||
* cogl_get_draw_framebuffer:
|
||||
*
|
||||
* Gets the current #CoglFramebuffer as set using
|
||||
* cogl_push_framebuffer()
|
||||
*
|
||||
* Return value: (transfer none): The current #CoglFramebuffer
|
||||
* Stability: unstable
|
||||
* Since: 1.8
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
cogl_get_draw_framebuffer (void);
|
||||
|
||||
uint32_t
|
||||
cogl_framebuffer_error_quark (void);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ G_BEGIN_DECLS
|
||||
* vertices multiple times.
|
||||
*
|
||||
* |[
|
||||
* CoglVertex2f quad_vertices[] = {
|
||||
* CoglVertexP2 quad_vertices[] = {
|
||||
* {x0, y0}, //0 = top left
|
||||
* {x1, y1}, //1 = bottom left
|
||||
* {x2, y2}, //2 = bottom right
|
||||
|
||||
@@ -280,8 +280,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
||||
CoglAttribute **attributes;
|
||||
CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||
|
||||
COGL_STATIC_TIMER (time_flush_modelview_and_entries,
|
||||
"flush: pipeline+entries", /* parent */
|
||||
@@ -1454,9 +1453,7 @@ _cogl_journal_flush (CoglJournal *journal)
|
||||
* is the number of pipeline layers.
|
||||
* 3) We split the entries explicitly by the number of pipeline layers:
|
||||
* We pad our vertex data when the number of layers is < 2 so that we
|
||||
* can minimize changes in stride. Each time the number of layers
|
||||
* changes we need to call glTexCoordPointer to inform GL of new VBO
|
||||
* offsets.
|
||||
* can minimize changes in stride.
|
||||
* 4) We then split according to compatible Cogl pipelines:
|
||||
* This is where we flush pipeline state
|
||||
* 5) Finally we split according to modelview matrix changes:
|
||||
|
||||
@@ -154,13 +154,6 @@ typedef struct _CoglMatrixEntryCache
|
||||
void
|
||||
_cogl_matrix_entry_identity_init (CoglMatrixEntry *entry);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COGL_MATRIX_MODELVIEW,
|
||||
COGL_MATRIX_PROJECTION,
|
||||
COGL_MATRIX_TEXTURE
|
||||
} CoglMatrixMode;
|
||||
|
||||
void
|
||||
_cogl_matrix_entry_cache_init (CoglMatrixEntryCache *cache);
|
||||
|
||||
|
||||
@@ -42,10 +42,6 @@
|
||||
#include "cogl-poll-private.h"
|
||||
#include "cogl-gtype-private.h"
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include "cogl-xlib-renderer.h"
|
||||
#endif
|
||||
|
||||
static void _cogl_onscreen_free (CoglOnscreen *onscreen);
|
||||
|
||||
COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (Onscreen, onscreen,
|
||||
@@ -161,9 +157,6 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
|
||||
cogl_object_unref (frame_info);
|
||||
g_queue_clear (&onscreen->pending_frame_infos);
|
||||
|
||||
if (framebuffer->context->window_buffer == COGL_FRAMEBUFFER (onscreen))
|
||||
framebuffer->context->window_buffer = NULL;
|
||||
|
||||
winsys->onscreen_deinit (onscreen);
|
||||
g_return_if_fail (onscreen->winsys == NULL);
|
||||
|
||||
|
||||
@@ -193,27 +193,9 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_BLEND)
|
||||
{
|
||||
const char *blend_enable_name;
|
||||
|
||||
changes = TRUE;
|
||||
|
||||
switch (pipeline->blend_enable)
|
||||
{
|
||||
case COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC:
|
||||
blend_enable_name = "AUTO";
|
||||
break;
|
||||
case COGL_PIPELINE_BLEND_ENABLE_ENABLED:
|
||||
blend_enable_name = "ENABLED";
|
||||
break;
|
||||
case COGL_PIPELINE_BLEND_ENABLE_DISABLED:
|
||||
blend_enable_name = "DISABLED";
|
||||
break;
|
||||
default:
|
||||
blend_enable_name = "UNKNOWN";
|
||||
}
|
||||
g_string_append_printf (changes_label,
|
||||
"\\lblend=%s\\n",
|
||||
blend_enable_name);
|
||||
"\\lblend\\n");
|
||||
}
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
|
||||
|
||||
@@ -308,8 +308,7 @@ _cogl_pipeline_layer_pre_paint (CoglPipelineLayer *layerr);
|
||||
void
|
||||
_cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer,
|
||||
CoglSamplerCacheWrapMode *wrap_mode_s,
|
||||
CoglSamplerCacheWrapMode *wrap_mode_t,
|
||||
CoglSamplerCacheWrapMode *wrap_mode_r);
|
||||
CoglSamplerCacheWrapMode *wrap_mode_t);
|
||||
|
||||
void
|
||||
_cogl_pipeline_layer_get_filters (CoglPipelineLayer *layer,
|
||||
@@ -351,9 +350,6 @@ _cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer);
|
||||
CoglPipelineWrapMode
|
||||
_cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer);
|
||||
|
||||
CoglPipelineWrapMode
|
||||
_cogl_pipeline_layer_get_wrap_mode_p (CoglPipelineLayer *layer);
|
||||
|
||||
void
|
||||
_cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest,
|
||||
CoglPipelineLayer *src,
|
||||
|
||||
@@ -331,9 +331,7 @@ cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
|
||||
authority->sampler_cache_entry,
|
||||
internal_mode,
|
||||
authority->sampler_cache_entry->
|
||||
wrap_mode_t,
|
||||
authority->sampler_cache_entry->
|
||||
wrap_mode_p);
|
||||
wrap_mode_t);
|
||||
_cogl_pipeline_set_layer_sampler_state (pipeline,
|
||||
layer,
|
||||
authority,
|
||||
@@ -373,62 +371,6 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
|
||||
authority->sampler_cache_entry,
|
||||
authority->sampler_cache_entry->
|
||||
wrap_mode_s,
|
||||
internal_mode,
|
||||
authority->sampler_cache_entry->
|
||||
wrap_mode_p);
|
||||
_cogl_pipeline_set_layer_sampler_state (pipeline,
|
||||
layer,
|
||||
authority,
|
||||
sampler_state);
|
||||
}
|
||||
|
||||
/* The rationale for naming the third texture coordinate 'p' instead
|
||||
of OpenGL's usual 'r' is that 'r' conflicts with the usual naming
|
||||
of the 'red' component when treating a vector as a color. Under
|
||||
GLSL this is awkward because the texture swizzling for a vector
|
||||
uses a single letter for each component and the names for colors,
|
||||
textures and positions are synonymous. GLSL works around this by
|
||||
naming the components of the texture s, t, p and q. Cogl already
|
||||
effectively already exposes this naming because it exposes GLSL so
|
||||
it makes sense to use that naming consistently. Another alternative
|
||||
could be u, v and w. This is what Blender and Direct3D use. However
|
||||
the w component conflicts with the w component of a position
|
||||
vertex. */
|
||||
void
|
||||
cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
CoglPipelineWrapMode mode)
|
||||
{
|
||||
CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER;
|
||||
CoglPipelineLayer *layer;
|
||||
CoglPipelineLayer *authority;
|
||||
CoglSamplerCacheWrapMode internal_mode =
|
||||
public_to_internal_wrap_mode (mode);
|
||||
const CoglSamplerCacheEntry *sampler_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
|
||||
/* Note: this will ensure that the layer exists, creating one if it
|
||||
* doesn't already.
|
||||
*
|
||||
* Note: If the layer already existed it's possibly owned by another
|
||||
* pipeline. If the layer is created then it will be owned by
|
||||
* pipeline. */
|
||||
layer = _cogl_pipeline_get_layer (pipeline, layer_index);
|
||||
|
||||
/* Now find the ancestor of the layer that is the authority for the
|
||||
* state we want to change */
|
||||
authority = _cogl_pipeline_layer_get_authority (layer, change);
|
||||
|
||||
sampler_state =
|
||||
_cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache,
|
||||
authority->sampler_cache_entry,
|
||||
authority->sampler_cache_entry->
|
||||
wrap_mode_s,
|
||||
authority->sampler_cache_entry->
|
||||
wrap_mode_t,
|
||||
internal_mode);
|
||||
_cogl_pipeline_set_layer_sampler_state (pipeline,
|
||||
layer,
|
||||
@@ -468,14 +410,11 @@ cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline,
|
||||
_cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache,
|
||||
authority->sampler_cache_entry,
|
||||
internal_mode,
|
||||
internal_mode,
|
||||
internal_mode);
|
||||
_cogl_pipeline_set_layer_sampler_state (pipeline,
|
||||
layer,
|
||||
authority,
|
||||
sampler_state);
|
||||
/* XXX: I wonder if we should really be duplicating the mode into
|
||||
* the 'p' wrap mode too? */
|
||||
}
|
||||
|
||||
/* FIXME: deprecate this API */
|
||||
@@ -552,41 +491,10 @@ cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, int layer_index)
|
||||
return _cogl_pipeline_layer_get_wrap_mode_t (layer);
|
||||
}
|
||||
|
||||
CoglPipelineWrapMode
|
||||
_cogl_pipeline_layer_get_wrap_mode_p (CoglPipelineLayer *layer)
|
||||
{
|
||||
CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER;
|
||||
CoglPipelineLayer *authority =
|
||||
_cogl_pipeline_layer_get_authority (layer, change);
|
||||
const CoglSamplerCacheEntry *sampler_state;
|
||||
|
||||
sampler_state = authority->sampler_cache_entry;
|
||||
return internal_to_public_wrap_mode (sampler_state->wrap_mode_p);
|
||||
}
|
||||
|
||||
CoglPipelineWrapMode
|
||||
cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, int layer_index)
|
||||
{
|
||||
CoglPipelineLayer *layer;
|
||||
|
||||
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
|
||||
|
||||
/* Note: this will ensure that the layer exists, creating one if it
|
||||
* doesn't already.
|
||||
*
|
||||
* Note: If the layer already existed it's possibly owned by another
|
||||
* pipeline. If the layer is created then it will be owned by
|
||||
* pipeline. */
|
||||
layer = _cogl_pipeline_get_layer (pipeline, layer_index);
|
||||
|
||||
return _cogl_pipeline_layer_get_wrap_mode_p (layer);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer,
|
||||
CoglSamplerCacheWrapMode *wrap_mode_s,
|
||||
CoglSamplerCacheWrapMode *wrap_mode_t,
|
||||
CoglSamplerCacheWrapMode *wrap_mode_p)
|
||||
CoglSamplerCacheWrapMode *wrap_mode_t)
|
||||
{
|
||||
CoglPipelineLayer *authority =
|
||||
_cogl_pipeline_layer_get_authority (layer,
|
||||
@@ -594,7 +502,6 @@ _cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer,
|
||||
|
||||
*wrap_mode_s = authority->sampler_cache_entry->wrap_mode_s;
|
||||
*wrap_mode_t = authority->sampler_cache_entry->wrap_mode_t;
|
||||
*wrap_mode_p = authority->sampler_cache_entry->wrap_mode_p;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -529,41 +529,6 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
CoglPipelineWrapMode mode);
|
||||
|
||||
/**
|
||||
* cogl_pipeline_get_layer_wrap_mode_p:
|
||||
* @pipeline: A #CoglPipeline object
|
||||
* @layer_index: the layer number to change.
|
||||
*
|
||||
* Returns the wrap mode for the 'p' coordinate of texture lookups on this
|
||||
* layer.
|
||||
*
|
||||
* Return value: the wrap mode for the 'p' coordinate of texture lookups on
|
||||
* this layer.
|
||||
*
|
||||
* Since: 1.6
|
||||
* Stability: unstable
|
||||
*/
|
||||
CoglPipelineWrapMode
|
||||
cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline,
|
||||
int layer_index);
|
||||
|
||||
/**
|
||||
* cogl_pipeline_set_layer_wrap_mode_p:
|
||||
* @pipeline: A #CoglPipeline object
|
||||
* @layer_index: the layer number to change.
|
||||
* @mode: the new wrap mode
|
||||
*
|
||||
* Sets the wrap mode for the 'p' coordinate of texture lookups on
|
||||
* this layer. 'p' is the third coordinate.
|
||||
*
|
||||
* Since: 2.0
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
CoglPipelineWrapMode mode);
|
||||
|
||||
/**
|
||||
* cogl_pipeline_set_layer_wrap_mode:
|
||||
* @pipeline: A #CoglPipeline object
|
||||
@@ -572,9 +537,8 @@ cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
|
||||
*
|
||||
* Sets the wrap mode for all three coordinates of texture lookups on
|
||||
* this layer. This is equivalent to calling
|
||||
* cogl_pipeline_set_layer_wrap_mode_s(),
|
||||
* cogl_pipeline_set_layer_wrap_mode_t() and
|
||||
* cogl_pipeline_set_layer_wrap_mode_p() separately.
|
||||
* cogl_pipeline_set_layer_wrap_mode_s() and
|
||||
* cogl_pipeline_set_layer_wrap_mode_t() separately.
|
||||
*
|
||||
* Since: 2.0
|
||||
* Stability: unstable
|
||||
|
||||
@@ -62,7 +62,6 @@ typedef enum
|
||||
{
|
||||
/* sparse state */
|
||||
COGL_PIPELINE_STATE_COLOR_INDEX,
|
||||
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
||||
COGL_PIPELINE_STATE_LAYERS_INDEX,
|
||||
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
|
||||
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
|
||||
@@ -99,8 +98,6 @@ typedef enum _CoglPipelineState
|
||||
{
|
||||
COGL_PIPELINE_STATE_COLOR =
|
||||
1L<<COGL_PIPELINE_STATE_COLOR_INDEX,
|
||||
COGL_PIPELINE_STATE_BLEND_ENABLE =
|
||||
1L<<COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
||||
COGL_PIPELINE_STATE_LAYERS =
|
||||
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
|
||||
|
||||
@@ -147,7 +144,6 @@ typedef enum _CoglPipelineState
|
||||
|
||||
#define COGL_PIPELINE_STATE_AFFECTS_BLENDING \
|
||||
(COGL_PIPELINE_STATE_COLOR | \
|
||||
COGL_PIPELINE_STATE_BLEND_ENABLE | \
|
||||
COGL_PIPELINE_STATE_LAYERS | \
|
||||
COGL_PIPELINE_STATE_BLEND | \
|
||||
COGL_PIPELINE_STATE_USER_SHADER | \
|
||||
@@ -184,15 +180,6 @@ typedef struct
|
||||
float alpha_func_reference;
|
||||
} CoglPipelineAlphaFuncState;
|
||||
|
||||
typedef enum _CoglPipelineBlendEnable
|
||||
{
|
||||
/* XXX: we want to detect users mistakenly using TRUE or FALSE
|
||||
* so start the enum at 2. */
|
||||
COGL_PIPELINE_BLEND_ENABLE_ENABLED = 2,
|
||||
COGL_PIPELINE_BLEND_ENABLE_DISABLED,
|
||||
COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC
|
||||
} CoglPipelineBlendEnable;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Determines how this pipeline is blended with other primitives */
|
||||
@@ -346,10 +333,6 @@ struct _CoglPipeline
|
||||
* pipelines with only a few layers... */
|
||||
CoglPipelineLayer *short_layers_cache[3];
|
||||
|
||||
/* The deprecated cogl_pipeline_get_layers() API returns a
|
||||
* const GList of layers, which we track here... */
|
||||
GList *deprecated_get_layers_list;
|
||||
|
||||
/* XXX: consider adding an authorities cache to speed up sparse
|
||||
* property value lookups:
|
||||
* CoglPipeline *authorities_cache[COGL_PIPELINE_N_SPARSE_PROPERTIES];
|
||||
@@ -367,13 +350,6 @@ struct _CoglPipeline
|
||||
/* Determines if pipeline->big_state is valid */
|
||||
unsigned int has_big_state:1;
|
||||
|
||||
/* By default blending is enabled automatically depending on the
|
||||
* unlit color, the lighting colors or the texture format. The user
|
||||
* can override this to explicitly enable or disable blending.
|
||||
*
|
||||
* This is a sparse property */
|
||||
unsigned int blend_enable:3;
|
||||
|
||||
/* There are many factors that can determine if we need to enable
|
||||
* blending, this holds our final decision */
|
||||
unsigned int real_blend_enable:1;
|
||||
@@ -392,7 +368,6 @@ struct _CoglPipeline
|
||||
unsigned int unknown_color_alpha:1;
|
||||
|
||||
unsigned int layers_cache_dirty:1;
|
||||
unsigned int deprecated_get_layers_list_dirty:1;
|
||||
|
||||
#ifdef COGL_DEBUG_ENABLED
|
||||
/* For debugging purposes it's possible to associate a static const
|
||||
@@ -586,9 +561,6 @@ typedef struct _CoglPipelineFlushOptions
|
||||
CoglTexture *layer0_override_texture;
|
||||
} CoglPipelineFlushOptions;
|
||||
|
||||
void
|
||||
cogl_use_program (GLuint gl_program);
|
||||
|
||||
unsigned int
|
||||
_cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
|
||||
|
||||
@@ -774,13 +746,6 @@ void
|
||||
_cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
|
||||
CoglPipelineFlushOptions *options);
|
||||
|
||||
CoglPipelineBlendEnable
|
||||
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline);
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
||||
CoglPipelineBlendEnable enable);
|
||||
|
||||
#ifdef COGL_DEBUG_ENABLED
|
||||
void
|
||||
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
||||
@@ -818,9 +783,6 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n);
|
||||
* API to support the deprecate cogl_pipeline_layer_xyz functions...
|
||||
*/
|
||||
|
||||
const GList *
|
||||
_cogl_pipeline_get_layers (CoglPipeline *pipeline);
|
||||
|
||||
typedef gboolean (*CoglPipelineInternalLayerCallback) (CoglPipelineLayer *layer,
|
||||
void *user_data);
|
||||
|
||||
|
||||
@@ -108,10 +108,6 @@ void
|
||||
_cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state);
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state);
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_layers_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state);
|
||||
|
||||
@@ -407,56 +407,6 @@ cogl_pipeline_set_color4f (CoglPipeline *pipeline,
|
||||
cogl_pipeline_set_color (pipeline, &color);
|
||||
}
|
||||
|
||||
CoglPipelineBlendEnable
|
||||
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline)
|
||||
{
|
||||
CoglPipeline *authority;
|
||||
|
||||
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
|
||||
|
||||
authority =
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
|
||||
return authority->blend_enable;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_blend_enable_equal (CoglPipeline *authority0,
|
||||
CoglPipeline *authority1)
|
||||
{
|
||||
return authority0->blend_enable == authority1->blend_enable ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
||||
CoglPipelineBlendEnable enable)
|
||||
{
|
||||
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE;
|
||||
CoglPipeline *authority;
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
g_return_if_fail (enable > 1 &&
|
||||
"don't pass TRUE or FALSE to _set_blend_enabled!");
|
||||
|
||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
||||
|
||||
if (authority->blend_enable == enable)
|
||||
return;
|
||||
|
||||
/* - Flush journal primitives referencing the current state.
|
||||
* - Make sure the pipeline has no dependants so it may be modified.
|
||||
* - If the pipeline isn't currently an authority for the state being
|
||||
* changed, then initialize that state from the current authority.
|
||||
*/
|
||||
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
|
||||
|
||||
pipeline->blend_enable = enable;
|
||||
|
||||
_cogl_pipeline_update_authority (pipeline, authority, state,
|
||||
_cogl_pipeline_blend_enable_equal);
|
||||
|
||||
pipeline->dirty_real_blend_enable = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
|
||||
CoglPipelineAlphaFunc alpha_func)
|
||||
@@ -1379,14 +1329,6 @@ _cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
||||
_COGL_COLOR_DATA_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state)
|
||||
{
|
||||
uint8_t blend_enable = authority->blend_enable;
|
||||
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority,
|
||||
CoglPipelineHashState *state)
|
||||
|
||||
@@ -418,7 +418,6 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline);
|
||||
* "!!ARBfp1.0\n"
|
||||
* "MOV result.color,fragment.color;\n"
|
||||
* "END\n");
|
||||
* cogl_shader_compile (shader);
|
||||
*
|
||||
* program = cogl_create_program ();
|
||||
* cogl_program_attach_shader (program, shader);
|
||||
|
||||
@@ -104,7 +104,6 @@ _cogl_pipeline_init_default_pipeline (void)
|
||||
|
||||
pipeline->real_blend_enable = FALSE;
|
||||
|
||||
pipeline->blend_enable = COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC;
|
||||
pipeline->layer_differences = NULL;
|
||||
pipeline->n_layers = 0;
|
||||
|
||||
@@ -281,8 +280,6 @@ _cogl_pipeline_copy (CoglPipeline *src, gboolean is_weak)
|
||||
*/
|
||||
|
||||
pipeline->layers_cache_dirty = TRUE;
|
||||
pipeline->deprecated_get_layers_list = NULL;
|
||||
pipeline->deprecated_get_layers_list_dirty = TRUE;
|
||||
|
||||
pipeline->has_static_breadcrumb = FALSE;
|
||||
|
||||
@@ -398,8 +395,6 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE)
|
||||
g_slice_free (CoglPipelineBigState, pipeline->big_state);
|
||||
|
||||
g_list_free (pipeline->deprecated_get_layers_list);
|
||||
|
||||
recursively_free_layer_caches (pipeline);
|
||||
|
||||
g_slice_free (CoglPipeline, pipeline);
|
||||
@@ -721,24 +716,12 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
|
||||
const CoglColor *override_color,
|
||||
gboolean unknown_color_alpha)
|
||||
{
|
||||
CoglPipeline *enable_authority;
|
||||
CoglPipeline *blend_authority;
|
||||
CoglPipelineBlendState *blend_state;
|
||||
CoglPipelineBlendEnable enabled;
|
||||
|
||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
|
||||
return FALSE;
|
||||
|
||||
/* We unconditionally check the _BLEND_ENABLE state first because
|
||||
* all the other changes are irrelevent if blend_enable != _AUTOMATIC
|
||||
*/
|
||||
enable_authority =
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
|
||||
|
||||
enabled = enable_authority->blend_enable;
|
||||
if (enabled != COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC)
|
||||
return enabled == COGL_PIPELINE_BLEND_ENABLE_ENABLED ? TRUE : FALSE;
|
||||
|
||||
blend_authority =
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND);
|
||||
|
||||
@@ -826,9 +809,6 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
|
||||
if (differences & COGL_PIPELINE_STATE_COLOR)
|
||||
dest->color = src->color;
|
||||
|
||||
if (differences & COGL_PIPELINE_STATE_BLEND_ENABLE)
|
||||
dest->blend_enable = src->blend_enable;
|
||||
|
||||
if (differences & COGL_PIPELINE_STATE_LAYERS)
|
||||
{
|
||||
GList *l;
|
||||
@@ -977,7 +957,6 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
|
||||
/* XXX: avoid using a default: label so we get a warning if we
|
||||
* don't explicitly handle a newly defined state-group here. */
|
||||
case COGL_PIPELINE_STATE_COLOR:
|
||||
case COGL_PIPELINE_STATE_BLEND_ENABLE:
|
||||
case COGL_PIPELINE_STATE_ALPHA_FUNC:
|
||||
case COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE:
|
||||
case COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE:
|
||||
@@ -2170,7 +2149,6 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
|
||||
break;
|
||||
}
|
||||
|
||||
case COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX:
|
||||
case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX:
|
||||
case COGL_PIPELINE_STATE_COUNT:
|
||||
g_warn_if_reached ();
|
||||
@@ -2313,42 +2291,6 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline, int layer_index)
|
||||
pipeline->dirty_real_blend_enable = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
prepend_layer_to_list_cb (CoglPipelineLayer *layer,
|
||||
void *user_data)
|
||||
{
|
||||
GList **layers = user_data;
|
||||
|
||||
*layers = g_list_prepend (*layers, layer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* TODO: deprecate this API and replace it with
|
||||
* cogl_pipeline_foreach_layer
|
||||
* TODO: update the docs to note that if the user modifies any layers
|
||||
* then the list may become invalid.
|
||||
*/
|
||||
const GList *
|
||||
_cogl_pipeline_get_layers (CoglPipeline *pipeline)
|
||||
{
|
||||
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
|
||||
|
||||
if (!pipeline->deprecated_get_layers_list_dirty)
|
||||
g_list_free (pipeline->deprecated_get_layers_list);
|
||||
|
||||
pipeline->deprecated_get_layers_list = NULL;
|
||||
|
||||
_cogl_pipeline_foreach_layer_internal (pipeline,
|
||||
prepend_layer_to_list_cb,
|
||||
&pipeline->deprecated_get_layers_list);
|
||||
pipeline->deprecated_get_layers_list =
|
||||
g_list_reverse (pipeline->deprecated_get_layers_list);
|
||||
|
||||
pipeline->deprecated_get_layers_list_dirty = 0;
|
||||
|
||||
return pipeline->deprecated_get_layers_list;
|
||||
}
|
||||
|
||||
int
|
||||
cogl_pipeline_get_n_layers (CoglPipeline *pipeline)
|
||||
{
|
||||
@@ -2388,37 +2330,6 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
|
||||
}
|
||||
|
||||
#ifdef COGL_DEBUG_ENABLED
|
||||
void
|
||||
_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* It was a mistake that we ever copied the OpenGL style API for
|
||||
* associating these things directly with the context when we
|
||||
* originally wrote Cogl. Until the corresponding deprecated APIs
|
||||
* can be removed though we now shoehorn the state changes through
|
||||
* the cogl_pipeline API instead.
|
||||
*/
|
||||
|
||||
/* A program explicitly set on the pipeline has higher precedence than
|
||||
* one associated with the context using cogl_program_use() */
|
||||
if (ctx->current_program &&
|
||||
cogl_pipeline_get_user_program (pipeline) == NULL)
|
||||
cogl_pipeline_set_user_program (pipeline, ctx->current_program);
|
||||
|
||||
if (ctx->legacy_depth_test_enabled)
|
||||
{
|
||||
CoglDepthState depth_state;
|
||||
cogl_depth_state_init (&depth_state);
|
||||
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
|
||||
cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
|
||||
}
|
||||
|
||||
if (ctx->legacy_backface_culling_enabled)
|
||||
cogl_pipeline_set_cull_face_mode (pipeline,
|
||||
COGL_PIPELINE_CULL_FACE_MODE_BACK);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
||||
const char *breadcrumb)
|
||||
@@ -2545,8 +2456,6 @@ _cogl_pipeline_init_state_hash_functions (void)
|
||||
{
|
||||
state_hash_functions[COGL_PIPELINE_STATE_COLOR_INDEX] =
|
||||
_cogl_pipeline_hash_color_state;
|
||||
state_hash_functions[COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX] =
|
||||
_cogl_pipeline_hash_blend_enable_state;
|
||||
state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] =
|
||||
_cogl_pipeline_hash_layers_state;
|
||||
state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] =
|
||||
@@ -2576,7 +2485,7 @@ _cogl_pipeline_init_state_hash_functions (void)
|
||||
|
||||
{
|
||||
/* So we get a big error if we forget to update this code! */
|
||||
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 15,
|
||||
_COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 14,
|
||||
"Make sure to install a hash function for "
|
||||
"newly added pipeline state and update assert "
|
||||
"in _cogl_pipeline_init_state_hash_functions");
|
||||
@@ -2850,14 +2759,7 @@ _cogl_pipeline_get_state_for_vertex_codegen (CoglContext *context)
|
||||
COGL_PIPELINE_STATE_USER_SHADER |
|
||||
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE |
|
||||
COGL_PIPELINE_STATE_VERTEX_SNIPPETS);
|
||||
|
||||
/* If we don't have the builtin point size uniform then we'll add
|
||||
* one in the GLSL but we'll only do this if the point size is
|
||||
* non-zero. Whether or not the point size is zero is represented by
|
||||
* COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE */
|
||||
if (!_cogl_has_private_feature
|
||||
(context, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM))
|
||||
state |= COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE;
|
||||
state |= COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE;
|
||||
|
||||
return state;
|
||||
}
|
||||
@@ -2883,10 +2785,8 @@ _cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context)
|
||||
{
|
||||
CoglPipelineState state = (COGL_PIPELINE_STATE_LAYERS |
|
||||
COGL_PIPELINE_STATE_USER_SHADER |
|
||||
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS);
|
||||
|
||||
if (!_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST))
|
||||
state |= COGL_PIPELINE_STATE_ALPHA_FUNC;
|
||||
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS |
|
||||
COGL_PIPELINE_STATE_ALPHA_FUNC);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ G_BEGIN_DECLS
|
||||
GType cogl_pipeline_get_gtype (void);
|
||||
|
||||
/**
|
||||
* cogl_pipeline_new: (skip)
|
||||
* cogl_pipeline_new: (constructor)
|
||||
* @context: a #CoglContext
|
||||
*
|
||||
* Allocates and initializes a default simple pipeline that will color
|
||||
|
||||
@@ -102,37 +102,6 @@ cogl_pixel_buffer_new (CoglContext *context,
|
||||
gboolean
|
||||
cogl_is_pixel_buffer (void *object);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* cogl_pixel_buffer_set_region:
|
||||
* @buffer: A #CoglPixelBuffer object
|
||||
* @data: pixel data to upload to @array
|
||||
* @src_width: width in pixels of the region to update
|
||||
* @src_height: height in pixels of the region to update
|
||||
* @src_rowstride: row stride in bytes of the source array
|
||||
* @dst_x: upper left destination horizontal coordinate
|
||||
* @dst_y: upper left destination vertical coordinate
|
||||
*
|
||||
* Uploads new data into a pixel array. The source data pointed by @data can
|
||||
* have a different stride than @array in which case the function will do the
|
||||
* right thing for you. For performance reasons, it is recommended for the
|
||||
* source data to have the same stride than @array.
|
||||
*
|
||||
* Return value: %TRUE if the upload succeeded, %FALSE otherwise
|
||||
*
|
||||
* Since: 1.2
|
||||
* Stability: Unstable
|
||||
*/
|
||||
gboolean
|
||||
cogl_pixel_buffer_set_region (CoglPixelBuffer *buffer,
|
||||
uint8_t *data,
|
||||
unsigned int src_width,
|
||||
unsigned int src_height,
|
||||
unsigned int src_rowstride,
|
||||
unsigned int dst_x,
|
||||
unsigned int dst_y);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PIXEL_BUFFER_H__ */
|
||||
|
||||
@@ -47,6 +47,13 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
void
|
||||
cogl_2d_primitives_immediate (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
const CoglVertexP2 *vertices,
|
||||
unsigned int n_vertices);
|
||||
|
||||
typedef struct _CoglMultiTexturedRect
|
||||
{
|
||||
const float *position; /* x0,y0,x1,y1 */
|
||||
@@ -59,8 +66,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglMultiTexturedRect *rects,
|
||||
int n_rects,
|
||||
gboolean disable_legacy_state);
|
||||
int n_rects);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -629,8 +629,7 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglMultiTexturedRect *rects,
|
||||
int n_rects,
|
||||
gboolean disable_legacy_state)
|
||||
int n_rects)
|
||||
{
|
||||
CoglContext *ctx = framebuffer->context;
|
||||
CoglPipeline *original_pipeline;
|
||||
@@ -654,18 +653,6 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
if (state.override_source)
|
||||
pipeline = state.override_source;
|
||||
|
||||
if (!disable_legacy_state)
|
||||
{
|
||||
if (G_UNLIKELY (ctx->legacy_state_set) &&
|
||||
_cogl_get_enable_legacy_state ())
|
||||
{
|
||||
/* If we haven't already made a pipeline copy */
|
||||
if (pipeline == original_pipeline)
|
||||
pipeline = cogl_pipeline_copy (pipeline);
|
||||
_cogl_pipeline_apply_legacy_state (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Emit geometry for each of the rectangles...
|
||||
*/
|
||||
@@ -720,134 +707,41 @@ _cogl_framebuffer_draw_multitextured_rectangles (
|
||||
cogl_object_unref (pipeline);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_rectangles_with_multitexture_coords (
|
||||
CoglMultiTexturedRect *rects,
|
||||
int n_rects)
|
||||
{
|
||||
_cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (),
|
||||
cogl_get_source (),
|
||||
rects,
|
||||
n_rects,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles (const float *verts,
|
||||
unsigned int n_rects)
|
||||
cogl_2d_primitives_immediate (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
const CoglVertexP2 *vertices,
|
||||
unsigned int n_vertices)
|
||||
{
|
||||
CoglMultiTexturedRect *rects;
|
||||
int i;
|
||||
CoglContext *ctx = framebuffer->context;
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
CoglAttribute *attributes[1];
|
||||
size_t vertices_size = sizeof (CoglVertexP2) * n_vertices;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
attribute_buffer =
|
||||
cogl_attribute_buffer_new (ctx, vertices_size, vertices);
|
||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||
"cogl_position_in",
|
||||
sizeof (CoglVertexP2), /* stride */
|
||||
0, /* offset */
|
||||
2, /* n_components */
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
|
||||
_cogl_framebuffer_draw_attributes (framebuffer,
|
||||
pipeline,
|
||||
mode,
|
||||
0, /* first_index */
|
||||
n_vertices,
|
||||
attributes,
|
||||
1,
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i].position = &verts[i * 4];
|
||||
rects[i].tex_coords = NULL;
|
||||
rects[i].tex_coords_len = 0;
|
||||
}
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangles_with_texture_coords (const float *verts,
|
||||
unsigned int n_rects)
|
||||
{
|
||||
CoglMultiTexturedRect *rects;
|
||||
int i;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect));
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
rects[i].position = &verts[i * 8];
|
||||
rects[i].tex_coords = &verts[i * 8 + 4];
|
||||
rects[i].tex_coords_len = 4;
|
||||
}
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (rects, n_rects);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangle_with_texture_coords (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
float tx_1,
|
||||
float ty_1,
|
||||
float tx_2,
|
||||
float ty_2)
|
||||
{
|
||||
const float position[4] = {x_1, y_1, x_2, y_2};
|
||||
const float tex_coords[4] = {tx_1, ty_1, tx_2, ty_2};
|
||||
CoglMultiTexturedRect rect;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rect.position = position;
|
||||
rect.tex_coords = tex_coords;
|
||||
rect.tex_coords_len = 4;
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (&rect, 1);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangle_with_multitexture_coords (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
const float *user_tex_coords,
|
||||
int user_tex_coords_len)
|
||||
{
|
||||
const float position[4] = {x_1, y_1, x_2, y_2};
|
||||
CoglMultiTexturedRect rect;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rect.position = position;
|
||||
rect.tex_coords = user_tex_coords;
|
||||
rect.tex_coords_len = user_tex_coords_len;
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (&rect, 1);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_rectangle (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2)
|
||||
{
|
||||
const float position[4] = {x_1, y_1, x_2, y_2};
|
||||
CoglMultiTexturedRect rect;
|
||||
|
||||
/* XXX: All the cogl_rectangle* APIs normalize their input into an array of
|
||||
* CoglMultiTexturedRect rectangles and pass these on to our work horse;
|
||||
* _cogl_rectangles_with_multitexture_coords.
|
||||
*/
|
||||
|
||||
rect.position = position;
|
||||
rect.tex_coords = NULL;
|
||||
rect.tex_coords_len = 0;
|
||||
|
||||
_cogl_rectangles_with_multitexture_coords (&rect, 1);
|
||||
cogl_object_unref (attributes[0]);
|
||||
cogl_object_unref (attribute_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -858,283 +752,17 @@ _cogl_rectangle_immediate (CoglFramebuffer *framebuffer,
|
||||
float x_2,
|
||||
float y_2)
|
||||
{
|
||||
/* Draw a rectangle using the vertex array API to avoid going
|
||||
through the journal. This should only be used in cases where the
|
||||
code might be called while the journal is already being flushed
|
||||
such as when flushing the clip state */
|
||||
CoglContext *ctx = framebuffer->context;
|
||||
float vertices[8] =
|
||||
CoglVertexP2 vertices[4] =
|
||||
{
|
||||
x_1, y_1,
|
||||
x_1, y_2,
|
||||
x_2, y_1,
|
||||
x_2, y_2
|
||||
{x_1, y_1},
|
||||
{x_1, y_2},
|
||||
{x_2, y_1},
|
||||
{x_2, y_2}
|
||||
};
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
CoglAttribute *attributes[1];
|
||||
|
||||
attribute_buffer =
|
||||
cogl_attribute_buffer_new (ctx, sizeof (vertices), vertices);
|
||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||
"cogl_position_in",
|
||||
sizeof (float) * 2, /* stride */
|
||||
0, /* offset */
|
||||
2, /* n_components */
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
_cogl_framebuffer_draw_attributes (framebuffer,
|
||||
pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||
0, /* first_index */
|
||||
4, /* n_vertices */
|
||||
attributes,
|
||||
1,
|
||||
COGL_DRAW_SKIP_JOURNAL_FLUSH |
|
||||
COGL_DRAW_SKIP_PIPELINE_VALIDATION |
|
||||
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
|
||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||
|
||||
|
||||
cogl_object_unref (attributes[0]);
|
||||
cogl_object_unref (attribute_buffer);
|
||||
}
|
||||
|
||||
typedef struct _AppendTexCoordsState
|
||||
{
|
||||
const CoglTextureVertex *vertices_in;
|
||||
int vertex;
|
||||
int layer;
|
||||
float *vertices_out;
|
||||
} AppendTexCoordsState;
|
||||
|
||||
static gboolean
|
||||
append_tex_coord_attributes_cb (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
void *user_data)
|
||||
{
|
||||
AppendTexCoordsState *state = user_data;
|
||||
CoglTexture *texture;
|
||||
float tx, ty;
|
||||
float *t;
|
||||
|
||||
tx = state->vertices_in[state->vertex].tx;
|
||||
ty = state->vertices_in[state->vertex].ty;
|
||||
|
||||
/* NULL textures will be handled in
|
||||
* _cogl_pipeline_flush_layers_gl_state but there is no need to worry
|
||||
* about scaling texture coordinates in this case */
|
||||
texture = cogl_pipeline_get_layer_texture (pipeline, layer_index);
|
||||
if (texture != NULL)
|
||||
_cogl_texture_transform_coords_to_gl (texture, &tx, &ty);
|
||||
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
t = state->vertices_out + 3 + 2 * state->layer;
|
||||
t[0] = tx;
|
||||
t[1] = ty;
|
||||
|
||||
state->layer++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct _ValidateState
|
||||
{
|
||||
CoglPipeline *original_pipeline;
|
||||
CoglPipeline *pipeline;
|
||||
} ValidateState;
|
||||
|
||||
static gboolean
|
||||
_cogl_polygon_validate_layer_cb (CoglPipeline *pipeline,
|
||||
int layer_index,
|
||||
void *user_data)
|
||||
{
|
||||
ValidateState *state = user_data;
|
||||
|
||||
/* By default COGL_PIPELINE_WRAP_MODE_AUTOMATIC becomes
|
||||
* GL_CLAMP_TO_EDGE but we want the polygon API to use GL_REPEAT to
|
||||
* maintain compatibility with previous releases
|
||||
*/
|
||||
|
||||
if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) ==
|
||||
COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
|
||||
{
|
||||
if (state->original_pipeline == state->pipeline)
|
||||
state->pipeline = cogl_pipeline_copy (pipeline);
|
||||
|
||||
cogl_pipeline_set_layer_wrap_mode_s (state->pipeline, layer_index,
|
||||
COGL_PIPELINE_WRAP_MODE_REPEAT);
|
||||
}
|
||||
|
||||
if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) ==
|
||||
COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
|
||||
{
|
||||
if (state->original_pipeline == state->pipeline)
|
||||
state->pipeline = cogl_pipeline_copy (pipeline);
|
||||
|
||||
cogl_pipeline_set_layer_wrap_mode_t (state->pipeline, layer_index,
|
||||
COGL_PIPELINE_WRAP_MODE_REPEAT);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_polygon (const CoglTextureVertex *vertices,
|
||||
unsigned int n_vertices,
|
||||
gboolean use_color)
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
ValidateState validate_state;
|
||||
int n_layers;
|
||||
int n_attributes;
|
||||
CoglAttribute **attributes;
|
||||
int i;
|
||||
unsigned int stride;
|
||||
size_t stride_bytes;
|
||||
CoglAttributeBuffer *attribute_buffer;
|
||||
float *v;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
pipeline = cogl_get_source ();
|
||||
|
||||
validate_state.original_pipeline = pipeline;
|
||||
validate_state.pipeline = pipeline;
|
||||
cogl_pipeline_foreach_layer (pipeline,
|
||||
_cogl_polygon_validate_layer_cb,
|
||||
&validate_state);
|
||||
pipeline = validate_state.pipeline;
|
||||
|
||||
n_layers = cogl_pipeline_get_n_layers (pipeline);
|
||||
|
||||
n_attributes = 1 + n_layers + (use_color ? 1 : 0);
|
||||
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
||||
|
||||
/* Our data is arranged like:
|
||||
* [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */
|
||||
stride = 3 + (2 * n_layers) + (use_color ? 1 : 0);
|
||||
stride_bytes = stride * sizeof (float);
|
||||
|
||||
/* Make sure there is enough space in the global vertex array. This
|
||||
* is used so we can render the polygon with a single call to OpenGL
|
||||
* but still support any number of vertices */
|
||||
g_array_set_size (ctx->polygon_vertices, n_vertices * stride);
|
||||
|
||||
attribute_buffer =
|
||||
cogl_attribute_buffer_new (ctx, n_vertices * stride_bytes, NULL);
|
||||
|
||||
attributes[0] = cogl_attribute_new (attribute_buffer,
|
||||
"cogl_position_in",
|
||||
stride_bytes,
|
||||
0,
|
||||
3,
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
for (i = 0; i < n_layers; i++)
|
||||
{
|
||||
static const char *names[] = {
|
||||
"cogl_tex_coord0_in",
|
||||
"cogl_tex_coord1_in",
|
||||
"cogl_tex_coord2_in",
|
||||
"cogl_tex_coord3_in",
|
||||
"cogl_tex_coord4_in",
|
||||
"cogl_tex_coord5_in",
|
||||
"cogl_tex_coord6_in",
|
||||
"cogl_tex_coord7_in"
|
||||
};
|
||||
char *allocated_name = NULL;
|
||||
const char *name;
|
||||
|
||||
if (i < 8)
|
||||
name = names[i];
|
||||
else
|
||||
name = allocated_name = g_strdup_printf ("cogl_tex_coord%d_in", i);
|
||||
|
||||
attributes[i + 1] = cogl_attribute_new (attribute_buffer,
|
||||
name,
|
||||
stride_bytes,
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
12 + 8 * i,
|
||||
2,
|
||||
COGL_ATTRIBUTE_TYPE_FLOAT);
|
||||
|
||||
g_free (allocated_name);
|
||||
}
|
||||
|
||||
if (use_color)
|
||||
{
|
||||
attributes[n_attributes - 1] =
|
||||
cogl_attribute_new (attribute_buffer,
|
||||
"cogl_color_in",
|
||||
stride_bytes,
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
12 + 8 * n_layers,
|
||||
4,
|
||||
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
/* Convert the vertices into an array of float vertex attributes */
|
||||
v = (float *)ctx->polygon_vertices->data;
|
||||
for (i = 0; i < n_vertices; i++)
|
||||
{
|
||||
AppendTexCoordsState append_tex_coords_state;
|
||||
uint8_t *c;
|
||||
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
v[0] = vertices[i].x;
|
||||
v[1] = vertices[i].y;
|
||||
v[2] = vertices[i].z;
|
||||
|
||||
append_tex_coords_state.vertices_in = vertices;
|
||||
append_tex_coords_state.vertex = i;
|
||||
append_tex_coords_state.layer = 0;
|
||||
append_tex_coords_state.vertices_out = v;
|
||||
cogl_pipeline_foreach_layer (pipeline,
|
||||
append_tex_coord_attributes_cb,
|
||||
&append_tex_coords_state);
|
||||
|
||||
if (use_color)
|
||||
{
|
||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||
c = (uint8_t *) (v + 3 + 2 * n_layers);
|
||||
c[0] = cogl_color_get_red_byte (&vertices[i].color);
|
||||
c[1] = cogl_color_get_green_byte (&vertices[i].color);
|
||||
c[2] = cogl_color_get_blue_byte (&vertices[i].color);
|
||||
c[3] = cogl_color_get_alpha_byte (&vertices[i].color);
|
||||
}
|
||||
|
||||
v += stride;
|
||||
}
|
||||
|
||||
v = (float *)ctx->polygon_vertices->data;
|
||||
cogl_buffer_set_data (COGL_BUFFER (attribute_buffer),
|
||||
0,
|
||||
v,
|
||||
ctx->polygon_vertices->len * sizeof (float));
|
||||
|
||||
/* XXX: although this may seem redundant, we need to do this since
|
||||
* cogl_polygon() can be used with legacy state and its the source stack
|
||||
* which track whether legacy state is enabled.
|
||||
*
|
||||
* (We only have a CoglDrawFlag to disable legacy state not one
|
||||
* to enable it) */
|
||||
cogl_push_source (pipeline);
|
||||
|
||||
_cogl_framebuffer_draw_attributes (cogl_get_draw_framebuffer (),
|
||||
pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLE_FAN,
|
||||
0, n_vertices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
0 /* no draw flags */);
|
||||
|
||||
cogl_pop_source ();
|
||||
|
||||
if (pipeline != validate_state.original_pipeline)
|
||||
cogl_object_unref (pipeline);
|
||||
|
||||
cogl_object_unref (attribute_buffer);
|
||||
|
||||
for (i = 0; i < n_attributes; i++)
|
||||
cogl_object_unref (attributes[i]);
|
||||
cogl_2d_primitives_immediate (framebuffer,
|
||||
pipeline,
|
||||
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||
vertices,
|
||||
4);
|
||||
}
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COGL_PRIMITIVES_H
|
||||
#define __COGL_PRIMITIVES_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* SECTION:cogl-primitives
|
||||
* @short_description: Functions that draw various primitive 3D shapes
|
||||
*
|
||||
* The primitives API provides utilities for drawing some
|
||||
* common 3D shapes in a more convenient way than the CoglVertexBuffer
|
||||
* API provides.
|
||||
*/
|
||||
|
||||
/**
|
||||
* cogl_rectangle:
|
||||
* @x_1: X coordinate of the top-left corner
|
||||
* @y_1: Y coordinate of the top-left corner
|
||||
* @x_2: X coordinate of the bottom-right corner
|
||||
* @y_2: Y coordinate of the bottom-right corner
|
||||
*
|
||||
* Fills a rectangle at the given coordinates with the current source material
|
||||
**/
|
||||
void
|
||||
cogl_rectangle (float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
/**
|
||||
* cogl_rectangle_with_texture_coords:
|
||||
* @x1: x coordinate upper left on screen.
|
||||
* @y1: y coordinate upper left on screen.
|
||||
* @x2: x coordinate lower right on screen.
|
||||
* @y2: y coordinate lower right on screen.
|
||||
* @tx1: x part of texture coordinate to use for upper left pixel
|
||||
* @ty1: y part of texture coordinate to use for upper left pixel
|
||||
* @tx2: x part of texture coordinate to use for lower right pixel
|
||||
* @ty2: y part of texture coordinate to use for left pixel
|
||||
*
|
||||
* Draw a rectangle using the current material and supply texture coordinates
|
||||
* to be used for the first texture layer of the material. To draw the entire
|
||||
* texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_rectangle_with_texture_coords (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2,
|
||||
float tx1,
|
||||
float ty1,
|
||||
float tx2,
|
||||
float ty2);
|
||||
|
||||
/**
|
||||
* cogl_rectangle_with_multitexture_coords:
|
||||
* @x1: x coordinate upper left on screen.
|
||||
* @y1: y coordinate upper left on screen.
|
||||
* @x2: x coordinate lower right on screen.
|
||||
* @y2: y coordinate lower right on screen.
|
||||
* @tex_coords: (in) (array) (transfer none): An array containing groups of
|
||||
* 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture
|
||||
* coordinates; one for the upper left texel, and one for the lower right
|
||||
* texel. Each value should be between 0.0 and 1.0, where the coordinate
|
||||
* (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the
|
||||
* bottom right.
|
||||
* @tex_coords_len: The length of the tex_coords array. (e.g. for one layer
|
||||
* and one group of texture coordinates, this would be 4)
|
||||
*
|
||||
* This function draws a rectangle using the current source material to
|
||||
* texture or fill with. As a material may contain multiple texture layers
|
||||
* this interface lets you supply texture coordinates for each layer of the
|
||||
* material.
|
||||
*
|
||||
* The first pair of coordinates are for the first layer (with the smallest
|
||||
* layer index) and if you supply less texture coordinates than there are
|
||||
* layers in the current source material then default texture coordinates
|
||||
* (0.0, 0.0, 1.0, 1.0) are generated.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_rectangle_with_multitexture_coords (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2,
|
||||
const float *tex_coords,
|
||||
int tex_coords_len);
|
||||
|
||||
/**
|
||||
* cogl_rectangles_with_texture_coords:
|
||||
* @verts: (in) (array) (transfer none): an array of vertices
|
||||
* @n_rects: number of rectangles to draw
|
||||
*
|
||||
* Draws a series of rectangles in the same way that
|
||||
* cogl_rectangle_with_texture_coords() does. In some situations it can give a
|
||||
* significant performance boost to use this function rather than
|
||||
* calling cogl_rectangle_with_texture_coords() separately for each rectangle.
|
||||
*
|
||||
* @verts should point to an array of #float<!-- -->s with
|
||||
* @n_rects * 8 elements. Each group of 8 values corresponds to the
|
||||
* parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
|
||||
* meaning as in cogl_rectangle_with_texture_coords().
|
||||
*
|
||||
* Since: 0.8.6
|
||||
*/
|
||||
void
|
||||
cogl_rectangles_with_texture_coords (const float *verts,
|
||||
unsigned int n_rects);
|
||||
|
||||
/**
|
||||
* cogl_rectangles:
|
||||
* @verts: (in) (array) (transfer none): an array of vertices
|
||||
* @n_rects: number of rectangles to draw
|
||||
*
|
||||
* Draws a series of rectangles in the same way that
|
||||
* cogl_rectangle() does. In some situations it can give a
|
||||
* significant performance boost to use this function rather than
|
||||
* calling cogl_rectangle() separately for each rectangle.
|
||||
*
|
||||
* @verts should point to an array of #float<!-- -->s with
|
||||
* @n_rects * 4 elements. Each group of 4 values corresponds to the
|
||||
* parameters x1, y1, x2, and y2, and have the same
|
||||
* meaning as in cogl_rectangle().
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_rectangles (const float *verts,
|
||||
unsigned int n_rects);
|
||||
|
||||
/**
|
||||
* cogl_polygon:
|
||||
* @vertices: An array of #CoglTextureVertex structs
|
||||
* @n_vertices: The length of the vertices array
|
||||
* @use_color: %TRUE if the color member of #CoglTextureVertex should be used
|
||||
*
|
||||
* Draws a convex polygon using the current source material to fill / texture
|
||||
* with according to the texture coordinates passed.
|
||||
*
|
||||
* If @use_color is %TRUE then the color will be changed for each vertex using
|
||||
* the value specified in the color member of #CoglTextureVertex. This can be
|
||||
* used for example to make the texture fade out by setting the alpha value of
|
||||
* the color.
|
||||
*
|
||||
* All of the texture coordinates must be in the range [0,1] and repeating the
|
||||
* texture is not supported.
|
||||
*
|
||||
* Because of the way this function is implemented it will currently
|
||||
* only work if either the texture is not sliced or the backend is not
|
||||
* OpenGL ES and the minifying and magnifying functions are both set
|
||||
* to COGL_MATERIAL_FILTER_NEAREST.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
cogl_polygon (const CoglTextureVertex *vertices,
|
||||
unsigned int n_vertices,
|
||||
gboolean use_color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PRIMITIVES_H */
|
||||
@@ -50,10 +50,8 @@ typedef enum
|
||||
COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE,
|
||||
COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS,
|
||||
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,
|
||||
COGL_PRIVATE_FEATURE_ALPHA_TEST,
|
||||
COGL_PRIVATE_FEATURE_FORMAT_CONVERSION,
|
||||
COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
|
||||
COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM,
|
||||
COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS,
|
||||
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES,
|
||||
COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE,
|
||||
@@ -63,15 +61,10 @@ typedef enum
|
||||
* events. Otherwise a dirty event will be queued when the onscreen
|
||||
* is first allocated or when it is shown or resized */
|
||||
COGL_PRIVATE_FEATURE_DIRTY_EVENTS,
|
||||
COGL_PRIVATE_FEATURE_ENABLE_PROGRAM_POINT_SIZE,
|
||||
/* These features let us avoid conditioning code based on the exact
|
||||
* driver being used and instead check for broad opengl feature
|
||||
* sets that can be shared by several GL apis */
|
||||
/* This feature allows for explicitly selecting a GL-based backend,
|
||||
* as opposed to nop or (in the future) Vulkan.
|
||||
*/
|
||||
COGL_PRIVATE_FEATURE_ANY_GL,
|
||||
COGL_PRIVATE_FEATURE_GL_FIXED,
|
||||
COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE,
|
||||
COGL_PRIVATE_FEATURE_GL_EMBEDDED,
|
||||
COGL_PRIVATE_FEATURE_GL_WEB,
|
||||
|
||||
COGL_N_PRIVATE_FEATURES
|
||||
} CoglPrivateFeature;
|
||||
@@ -94,18 +87,9 @@ _cogl_transform_point (const CoglMatrix *matrix_mv,
|
||||
gboolean
|
||||
_cogl_check_extension (const char *name, char * const *ext);
|
||||
|
||||
void
|
||||
_cogl_clear (const CoglColor *color, unsigned long buffers);
|
||||
|
||||
void
|
||||
_cogl_init (void);
|
||||
|
||||
void
|
||||
_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy);
|
||||
|
||||
gboolean
|
||||
_cogl_get_enable_legacy_state (void);
|
||||
|
||||
#define _cogl_has_private_feature(ctx, feature) \
|
||||
COGL_FLAGS_GET ((ctx)->private_features, (feature))
|
||||
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
#include "cogl-closure-list-private.h"
|
||||
#include "winsys/cogl-winsys-private.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
typedef const CoglWinsysVtable *(*CoglCustomWinsysVtableGetter) (CoglRenderer *renderer);
|
||||
|
||||
struct _CoglRenderer
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user