Compare commits

..

26 Commits

Author SHA1 Message Date
Carlos Garnacho
1c31fe8e65 backends: Move warp_pointer() to ClutterSeat
The onscreen pointer sprite is a per-seat element, so it makes sense
to move pointer warping over there too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
819ea8c0a6 backends: Set pointer constrain/relative motion hooks before backend init
The backend being initialized triggers a pointer warp (and motion event)
where we want to observe the callbacks put in place. So ensure we set
up the hooks before that could happen.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
f0241114f6 backends: Use latest pointer position if no pointer constrain exists
The meta_seat_native_constrain_pointer() function receives the current
pointer position, and the new pointer position as in/out parameters.
We were however calculating the new coordinates based on the last pointer
position if there was no pointer constrain in place.

Fortunately to us, this didn't use to happen often/ever, as a pointer
constrain function is set on MetaBackend initialization. This behavior
did also exist previously in MetaDeviceManagerNative.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
987cd7e821 backends: Drop get_relative_motion_deltas() vfunc
Just go ATM through backend checks, and looking up directly the
native event data, pretty much like the rest of the places do that...
Eventually would be nice to have this information in ClutterEvent,
but let's not have it clutter the MetaBackend class.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
a4a7f9a660 backends: Do not use device IDs on idle monitors
Device IDs are somewhat x11 specific, seems better to avoid those
on public API. We can rely everywhere on ClutterInputDevice, so use
it instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
993b0b2758 clutter: Drop ClutterDeviceManager
This is mostly replaced by ClutterSeat, which offers a per-seat instead
of a global device abstraction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
9bddda584b tests: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
81b0802eab backends: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
5de6d032d6 clutter: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:26:24 +01:00
Carlos Garnacho
a4d39bdabc backends: Make meta_backend_update_last_device() take a clutter device
Instead of a pretty x11 specific device ID. This also updates the argument
of the ::last-device-changed signal to be a ClutterInputDevice.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
4e12be36d1 backends: Move native keymap manipulation functions to MetaSeatNative
Since the ClutterKeymap is obtained through the ClutterSeat, it makes
sense to have these manipulation functions in the ClutterSeat impl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
1c70f6894f core: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
ef2acde122 wayland: Replace ClutterDeviceManager usage in favor of ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
a8c6fab3b8 clutter: Drop select_stage_events() device manager vfunc
This is specific to X11, so handle it within the X11 backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
b8c8b59dc8 clutter: Move motion compression handling to ClutterSeat
Another responsibility taken away from ClutterDeviceManager

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
efe698f6e1 clutter: Move virtual device management to ClutterSeat
A11y in general may be considered a per-seat feature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
75ad578a7d clutter: Move pointer a11y from ClutterDeviceManager to ClutterSeat
A11y in general may be considered a per-seat feature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
77d0ec12b1 clutter: Move keyboard a11y from ClutterDeviceManager to ClutterSeat
A11y in general may be considered a per-seat feature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
11f3db6693 clutter: Move platform event data management to ClutterSeat
https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
c5b89d9a86 clutter: Move keymap from ClutterBackend to ClutterSeat
Keymaps are a per-seat feature, so move it there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
ed4c96c751 clutter: Move bell_notify() from ClutterBackend to ClutterSeat
Bells can be considered to be a per-seat feature, so move it there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
2001bdd863 clutter: Move keymap direction from ClutterBackend to ClutterKeymap
This makes more sense to have in the ClutterKeymap, since we have it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
9577475453 native: Implement ClutterSeat
We had the MetaSeatNative struct around, so use it as the base of
this Clutter object. A few responsibilities were drawn from
ClutterDeviceManager.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
ea099a871c x11: Implement ClutterSeat
The ClutterDeviceManager signaling becomes implemented on top of this.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
454e104d6f clutter: Add ClutterSeat object
This object will take most responsibilities away from ClutterDeviceManager,
with the peculiarity that it'll express the per-seat device tree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
Carlos Garnacho
127df62a02 x11: Drop subscription for input event from floating devices
This is unlikely to happen, and unlikely to be right (eg. we don't translate
input event coordinates, since those are not in display coordinate space, we
don't offer any feedback for those either).

This can simply be dropped, we listen to XIAllMasterDevices, which suffices
for what we want to do.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/852
2019-11-22 22:24:07 +01:00
601 changed files with 25169 additions and 22927 deletions

View File

@@ -28,20 +28,6 @@ build-mutter:
- merge_requests - merge_requests
- /^.*$/ - /^.*$/
build-without-opengl-and-glx:
stage: build
script:
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build
only:
- merge_requests
- /^.*$/
build-without-native-backend-and-wayland: build-without-native-backend-and-wayland:
stage: build stage: build
script: script:

View File

@@ -1,8 +1,8 @@
# Rebuild and push with # Rebuild and push with
# #
# cd .gitlab-ci/ # cd .gitlab-ci/
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 . # docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3 # docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
# #
FROM fedora:31 FROM fedora:31
@@ -11,7 +11,6 @@ RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \ dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \ dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y fmuellner/gnome-shell-ci && \ dnf copr enable -y fmuellner/gnome-shell-ci && \
dnf copr enable -y jadahl/mutter-ci && \
dnf -y update && dnf -y upgrade && \ dnf -y update && dnf -y upgrade && \
dnf builddep -y mutter && \ dnf builddep -y mutter && \
@@ -27,6 +26,4 @@ RUN dnf -y update && dnf -y upgrade && \
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \ dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
dnf remove -y --noautoremove mutter mutter-devel && \ dnf remove -y --noautoremove mutter mutter-devel && \
dnf upgrade -y 'pkgconfig(libpipewire-0.3)' && \
dnf clean all dnf clean all

View File

@@ -19,7 +19,7 @@ fi
function commit_message_has_url() { function commit_message_has_url() {
commit=$1 commit=$1
commit_message=$(git show -s --format='format:%b' $commit) commit_message=$(git show -s --format='format:%b' $commit)
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(-/\)\?\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)" echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
return $? return $?
} }

View File

@@ -1,55 +0,0 @@
<!--
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"

View File

@@ -1,30 +0,0 @@
<!--
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"

273
NEWS
View File

@@ -1,276 +1,3 @@
3.36.4
======
* Fix crash on area screenshots with fractional scaling [Sebastian; !1320]
* Do not paint textures of fully obscured windows [Robert; !1326]
* Turn off CRTCs as well when enabling DPMS [Michel; !1240]
* Improve selection support
[Robert, Carlos, Sebastian; !1330, !1193, !1253, !1255, !1293, !1350]
* Use a more appropriate combine function on opaque areas [Daniel; !1331]
* Fix remote desktop being broken without screencast session [Olivier; #1307]
* Fix popovers disappearing on wayland and HiDPI [Robert; #1312]
* Fixed crashes [Jonas Å.; !1317]
* Plugged memory leaks [Jonas Å.; !1283]
* Misc. bug fixes and cleanups
[Corentin, Sebastian, Jonas Å., Jonas D.; !1314, !1321, !1295, !1333]
Contributors:
Jonas Dreßler, Michel Dänzer, Olivier Fourdan, Carlos Garnacho,
Sebastian Keller, Robert Mader, Corentin Noël, Daniel van Vugt, Jonas Ådahl
3.36.3
======
* Broadcast clipboard/primary offers [Carlos; !1262]
* Fix monitor screen cast on X11 [Jonas Å.; !1251]
* Implement touch-mode detecation for the X11 backend [Carlos; !1278]
* Drop external keyboard detection from touch-mode heuristics [Carlos; !1277]
* Fix leaked DMA buffers in screencasts [Jonas; !1283]
* Fixed crashes [Daniel, Carlos, Jonas D.; !1256, !1258, !1280]
Contributors:
Carlos Garnacho, Daniel van Vugt, Jonas Ådahl
3.36.2
======
* Sync timelines to hardware vsync [Daniel; !724]
* Fix screencasting non-maximized windows [Jonas; !1174]
* Make window-aliveness checks less aggressive [Jonas; !1182]
* Fix stylus coordinates when using screen rotation [Jonas T.; #1118]
* Preserve keyboard state on VT switch [Olivier; !1185]
* Fix trackball button scrolling [Phillip; #1120]
* Fix tiled monitor support [Jonas Å.; !1199]
* Fix various clipboard issues [Carlos; !1198, !1203, !1204, !1186, !1206]
* Synchronize shadows to server-side decorations [Olivier; !1214]
* Fix overview key on X11 when using multiple keyboard layouts [Olivier; !1219]
* Fix capturing with multiple stage views [Jonas Å.; !1222]
* Fixed crashes [Jonas D., Carlos; !1173, !1183]
* Misc. bug fixes and cleanups [Andre, Georges, Simon, Christian, Carlos, Marco,
Pekka, Laurent, Jonas D.; !1169, !1170, !1172, !1168, !1184, !1200, !1209,
#1074, !1208]
Contributors:
Marco Trevisan (Treviño), Laurent Bigonville, Jonas Dreßler, Olivier Fourdan,
Carlos Garnacho, Andre Moreira Magalhaes, Simon McVittie,
Georges Basile Stavracas Neto, Pekka Paalanen, Christian Rauch, Jonas Troeger,
Daniel van Vugt, Phillip Wood, Jonas Ådahl
Translators:
Dušan Kazik [sk], Christian Kirbach [de]
3.36.1
======
* Fix hardware cursor on GPU hotplpug [Pekka; !1097]
* Fix black areas around XWayland windows when resizing [Robert, Olivier; !1091]
* Fix applying wrong scale to monitors on X11 [Jonas; !1118]
* Fix moving/resizing windows via keyboard on wayland [Alynx; !997]
* Fix locate-pointer feature interfering with keybindings [Carlos; !1014]
* Add support for middle-click emulation [Andrew; !256]
* Fix freeze when moving cursor between scaled monitors [Robert; !1125]
* Fix popup misplacement with focus-follows-mouse [Jonas Å.; !1122]
* Fix misplaced cursor in preedit strings [Carlos; !1132]
* Support mirroring with proprietary Nvidia driver [Jonas Å.; !1098]
* Support tablets with multiple mode switch buttons in a group [Carlos; !970]
* Ignore foreground color for color glyphs (emojis) [Carlos; !1148]
* Allow pad mode switches while showing OSD [Carlos; !975]
* Fix positioning of OSD for display-attached tablets [Carlos; !971]
* Respect configured RANDR panning on X11 [Jonas Å.; !1085]
* Use correct texture filtering with scaled displays [Jonas; !1124]
* Fix cursor hotspots in virtual machines [Jonas Å.; !1136]
* Fix build with GLES and no GL [Georges; !1151]
* Work around Firefox bug when copying images on wayland [Robert; !1141]
* Fix wrong cursor rotation on rotated displays [Hans; !1153]
* Fix glitches in window screencasts [Georges; !1129]
* Fix IM support for deleting surrounding text [Takao, Carlos; #539]
* Fix map animation of maximized windows [Robert; !1164]
* Fixed crashes [Jonas Å., Carlos, Florian, Robert; !1120, !1121,
#917, #1132, #1083, !1147, #1147]
* Misc. bug fixes and cleanups [Jonas Å., Olivier, Mart, Sebastian, Corentin,
Andre, Daniel, Robert, Carlos, Peter, Georges, Jonas D., Florian, Christian;
!1115, !1102, !1104, !1106, !1117, !1119, !1101, !1123, #1124, !1130, !1131,
!1133, #1065, !1108, !1144, !1145, !1109, !1059, !1107, !999, !1152, #1128,
!1155, !1156, !1158, !1157, #1146, !1161, !1163]
Contributors:
Jonas Dreßler, Olivier Fourdan, Takao Fujiwara, Carlos Garnacho, Andrew Gaul,
Hans de Goede, Peter Hutterer, Sebastian Keller, Robert Mader,
Andre Moreira Magalhaes, Florian Müllner, Georges Basile Stavracas Neto,
Corentin Noël, Pekka Paalanen, Christian Rauch, Mart Raudsepp,
Daniel van Vugt, Alynx Zhou, Jonas Ådahl
Translators:
Марко Костић [sr], Daniel Șerbănescu [ro]
3.36.0
======
* Fix placement of popup windows in multi-monitor setups [Jonas; !1110]
* Fix invisible mouse cursor on some hardware [Jonas; !1079]
Contributors:
Jonas Ådahl
Translators:
Aurimas Černius [lt], Goran Vidović [hr], Anders Jonsson [sv],
Guillaume Bernard [fr], Milo Casagrande [it], Daniel Korostil [uk],
Andre Klapper [cy], Aman Alam [pa], Nathan Follens [nl]
3.35.92
=======
* Fix visibility of initially hidden windows [Jonas Å.; !1066]
* Avoid flicker when (un)redirecting windows [Sebastian; #997]
* Let BindConstraints update the preferred size [Emmanuele; !1070]
* Learn about GLES3 [Adam; !882]
* Ping windows on every window focus [Jonas D.; !891]
* Remove overhead from hot code paths [Christian;
#1056, !1081, !1083, !1071, !1087]
* Allow remote desktop services to inhibit animations [Jonas Å.; !838]
* Update screen-cast code to PipeWire 0.3 API [Wim; !1062]
* Make check-alive timeouts configurable [Jonas Å.; !1080]
* Make each stage view correspond to a single CRTC [Jonas Å.; !1042]
* Implement scaled/transformed hardware cursors [Robert; !526]
* Use DMA buffers for screencasting if possible [Georges; !1086]
* Make Xwayland startup asynchronous [Carlos; !944]
* Fix clipping glitches in long text entries [Jonas D.; !1096]
* Add side channel for starting required X11 services [Carlos; !945]
* Support synchronized wayland popup moving [Jonas Å.; !705]
* Fixed crashes [Olivier, Jonas Å.; !1073, !1093]
* Plugged memory leaks [Sebastian, Jonas Å.; !1089, !1095]
* Misc. bug fixes and cleanups [Jonas Å, Olivier, Florian, Daniel, Jonas D.,
Robert, Sebastian, Christian, Arun, Carlos, worldofpeace; !1061, #1043,
!1067, !1068, !1065, !835, !1058, !1069, !1075, #1060, !1077, !423, !1090,
!1088, !1094, #1067, !1064, !1099, !957, !1000, !1082]
Contributors:
Emmanuele Bassi, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
Christian Hergert, Adam Jackson, Sebastian Keller, Robert Mader,
Florian Müllner, Georges Basile Stavracas Neto, Arun Raghavan, Wim Taymans,
Daniel van Vugt, worldofpeace, Jonas Ådahl
Translators:
Yi-Jyun Pan [zh_TW], Asier Sarasua Garmendia [eu], Rafael Fontenelle [pt_BR],
Emin Tufan Çetin [tr], Daniel Mustieles [es], Balázs Úr [hu],
Gwan-gyeong Mun [ko], Marek Černocký [cs], Fran Dieguez [gl],
Kukuh Syafaat [id], Alan Mortensen [da], Piotr Drąg [pl], sicklylife [ja],
Matej Urbančič [sl]
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 3.35.1
====== ======
* Fix immediate screen blank after releaseing inhibitor [Tim; #573] * Fix immediate screen blank after releaseing inhibitor [Tim; #573]

View File

@@ -600,11 +600,10 @@ cally_actor_real_remove_actor (ClutterActor *container,
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0); g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
atk_parent = ATK_OBJECT (data); atk_parent = ATK_OBJECT (data);
atk_child = clutter_actor_get_accessible (actor);
if (clutter_actor_has_accessible (actor)) if (atk_child)
{ {
atk_child = clutter_actor_get_accessible (actor);
g_value_init (&values.old_value, G_TYPE_POINTER); g_value_init (&values.old_value, G_TYPE_POINTER);
g_value_set_pointer (&values.old_value, atk_parent); g_value_set_pointer (&values.old_value, atk_parent);

View File

@@ -315,6 +315,7 @@ void _clutter_actor_queue_relayout_on_clones
void _clutter_actor_queue_only_relayout (ClutterActor *actor); void _clutter_actor_queue_only_relayout (ClutterActor *actor);
void _clutter_actor_queue_update_resource_scale_recursive (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, gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
float *resource_scale); float *resource_scale);

View File

@@ -631,7 +631,7 @@
#include "clutter-color-static.h" #include "clutter-color-static.h"
#include "clutter-color.h" #include "clutter-color.h"
#include "clutter-constraint-private.h" #include "clutter-constraint-private.h"
#include "clutter-container-private.h" #include "clutter-container.h"
#include "clutter-content-private.h" #include "clutter-content-private.h"
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-easing.h" #include "clutter-easing.h"
@@ -643,7 +643,6 @@
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-marshal.h" #include "clutter-marshal.h"
#include "clutter-mutter.h" #include "clutter-mutter.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h" #include "clutter-paint-nodes.h"
#include "clutter-paint-node-private.h" #include "clutter-paint-node-private.h"
#include "clutter-paint-volume-private.h" #include "clutter-paint-volume-private.h"
@@ -710,7 +709,6 @@ struct _ClutterActorPrivate
guint8 opacity; guint8 opacity;
gint opacity_override; gint opacity_override;
unsigned int inhibit_culling_counter;
ClutterOffscreenRedirect offscreen_redirect; ClutterOffscreenRedirect offscreen_redirect;
@@ -1125,20 +1123,6 @@ static GQuark quark_actor_layout_info = 0;
static GQuark quark_actor_transform_info = 0; static GQuark quark_actor_transform_info = 0;
static GQuark quark_actor_animation_info = 0; static GQuark quark_actor_animation_info = 0;
static GQuark quark_key = 0;
static GQuark quark_motion = 0;
static GQuark quark_pointer_focus = 0;
static GQuark quark_button = 0;
static GQuark quark_scroll = 0;
static GQuark quark_stage = 0;
static GQuark quark_destroy = 0;
static GQuark quark_client = 0;
static GQuark quark_delete = 0;
static GQuark quark_touch = 0;
static GQuark quark_touchpad = 0;
static GQuark quark_proximity = 0;
static GQuark quark_pad = 0;
G_DEFINE_TYPE_WITH_CODE (ClutterActor, G_DEFINE_TYPE_WITH_CODE (ClutterActor,
clutter_actor, clutter_actor,
G_TYPE_INITIALLY_UNOWNED, G_TYPE_INITIALLY_UNOWNED,
@@ -1302,12 +1286,10 @@ clutter_actor_verify_map_state (ClutterActor *self)
static gboolean static gboolean
_clutter_actor_transform_local_box_to_stage (ClutterActor *self, _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
ClutterStage *stage, ClutterStage *stage,
ClutterPickContext *pick_context,
const ClutterActorBox *box, const ClutterActorBox *box,
graphene_point_t vertices[4]) graphene_point_t vertices[4])
{ {
CoglFramebuffer *fb = CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
clutter_pick_context_get_framebuffer (pick_context);
CoglMatrix stage_transform, inv_stage_transform; CoglMatrix stage_transform, inv_stage_transform;
CoglMatrix modelview, transform_to_stage; CoglMatrix modelview, transform_to_stage;
int v; int v;
@@ -1348,7 +1330,6 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
/** /**
* clutter_actor_pick_box: * clutter_actor_pick_box:
* @self: The #ClutterActor being "pick" painted. * @self: The #ClutterActor being "pick" painted.
* @pick_context: The #ClutterPickContext
* @box: A rectangle in the actor's own local coordinates. * @box: A rectangle in the actor's own local coordinates.
* *
* Logs (does a virtual paint of) a rectangle for picking. Note that @box is * Logs (does a virtual paint of) a rectangle for picking. Note that @box is
@@ -1359,7 +1340,6 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
*/ */
void void
clutter_actor_pick_box (ClutterActor *self, clutter_actor_pick_box (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *box) const ClutterActorBox *box)
{ {
ClutterStage *stage; ClutterStage *stage;
@@ -1373,14 +1353,12 @@ clutter_actor_pick_box (ClutterActor *self,
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
if (_clutter_actor_transform_local_box_to_stage (self, stage, pick_context, if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices))
box, vertices))
clutter_stage_log_pick (stage, vertices, self); clutter_stage_log_pick (stage, vertices, self);
} }
static gboolean static gboolean
_clutter_actor_push_pick_clip (ClutterActor *self, _clutter_actor_push_pick_clip (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *clip) const ClutterActorBox *clip)
{ {
ClutterStage *stage; ClutterStage *stage;
@@ -1388,8 +1366,7 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
if (!_clutter_actor_transform_local_box_to_stage (self, stage, pick_context, if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices))
clip, vertices))
return FALSE; return FALSE;
clutter_stage_push_pick_clip (stage, vertices); clutter_stage_push_pick_clip (stage, vertices);
@@ -1793,15 +1770,6 @@ clutter_actor_unmap (ClutterActor *self)
clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNMAPPED); 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 static void
clutter_actor_real_show (ClutterActor *self) clutter_actor_real_show (ClutterActor *self)
{ {
@@ -1835,11 +1803,6 @@ clutter_actor_real_show (ClutterActor *self)
clutter_actor_queue_relayout (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 static inline void
@@ -2358,8 +2321,7 @@ _clutter_actor_rerealize (ClutterActor *self,
} }
static void static void
clutter_actor_real_pick (ClutterActor *self, clutter_actor_real_pick (ClutterActor *self)
ClutterPickContext *pick_context)
{ {
if (clutter_actor_should_pick_paint (self)) if (clutter_actor_should_pick_paint (self))
{ {
@@ -2370,7 +2332,7 @@ clutter_actor_real_pick (ClutterActor *self,
.y2 = clutter_actor_get_height (self), .y2 = clutter_actor_get_height (self),
}; };
clutter_actor_pick_box (self, pick_context, &box); clutter_actor_pick_box (self, &box);
} }
/* XXX - this thoroughly sucks, but we need to maintain compatibility /* XXX - this thoroughly sucks, but we need to maintain compatibility
@@ -2387,7 +2349,7 @@ clutter_actor_real_pick (ClutterActor *self,
for (iter = self->priv->first_child; for (iter = self->priv->first_child;
iter != NULL; iter != NULL;
iter = iter->priv->next_sibling) iter = iter->priv->next_sibling)
clutter_actor_pick (iter, pick_context); clutter_actor_pick (iter);
} }
} }
@@ -2410,7 +2372,6 @@ clutter_actor_should_pick_paint (ClutterActor *self)
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
if (CLUTTER_ACTOR_IS_MAPPED (self) && if (CLUTTER_ACTOR_IS_MAPPED (self) &&
clutter_actor_has_allocation (self) &&
(_clutter_context_get_pick_mode () == CLUTTER_PICK_ALL || (_clutter_context_get_pick_mode () == CLUTTER_PICK_ALL ||
CLUTTER_ACTOR_IS_REACTIVE (self))) CLUTTER_ACTOR_IS_REACTIVE (self)))
return TRUE; return TRUE;
@@ -2604,9 +2565,6 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
gboolean retval; gboolean retval;
ClutterActorBox old_alloc = { 0, }; ClutterActorBox old_alloc = { 0, };
g_return_val_if_fail (!isnan (box->x1) && !isnan (box->x2) &&
!isnan (box->y1) && !isnan (box->y2), FALSE);
obj = G_OBJECT (self); obj = G_OBJECT (self);
g_object_freeze_notify (obj); g_object_freeze_notify (obj);
@@ -2897,23 +2855,9 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
memset (priv->height_requests, 0, memset (priv->height_requests, 0,
N_CACHED_SIZE_REQUESTS * sizeof (SizeRequest)); N_CACHED_SIZE_REQUESTS * sizeof (SizeRequest));
/* We may need to go all the way up the hierarchy */ /* We need to go all the way up the hierarchy */
if (priv->parent != NULL) 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);
}
}
} }
/** /**
@@ -3493,8 +3437,8 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
cogl_pipeline_set_color (outline, &cogl_color); cogl_pipeline_set_color (outline, &cogl_color);
pipeline_node = clutter_pipeline_node_new (outline); pipeline_node = clutter_pipeline_node_new (outline);
clutter_paint_node_set_static_name (pipeline_node, clutter_paint_node_set_name (pipeline_node,
"ClutterActor (paint volume outline)"); "ClutterActor (paint volume outline)");
clutter_paint_node_add_primitive (pipeline_node, prim); clutter_paint_node_add_primitive (pipeline_node, prim);
clutter_paint_node_add_child (node, pipeline_node); clutter_paint_node_add_child (node, pipeline_node);
cogl_object_unref (prim); cogl_object_unref (prim);
@@ -3508,8 +3452,8 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
pango_layout_set_text (layout, label, -1); pango_layout_set_text (layout, label, -1);
text_node = clutter_text_node_new (layout, color); text_node = clutter_text_node_new (layout, color);
clutter_paint_node_set_static_name (text_node, clutter_paint_node_set_name (text_node,
"ClutterActor (paint volume label)"); "ClutterActor (paint volume label)");
clutter_paint_node_add_rectangle (text_node, clutter_paint_node_add_rectangle (text_node,
&(ClutterActorBox) { &(ClutterActorBox) {
.x1 = pv->vertices[0].x, .x1 = pv->vertices[0].x,
@@ -3605,8 +3549,8 @@ _clutter_actor_paint_cull_result (ClutterActor *self,
pango_layout_set_text (layout, label, -1); pango_layout_set_text (layout, label, -1);
text_node = clutter_text_node_new (layout, &color); text_node = clutter_text_node_new (layout, &color);
clutter_paint_node_set_static_name (text_node, clutter_paint_node_set_name (text_node,
"ClutterActor (paint volume text)"); "ClutterActor (paint volume text)");
clutter_paint_node_add_rectangle (text_node, clutter_paint_node_add_rectangle (text_node,
&(ClutterActorBox) { &(ClutterActorBox) {
.x1 = 0.f, .x1 = 0.f,
@@ -3647,9 +3591,8 @@ in_clone_paint (void)
* means there's no point in trying to cull descendants of the current * means there's no point in trying to cull descendants of the current
* node. */ * node. */
static gboolean static gboolean
cull_actor (ClutterActor *self, cull_actor (ClutterActor *self,
ClutterPaintContext *paint_context, ClutterCullResult *result_out)
ClutterCullResult *result_out)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
ClutterStage *stage; ClutterStage *stage;
@@ -3676,10 +3619,10 @@ cull_actor (ClutterActor *self,
return FALSE; return FALSE;
} }
if (clutter_paint_context_is_drawing_off_stage (paint_context)) if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage))
{ {
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): " CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
"Drawing off stage", "Current framebuffer doesn't correspond to stage",
_clutter_actor_get_debug_name (self)); _clutter_actor_get_debug_name (self));
return FALSE; return FALSE;
} }
@@ -3762,13 +3705,7 @@ needs_flatten_effect (ClutterActor *self)
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT)) CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT))
return FALSE; return FALSE;
/* We need to enable the effect immediately even in ON_IDLE because that can if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ALWAYS)
* 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; return TRUE;
else if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY) else if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY)
{ {
@@ -3823,8 +3760,7 @@ add_or_remove_flatten_effect (ClutterActor *self)
} }
static void static void
clutter_actor_real_paint (ClutterActor *actor, clutter_actor_real_paint (ClutterActor *actor)
ClutterPaintContext *paint_context)
{ {
ClutterActorPrivate *priv = actor->priv; ClutterActorPrivate *priv = actor->priv;
ClutterActor *iter; ClutterActor *iter;
@@ -3841,19 +3777,21 @@ clutter_actor_real_paint (ClutterActor *actor,
iter->priv->allocation.x2 - iter->priv->allocation.x1, iter->priv->allocation.x2 - iter->priv->allocation.x1,
iter->priv->allocation.y2 - iter->priv->allocation.y1); iter->priv->allocation.y2 - iter->priv->allocation.y1);
clutter_actor_paint (iter, paint_context); clutter_actor_paint (iter);
} }
} }
static gboolean static gboolean
clutter_actor_paint_node (ClutterActor *actor, clutter_actor_paint_node (ClutterActor *actor,
ClutterPaintNode *root, ClutterPaintNode *root)
ClutterPaintContext *paint_context)
{ {
ClutterActorPrivate *priv = actor->priv; ClutterActorPrivate *priv = actor->priv;
ClutterActorBox box; ClutterActorBox box;
ClutterColor bg_color; ClutterColor bg_color;
if (root == NULL)
return FALSE;
box.x1 = 0.f; box.x1 = 0.f;
box.y1 = 0.f; box.y1 = 0.f;
box.x2 = clutter_actor_box_get_width (&priv->allocation); box.x2 = clutter_actor_box_get_width (&priv->allocation);
@@ -3867,7 +3805,7 @@ clutter_actor_paint_node (ClutterActor *actor,
CoglFramebuffer *fb; CoglFramebuffer *fb;
CoglBufferBit clear_flags; CoglBufferBit clear_flags;
fb = clutter_paint_context_get_base_framebuffer (paint_context); fb = _clutter_stage_get_active_framebuffer (CLUTTER_STAGE (actor));
if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor))) if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
{ {
@@ -3887,7 +3825,7 @@ clutter_actor_paint_node (ClutterActor *actor,
clear_flags = COGL_BUFFER_BIT_DEPTH; clear_flags = COGL_BUFFER_BIT_DEPTH;
node = clutter_root_node_new (fb, &bg_color, clear_flags); node = clutter_root_node_new (fb, &bg_color, clear_flags);
clutter_paint_node_set_static_name (node, "stageClear"); clutter_paint_node_set_name (node, "stageClear");
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
clutter_paint_node_add_child (root, node); clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node); clutter_paint_node_unref (node);
@@ -3902,14 +3840,14 @@ clutter_actor_paint_node (ClutterActor *actor,
/ 255; / 255;
node = clutter_color_node_new (&bg_color); node = clutter_color_node_new (&bg_color);
clutter_paint_node_set_static_name (node, "backgroundColor"); clutter_paint_node_set_name (node, "backgroundColor");
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
clutter_paint_node_add_child (root, node); clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node); clutter_paint_node_unref (node);
} }
if (priv->content != NULL) if (priv->content != NULL)
_clutter_content_paint_content (priv->content, actor, root, paint_context); _clutter_content_paint_content (priv->content, actor, root);
if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL) if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL)
CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root); CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root);
@@ -3925,7 +3863,7 @@ clutter_actor_paint_node (ClutterActor *actor,
} }
#endif /* CLUTTER_ENABLE_DEBUG */ #endif /* CLUTTER_ENABLE_DEBUG */
clutter_paint_node_paint (root, paint_context); clutter_paint_node_paint (root);
return TRUE; return TRUE;
} }
@@ -3949,14 +3887,12 @@ clutter_actor_paint_node (ClutterActor *actor,
* unless it is performing a pick paint. * unless it is performing a pick paint.
*/ */
void void
clutter_actor_paint (ClutterActor *self, clutter_actor_paint (ClutterActor *self)
ClutterPaintContext *paint_context)
{ {
g_autoptr (ClutterPaintNode) actor_node = NULL; g_autoptr (ClutterPaintNode) actor_node = NULL;
g_autoptr (ClutterPaintNode) root_node = NULL; g_autoptr (ClutterPaintNode) root_node = NULL;
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
ClutterActorBox clip; ClutterActorBox clip;
gboolean culling_inhibited;
gboolean clip_set = FALSE; gboolean clip_set = FALSE;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
@@ -4023,14 +3959,11 @@ clutter_actor_paint (ClutterActor *self,
clutter_actor_get_transform (self, &transform); clutter_actor_get_transform (self, &transform);
if (!cogl_matrix_is_identity (&transform)) transform_node = clutter_transform_node_new (&transform);
{ clutter_paint_node_add_child (transform_node, root_node);
transform_node = clutter_transform_node_new (&transform); clutter_paint_node_unref (root_node);
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 #ifdef CLUTTER_ENABLE_DEBUG
/* Catch when out-of-band transforms have been made by actors not as part /* Catch when out-of-band transforms have been made by actors not as part
@@ -4105,8 +4038,7 @@ clutter_actor_paint (ClutterActor *self,
* paint then the last-paint-volume would likely represent the new * paint then the last-paint-volume would likely represent the new
* actor position not the old. * actor position not the old.
*/ */
culling_inhibited = priv->inhibit_culling_counter > 0; if (!in_clone_paint ())
if (!culling_inhibited && !in_clone_paint ())
{ {
gboolean success; gboolean success;
/* annoyingly gcc warns if uninitialized even though /* annoyingly gcc warns if uninitialized even though
@@ -4120,7 +4052,7 @@ clutter_actor_paint (ClutterActor *self,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS))) CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
_clutter_actor_update_last_paint_volume (self); _clutter_actor_update_last_paint_volume (self);
success = cull_actor (self, paint_context, &result); success = cull_actor (self, &result);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)) if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
_clutter_actor_paint_cull_result (self, success, result, actor_node); _clutter_actor_paint_cull_result (self, success, result, actor_node);
@@ -4137,7 +4069,7 @@ clutter_actor_paint (ClutterActor *self,
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES)) if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
_clutter_actor_draw_paint_volume (self, actor_node); _clutter_actor_draw_paint_volume (self, actor_node);
clutter_paint_node_paint (root_node, paint_context); clutter_paint_node_paint (root_node);
/* If we make it here then the actor has run through a complete /* 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 */ paint run including all the effects so it's no longer dirty */
@@ -4157,8 +4089,7 @@ clutter_actor_paint (ClutterActor *self,
* Since: 1.8 * Since: 1.8
*/ */
void void
clutter_actor_continue_paint (ClutterActor *self, clutter_actor_continue_paint (ClutterActor *self)
ClutterPaintContext *paint_context)
{ {
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
@@ -4178,7 +4109,6 @@ clutter_actor_continue_paint (ClutterActor *self,
actual actor */ actual actor */
if (priv->next_effect_to_paint == NULL) if (priv->next_effect_to_paint == NULL)
{ {
CoglFramebuffer *framebuffer;
ClutterPaintNode *dummy; ClutterPaintNode *dummy;
/* XXX - this will go away in 2.0, when we can get rid of this /* XXX - this will go away in 2.0, when we can get rid of this
@@ -4186,24 +4116,21 @@ clutter_actor_continue_paint (ClutterActor *self,
* for the entire frame, starting from the Stage; the paint() * for the entire frame, starting from the Stage; the paint()
* virtual function can then be called directly. * virtual function can then be called directly.
*/ */
framebuffer = clutter_paint_context_get_base_framebuffer (paint_context); dummy = _clutter_dummy_node_new (self);
dummy = _clutter_dummy_node_new (self, framebuffer); clutter_paint_node_set_name (dummy, "Root");
clutter_paint_node_set_static_name (dummy, "Root");
/* XXX - for 1.12, we use the return value of paint_node() to /* XXX - for 1.12, we use the return value of paint_node() to
* decide whether we should emit the ::paint signal. * decide whether we should emit the ::paint signal.
*/ */
clutter_actor_paint_node (self, dummy, paint_context); clutter_actor_paint_node (self, dummy);
clutter_paint_node_unref (dummy); clutter_paint_node_unref (dummy);
/* XXX:2.0 - Call the paint() virtual directly */ /* XXX:2.0 - Call the paint() virtual directly */
if (!(clutter_paint_context_get_paint_flags (paint_context) & if (g_signal_has_handler_pending (self, actor_signals[PAINT],
CLUTTER_PAINT_FLAG_NO_PAINT_SIGNAL) &&
g_signal_has_handler_pending (self, actor_signals[PAINT],
0, TRUE)) 0, TRUE))
g_signal_emit (self, actor_signals[PAINT], 0, paint_context); g_signal_emit (self, actor_signals[PAINT], 0);
else else
CLUTTER_ACTOR_GET_CLASS (self)->paint (self, paint_context); CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
} }
else else
{ {
@@ -4230,12 +4157,7 @@ clutter_actor_continue_paint (ClutterActor *self,
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY; run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
} }
if (priv->current_effect == priv->flatten_effect && _clutter_effect_paint (priv->current_effect, run_flags);
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; priv->current_effect = old_current_effect;
} }
@@ -4248,11 +4170,9 @@ clutter_actor_continue_paint (ClutterActor *self,
* Asks @actor to perform a pick. * Asks @actor to perform a pick.
*/ */
void void
clutter_actor_pick (ClutterActor *actor, clutter_actor_pick (ClutterActor *actor)
ClutterPickContext *pick_context)
{ {
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
CoglFramebuffer *framebuffer;
ClutterActorBox clip; ClutterActorBox clip;
gboolean clip_set = FALSE; gboolean clip_set = FALSE;
@@ -4272,16 +4192,15 @@ clutter_actor_pick (ClutterActor *actor,
/* mark that we are in the paint process */ /* mark that we are in the paint process */
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK); CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
framebuffer = clutter_pick_context_get_framebuffer (pick_context); cogl_push_matrix ();
cogl_framebuffer_push_matrix (framebuffer);
if (priv->enable_model_view_transform) if (priv->enable_model_view_transform)
{ {
CoglMatrix matrix; CoglMatrix matrix;
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix); cogl_get_modelview_matrix (&matrix);
_clutter_actor_apply_modelview_transform (actor, &matrix); _clutter_actor_apply_modelview_transform (actor, &matrix);
cogl_framebuffer_set_modelview_matrix (framebuffer, &matrix); cogl_set_modelview_matrix (&matrix);
} }
if (priv->has_clip) if (priv->has_clip)
@@ -4302,7 +4221,7 @@ clutter_actor_pick (ClutterActor *actor,
} }
if (clip_set) if (clip_set)
clip_set = _clutter_actor_push_pick_clip (actor, pick_context, &clip); clip_set = _clutter_actor_push_pick_clip (actor, &clip);
priv->next_effect_to_paint = NULL; priv->next_effect_to_paint = NULL;
if (priv->effects) if (priv->effects)
@@ -4311,12 +4230,12 @@ clutter_actor_pick (ClutterActor *actor,
_clutter_meta_group_peek_metas (priv->effects); _clutter_meta_group_peek_metas (priv->effects);
} }
clutter_actor_continue_pick (actor, pick_context); clutter_actor_continue_pick (actor);
if (clip_set) if (clip_set)
_clutter_actor_pop_pick_clip (actor); _clutter_actor_pop_pick_clip (actor);
cogl_framebuffer_pop_matrix (framebuffer); cogl_pop_matrix ();
/* paint sequence complete */ /* paint sequence complete */
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK); CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
@@ -4333,8 +4252,7 @@ clutter_actor_pick (ClutterActor *actor,
* is the last effect in the chain. * is the last effect in the chain.
*/ */
void void
clutter_actor_continue_pick (ClutterActor *actor, clutter_actor_continue_pick (ClutterActor *actor)
ClutterPickContext *pick_context)
{ {
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
@@ -4360,9 +4278,9 @@ clutter_actor_continue_pick (ClutterActor *actor,
*/ */
if (g_signal_has_handler_pending (actor, actor_signals[PICK], if (g_signal_has_handler_pending (actor, actor_signals[PICK],
0, TRUE)) 0, TRUE))
g_signal_emit (actor, actor_signals[PICK], 0, pick_context); g_signal_emit (actor, actor_signals[PICK], 0);
else else
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor, pick_context); CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor);
} }
else else
{ {
@@ -4376,7 +4294,7 @@ clutter_actor_continue_pick (ClutterActor *actor,
priv->current_effect = priv->next_effect_to_paint->data; priv->current_effect = priv->next_effect_to_paint->data;
priv->next_effect_to_paint = priv->next_effect_to_paint->next; priv->next_effect_to_paint = priv->next_effect_to_paint->next;
_clutter_effect_pick (priv->current_effect, pick_context); _clutter_effect_pick (priv->current_effect);
priv->current_effect = old_current_effect; priv->current_effect = old_current_effect;
} }
@@ -4605,7 +4523,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
/* we need to emit the signal before dropping the reference */ /* we need to emit the signal before dropping the reference */
if (emit_actor_removed) if (emit_actor_removed)
_clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child); g_signal_emit_by_name (self, "actor-removed", child);
if (notify_first_last) if (notify_first_last)
{ {
@@ -6568,20 +6486,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
quark_actor_transform_info = g_quark_from_static_string ("-clutter-actor-transform-info"); quark_actor_transform_info = g_quark_from_static_string ("-clutter-actor-transform-info");
quark_actor_animation_info = g_quark_from_static_string ("-clutter-actor-animation-info"); quark_actor_animation_info = g_quark_from_static_string ("-clutter-actor-animation-info");
quark_key = g_quark_from_static_string ("key");
quark_motion = g_quark_from_static_string ("motion");
quark_pointer_focus = g_quark_from_static_string ("pointer-focus");
quark_button = g_quark_from_static_string ("button");
quark_scroll = g_quark_from_static_string ("scroll");
quark_stage = g_quark_from_static_string ("stage");
quark_destroy = g_quark_from_static_string ("destroy");
quark_client = g_quark_from_static_string ("client");
quark_delete = g_quark_from_static_string ("delete");
quark_touch = g_quark_from_static_string ("touch");
quark_touchpad = g_quark_from_static_string ("touchpad");
quark_proximity = g_quark_from_static_string ("proximity");
quark_pad = g_quark_from_static_string ("pad");
object_class->constructor = clutter_actor_constructor; object_class->constructor = clutter_actor_constructor;
object_class->set_property = clutter_actor_set_property; object_class->set_property = clutter_actor_set_property;
object_class->get_property = clutter_actor_get_property; object_class->get_property = clutter_actor_get_property;
@@ -6681,7 +6585,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_float ("width", g_param_spec_float ("width",
P_("Width"), P_("Width"),
P_("Width of the actor"), P_("Width of the actor"),
-1.0f, G_MAXFLOAT, 0.0, G_MAXFLOAT,
0.0, 0.0,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
@@ -6700,7 +6604,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_float ("height", g_param_spec_float ("height",
P_("Height"), P_("Height"),
P_("Height of the actor"), P_("Height of the actor"),
-1.0f, G_MAXFLOAT, 0.0, G_MAXFLOAT,
0.0, 0.0,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
@@ -8617,7 +8521,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
actor_signals[CAPTURED_EVENT] = actor_signals[CAPTURED_EVENT] =
g_signal_new (I_("captured-event"), g_signal_new (I_("captured-event"),
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterActorClass, captured_event), G_STRUCT_OFFSET (ClutterActorClass, captured_event),
_clutter_boolean_handled_accumulator, NULL, _clutter_boolean_handled_accumulator, NULL,
_clutter_marshal_BOOLEAN__BOXED, _clutter_marshal_BOOLEAN__BOXED,
@@ -8630,7 +8534,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
/** /**
* ClutterActor::paint: * ClutterActor::paint:
* @actor: the #ClutterActor that received the signal * @actor: the #ClutterActor that received the signal
* @paint_context: a #ClutterPaintContext
* *
* The ::paint signal is emitted each time an actor is being painted. * The ::paint signal is emitted each time an actor is being painted.
* *
@@ -8658,8 +8561,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_SIGNAL_DEPRECATED, G_SIGNAL_DEPRECATED,
G_STRUCT_OFFSET (ClutterActorClass, paint), G_STRUCT_OFFSET (ClutterActorClass, paint),
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_NONE, 0);
CLUTTER_TYPE_PAINT_CONTEXT);
/** /**
* ClutterActor::realize: * ClutterActor::realize:
* @actor: the #ClutterActor that received the signal * @actor: the #ClutterActor that received the signal
@@ -8702,7 +8604,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
/** /**
* ClutterActor::pick: * ClutterActor::pick:
* @actor: the #ClutterActor that received the signal * @actor: the #ClutterActor that received the signal
* @pick_context: a #ClutterPickContext
* *
* The ::pick signal is emitted each time an actor is being painted * 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 * in "pick mode". The pick mode is used to identify the actor during
@@ -8724,8 +8625,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED, G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
G_STRUCT_OFFSET (ClutterActorClass, pick), G_STRUCT_OFFSET (ClutterActorClass, pick),
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_NONE, 0);
CLUTTER_TYPE_PICK_CONTEXT);
/** /**
* ClutterActor::allocation-changed: * ClutterActor::allocation-changed:
@@ -9804,23 +9704,6 @@ clutter_actor_get_preferred_width (ClutterActor *self,
return; 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); CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
/* the remaining cases are: /* the remaining cases are:
@@ -9969,23 +9852,6 @@ clutter_actor_get_preferred_height (ClutterActor *self,
return; 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); CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
/* the remaining cases are: /* the remaining cases are:
@@ -10369,11 +10235,6 @@ clutter_actor_allocate (ClutterActor *self,
old_allocation = priv->allocation; old_allocation = priv->allocation;
real_allocation = *box; real_allocation = *box;
g_return_if_fail (!isnan (real_allocation.x1) &&
!isnan (real_allocation.x2) &&
!isnan (real_allocation.y1) &&
!isnan (real_allocation.y2));
/* constraints are allowed to modify the allocation only here; we do /* constraints are allowed to modify the allocation only here; we do
* this prior to all the other checks so that we can bail out if the * this prior to all the other checks so that we can bail out if the
* allocation did not change * allocation did not change
@@ -13268,7 +13129,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
} }
if (emit_actor_added) if (emit_actor_added)
_clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child); g_signal_emit_by_name (self, "actor-added", child);
if (notify_first_last) if (notify_first_last)
{ {
@@ -13932,70 +13793,8 @@ clutter_actor_event (ClutterActor *actor,
if (capture) if (capture)
{ {
GQuark detail = 0; g_signal_emit (actor, actor_signals[CAPTURED_EVENT], 0,
event,
switch (event->type)
{
case CLUTTER_NOTHING:
break;
case CLUTTER_KEY_PRESS:
case CLUTTER_KEY_RELEASE:
detail = quark_key;
break;
case CLUTTER_MOTION:
detail = quark_motion;
break;
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
detail = quark_pointer_focus;
break;
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
detail = quark_button;
break;
case CLUTTER_SCROLL:
detail = quark_scroll;
break;
case CLUTTER_STAGE_STATE:
detail = quark_stage;
break;
case CLUTTER_DESTROY_NOTIFY:
detail = quark_destroy;
break;
case CLUTTER_CLIENT_MESSAGE:
detail = quark_client;
break;
case CLUTTER_DELETE:
detail = quark_delete;
break;
case CLUTTER_TOUCH_BEGIN:
case CLUTTER_TOUCH_UPDATE:
case CLUTTER_TOUCH_END:
case CLUTTER_TOUCH_CANCEL:
detail = quark_touch;
break;
case CLUTTER_TOUCHPAD_PINCH:
case CLUTTER_TOUCHPAD_SWIPE:
detail = quark_touchpad;
break;
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
detail = quark_proximity;
break;
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
detail = quark_pad;
break;
case CLUTTER_EVENT_LAST: /* Just keep compiler warnings quiet */
break;
}
g_signal_emit (actor,
actor_signals[CAPTURED_EVENT],
detail,
event,
&retval); &retval);
goto out; goto out;
} }
@@ -15861,7 +15660,7 @@ update_pango_context (ClutterBackend *backend,
* stored by the #ClutterBackend change. * stored by the #ClutterBackend change.
* *
* You can use the returned #PangoContext to create a #PangoLayout * You can use the returned #PangoContext to create a #PangoLayout
* and render text using cogl_pango_show_layout() to reuse the * and render text using cogl_pango_render_layout() to reuse the
* glyphs cache also used by Clutter. * glyphs cache also used by Clutter.
* *
* Return value: (transfer none): the #PangoContext for a #ClutterActor. * Return value: (transfer none): the #PangoContext for a #ClutterActor.
@@ -16016,63 +15815,6 @@ clutter_actor_get_opacity_override (ClutterActor *self)
return self->priv->opacity_override; return self->priv->opacity_override;
} }
/**
* clutter_actor_inhibit_culling:
* @actor: a #ClutterActor
*
* Increases the culling inhibitor counter. Inhibiting culling
* forces the actor to be painted even when outside the visible
* bounds of the stage view.
*
* This is usually necessary when an actor is being painted on
* another paint context.
*
* Pair with clutter_actor_uninhibit_culling() when the actor doesn't
* need to be painted anymore.
*/
void
clutter_actor_inhibit_culling (ClutterActor *actor)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = actor->priv;
priv->inhibit_culling_counter++;
_clutter_actor_set_enable_paint_unmapped (actor, TRUE);
}
/**
* clutter_actor_uninhibit_culling:
* @actor: a #ClutterActor
*
* Decreases the culling inhibitor counter. See clutter_actor_inhibit_culling()
* for when inhibit culling is necessary.
*
* Calling this function without a matching call to
* clutter_actor_inhibit_culling() is a programming error.
*/
void
clutter_actor_uninhibit_culling (ClutterActor *actor)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = actor->priv;
if (priv->inhibit_culling_counter == 0)
{
g_critical ("Unpaired call to clutter_actor_uninhibit_culling");
return;
}
priv->inhibit_culling_counter--;
if (priv->inhibit_culling_counter == 0)
_clutter_actor_set_enable_paint_unmapped (actor, FALSE);
}
/* Allows you to disable applying the actors model view transform during /* Allows you to disable applying the actors model view transform during
* a paint. Used by ClutterClone. */ * a paint. Used by ClutterClone. */
void void
@@ -17786,42 +17528,10 @@ _clutter_actor_compute_resource_scale (ClutterActor *self,
resource_scale)) resource_scale))
{ {
if (priv->parent) if (priv->parent)
{ return _clutter_actor_compute_resource_scale (priv->parent,
gboolean in_clone_paint; resource_scale);
gboolean was_parent_in_clone_paint;
gboolean was_parent_unmapped;
gboolean was_parent_paint_unmapped;
gboolean ret;
in_clone_paint = clutter_actor_is_in_clone_paint (self);
was_parent_unmapped = !clutter_actor_is_mapped (priv->parent);
was_parent_in_clone_paint =
clutter_actor_is_in_clone_paint (priv->parent);
was_parent_paint_unmapped = priv->parent->priv->enable_paint_unmapped;
if (in_clone_paint && was_parent_unmapped)
{
_clutter_actor_set_in_clone_paint (priv->parent, TRUE);
_clutter_actor_set_enable_paint_unmapped (priv->parent, TRUE);
}
ret = _clutter_actor_compute_resource_scale (priv->parent,
resource_scale);
if (in_clone_paint && was_parent_unmapped)
{
_clutter_actor_set_in_clone_paint (priv->parent,
was_parent_in_clone_paint);
_clutter_actor_set_enable_paint_unmapped (priv->parent,
was_parent_paint_unmapped);
}
return ret;
}
else else
{ return FALSE;
return FALSE;
}
} }
return TRUE; return TRUE;
@@ -19472,8 +19182,8 @@ _clutter_actor_create_transition (ClutterActor *actor,
gboolean call_restore = FALSE; gboolean call_restore = FALSE;
TransitionClosure *clos; TransitionClosure *clos;
va_list var_args; va_list var_args;
g_auto (GValue) initial = G_VALUE_INIT; GValue initial = G_VALUE_INIT;
g_auto (GValue) final = G_VALUE_INIT; GValue final = G_VALUE_INIT;
GType ptype; GType ptype;
char *error; char *error;
@@ -19522,6 +19232,7 @@ _clutter_actor_create_transition (ClutterActor *actor,
if (error != NULL) if (error != NULL)
{ {
g_critical ("%s: %s", G_STRLOC, error); g_critical ("%s: %s", G_STRLOC, error);
g_value_unset (&initial);
g_free (error); g_free (error);
goto out; goto out;
} }
@@ -19543,6 +19254,9 @@ _clutter_actor_create_transition (ClutterActor *actor,
&final, &final,
pspec); pspec);
g_value_unset (&initial);
g_value_unset (&final);
goto out; goto out;
} }
@@ -19590,6 +19304,9 @@ _clutter_actor_create_transition (ClutterActor *actor,
/* the actor now owns the transition */ /* the actor now owns the transition */
g_object_unref (res); g_object_unref (res);
g_value_unset (&initial);
g_value_unset (&final);
} }
else else
{ {
@@ -21076,6 +20793,32 @@ clutter_actor_has_mapped_clones (ClutterActor *self)
return FALSE; 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 static void
clutter_actor_child_model__items_changed (GListModel *model, clutter_actor_child_model__items_changed (GListModel *model,
guint position, guint position,
@@ -21364,7 +21107,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
color.alpha = clutter_actor_get_paint_opacity_internal (self); color.alpha = clutter_actor_get_paint_opacity_internal (self);
node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter); node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
clutter_paint_node_set_static_name (node, "Texture"); clutter_paint_node_set_name (node, "Texture");
if (priv->content_repeat == CLUTTER_REPEAT_NONE) if (priv->content_repeat == CLUTTER_REPEAT_NONE)
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
@@ -21385,14 +21128,3 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
return node; 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;
}

View File

@@ -39,8 +39,6 @@
#include <clutter/clutter-types.h> #include <clutter/clutter-types.h>
#include <clutter/clutter-event.h> #include <clutter/clutter-event.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-pick-context.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -230,14 +228,12 @@ struct _ClutterActorClass
void (* unrealize) (ClutterActor *self); void (* unrealize) (ClutterActor *self);
void (* map) (ClutterActor *self); void (* map) (ClutterActor *self);
void (* unmap) (ClutterActor *self); void (* unmap) (ClutterActor *self);
void (* paint) (ClutterActor *self, void (* paint) (ClutterActor *self);
ClutterPaintContext *paint_context);
void (* parent_set) (ClutterActor *actor, void (* parent_set) (ClutterActor *actor,
ClutterActor *old_parent); ClutterActor *old_parent);
void (* destroy) (ClutterActor *self); void (* destroy) (ClutterActor *self);
void (* pick) (ClutterActor *actor, void (* pick) (ClutterActor *actor);
ClutterPickContext *pick_context);
gboolean (* queue_redraw) (ClutterActor *actor, gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued, ClutterActor *leaf_that_queued,
@@ -299,11 +295,10 @@ struct _ClutterActorClass
gboolean (* touch_event) (ClutterActor *self, gboolean (* touch_event) (ClutterActor *self,
ClutterTouchEvent *event); ClutterTouchEvent *event);
gboolean (* has_accessible) (ClutterActor *self);
/*< private >*/ /*< private >*/
/* padding for future expansion */ /* padding for future expansion */
gpointer _padding_dummy[25]; gpointer _padding_dummy[26];
}; };
/** /**
@@ -354,17 +349,13 @@ void clutter_actor_map
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_unmap (ClutterActor *self); void clutter_actor_unmap (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_paint (ClutterActor *self, void clutter_actor_paint (ClutterActor *self);
ClutterPaintContext *paint_context);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_continue_paint (ClutterActor *self, void clutter_actor_continue_paint (ClutterActor *self);
ClutterPaintContext *paint_context);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_pick (ClutterActor *actor, void clutter_actor_pick (ClutterActor *actor);
ClutterPickContext *pick_context);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_continue_pick (ClutterActor *actor, void clutter_actor_continue_pick (ClutterActor *actor);
ClutterPickContext *pick_context);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_queue_redraw (ClutterActor *self); void clutter_actor_queue_redraw (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
@@ -381,8 +372,6 @@ CLUTTER_EXPORT
const gchar * clutter_actor_get_name (ClutterActor *self); const gchar * clutter_actor_get_name (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
AtkObject * clutter_actor_get_accessible (ClutterActor *self); AtkObject * clutter_actor_get_accessible (ClutterActor *self);
CLUTTER_EXPORT
gboolean clutter_actor_has_accessible (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_actor_is_visible (ClutterActor *self); gboolean clutter_actor_is_visible (ClutterActor *self);
@@ -884,11 +873,6 @@ void clutter_actor_set_opacity_override
CLUTTER_EXPORT CLUTTER_EXPORT
gint clutter_actor_get_opacity_override (ClutterActor *self); gint clutter_actor_get_opacity_override (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_inhibit_culling (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_actor_uninhibit_culling (ClutterActor *actor);
/** /**
* ClutterActorCreateChildFunc: * ClutterActorCreateChildFunc:
* @item: (type GObject): the item in the model * @item: (type GObject): the item in the model
@@ -923,7 +907,6 @@ void clutter_actor_bind_model_with_properties
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_pick_box (ClutterActor *self, void clutter_actor_pick_box (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *box); const ClutterActorBox *box);
G_END_DECLS G_END_DECLS

View File

@@ -90,7 +90,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_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 (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)

View File

@@ -129,6 +129,9 @@ gfloat _clutter_backend_get_units_per_em (Clutter
PangoFontDescription *font_desc); PangoFontDescription *font_desc);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend); 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); void clutter_set_allowed_drivers (const char *drivers);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@@ -970,6 +970,27 @@ clutter_wayland_set_compositor_display (void *display)
} }
#endif #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 void
clutter_set_allowed_drivers (const char *drivers) clutter_set_allowed_drivers (const char *drivers)
{ {

View File

@@ -144,55 +144,6 @@ source_destroyed (ClutterActor *actor,
bind->source = NULL; 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 static void
clutter_bind_constraint_update_allocation (ClutterConstraint *constraint, clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor, ClutterActor *actor,
@@ -377,8 +328,6 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
meta_class->set_actor = clutter_bind_constraint_set_actor; meta_class->set_actor = clutter_bind_constraint_set_actor;
constraint_class->update_allocation = clutter_bind_constraint_update_allocation; constraint_class->update_allocation = clutter_bind_constraint_update_allocation;
constraint_class->update_preferred_size = clutter_bind_constraint_update_preferred_size;
/** /**
* ClutterBindConstraint:source: * ClutterBindConstraint:source:
* *

View File

@@ -99,8 +99,7 @@ G_DEFINE_TYPE (ClutterBlurEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT); CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean 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); ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
ClutterEffectClass *parent_class; ClutterEffectClass *parent_class;
@@ -125,7 +124,7 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect,
} }
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class); parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context)) if (parent_class->pre_paint (effect))
{ {
ClutterOffscreenEffect *offscreen_effect = ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect); CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -158,12 +157,10 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect,
} }
static void 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); ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity; guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (self->actor); paint_opacity = clutter_actor_get_paint_opacity (self->actor);

View File

@@ -475,10 +475,8 @@ get_preferred_size_for_orientation (ClutterBoxLayout *self,
ClutterActor *child; ClutterActor *child;
gint n_children = 0; gint n_children = 0;
gfloat minimum, natural; gfloat minimum, natural;
float largest_min_size, largest_nat_size;
minimum = natural = 0; minimum = natural = 0;
largest_min_size = largest_nat_size = 0;
clutter_actor_iter_init (&iter, container); clutter_actor_iter_init (&iter, container);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
@@ -493,22 +491,8 @@ get_preferred_size_for_orientation (ClutterBoxLayout *self,
get_child_size (child, priv->orientation, get_child_size (child, priv->orientation,
for_size, &child_min, &child_nat); for_size, &child_min, &child_nat);
if (priv->is_homogeneous) minimum += child_min;
{ natural += child_nat;
largest_min_size = MAX (largest_min_size, child_min);
largest_nat_size = MAX (largest_nat_size, child_nat);
}
else
{
minimum += child_min;
natural += child_nat;
}
}
if (priv->is_homogeneous)
{
minimum = largest_min_size * n_children;
natural = largest_nat_size * n_children;
} }
if (n_children > 1) if (n_children > 1)
@@ -639,8 +623,6 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
} }
else else
{ {
size -= (nvis_children - 1) * priv->spacing;
/* Bring children up to size first */ /* Bring children up to size first */
if (isnormal (size) || size == 0) if (isnormal (size) || size == 0)
{ {

View File

@@ -121,17 +121,16 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
static gboolean static gboolean
will_have_no_effect (ClutterBrightnessContrastEffect *self) will_have_no_effect (ClutterBrightnessContrastEffect *self)
{ {
return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) && return (self->brightness_red == no_change &&
G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) && self->brightness_green == no_change &&
G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) && self->brightness_blue == no_change &&
G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) && self->contrast_red == no_change &&
G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) && self->contrast_green == no_change &&
G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON)); self->contrast_blue == no_change);
} }
static gboolean 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); ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
ClutterEffectClass *parent_class; ClutterEffectClass *parent_class;
@@ -157,7 +156,7 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
parent_class = parent_class =
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class); CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context)) if (parent_class->pre_paint (effect))
{ {
ClutterOffscreenEffect *offscreen_effect = ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect); CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -176,12 +175,10 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
} }
static void 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); ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor; ClutterActor *actor;
guint8 paint_opacity; guint8 paint_opacity;
@@ -497,9 +494,9 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
{ {
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect)); g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) && if (red == effect->brightness_red &&
G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) && green == effect->brightness_green &&
G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON)) blue == effect->brightness_blue)
return; return;
effect->brightness_red = red; effect->brightness_red = red;
@@ -587,9 +584,9 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
{ {
g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect)); g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) && if (red == effect->contrast_red &&
G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) && green == effect->contrast_green &&
G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON)) blue == effect->contrast_blue)
return; return;
effect->contrast_red = red; effect->contrast_red = red;

View File

@@ -328,10 +328,9 @@ clutter_canvas_init (ClutterCanvas *self)
} }
static void static void
clutter_canvas_paint_content (ClutterContent *content, clutter_canvas_paint_content (ClutterContent *content,
ClutterActor *actor, ClutterActor *actor,
ClutterPaintNode *root, ClutterPaintNode *root)
ClutterPaintContext *paint_context)
{ {
ClutterCanvas *self = CLUTTER_CANVAS (content); ClutterCanvas *self = CLUTTER_CANVAS (content);
ClutterCanvasPrivate *priv = self->priv; ClutterCanvasPrivate *priv = self->priv;
@@ -352,7 +351,7 @@ clutter_canvas_paint_content (ClutterContent *content,
return; return;
node = clutter_actor_create_texture_paint_node (actor, priv->texture); node = clutter_actor_create_texture_paint_node (actor, priv->texture);
clutter_paint_node_set_static_name (node, "Canvas Content"); clutter_paint_node_set_name (node, "Canvas Content");
clutter_paint_node_add_child (root, node); clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node); clutter_paint_node_unref (node);

View File

@@ -346,12 +346,6 @@ on_captured_event (ClutterActor *stage,
ClutterModifierType modifier_state; ClutterModifierType modifier_state;
gboolean has_button = TRUE; gboolean has_button = TRUE;
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
{
clutter_click_action_release (action);
return CLUTTER_EVENT_PROPAGATE;
}
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action)); actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
switch (clutter_event_type (event)) switch (clutter_event_type (event))

View File

@@ -152,8 +152,7 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
} }
static void static void
clutter_clone_paint (ClutterActor *actor, clutter_clone_paint (ClutterActor *actor)
ClutterPaintContext *paint_context)
{ {
ClutterClone *self = CLUTTER_CLONE (actor); ClutterClone *self = CLUTTER_CLONE (actor);
ClutterClonePrivate *priv = self->priv; ClutterClonePrivate *priv = self->priv;
@@ -190,7 +189,7 @@ clutter_clone_paint (ClutterActor *actor,
if (clutter_actor_is_realized (priv->clone_source)) if (clutter_actor_is_realized (priv->clone_source))
{ {
_clutter_actor_push_clone_paint (); _clutter_actor_push_clone_paint ();
clutter_actor_paint (priv->clone_source, paint_context); clutter_actor_paint (priv->clone_source);
_clutter_actor_pop_clone_paint (); _clutter_actor_pop_clone_paint ();
} }

View File

@@ -105,8 +105,7 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT); CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean 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); ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
ClutterEffectClass *parent_class; ClutterEffectClass *parent_class;
@@ -127,7 +126,7 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect,
} }
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class); parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context)) if (parent_class->pre_paint (effect))
{ {
ClutterOffscreenEffect *offscreen_effect = ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect); CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -146,12 +145,10 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect,
} }
static void 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); ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor; ClutterActor *actor;
guint8 paint_opacity; guint8 paint_opacity;

View File

@@ -30,6 +30,13 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor, ClutterActor *actor,
ClutterActorBox *allocation); 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 G_END_DECLS
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */ #endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */

View File

@@ -222,17 +222,6 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
return !clutter_actor_box_equal (allocation, &old_alloc); 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 void
clutter_constraint_update_preferred_size (ClutterConstraint *constraint, clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
ClutterActor *actor, ClutterActor *actor,

View File

@@ -99,14 +99,6 @@ struct _ClutterConstraintClass
CLUTTER_EXPORT CLUTTER_EXPORT
GType clutter_constraint_get_type (void) G_GNUC_CONST; 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 */ /* ClutterActor API */
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_add_constraint (ClutterActor *self, void clutter_actor_add_constraint (ClutterActor *self,

View File

@@ -1,36 +0,0 @@
/*
* 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__ */

View File

@@ -37,7 +37,6 @@
#include "clutter-actor-private.h" #include "clutter-actor-private.h"
#include "clutter-child-meta.h" #include "clutter-child-meta.h"
#include "clutter-container-private.h"
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-marshal.h" #include "clutter-marshal.h"
@@ -1251,23 +1250,3 @@ clutter_container_child_notify (ClutterContainer *container,
child, child,
pspec); 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);
}

View File

@@ -34,10 +34,9 @@ void _clutter_content_attached (ClutterContent *conte
void _clutter_content_detached (ClutterContent *content, void _clutter_content_detached (ClutterContent *content,
ClutterActor *actor); ClutterActor *actor);
void _clutter_content_paint_content (ClutterContent *content, void _clutter_content_paint_content (ClutterContent *content,
ClutterActor *actor, ClutterActor *actor,
ClutterPaintNode *node, ClutterPaintNode *node);
ClutterPaintContext *paint_context);
G_END_DECLS G_END_DECLS

View File

@@ -96,10 +96,9 @@ clutter_content_real_invalidate_size (ClutterContent *content)
} }
static void static void
clutter_content_real_paint_content (ClutterContent *content, clutter_content_real_paint_content (ClutterContent *content,
ClutterActor *actor, ClutterActor *actor,
ClutterPaintNode *context, ClutterPaintNode *context)
ClutterPaintContext *paint_context)
{ {
} }
@@ -301,8 +300,7 @@ _clutter_content_detached (ClutterContent *content,
* _clutter_content_paint_content: * _clutter_content_paint_content:
* @content: a #ClutterContent * @content: a #ClutterContent
* @actor: a #ClutterActor * @actor: a #ClutterActor
* @node: a #ClutterPaintNode * @context: a #ClutterPaintNode
* @paint_context: a #ClutterPaintContext
* *
* Creates the render tree for the @content and @actor. * Creates the render tree for the @content and @actor.
* *
@@ -310,13 +308,11 @@ _clutter_content_detached (ClutterContent *content,
* virtual function. * virtual function.
*/ */
void void
_clutter_content_paint_content (ClutterContent *content, _clutter_content_paint_content (ClutterContent *content,
ClutterActor *actor, ClutterActor *actor,
ClutterPaintNode *node, 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);
} }
/** /**

View File

@@ -65,10 +65,9 @@ struct _ClutterContentInterface
gboolean (* get_preferred_size) (ClutterContent *content, gboolean (* get_preferred_size) (ClutterContent *content,
gfloat *width, gfloat *width,
gfloat *height); gfloat *height);
void (* paint_content) (ClutterContent *content, void (* paint_content) (ClutterContent *content,
ClutterActor *actor, ClutterActor *actor,
ClutterPaintNode *node, ClutterPaintNode *node);
ClutterPaintContext *paint_context);
void (* attached) (ClutterContent *content, void (* attached) (ClutterContent *content,
ClutterActor *actor); ClutterActor *actor);

View File

@@ -166,16 +166,14 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
} }
static void 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); ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
ClutterDeformEffectPrivate *priv = self->priv; ClutterDeformEffectPrivate *priv = self->priv;
CoglHandle material; CoglHandle material;
CoglPipeline *pipeline; CoglPipeline *pipeline;
CoglDepthState depth_state; CoglDepthState depth_state;
CoglFramebuffer *fb = CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
if (priv->is_dirty) if (priv->is_dirty)
{ {

View File

@@ -112,8 +112,7 @@ G_DEFINE_TYPE (ClutterDesaturateEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT); CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean 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); ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
ClutterEffectClass *parent_class; ClutterEffectClass *parent_class;
@@ -134,7 +133,7 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
} }
parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class); parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context)) if (parent_class->pre_paint (effect))
{ {
ClutterOffscreenEffect *offscreen_effect = ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect); CLUTTER_OFFSCREEN_EFFECT (effect);
@@ -153,12 +152,10 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
} }
static void 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); ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
ClutterActor *actor; ClutterActor *actor;
CoglHandle texture; CoglHandle texture;
guint8 paint_opacity; guint8 paint_opacity;

View File

@@ -5,18 +5,14 @@
G_BEGIN_DECLS G_BEGIN_DECLS
gboolean _clutter_effect_pre_paint (ClutterEffect *effect, gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
ClutterPaintContext *paint_context); void _clutter_effect_post_paint (ClutterEffect *effect);
void _clutter_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context);
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect, gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume); ClutterPaintVolume *volume);
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect); gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect, void _clutter_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags); ClutterEffectPaintFlags flags);
void _clutter_effect_pick (ClutterEffect *effect, void _clutter_effect_pick (ClutterEffect *effect);
ClutterPickContext *pick_context);
G_END_DECLS G_END_DECLS

View File

@@ -177,15 +177,13 @@ G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
CLUTTER_TYPE_ACTOR_META); CLUTTER_TYPE_ACTOR_META);
static gboolean static gboolean
clutter_effect_real_pre_paint (ClutterEffect *effect, clutter_effect_real_pre_paint (ClutterEffect *effect)
ClutterPaintContext *paint_context)
{ {
return TRUE; return TRUE;
} }
static void static void
clutter_effect_real_post_paint (ClutterEffect *effect, clutter_effect_real_post_paint (ClutterEffect *effect)
ClutterPaintContext *paint_context)
{ {
} }
@@ -198,7 +196,6 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
static void static void
clutter_effect_real_paint (ClutterEffect *effect, clutter_effect_real_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags) ClutterEffectPaintFlags flags)
{ {
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect); ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
@@ -209,24 +206,23 @@ clutter_effect_real_paint (ClutterEffect *effect,
effects that haven't migrated to use the 'paint' virtual yet. This effects that haven't migrated to use the 'paint' virtual yet. This
just calls the old pre and post virtuals before chaining on */ just calls the old pre and post virtuals before chaining on */
pre_paint_succeeded = _clutter_effect_pre_paint (effect, paint_context); pre_paint_succeeded = _clutter_effect_pre_paint (effect);
actor = clutter_actor_meta_get_actor (actor_meta); actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_paint (actor, paint_context); clutter_actor_continue_paint (actor);
if (pre_paint_succeeded) if (pre_paint_succeeded)
_clutter_effect_post_paint (effect, paint_context); _clutter_effect_post_paint (effect);
} }
static void static void
clutter_effect_real_pick (ClutterEffect *effect, clutter_effect_real_pick (ClutterEffect *effect)
ClutterPickContext *pick_context)
{ {
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect); ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
ClutterActor *actor; ClutterActor *actor;
actor = clutter_actor_meta_get_actor (actor_meta); actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_pick (actor, pick_context); clutter_actor_continue_pick (actor);
} }
static void static void
@@ -266,40 +262,36 @@ clutter_effect_init (ClutterEffect *self)
} }
gboolean 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); g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect, paint_context); return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect);
} }
void void
_clutter_effect_post_paint (ClutterEffect *effect, _clutter_effect_post_paint (ClutterEffect *effect)
ClutterPaintContext *paint_context)
{ {
g_return_if_fail (CLUTTER_IS_EFFECT (effect)); g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect, paint_context); CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect);
} }
void void
_clutter_effect_paint (ClutterEffect *effect, _clutter_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags) ClutterEffectPaintFlags flags)
{ {
g_return_if_fail (CLUTTER_IS_EFFECT (effect)); g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, paint_context, flags); CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, flags);
} }
void void
_clutter_effect_pick (ClutterEffect *effect, _clutter_effect_pick (ClutterEffect *effect)
ClutterPickContext *pick_context)
{ {
g_return_if_fail (CLUTTER_IS_EFFECT (effect)); g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context); CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
} }
gboolean gboolean

View File

@@ -30,8 +30,6 @@
#endif #endif
#include <clutter/clutter-actor-meta.h> #include <clutter/clutter-actor-meta.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-pick-context.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -76,19 +74,15 @@ struct _ClutterEffectClass
ClutterActorMetaClass parent_class; ClutterActorMetaClass parent_class;
/*< public >*/ /*< public >*/
gboolean (* pre_paint) (ClutterEffect *effect, gboolean (* pre_paint) (ClutterEffect *effect);
ClutterPaintContext *paint_context); void (* post_paint) (ClutterEffect *effect);
void (* post_paint) (ClutterEffect *effect,
ClutterPaintContext *paint_context);
gboolean (* modify_paint_volume) (ClutterEffect *effect, gboolean (* modify_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume); ClutterPaintVolume *volume);
void (* paint) (ClutterEffect *effect, void (* paint) (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags); ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect, void (* pick) (ClutterEffect *effect);
ClutterPickContext *pick_context);
/*< private >*/ /*< private >*/
void (* _clutter_effect4) (void); void (* _clutter_effect4) (void);

View File

@@ -535,13 +535,9 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
* ClutterOffscreenRedirect: * ClutterOffscreenRedirect:
* @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect * @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect
* the actor if it is semi-transparent and its has_overlaps() * the actor if it is semi-transparent and its has_overlaps()
* virtual returns %TRUE. * virtual returns %TRUE. This is the default.
* @CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: Always redirect the actor to an * @CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: Always redirect the actor to an
* offscreen buffer even if it is fully opaque. * 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(). * Possible flags to pass to clutter_actor_set_offscreen_redirect().
* *
@@ -549,9 +545,8 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
*/ */
typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/ typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
{ {
CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1 << 0, CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1<<0,
CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1 << 1, CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1<<1
CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
} ClutterOffscreenRedirect; } ClutterOffscreenRedirect;
/** /**
@@ -678,15 +673,12 @@ typedef enum /*< prefix=CLUTTER_BIND >*/
* has queued a redraw before this paint. This implies that the effect * has queued a redraw before this paint. This implies that the effect
* should call clutter_actor_continue_paint() to chain to the next * should call clutter_actor_continue_paint() to chain to the next
* effect and can not cache any results from a previous paint. * 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. * Flags passed to the paint or pick method of #ClutterEffect.
*/ */
typedef enum /*< prefix=CLUTTER_EFFECT_PAINT >*/ 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; } ClutterEffectPaintFlags;
/** /**

View File

@@ -118,10 +118,9 @@ clutter_image_init (ClutterImage *self)
} }
static void static void
clutter_image_paint_content (ClutterContent *content, clutter_image_paint_content (ClutterContent *content,
ClutterActor *actor, ClutterActor *actor,
ClutterPaintNode *root, ClutterPaintNode *root)
ClutterPaintContext *paint_context)
{ {
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv; ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
ClutterPaintNode *node; ClutterPaintNode *node;
@@ -130,7 +129,7 @@ clutter_image_paint_content (ClutterContent *content,
return; return;
node = clutter_actor_create_texture_paint_node (actor, priv->texture); node = clutter_actor_create_texture_paint_node (actor, priv->texture);
clutter_paint_node_set_static_name (node, "Image Content"); clutter_paint_node_set_name (node, "Image Content");
clutter_paint_node_add_child (root, node); clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node); clutter_paint_node_unref (node);
} }

View File

@@ -36,13 +36,13 @@ typedef struct _ClutterAxisInfo
{ {
ClutterInputAxis axis; ClutterInputAxis axis;
double min_axis; gdouble min_axis;
double max_axis; gdouble max_axis;
double min_value; gdouble min_value;
double max_value; gdouble max_value;
double resolution; gdouble resolution;
} ClutterAxisInfo; } ClutterAxisInfo;
typedef struct _ClutterKeyInfo typedef struct _ClutterKeyInfo
@@ -55,9 +55,9 @@ typedef struct _ClutterScrollInfo
{ {
guint axis_id; guint axis_id;
ClutterScrollDirection direction; ClutterScrollDirection direction;
double increment; gdouble increment;
double last_value; gdouble last_value;
guint last_value_valid : 1; guint last_value_valid : 1;
} ClutterScrollInfo; } ClutterScrollInfo;
@@ -66,8 +66,8 @@ typedef struct _ClutterTouchInfo
ClutterEventSequence *sequence; ClutterEventSequence *sequence;
ClutterActor *actor; ClutterActor *actor;
float current_x; gfloat current_x;
float current_y; gfloat current_y;
} ClutterTouchInfo; } ClutterTouchInfo;
typedef struct _ClutterPtrA11yData typedef struct _ClutterPtrA11yData
@@ -91,12 +91,12 @@ struct _ClutterInputDevice
{ {
GObject parent_instance; GObject parent_instance;
int id; gint id;
ClutterInputDeviceType device_type; ClutterInputDeviceType device_type;
ClutterInputMode device_mode; ClutterInputMode device_mode;
char *device_name; gchar *device_name;
ClutterSeat *seat; ClutterSeat *seat;
@@ -118,26 +118,26 @@ struct _ClutterInputDevice
GHashTable *inv_sequence_grab_actors; GHashTable *inv_sequence_grab_actors;
/* the current click count */ /* the current click count */
int click_count; gint click_count;
/* the stage the device is on */ /* the stage the device is on */
ClutterStage *stage; ClutterStage *stage;
/* the current state */ /* the current state */
float current_x; gfloat current_x;
float current_y; gfloat current_y;
uint32_t current_time; guint32 current_time;
int current_button_number; gint current_button_number;
ClutterModifierType current_state; ClutterModifierType current_state;
/* the current touch points states */ /* the current touch points states */
GHashTable *touch_sequences_info; GHashTable *touch_sequences_info;
/* the previous state, used for click count generation */ /* the previous state, used for click count generation */
int previous_x; gint previous_x;
int previous_y; gint previous_y;
uint32_t previous_time; guint32 previous_time;
int previous_button_number; gint previous_button_number;
ClutterModifierType previous_state; ClutterModifierType previous_state;
GArray *axes; GArray *axes;
@@ -147,15 +147,15 @@ struct _ClutterInputDevice
GArray *scroll_info; GArray *scroll_info;
char *vendor_id; gchar *vendor_id;
char *product_id; gchar *product_id;
char *node_path; gchar *node_path;
GPtrArray *tools; GPtrArray *tools;
int n_rings; gint n_rings;
int n_strips; gint n_strips;
int n_mode_groups; gint n_mode_groups;
ClutterInputDeviceMapping mapping_mode; ClutterInputDeviceMapping mapping_mode;
@@ -200,10 +200,9 @@ void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
ClutterActor *actor, ClutterActor *actor,
gboolean emit_crossing); gboolean emit_crossing);
CLUTTER_EXPORT ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
ClutterActor * clutter_input_device_update (ClutterInputDevice *device, ClutterEventSequence *sequence,
ClutterEventSequence *sequence, gboolean emit_crossing);
gboolean emit_crossing);
CLUTTER_EXPORT CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device, void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event); ClutterEvent *event);

View File

@@ -96,7 +96,6 @@ clutter_input_device_dispose (GObject *gobject)
g_clear_pointer (&device->device_name, g_free); g_clear_pointer (&device->device_name, g_free);
g_clear_pointer (&device->vendor_id, g_free); g_clear_pointer (&device->vendor_id, g_free);
g_clear_pointer (&device->product_id, g_free); g_clear_pointer (&device->product_id, g_free);
g_clear_pointer (&device->node_path, g_free);
if (device->associated != NULL) if (device->associated != NULL)
{ {
@@ -798,7 +797,7 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
* *
* Sets the actor under the pointer coordinates of @device * 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: * and it will:
* *
* - queue a %CLUTTER_LEAVE event on the previous pointer actor * - queue a %CLUTTER_LEAVE event on the previous pointer actor
@@ -1016,7 +1015,7 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
} }
/* /*
* clutter_input_device_update: * _clutter_input_device_update:
* @device: a #ClutterInputDevice * @device: a #ClutterInputDevice
* *
* Updates the input @device by determining the #ClutterActor underneath the * Updates the input @device by determining the #ClutterActor underneath the
@@ -1030,9 +1029,9 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
* Since: 1.2 * Since: 1.2
*/ */
ClutterActor * ClutterActor *
clutter_input_device_update (ClutterInputDevice *device, _clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
gboolean emit_crossing) gboolean emit_crossing)
{ {
ClutterStage *stage; ClutterStage *stage;
ClutterActor *new_cursor_actor; ClutterActor *new_cursor_actor;

View File

@@ -29,7 +29,7 @@ void clutter_input_focus_focus_out (ClutterInputFocus *focus);
void clutter_input_focus_commit (ClutterInputFocus *focus, void clutter_input_focus_commit (ClutterInputFocus *focus,
const gchar *text); const gchar *text);
void clutter_input_focus_delete_surrounding (ClutterInputFocus *focus, void clutter_input_focus_delete_surrounding (ClutterInputFocus *focus,
int offset, guint offset,
guint len); guint len);
void clutter_input_focus_request_surrounding (ClutterInputFocus *focus); void clutter_input_focus_request_surrounding (ClutterInputFocus *focus);

View File

@@ -217,7 +217,7 @@ clutter_input_focus_commit (ClutterInputFocus *focus,
void void
clutter_input_focus_delete_surrounding (ClutterInputFocus *focus, clutter_input_focus_delete_surrounding (ClutterInputFocus *focus,
int offset, guint offset,
guint len) guint len)
{ {
g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus)); g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));

View File

@@ -41,7 +41,7 @@ struct _ClutterInputFocusClass
void (* request_surrounding) (ClutterInputFocus *focus); void (* request_surrounding) (ClutterInputFocus *focus);
void (* delete_surrounding) (ClutterInputFocus *focus, void (* delete_surrounding) (ClutterInputFocus *focus,
int offset, guint offset,
guint len); guint len);
void (* commit_text) (ClutterInputFocus *focus, void (* commit_text) (ClutterInputFocus *focus,
const gchar *text); const gchar *text);

View File

@@ -168,7 +168,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, 0, NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT); G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
signals[REQUEST_SURROUNDING] = signals[REQUEST_SURROUNDING] =
g_signal_new ("request-surrounding", g_signal_new ("request-surrounding",
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
@@ -292,7 +292,7 @@ clutter_input_method_commit (ClutterInputMethod *im,
void void
clutter_input_method_delete_surrounding (ClutterInputMethod *im, clutter_input_method_delete_surrounding (ClutterInputMethod *im,
int offset, guint offset,
guint len) guint len)
{ {
ClutterInputMethodPrivate *priv; ClutterInputMethodPrivate *priv;

View File

@@ -68,7 +68,7 @@ void clutter_input_method_commit (ClutterInputMethod *im,
const gchar *text); const gchar *text);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_method_delete_surrounding (ClutterInputMethod *im, void clutter_input_method_delete_surrounding (ClutterInputMethod *im,
int offset, guint offset,
guint len); guint len);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_method_request_surrounding (ClutterInputMethod *im); void clutter_input_method_request_surrounding (ClutterInputMethod *im);

View File

@@ -63,7 +63,6 @@
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-master-clock.h" #include "clutter-master-clock.h"
#include "clutter-mutter.h" #include "clutter-mutter.h"
#include "clutter-paint-node-private.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-settings-private.h" #include "clutter-settings-private.h"
#include "clutter-stage-manager.h" #include "clutter-stage-manager.h"
@@ -971,9 +970,6 @@ clutter_init_real (GError **error)
if (clutter_enable_accessibility) if (clutter_enable_accessibility)
cally_accessibility_init (); cally_accessibility_init ();
/* Initialize types required for paint nodes */
_clutter_paint_node_init_types ();
return CLUTTER_INIT_SUCCESS; return CLUTTER_INIT_SUCCESS;
} }
@@ -1527,7 +1523,7 @@ event_click_count_generate (ClutterEvent *event)
previous_y = event->button.y; previous_y = event->button.y;
previous_time = event->button.time; previous_time = event->button.time;
G_GNUC_FALLTHROUGH; /* fallthrough */
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
event->button.click_count = click_count; event->button.click_count = click_count;
break; break;
@@ -1780,7 +1776,7 @@ _clutter_process_event_details (ClutterActor *stage,
emit_crossing_event (event, device); emit_crossing_event (event, device);
actor = clutter_input_device_update (device, NULL, FALSE); actor = _clutter_input_device_update (device, NULL, FALSE);
if (actor != stage) if (actor != stage)
{ {
ClutterEvent *crossing; ClutterEvent *crossing;
@@ -1838,10 +1834,12 @@ _clutter_process_event_details (ClutterActor *stage,
{ {
if (_clutter_is_input_pointer_a11y_enabled (device)) if (_clutter_is_input_pointer_a11y_enabled (device))
{ {
ClutterInputDevice *core_pointer;
gfloat x, y; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
_clutter_input_pointer_a11y_on_motion_event (device, x, y); core_pointer = clutter_event_get_device (event);
_clutter_input_pointer_a11y_on_motion_event (core_pointer, x, y);
} }
} }
#endif /* CLUTTER_WINDOWING_X11 */ #endif /* CLUTTER_WINDOWING_X11 */
@@ -1872,7 +1870,7 @@ _clutter_process_event_details (ClutterActor *stage,
break; break;
} }
G_GNUC_FALLTHROUGH; /* fallthrough from motion */
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
#ifdef CLUTTER_WINDOWING_X11 #ifdef CLUTTER_WINDOWING_X11
@@ -1880,7 +1878,10 @@ _clutter_process_event_details (ClutterActor *stage,
{ {
if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION)) if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
{ {
_clutter_input_pointer_a11y_on_button_event (device, ClutterInputDevice *core_pointer;
core_pointer = clutter_event_get_device (event);
_clutter_input_pointer_a11y_on_button_event (core_pointer,
event->button.button, event->button.button,
event->type == CLUTTER_BUTTON_PRESS); event->type == CLUTTER_BUTTON_PRESS);
} }
@@ -1939,7 +1940,7 @@ _clutter_process_event_details (ClutterActor *stage,
* get the actor underneath * get the actor underneath
*/ */
if (device != NULL) if (device != NULL)
actor = clutter_input_device_update (device, NULL, TRUE); actor = _clutter_input_device_update (device, NULL, TRUE);
else else
{ {
CLUTTER_NOTE (EVENT, "No device found: picking"); CLUTTER_NOTE (EVENT, "No device found: picking");
@@ -2012,7 +2013,7 @@ _clutter_process_event_details (ClutterActor *stage,
break; break;
} }
G_GNUC_FALLTHROUGH; /* fallthrough from motion */
case CLUTTER_TOUCH_BEGIN: case CLUTTER_TOUCH_BEGIN:
case CLUTTER_TOUCH_CANCEL: case CLUTTER_TOUCH_CANCEL:
case CLUTTER_TOUCH_END: case CLUTTER_TOUCH_END:
@@ -2056,7 +2057,7 @@ _clutter_process_event_details (ClutterActor *stage,
} }
if (device != NULL) if (device != NULL)
actor = clutter_input_device_update (device, sequence, TRUE); actor = _clutter_input_device_update (device, sequence, TRUE);
else else
{ {
CLUTTER_NOTE (EVENT, "No device found: picking"); CLUTTER_NOTE (EVENT, "No device found: picking");

View File

@@ -31,8 +31,6 @@
#include "clutter-build-config.h" #include "clutter-build-config.h"
#include <cogl/cogl.h>
#include "clutter-master-clock.h" #include "clutter-master-clock.h"
#include "clutter-master-clock-default.h" #include "clutter-master-clock-default.h"
#include "clutter-debug.h" #include "clutter-debug.h"
@@ -190,26 +188,6 @@ master_clock_get_swap_wait_time (ClutterMasterClockDefault *master_clock)
} }
} }
static int64_t
master_clock_get_next_presentation_time (ClutterMasterClockDefault *master_clock)
{
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
const GSList *stages, *l;
int64_t earliest = -1;
stages = clutter_stage_manager_peek_stages (stage_manager);
for (l = stages; l != NULL; l = l->next)
{
gint64 t = _clutter_stage_get_next_presentation_time (l->data);
if (earliest == -1 || (t != -1 && t < earliest))
earliest = t;
}
return earliest;
}
static void static void
master_clock_schedule_stage_updates (ClutterMasterClockDefault *master_clock) master_clock_schedule_stage_updates (ClutterMasterClockDefault *master_clock)
{ {
@@ -483,14 +461,8 @@ clutter_clock_dispatch (GSource *source,
_clutter_threads_acquire_lock (); _clutter_threads_acquire_lock ();
COGL_TRACE_BEGIN (ClutterMasterClockTick, "Master Clock (tick)");
/* Get the time to use for this frame */ /* Get the time to use for this frame */
master_clock->cur_tick = master_clock_get_next_presentation_time (master_clock); master_clock->cur_tick = g_source_get_time (source);
/* On the first frame the backend might not have an answer */
if (master_clock->cur_tick <= 0)
master_clock->cur_tick = g_source_get_time (source);
#ifdef CLUTTER_ENABLE_DEBUG #ifdef CLUTTER_ENABLE_DEBUG
master_clock->remaining_budget = master_clock->frame_budget; master_clock->remaining_budget = master_clock->frame_budget;
@@ -520,8 +492,6 @@ clutter_clock_dispatch (GSource *source,
g_slist_free_full (stages, g_object_unref); g_slist_free_full (stages, g_object_unref);
COGL_TRACE_END (ClutterMasterClockTick);
_clutter_threads_release_lock (); _clutter_threads_release_lock ();
return TRUE; return TRUE;

View File

@@ -30,7 +30,6 @@
#include "clutter-input-device-private.h" #include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h" #include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h" #include "clutter-macros.h"
#include "clutter-paint-context-private.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-stage-private.h" #include "clutter-stage-private.h"
#include "clutter-stage-view.h" #include "clutter-stage-view.h"
@@ -49,23 +48,6 @@ void clutter_stage_capture_into (ClutterStage *stage,
cairo_rectangle_int_t *rect, cairo_rectangle_int_t *rect,
uint8_t *data); uint8_t *data);
CLUTTER_EXPORT
void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer,
const cairo_rectangle_int_t *rect,
float scale,
ClutterPaintFlag paint_flags);
CLUTTER_EXPORT
gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
const cairo_rectangle_int_t *rect,
float scale,
uint8_t *data,
int stride,
CoglPixelFormat format,
ClutterPaintFlag paint_flags,
GError **error);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_freeze_updates (ClutterStage *stage); void clutter_stage_freeze_updates (ClutterStage *stage);

View File

@@ -74,7 +74,6 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-stage-private.h" #include "clutter-stage-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-volume-private.h" #include "clutter-paint-volume-private.h"
#include "clutter-actor-box-private.h" #include "clutter-actor-box-private.h"
@@ -118,7 +117,11 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
meta_class->set_actor (meta, actor); meta_class->set_actor (meta, actor);
/* clear out the previous state */ /* clear out the previous state */
g_clear_pointer (&priv->offscreen, cogl_object_unref); if (priv->offscreen != NULL)
{
cogl_object_unref (priv->offscreen);
priv->offscreen = NULL;
}
/* we keep a back pointer here, to avoid going through the ActorMeta */ /* we keep a back pointer here, to avoid going through the ActorMeta */
priv->actor = clutter_actor_meta_get_actor (meta); priv->actor = clutter_actor_meta_get_actor (meta);
@@ -194,8 +197,17 @@ update_fbo (ClutterEffect *effect,
ensure_pipeline_filter_for_scale (self, resource_scale); ensure_pipeline_filter_for_scale (self, resource_scale);
} }
g_clear_pointer (&priv->texture, cogl_object_unref); if (priv->texture != NULL)
g_clear_pointer (&priv->offscreen, cogl_object_unref); {
cogl_object_unref (priv->texture);
priv->texture = NULL;
}
if (priv->offscreen != NULL)
{
cogl_object_unref (priv->offscreen);
priv->offscreen = NULL;
}
priv->texture = priv->texture =
clutter_offscreen_effect_create_texture (self, target_width, target_height); clutter_offscreen_effect_create_texture (self, target_width, target_height);
@@ -225,8 +237,7 @@ update_fbo (ClutterEffect *effect,
} }
static gboolean 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); ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv; ClutterOffscreenEffectPrivate *priv = self->priv;
@@ -237,7 +248,6 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
CoglColor transparent; CoglColor transparent;
gfloat stage_width, stage_height; gfloat stage_width, stage_height;
gfloat target_width = -1, target_height = -1; gfloat target_width = -1, target_height = -1;
CoglFramebuffer *framebuffer;
gfloat resource_scale; gfloat resource_scale;
gfloat ceiled_resource_scale; gfloat ceiled_resource_scale;
graphene_point3d_t local_offset; graphene_point3d_t local_offset;
@@ -302,10 +312,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
if (!update_fbo (effect, target_width, target_height, resource_scale)) if (!update_fbo (effect, target_width, target_height, resource_scale))
return FALSE; return FALSE;
framebuffer = clutter_paint_context_get_framebuffer (paint_context); cogl_get_modelview_matrix (&old_modelview);
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen); /* let's draw offscreen */
cogl_push_framebuffer (priv->offscreen);
/* We don't want the FBO contents to be transformed. That could waste memory /* 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 * (e.g. during zoom), or result in something that's not rectangular (clipped
@@ -315,7 +325,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
* contents on screen... * contents on screen...
*/ */
clutter_actor_get_transform (priv->stage, &modelview); clutter_actor_get_transform (priv->stage, &modelview);
cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview); cogl_set_modelview_matrix (&modelview);
/* Save the original viewport for calculating priv->position */ /* Save the original viewport for calculating priv->position */
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage), _clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
@@ -327,11 +337,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
/* Set up the viewport so that it has the same size as the stage (avoid /* Set up the viewport so that it has the same size as the stage (avoid
* distortion), but translated to account for the FBO offset... * distortion), but translated to account for the FBO offset...
*/ */
cogl_framebuffer_set_viewport (priv->offscreen, cogl_set_viewport (-priv->fbo_offset_x,
-priv->fbo_offset_x, -priv->fbo_offset_y,
-priv->fbo_offset_y, stage_width,
stage_width, stage_height);
stage_height);
/* Copy the stage's projection matrix across to the framebuffer */ /* Copy the stage's projection matrix across to the framebuffer */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage), _clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
@@ -348,15 +357,14 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
&priv->position, &priv->position,
1); 1);
cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection); cogl_set_projection_matrix (&projection);
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0); cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
cogl_framebuffer_clear (priv->offscreen, cogl_clear (&transparent,
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH, COGL_BUFFER_BIT_DEPTH);
&transparent);
cogl_framebuffer_push_matrix (priv->offscreen); cogl_push_matrix ();
/* Override the actor's opacity to fully opaque - we paint the 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 * texture with the actor's paint opacity, so we need to do this to avoid
@@ -370,12 +378,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
} }
static void 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; ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
guint8 paint_opacity; guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (priv->actor); paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
@@ -401,21 +407,18 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
} }
static void static void
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect, clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
ClutterPaintContext *paint_context)
{ {
ClutterOffscreenEffectPrivate *priv = effect->priv; ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglMatrix modelview; CoglMatrix modelview;
float resource_scale; float resource_scale;
cogl_framebuffer_push_matrix (framebuffer); cogl_push_matrix ();
/* The current modelview matrix is *almost* perfect already. It's only /* The current modelview matrix is *almost* perfect already. It's only
* missing a correction for the expanded FBO and offset rendering within... * missing a correction for the expanded FBO and offset rendering within...
*/ */
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview); cogl_get_modelview_matrix (&modelview);
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) && if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
resource_scale != 1.0f) resource_scale != 1.0f)
@@ -428,23 +431,21 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
priv->fbo_offset_x, priv->fbo_offset_x,
priv->fbo_offset_y, priv->fbo_offset_y,
0.0f); 0.0f);
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview); cogl_set_modelview_matrix (&modelview);
/* paint the target material; this is virtualized for /* paint the target material; this is virtualized for
* sub-classes that require special hand-holding * sub-classes that require special hand-holding
*/ */
clutter_offscreen_effect_paint_target (effect, paint_context); clutter_offscreen_effect_paint_target (effect);
cogl_framebuffer_pop_matrix (framebuffer); cogl_pop_matrix ();
} }
static void 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); ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv; ClutterOffscreenEffectPrivate *priv = self->priv;
CoglFramebuffer *framebuffer;
if (priv->offscreen == NULL || if (priv->offscreen == NULL ||
priv->target == NULL || priv->target == NULL ||
@@ -454,60 +455,31 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect,
/* Restore the previous opacity override */ /* Restore the previous opacity override */
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override); clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
framebuffer = clutter_paint_context_get_framebuffer (paint_context); cogl_pop_matrix ();
cogl_framebuffer_pop_matrix (framebuffer); cogl_pop_framebuffer ();
clutter_paint_context_pop_framebuffer (paint_context);
clutter_offscreen_effect_paint_texture (self, paint_context); clutter_offscreen_effect_paint_texture (self);
} }
static void static void
clutter_offscreen_effect_paint (ClutterEffect *effect, clutter_offscreen_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags) ClutterEffectPaintFlags flags)
{ {
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect); ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv; 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 /* 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. * then we can just use the cached image in the FBO.
*/ */
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY)) if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
{ {
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect); /* Chain up to the parent paint method which will call the pre and
gboolean pre_paint_succeeded; post paint functions to update the image */
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
pre_paint_succeeded = effect_class->pre_paint (effect, paint_context); paint (effect, flags);
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 else
clutter_offscreen_effect_paint_texture (self, paint_context); clutter_offscreen_effect_paint_texture (self);
}
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 static void
@@ -516,9 +488,14 @@ clutter_offscreen_effect_finalize (GObject *gobject)
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject); ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
ClutterOffscreenEffectPrivate *priv = self->priv; ClutterOffscreenEffectPrivate *priv = self->priv;
g_clear_pointer (&priv->offscreen, cogl_object_unref); if (priv->offscreen)
g_clear_pointer (&priv->texture, cogl_object_unref); cogl_object_unref (priv->offscreen);
g_clear_pointer (&priv->target, cogl_object_unref);
if (priv->target)
cogl_object_unref (priv->target);
if (priv->texture)
cogl_object_unref (priv->texture);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject); G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
} }
@@ -540,7 +517,6 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
effect_class->paint = clutter_offscreen_effect_paint; effect_class->paint = clutter_offscreen_effect_paint;
gobject_class->finalize = clutter_offscreen_effect_finalize; gobject_class->finalize = clutter_offscreen_effect_finalize;
gobject_class->notify = clutter_offscreen_effect_notify;
} }
static void static void
@@ -606,20 +582,17 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
/** /**
* clutter_offscreen_effect_paint_target: * clutter_offscreen_effect_paint_target:
* @effect: a #ClutterOffscreenEffect * @effect: a #ClutterOffscreenEffect
* @paint_context: a #ClutterPaintContext
* *
* Calls the paint_target() virtual function of the @effect * Calls the paint_target() virtual function of the @effect
* *
* Since: 1.4 * Since: 1.4
*/ */
void 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)); 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);
} }
/** /**

View File

@@ -79,8 +79,7 @@ struct _ClutterOffscreenEffectClass
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect, CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
gfloat width, gfloat width,
gfloat height); gfloat height);
void (* paint_target) (ClutterOffscreenEffect *effect, void (* paint_target) (ClutterOffscreenEffect *effect);
ClutterPaintContext *paint_context);
/*< private >*/ /*< private >*/
void (* _clutter_offscreen1) (void); void (* _clutter_offscreen1) (void);
@@ -102,8 +101,7 @@ CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect); CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect, void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
ClutterPaintContext *paint_context);
CLUTTER_EXPORT CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect, CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
gfloat width, gfloat width,

View File

@@ -1,41 +0,0 @@
/*
* 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"
typedef enum _ClutterPaintFlag
{
CLUTTER_PAINT_FLAG_NONE = 0,
CLUTTER_PAINT_FLAG_NO_CURSORS = 1 << 0,
CLUTTER_PAINT_FLAG_NO_PAINT_SIGNAL = 1 << 1,
} ClutterPaintFlag;
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view,
const cairo_region_t *redraw_clip,
ClutterPaintFlag paint_flags);
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */

View File

@@ -1,187 +0,0 @@
/*
* 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;
ClutterPaintFlag paint_flags;
GList *framebuffers;
ClutterStageView *view;
cairo_region_t *redraw_clip;
};
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,
const cairo_region_t *redraw_clip,
ClutterPaintFlag paint_flags)
{
ClutterPaintContext *paint_context;
CoglFramebuffer *framebuffer;
paint_context = g_new0 (ClutterPaintContext, 1);
g_ref_count_init (&paint_context->ref_count);
paint_context->view = view;
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
paint_context->paint_flags = paint_flags;
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);
paint_context->paint_flags = (CLUTTER_PAINT_FLAG_NO_CURSORS |
CLUTTER_PAINT_FLAG_NO_PAINT_SIGNAL);
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;
g_clear_pointer (&paint_context->redraw_clip, cairo_region_destroy);
}
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);
}
const cairo_region_t *
clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context)
{
return paint_context->redraw_clip;
}
/**
* 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;
}
/**
* clutter_paint_context_get_paint_flags: (skip)
*/
ClutterPaintFlag
clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context)
{
return paint_context->paint_flags;
}

View File

@@ -1,65 +0,0 @@
/*
* 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);
CLUTTER_EXPORT
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_H */

View File

@@ -27,7 +27,6 @@
#include <glib-object.h> #include <glib-object.h>
#include <json-glib/json-glib.h> #include <json-glib/json-glib.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-paint-node.h> #include <clutter/clutter-paint-node.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -49,11 +48,11 @@ struct _ClutterPaintNode
ClutterPaintNode *next_sibling; ClutterPaintNode *next_sibling;
ClutterPaintNode *last_child; ClutterPaintNode *last_child;
guint n_children;
GArray *operations; GArray *operations;
const gchar *name; gchar *name;
guint n_children;
volatile int ref_count; volatile int ref_count;
}; };
@@ -64,12 +63,9 @@ struct _ClutterPaintNodeClass
void (* finalize) (ClutterPaintNode *node); void (* finalize) (ClutterPaintNode *node);
gboolean (* pre_draw) (ClutterPaintNode *node, gboolean (* pre_draw) (ClutterPaintNode *node);
ClutterPaintContext *paint_context); void (* draw) (ClutterPaintNode *node);
void (* draw) (ClutterPaintNode *node, void (* post_draw) (ClutterPaintNode *node);
ClutterPaintContext *paint_context);
void (* post_draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
JsonNode*(* serialize) (ClutterPaintNode *node); JsonNode*(* serialize) (ClutterPaintNode *node);
@@ -115,8 +111,7 @@ void _clutter_paint_node_init_types (void);
gpointer _clutter_paint_node_create (GType gtype); gpointer _clutter_paint_node_create (GType gtype);
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix); 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); void _clutter_paint_node_dump_tree (ClutterPaintNode *root);

View File

@@ -171,6 +171,8 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
{ {
ClutterPaintNode *iter; ClutterPaintNode *iter;
g_free (node->name);
if (node->operations != NULL) if (node->operations != NULL)
{ {
guint i; guint i;
@@ -200,21 +202,18 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
} }
static gboolean static gboolean
clutter_paint_node_real_pre_draw (ClutterPaintNode *node, clutter_paint_node_real_pre_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
return FALSE; return FALSE;
} }
static void static void
clutter_paint_node_real_draw (ClutterPaintNode *node, clutter_paint_node_real_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
} }
static void static void
clutter_paint_node_real_post_draw (ClutterPaintNode *node, clutter_paint_node_real_post_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
} }
@@ -295,8 +294,7 @@ clutter_paint_node_get_type (void)
* *
* The @name will be used for debugging purposes. * The @name will be used for debugging purposes.
* *
* The @node will intern @name using g_intern_string(). If you have access to a * The @node will copy the passed string.
* static string, use clutter_paint_node_set_static_name() instead.
* *
* Since: 1.10 * Since: 1.10
*/ */
@@ -306,22 +304,8 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
{ {
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node)); g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
node->name = g_intern_string (name); g_free (node->name);
} node->name = g_strdup (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;
} }
/** /**
@@ -1013,30 +997,29 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
* its children, if any. * its children, if any.
*/ */
void void
clutter_paint_node_paint (ClutterPaintNode *node, clutter_paint_node_paint (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node); ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
ClutterPaintNode *iter; ClutterPaintNode *iter;
gboolean res; gboolean res;
res = klass->pre_draw (node, paint_context); res = klass->pre_draw (node);
if (res) if (res)
{ {
klass->draw (node, paint_context); klass->draw (node);
} }
for (iter = node->first_child; for (iter = node->first_child;
iter != NULL; iter != NULL;
iter = iter->next_sibling) iter = iter->next_sibling)
{ {
clutter_paint_node_paint (iter, paint_context); clutter_paint_node_paint (iter);
} }
if (res) if (res)
{ {
klass->post_draw (node, paint_context); klass->post_draw (node);
} }
} }
@@ -1194,6 +1177,8 @@ _clutter_paint_node_create (GType gtype)
{ {
g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL); g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL);
_clutter_paint_node_init_types ();
return (gpointer) g_type_create_instance (gtype); return (gpointer) g_type_create_instance (gtype);
} }
@@ -1214,10 +1199,9 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
* @node: a #ClutterPaintNode * @node: a #ClutterPaintNode
* *
* Retrieves the #CoglFramebuffer that @node will draw * Retrieves the #CoglFramebuffer that @node will draw
* into, if it the root node has a custom framebuffer set. * into.
* *
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is * Returns: (transfer none): a #CoglFramebuffer
* set.
*/ */
CoglFramebuffer * CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node) clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
@@ -1225,9 +1209,12 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
ClutterPaintNode *root = clutter_paint_node_get_root (node); ClutterPaintNode *root = clutter_paint_node_get_root (node);
ClutterPaintNodeClass *klass; ClutterPaintNodeClass *klass;
if (root == NULL)
return NULL;
klass = CLUTTER_PAINT_NODE_GET_CLASS (root); klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
if (klass->get_framebuffer != NULL) if (klass->get_framebuffer != NULL)
return klass->get_framebuffer (root); return klass->get_framebuffer (root);
else
return NULL; return cogl_get_draw_framebuffer ();
} }

View File

@@ -50,15 +50,11 @@ CLUTTER_EXPORT
void clutter_paint_node_unref (ClutterPaintNode *node); void clutter_paint_node_unref (ClutterPaintNode *node);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_paint_node_paint (ClutterPaintNode *node, void clutter_paint_node_paint (ClutterPaintNode *node);
ClutterPaintContext *paint_context);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_paint_node_set_name (ClutterPaintNode *node, void clutter_paint_node_set_name (ClutterPaintNode *node,
const char *name); const char *name);
CLUTTER_EXPORT
void clutter_paint_node_set_static_name (ClutterPaintNode *node,
const char *name);
CLUTTER_EXPORT CLUTTER_EXPORT
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node); CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);

View File

@@ -44,7 +44,6 @@
#include "clutter-color.h" #include "clutter-color.h"
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h" #include "clutter-paint-nodes.h"
@@ -104,12 +103,11 @@ struct _ClutterRootNode
G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean static gboolean
clutter_root_node_pre_draw (ClutterPaintNode *node, clutter_root_node_pre_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterRootNode *rnode = (ClutterRootNode *) node; ClutterRootNode *rnode = (ClutterRootNode *) node;
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer); cogl_push_framebuffer (rnode->framebuffer);
cogl_framebuffer_clear (rnode->framebuffer, cogl_framebuffer_clear (rnode->framebuffer,
rnode->clear_flags, rnode->clear_flags,
@@ -119,10 +117,9 @@ clutter_root_node_pre_draw (ClutterPaintNode *node,
} }
static void static void
clutter_root_node_post_draw (ClutterPaintNode *node, clutter_root_node_post_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
clutter_paint_context_pop_framebuffer (paint_context); cogl_pop_framebuffer ();
} }
static void static void
@@ -166,8 +163,6 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
{ {
ClutterRootNode *res; ClutterRootNode *res;
g_return_val_if_fail (framebuffer, NULL);
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE); res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
cogl_color_init_from_4ub (&res->clear_color, cogl_color_init_from_4ub (&res->clear_color,
@@ -177,7 +172,11 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
clear_color->alpha); clear_color->alpha);
cogl_color_premultiply (&res->clear_color); cogl_color_premultiply (&res->clear_color);
res->framebuffer = cogl_object_ref (framebuffer); if (G_LIKELY (framebuffer != NULL))
res->framebuffer = cogl_object_ref (framebuffer);
else
res->framebuffer = cogl_object_ref (cogl_get_draw_framebuffer ());
res->clear_flags = clear_flags; res->clear_flags = clear_flags;
return (ClutterPaintNode *) res; return (ClutterPaintNode *) res;
@@ -202,12 +201,10 @@ struct _ClutterTransformNodeClass
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean static gboolean
clutter_transform_node_pre_draw (ClutterPaintNode *node, clutter_transform_node_pre_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterTransformNode *transform_node = (ClutterTransformNode *) node; ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
CoglFramebuffer *fb = CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_push_matrix (fb); cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_transform (fb, &transform_node->transform); cogl_framebuffer_transform (fb, &transform_node->transform);
@@ -216,11 +213,9 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node,
} }
static void static void
clutter_transform_node_post_draw (ClutterPaintNode *node, clutter_transform_node_post_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
CoglFramebuffer *fb = CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (fb); cogl_framebuffer_pop_matrix (fb);
} }
@@ -283,8 +278,7 @@ struct _ClutterDummyNode
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean static gboolean
clutter_dummy_node_pre_draw (ClutterPaintNode *node, clutter_dummy_node_pre_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
return TRUE; return TRUE;
} }
@@ -321,16 +315,6 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
return dnode->framebuffer; 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 static void
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass) clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
{ {
@@ -339,7 +323,6 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
node_class->pre_draw = clutter_dummy_node_pre_draw; node_class->pre_draw = clutter_dummy_node_pre_draw;
node_class->serialize = clutter_dummy_node_serialize; node_class->serialize = clutter_dummy_node_serialize;
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer; node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
node_class->finalize = clutter_dummy_node_finalize;
} }
static void static void
@@ -348,8 +331,7 @@ clutter_dummy_node_init (ClutterDummyNode *self)
} }
ClutterPaintNode * ClutterPaintNode *
_clutter_dummy_node_new (ClutterActor *actor, _clutter_dummy_node_new (ClutterActor *actor)
CoglFramebuffer *framebuffer)
{ {
ClutterPaintNode *res; ClutterPaintNode *res;
ClutterDummyNode *dnode; ClutterDummyNode *dnode;
@@ -358,7 +340,7 @@ _clutter_dummy_node_new (ClutterActor *actor,
dnode = (ClutterDummyNode *) res; dnode = (ClutterDummyNode *) res;
dnode->actor = actor; dnode->actor = actor;
dnode->framebuffer = cogl_object_ref (framebuffer); dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
return res; return res;
} }
@@ -401,34 +383,22 @@ clutter_pipeline_node_finalize (ClutterPaintNode *node)
} }
static gboolean 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); ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
if (node->operations != NULL && if (node->operations != NULL &&
pnode->pipeline != NULL) pnode->pipeline != NULL)
return TRUE; {
cogl_push_source (pnode->pipeline);
return TRUE;
}
return FALSE; 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 static void
clutter_pipeline_node_draw (ClutterPaintNode *node, clutter_pipeline_node_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node); ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
CoglFramebuffer *fb; CoglFramebuffer *fb;
@@ -440,7 +410,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return; return;
fb = clutter_paint_context_get_framebuffer (paint_context); fb = clutter_paint_node_get_framebuffer (node);
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {
@@ -454,20 +424,18 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
break; break;
case PAINT_OP_TEX_RECT: case PAINT_OP_TEX_RECT:
cogl_framebuffer_draw_textured_rectangle (fb, cogl_rectangle_with_texture_coords (op->op.texrect[0],
pnode->pipeline, op->op.texrect[1],
op->op.texrect[0], op->op.texrect[2],
op->op.texrect[1], op->op.texrect[3],
op->op.texrect[2], op->op.texrect[4],
op->op.texrect[3], op->op.texrect[5],
op->op.texrect[4], op->op.texrect[6],
op->op.texrect[5], op->op.texrect[7]);
op->op.texrect[6],
op->op.texrect[7]);
break; break;
case PAINT_OP_MULTITEX_RECT: case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (fb, cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
pnode->pipeline, pnode->pipeline,
op->op.texrect[0], op->op.texrect[0],
op->op.texrect[1], op->op.texrect[1],
@@ -478,7 +446,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
break; break;
case PAINT_OP_PATH: case PAINT_OP_PATH:
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path); cogl_path_fill (op->op.path);
break; break;
case PAINT_OP_PRIMITIVE: case PAINT_OP_PRIMITIVE:
@@ -491,9 +459,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
} }
static void static void
clutter_pipeline_node_post_draw (ClutterPaintNode *node, clutter_pipeline_node_post_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
cogl_pop_source ();
} }
static JsonNode * static JsonNode *
@@ -812,8 +780,7 @@ clutter_text_node_finalize (ClutterPaintNode *node)
} }
static gboolean 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); ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
@@ -821,8 +788,7 @@ clutter_text_node_pre_draw (ClutterPaintNode *node,
} }
static void static void
clutter_text_node_draw (ClutterPaintNode *node, clutter_text_node_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node); ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
PangoRectangle extents; PangoRectangle extents;
@@ -832,7 +798,7 @@ clutter_text_node_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return; return;
fb = get_target_framebuffer (node, paint_context); fb = clutter_paint_node_get_framebuffer (node);
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents); pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
@@ -865,11 +831,11 @@ clutter_text_node_draw (ClutterPaintNode *node,
clipped = TRUE; clipped = TRUE;
} }
cogl_pango_show_layout (fb, cogl_pango_render_layout (tnode->layout,
tnode->layout, op->op.texrect[0],
op->op.texrect[0], op->op.texrect[1],
op->op.texrect[1], &tnode->color,
&tnode->color); 0);
if (clipped) if (clipped)
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
@@ -1008,8 +974,7 @@ struct _ClutterClipNodeClass
G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean static gboolean
clutter_clip_node_pre_draw (ClutterPaintNode *node, clutter_clip_node_pre_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
gboolean retval = FALSE; gboolean retval = FALSE;
CoglFramebuffer *fb; CoglFramebuffer *fb;
@@ -1018,7 +983,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return FALSE; return FALSE;
fb = get_target_framebuffer (node, paint_context); fb = clutter_paint_node_get_framebuffer (node);
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {
@@ -1053,8 +1018,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
} }
static void static void
clutter_clip_node_post_draw (ClutterPaintNode *node, clutter_clip_node_post_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
CoglFramebuffer *fb; CoglFramebuffer *fb;
guint i; guint i;
@@ -1062,7 +1026,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
if (node->operations == NULL) if (node->operations == NULL)
return; return;
fb = get_target_framebuffer (node, paint_context); fb = clutter_paint_node_get_framebuffer (node);
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {
@@ -1136,8 +1100,7 @@ struct _ClutterActorNodeClass
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean 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); ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
@@ -1147,17 +1110,15 @@ clutter_actor_node_pre_draw (ClutterPaintNode *node,
} }
static void static void
clutter_actor_node_draw (ClutterPaintNode *node, clutter_actor_node_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node); ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
clutter_actor_continue_paint (actor_node->actor, paint_context); clutter_actor_continue_paint (actor_node->actor);
} }
static void 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); ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
@@ -1182,7 +1143,6 @@ clutter_actor_node_serialize (ClutterPaintNode *node)
return json_builder_get_root (builder); return json_builder_get_root (builder);
} }
static void static void
clutter_actor_node_class_init (ClutterActorNodeClass *klass) clutter_actor_node_class_init (ClutterActorNodeClass *klass)
{ {
@@ -1257,11 +1217,9 @@ struct _ClutterLayerNodeClass
G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean static gboolean
clutter_layer_node_pre_draw (ClutterPaintNode *node, clutter_layer_node_pre_draw (ClutterPaintNode *node)
ClutterPaintContext *paint_context)
{ {
ClutterLayerNode *lnode = (ClutterLayerNode *) node; ClutterLayerNode *lnode = (ClutterLayerNode *) node;
CoglFramebuffer *framebuffer;
CoglMatrix matrix; CoglMatrix matrix;
/* if we were unable to create an offscreen buffer for this node, then /* if we were unable to create an offscreen buffer for this node, then
@@ -1277,10 +1235,9 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
/* copy the same modelview from the current framebuffer to the one we /* copy the same modelview from the current framebuffer to the one we
* are going to use * are going to use
*/ */
framebuffer = clutter_paint_context_get_framebuffer (paint_context); cogl_get_modelview_matrix (&matrix);
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen); cogl_push_framebuffer (lnode->offscreen);
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix); cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
@@ -1298,7 +1255,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
0.f, 0.f, 0.f, 0.f); 0.f, 0.f, 0.f, 0.f);
cogl_framebuffer_push_matrix (lnode->offscreen); cogl_push_matrix ();
/* every draw operation after this point will happen an offscreen /* every draw operation after this point will happen an offscreen
* framebuffer * framebuffer
@@ -1308,18 +1265,17 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
} }
static void 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); ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
CoglFramebuffer *fb; CoglFramebuffer *fb;
guint i; guint i;
/* switch to the previous framebuffer */ /* switch to the previous framebuffer */
cogl_framebuffer_pop_matrix (lnode->offscreen); cogl_pop_matrix ();
clutter_paint_context_pop_framebuffer (paint_context); cogl_pop_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context); fb = cogl_get_draw_framebuffer ();
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {
@@ -1333,20 +1289,20 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
case PAINT_OP_TEX_RECT: case PAINT_OP_TEX_RECT:
/* now we need to paint the texture */ /* now we need to paint the texture */
cogl_framebuffer_draw_textured_rectangle (fb, cogl_push_source (lnode->state);
lnode->state, cogl_rectangle_with_texture_coords (op->op.texrect[0],
op->op.texrect[0], op->op.texrect[1],
op->op.texrect[1], op->op.texrect[2],
op->op.texrect[2], op->op.texrect[3],
op->op.texrect[3], op->op.texrect[4],
op->op.texrect[4], op->op.texrect[5],
op->op.texrect[5], op->op.texrect[6],
op->op.texrect[6], op->op.texrect[7]);
op->op.texrect[7]); cogl_pop_source ();
break; break;
case PAINT_OP_MULTITEX_RECT: case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (fb, cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
lnode->state, lnode->state,
op->op.texrect[0], op->op.texrect[0],
op->op.texrect[1], op->op.texrect[1],
@@ -1357,7 +1313,9 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
break; break;
case PAINT_OP_PATH: case PAINT_OP_PATH:
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path); cogl_push_source (lnode->state);
cogl_path_fill (op->op.path);
cogl_pop_source ();
break; break;
case PAINT_OP_PRIMITIVE: case PAINT_OP_PRIMITIVE:

View File

@@ -1,25 +0,0 @@
/*
* 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 */

View File

@@ -1,83 +0,0 @@
/*
* 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;
}

View File

@@ -1,49 +0,0 @@
/*
* 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 */

View File

@@ -248,9 +248,6 @@ gboolean _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1
const cairo_rectangle_int_t *src2, const cairo_rectangle_int_t *src2,
cairo_rectangle_int_t *dest); cairo_rectangle_int_t *dest);
gboolean clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2);
struct _ClutterVertex4 struct _ClutterVertex4
{ {

View File

@@ -41,7 +41,6 @@ enum
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED, PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
PTR_A11Y_TIMEOUT_STARTED, PTR_A11Y_TIMEOUT_STARTED,
PTR_A11Y_TIMEOUT_STOPPED, PTR_A11Y_TIMEOUT_STOPPED,
IS_UNFOCUS_INHIBITED_CHANGED,
N_SIGNALS, N_SIGNALS,
}; };
@@ -51,7 +50,6 @@ enum
{ {
PROP_0, PROP_0,
PROP_BACKEND, PROP_BACKEND,
PROP_TOUCH_MODE,
N_PROPS N_PROPS
}; };
@@ -63,8 +61,6 @@ struct _ClutterSeatPrivate
{ {
ClutterBackend *backend; ClutterBackend *backend;
unsigned int inhibit_unfocus_count;
/* Keyboard a11y */ /* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings; ClutterKbdA11ySettings kbd_a11y_settings;
@@ -88,7 +84,6 @@ clutter_seat_set_property (GObject *object,
case PROP_BACKEND: case PROP_BACKEND:
priv->backend = g_value_get_object (value); priv->backend = g_value_get_object (value);
break; break;
case PROP_TOUCH_MODE:
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@@ -108,9 +103,6 @@ clutter_seat_get_property (GObject *object,
case PROP_BACKEND: case PROP_BACKEND:
g_value_set_object (value, priv->backend); g_value_set_object (value, priv->backend);
break; break;
case PROP_TOUCH_MODE:
g_value_set_boolean (value, FALSE);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@@ -140,17 +132,25 @@ clutter_seat_class_init (ClutterSeatClass *klass)
g_signal_new (I_("device-added"), g_signal_new (I_("device-added"),
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, 0, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE); 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] = signals[DEVICE_REMOVED] =
g_signal_new (I_("device-removed"), g_signal_new (I_("device-removed"),
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, 0, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE); 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] = signals[TOOL_CHANGED] =
g_signal_new (I_("tool-changed"), g_signal_new (I_("tool-changed"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
@@ -223,9 +223,13 @@ clutter_seat_class_init (ClutterSeatClass *klass)
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"), g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, 0, NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE); 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: * ClutterSeat::ptr-a11y-timeout-started:
@@ -278,22 +282,6 @@ clutter_seat_class_init (ClutterSeatClass *klass)
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEANv); _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] = props[PROP_BACKEND] =
g_param_spec_object ("backend", g_param_spec_object ("backend",
P_("Backend"), P_("Backend"),
@@ -301,19 +289,6 @@ clutter_seat_class_init (ClutterSeatClass *klass)
CLUTTER_TYPE_BACKEND, CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); 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); g_object_class_install_properties (object_class, N_PROPS, props);
} }
@@ -360,10 +335,7 @@ clutter_seat_get_keyboard (ClutterSeat *seat)
* *
* Returns the list of HW devices * Returns the list of HW devices
* *
* Returns: (transfer container) (element-type Clutter.InputDevice): A list * Returns: (transfer container) (element-type Clutter.InputDevice): A list of #ClutterInputDevice
* 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 * GList *
clutter_seat_list_devices (ClutterSeat *seat) clutter_seat_list_devices (ClutterSeat *seat)
@@ -533,85 +505,6 @@ clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat
priv->pointer_a11y_settings.dwell_click_type = click_type; 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: * clutter_seat_create_virtual_device:
* @seat: a #ClutterSeat * @seat: a #ClutterSeat
@@ -658,9 +551,10 @@ clutter_seat_compress_motion (ClutterSeat *seat,
g_return_if_fail (CLUTTER_IS_SEAT (seat)); g_return_if_fail (CLUTTER_IS_SEAT (seat));
seat_class = CLUTTER_SEAT_GET_CLASS (seat); seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (!seat_class->compress_motion)
return;
if (seat_class->compress_motion) seat_class->compress_motion (seat, event, to_discard);
seat_class->compress_motion (seat, event, to_discard);
} }
void void
@@ -672,29 +566,3 @@ clutter_seat_warp_pointer (ClutterSeat *seat,
CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y); 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
* - 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;
}

View File

@@ -159,16 +159,6 @@ void clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat, void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
ClutterPointerA11yDwellClickType click_type); 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 CLUTTER_EXPORT
ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat *seat, ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat *seat,
ClutterInputDeviceType device_type); ClutterInputDeviceType device_type);
@@ -184,7 +174,5 @@ CLUTTER_EXPORT
void clutter_seat_warp_pointer (ClutterSeat *seat, void clutter_seat_warp_pointer (ClutterSeat *seat,
int x, int x,
int y); int y);
CLUTTER_EXPORT
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
#endif /* CLUTTER_SEAT_H */ #endif /* CLUTTER_SEAT_H */

View File

@@ -367,12 +367,24 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
CLUTTER_NOTE (SHADER, "Compiling shader effect"); CLUTTER_NOTE (SHADER, "Compiling shader effect");
class_priv->program = cogl_create_program (); cogl_shader_compile (class_priv->shader);
cogl_program_attach_shader (class_priv->program, if (cogl_shader_is_compiled (class_priv->shader))
class_priv->shader); {
class_priv->program = cogl_create_program ();
cogl_program_link (class_priv->program); 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);
}
} }
priv->shader = cogl_object_ref (class_priv->shader); priv->shader = cogl_object_ref (class_priv->shader);
@@ -383,8 +395,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
} }
static void 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); ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
ClutterShaderEffectPrivate *priv = self->priv; ClutterShaderEffectPrivate *priv = self->priv;
@@ -414,7 +425,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
out: out:
/* paint the offscreen buffer */ /* paint the offscreen buffer */
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class); parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
parent->paint_target (effect, paint_context); parent->paint_target (effect);
} }
@@ -890,11 +901,23 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
CLUTTER_NOTE (SHADER, "Compiling shader effect"); CLUTTER_NOTE (SHADER, "Compiling shader effect");
priv->program = cogl_create_program (); cogl_shader_compile (priv->shader);
cogl_program_attach_shader (priv->program, priv->shader); if (cogl_shader_is_compiled (priv->shader))
{
priv->program = cogl_create_program ();
cogl_program_link (priv->program); 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);
}
return TRUE; return TRUE;
} }

View File

@@ -36,9 +36,9 @@ typedef struct _ClutterStageQueueRedrawEntry ClutterStageQueueRedrawEntry;
/* stage */ /* stage */
ClutterStageWindow *_clutter_stage_get_default_window (void); ClutterStageWindow *_clutter_stage_get_default_window (void);
void clutter_stage_paint_view (ClutterStage *stage, void _clutter_stage_paint_view (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view,
const cairo_region_t *redraw_clip); const cairo_rectangle_int_t *clip);
void _clutter_stage_emit_after_paint (ClutterStage *stage); void _clutter_stage_emit_after_paint (ClutterStage *stage);
@@ -78,7 +78,6 @@ void _clutter_stage_schedule_update (ClutterStage *stage);
gint64 _clutter_stage_get_update_time (ClutterStage *stage); gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage); void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage); gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
int64_t _clutter_stage_get_next_presentation_time (ClutterStage *stage);
void clutter_stage_log_pick (ClutterStage *stage, void clutter_stage_log_pick (ClutterStage *stage,
const graphene_point_t *vertices, const graphene_point_t *vertices,
@@ -105,6 +104,8 @@ ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (Clut
const ClutterPaintVolume *clip); const ClutterPaintVolume *clip);
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry); 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, void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device, ClutterInputDevice *device,
ClutterActor *actor); ClutterActor *actor);
@@ -142,9 +143,6 @@ void _clutter_stage_presented (ClutterStage *stag
GList * _clutter_stage_peek_stage_views (ClutterStage *stage); GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
ClutterActor *actor);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */ #endif /* __CLUTTER_STAGE_PRIVATE_H__ */

View File

@@ -20,7 +20,8 @@
#include "clutter/clutter-stage-view.h" #include "clutter/clutter-stage-view.h"
void clutter_stage_view_after_paint (ClutterStageView *view); void clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view); gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
@@ -32,15 +33,5 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view, void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty); gboolean dirty);
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view);
gboolean clutter_stage_view_has_redraw_clip (ClutterStageView *view);
const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */ #endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */

View File

@@ -23,8 +23,6 @@
#include <cairo-gobject.h> #include <cairo-gobject.h>
#include <math.h> #include <math.h>
#include "clutter/clutter-private.h"
enum enum
{ {
PROP_0, PROP_0,
@@ -52,9 +50,6 @@ typedef struct _ClutterStageViewPrivate
CoglOffscreen *shadowfb; CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline; CoglPipeline *shadowfb_pipeline;
gboolean has_redraw_clip;
cairo_region_t *redraw_clip;
guint dirty_viewport : 1; guint dirty_viewport : 1;
guint dirty_projection : 1; guint dirty_projection : 1;
} ClutterStageViewPrivate; } ClutterStageViewPrivate;
@@ -171,11 +166,12 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
} }
static void static void
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view, clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
CoglPipeline *pipeline, const cairo_rectangle_int_t *rect,
CoglFramebuffer *src_framebuffer, CoglPipeline *pipeline,
CoglFramebuffer *dst_framebuffer, CoglFramebuffer *src_framebuffer,
gboolean can_blit) CoglFramebuffer *dst_framebuffer,
gboolean can_blit)
{ {
CoglMatrix matrix; CoglMatrix matrix;
@@ -208,7 +204,8 @@ clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
} }
void void
clutter_stage_view_after_paint (ClutterStageView *view) clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{ {
ClutterStageViewPrivate *priv = ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
@@ -225,6 +222,7 @@ clutter_stage_view_after_paint (ClutterStageView *view)
if (priv->shadowfb) if (priv->shadowfb)
{ {
clutter_stage_view_copy_to_framebuffer (view, clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline, priv->offscreen_pipeline,
priv->offscreen, priv->offscreen,
priv->shadowfb, priv->shadowfb,
@@ -233,6 +231,7 @@ clutter_stage_view_after_paint (ClutterStageView *view)
else else
{ {
clutter_stage_view_copy_to_framebuffer (view, clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline, priv->offscreen_pipeline,
priv->offscreen, priv->offscreen,
priv->framebuffer, priv->framebuffer,
@@ -244,6 +243,7 @@ clutter_stage_view_after_paint (ClutterStageView *view)
{ {
clutter_stage_view_ensure_shadowfb_blit_pipeline (view); clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view, clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->shadowfb_pipeline, priv->shadowfb_pipeline,
priv->shadowfb, priv->shadowfb,
priv->framebuffer, priv->framebuffer,
@@ -307,86 +307,6 @@ clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
view_class->get_offscreen_transformation_matrix (view, matrix); view_class->get_offscreen_transformation_matrix (view, matrix);
} }
void
clutter_stage_view_add_redraw_clip (ClutterStageView *view,
const cairo_rectangle_int_t *clip)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->has_redraw_clip && !priv->redraw_clip)
return;
if (!clip)
{
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
priv->has_redraw_clip = TRUE;
return;
}
if (clip->width == 0 || clip->height == 0)
return;
if (!priv->redraw_clip)
{
if (!clutter_util_rectangle_equal (&priv->layout, clip))
priv->redraw_clip = cairo_region_create_rectangle (clip);
}
else
{
cairo_region_union_rectangle (priv->redraw_clip, clip);
if (cairo_region_num_rectangles (priv->redraw_clip) == 1)
{
cairo_rectangle_int_t redraw_clip_extents;
cairo_region_get_extents (priv->redraw_clip, &redraw_clip_extents);
if (clutter_util_rectangle_equal (&priv->layout, &redraw_clip_extents))
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
}
}
priv->has_redraw_clip = TRUE;
}
gboolean
clutter_stage_view_has_redraw_clip (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->has_redraw_clip;
}
gboolean
clutter_stage_view_has_full_redraw_clip (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->has_redraw_clip && !priv->redraw_clip;
}
const cairo_region_t *
clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->redraw_clip;
}
cairo_region_t *
clutter_stage_view_take_redraw_clip (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
priv->has_redraw_clip = FALSE;
return g_steal_pointer (&priv->redraw_clip);
}
void void
clutter_stage_view_transform_to_onscreen (ClutterStageView *view, clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
gfloat *x, gfloat *x,
@@ -499,7 +419,6 @@ clutter_stage_view_dispose (GObject *object)
g_clear_pointer (&priv->offscreen, cogl_object_unref); g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref); g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref); g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object); G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
} }

View File

@@ -178,20 +178,75 @@ _clutter_stage_window_clear_update_time (ClutterStageWindow *window)
iface->clear_update_time (window); iface->clear_update_time (window);
} }
int64_t void
_clutter_stage_window_get_next_presentation_time (ClutterStageWindow *window) _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{ {
ClutterStageWindowInterface *iface; ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 0); g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window); iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->add_redraw_clip != NULL)
iface->add_redraw_clip (window, stage_clip);
}
/* If not implemented then just revert to the old behaviour... */ /* Determines if the backend will clip the rendering of the next
if (iface->get_next_presentation_time == NULL) * frame.
return _clutter_stage_window_get_update_time (window); *
* Note: at the start of each new frame there is an implied clip that
* clips everything (i.e. nothing would be drawn) so this function
* will return True at the start of a new frame if the backend
* supports clipped redraws.
*/
gboolean
_clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
{
ClutterStageWindowInterface *iface;
return iface->get_next_presentation_time (window); g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->has_redraw_clips != NULL)
return iface->has_redraw_clips (window);
return FALSE;
}
/* Determines if the backend will discard any additional redraw clips
* and instead promote them to a full stage redraw.
*
* The ideas is that backend may have some heuristics that cause it to
* give up tracking redraw clips so this can be used to avoid the cost
* of calculating a redraw clip when we know it's going to be ignored
* anyway.
*/
gboolean
_clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
{
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->ignoring_redraw_clips != NULL)
return iface->ignoring_redraw_clips (window);
return TRUE;
}
cairo_region_t *
_clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
{
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_redraw_clip != NULL)
return iface->get_redraw_clip (window);
return NULL;
} }
void void

View File

@@ -51,6 +51,12 @@ struct _ClutterStageWindowInterface
gint64 (* get_update_time) (ClutterStageWindow *stage_window); gint64 (* get_update_time) (ClutterStageWindow *stage_window);
void (* clear_update_time) (ClutterStageWindow *stage_window); void (* clear_update_time) (ClutterStageWindow *stage_window);
void (* add_redraw_clip) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *stage_rectangle);
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
void (* set_accept_focus) (ClutterStageWindow *stage_window, void (* set_accept_focus) (ClutterStageWindow *stage_window,
gboolean accept_focus); gboolean accept_focus);
@@ -61,8 +67,6 @@ struct _ClutterStageWindowInterface
GList *(* get_views) (ClutterStageWindow *stage_window); GList *(* get_views) (ClutterStageWindow *stage_window);
int64_t (* get_frame_counter) (ClutterStageWindow *stage_window); int64_t (* get_frame_counter) (ClutterStageWindow *stage_window);
void (* finish_frame) (ClutterStageWindow *stage_window); void (* finish_frame) (ClutterStageWindow *stage_window);
int64_t (* get_next_presentation_time) (ClutterStageWindow *stage_window);
}; };
ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *window); ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *window);
@@ -90,6 +94,12 @@ void _clutter_stage_window_schedule_update (ClutterStageWin
gint64 _clutter_stage_window_get_update_time (ClutterStageWindow *window); gint64 _clutter_stage_window_get_update_time (ClutterStageWindow *window);
void _clutter_stage_window_clear_update_time (ClutterStageWindow *window); void _clutter_stage_window_clear_update_time (ClutterStageWindow *window);
void _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip);
gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window, void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus); gboolean accept_focus);
@@ -103,8 +113,6 @@ void _clutter_stage_window_finish_frame (ClutterStageWin
int64_t _clutter_stage_window_get_frame_counter (ClutterStageWindow *window); int64_t _clutter_stage_window_get_frame_counter (ClutterStageWindow *window);
int64_t _clutter_stage_window_get_next_presentation_time (ClutterStageWindow *window);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_STAGE_WINDOW_H__ */ #endif /* __CLUTTER_STAGE_WINDOW_H__ */

View File

@@ -68,9 +68,7 @@
#include "clutter-marshal.h" #include "clutter-marshal.h"
#include "clutter-master-clock.h" #include "clutter-master-clock.h"
#include "clutter-mutter.h" #include "clutter-mutter.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-volume-private.h" #include "clutter-paint-volume-private.h"
#include "clutter-pick-context-private.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-stage-manager-private.h" #include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h" #include "clutter-stage-private.h"
@@ -78,6 +76,7 @@
#include "clutter-private.h" #include "clutter-private.h"
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "cogl/cogl-trace.h"
struct _ClutterStageQueueRedrawEntry struct _ClutterStageQueueRedrawEntry
{ {
@@ -119,10 +118,10 @@ struct _ClutterStagePrivate
ClutterPlane current_clip_planes[4]; ClutterPlane current_clip_planes[4];
GHashTable *pending_relayouts;
unsigned int pending_relayouts_version;
GList *pending_queue_redraws; GList *pending_queue_redraws;
CoglFramebuffer *active_framebuffer;
gint sync_delay; gint sync_delay;
GTimer *fps_timer; GTimer *fps_timer;
@@ -143,8 +142,11 @@ struct _ClutterStagePrivate
gpointer paint_data; gpointer paint_data;
GDestroyNotify paint_notify; GDestroyNotify paint_notify;
cairo_rectangle_int_t view_clip;
int update_freeze_count; int update_freeze_count;
guint relayout_pending : 1;
guint redraw_pending : 1; guint redraw_pending : 1;
guint is_cursor_visible : 1; guint is_cursor_visible : 1;
guint throttle_motion_events : 1; guint throttle_motion_events : 1;
@@ -441,9 +443,9 @@ is_inside_axis_aligned_rectangle (const graphene_point_t *point,
const graphene_point_t *vertices) const graphene_point_t *vertices)
{ {
float min_x = FLT_MAX; float min_x = FLT_MAX;
float max_x = -FLT_MAX; float max_x = FLT_MIN;
float min_y = FLT_MAX; float min_y = FLT_MAX;
float max_y = -FLT_MAX; float max_y = FLT_MIN;
int i; int i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@@ -556,33 +558,6 @@ pick_record_contains_point (ClutterStage *stage,
return TRUE; return TRUE;
} }
static void
clutter_stage_add_redraw_clip (ClutterStage *stage,
cairo_rectangle_int_t *clip)
{
GList *l;
for (l = _clutter_stage_peek_stage_views (stage); l; l = l->next)
{
ClutterStageView *view = l->data;
if (!clip)
{
clutter_stage_view_add_redraw_clip (view, NULL);
}
else
{
cairo_rectangle_int_t view_layout;
cairo_rectangle_int_t intersection;
clutter_stage_view_get_layout (view, &view_layout);
if (_clutter_util_rectangle_intersection (&view_layout, clip,
&intersection))
clutter_stage_view_add_redraw_clip (view, &intersection);
}
}
}
static inline void static inline void
queue_full_redraw (ClutterStage *stage) queue_full_redraw (ClutterStage *stage)
{ {
@@ -601,7 +576,7 @@ queue_full_redraw (ClutterStage *stage)
if (stage_window == NULL) if (stage_window == NULL)
return; return;
clutter_stage_add_redraw_clip (stage, NULL); _clutter_stage_window_add_redraw_clip (stage_window, NULL);
} }
static gboolean static gboolean
@@ -863,6 +838,20 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
graphene_vec3_normalize (&plane->n, &plane->n); 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 /* XXX: Instead of having a toplevel 2D clip region, it might be
* better to have a clip volume within the view frustum. This could * better to have a clip volume within the view frustum. This could
* allow us to avoid projecting actors into window coordinates to * allow us to avoid projecting actors into window coordinates to
@@ -874,6 +863,7 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
const cairo_rectangle_int_t *clip) const cairo_rectangle_int_t *clip)
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
cairo_rectangle_int_t view_layout; cairo_rectangle_int_t view_layout;
float clip_poly[8]; float clip_poly[8];
float viewport[4]; float viewport[4];
@@ -924,33 +914,25 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
priv->current_clip_planes); priv->current_clip_planes);
_clutter_stage_paint_volume_stack_free_all (stage); _clutter_stage_paint_volume_stack_free_all (stage);
_clutter_stage_update_active_framebuffer (stage, framebuffer);
} }
static void static void
clutter_stage_do_paint_view (ClutterStage *stage, clutter_stage_do_paint_view (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view,
const cairo_region_t *redraw_clip) const cairo_rectangle_int_t *clip)
{ {
ClutterPaintContext *paint_context; setup_view_for_pick_or_paint (stage, view, clip);
cairo_rectangle_int_t clip_rect; clutter_actor_paint (CLUTTER_ACTOR (stage));
paint_context = clutter_paint_context_new_for_view (view, redraw_clip,
CLUTTER_PAINT_FLAG_NONE);
cairo_region_get_extents (redraw_clip, &clip_rect);
setup_view_for_pick_or_paint (stage, view, &clip_rect);
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 /* This provides a common point of entry for painting the scenegraph
* for picking or painting... * for picking or painting...
*/ */
void void
clutter_stage_paint_view (ClutterStage *stage, _clutter_stage_paint_view (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view,
const cairo_region_t *redraw_clip) const cairo_rectangle_int_t *clip)
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
@@ -959,11 +941,15 @@ clutter_stage_paint_view (ClutterStage *stage,
COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Paint (view)"); COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Paint (view)");
priv->view_clip = *clip;
if (g_signal_has_handler_pending (stage, stage_signals[PAINT_VIEW], if (g_signal_has_handler_pending (stage, stage_signals[PAINT_VIEW],
0, TRUE)) 0, TRUE))
g_signal_emit (stage, stage_signals[PAINT_VIEW], 0, view, redraw_clip); g_signal_emit (stage, stage_signals[PAINT_VIEW], 0, view);
else else
CLUTTER_STAGE_GET_CLASS (stage)->paint_view (stage, view, redraw_clip); CLUTTER_STAGE_GET_CLASS (stage)->paint_view (stage, view);
priv->view_clip = (cairo_rectangle_int_t) { 0 };
} }
void void
@@ -977,20 +963,18 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
* respect the Z order as it uses our empty sort_depth_order. * respect the Z order as it uses our empty sort_depth_order.
*/ */
static void static void
clutter_stage_paint (ClutterActor *self, clutter_stage_paint (ClutterActor *self)
ClutterPaintContext *paint_context)
{ {
ClutterActorIter iter; ClutterActorIter iter;
ClutterActor *child; ClutterActor *child;
clutter_actor_iter_init (&iter, self); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
clutter_actor_paint (child, paint_context); clutter_actor_paint (child);
} }
static void static void
clutter_stage_pick (ClutterActor *self, clutter_stage_pick (ClutterActor *self)
ClutterPickContext *pick_context)
{ {
ClutterActorIter iter; ClutterActorIter iter;
ClutterActor *child; ClutterActor *child;
@@ -1001,7 +985,7 @@ clutter_stage_pick (ClutterActor *self,
*/ */
clutter_actor_iter_init (&iter, self); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &child)) while (clutter_actor_iter_next (&iter, &child))
clutter_actor_pick (child, pick_context); clutter_actor_pick (child);
} }
static gboolean static gboolean
@@ -1312,20 +1296,7 @@ _clutter_stage_needs_update (ClutterStage *stage)
priv = stage->priv; priv = stage->priv;
return priv->redraw_pending || g_hash_table_size (priv->pending_relayouts) > 0; return priv->relayout_pending || priv->redraw_pending;
}
void
clutter_stage_queue_actor_relayout (ClutterStage *stage,
ClutterActor *actor)
{
ClutterStagePrivate *priv = stage->priv;
if (g_hash_table_size (priv->pending_relayouts) == 0)
_clutter_stage_schedule_update (stage);
g_hash_table_add (priv->pending_relayouts, g_object_ref (actor));
priv->pending_relayouts_version++;
} }
void void
@@ -1333,58 +1304,41 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
{ {
ClutterStage *stage = CLUTTER_STAGE (actor); ClutterStage *stage = CLUTTER_STAGE (actor);
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
GHashTableIter iter; gfloat natural_width, natural_height;
gpointer key; ClutterActorBox box = { 0, };
int count = 0;
/* No work to do? Avoid the extraneous debug log messages too. */ if (!priv->relayout_pending)
if (g_hash_table_size (priv->pending_relayouts) == 0)
return; return;
CLUTTER_NOTE (ACTOR, ">>> Recomputing layout"); /* avoid reentrancy */
if (!CLUTTER_ACTOR_IN_RELAYOUT (stage))
g_hash_table_iter_init (&iter, priv->pending_relayouts);
while (g_hash_table_iter_next (&iter, &key, NULL))
{ {
g_autoptr (ClutterActor) queued_actor = key; priv->relayout_pending = FALSE;
unsigned int old_version; priv->stage_was_relayout = TRUE;
g_hash_table_iter_steal (&iter); CLUTTER_NOTE (ACTOR, "Recomputing layout");
priv->pending_relayouts_version++;
if (CLUTTER_ACTOR_IN_RELAYOUT (queued_actor)) /* avoid reentrancy */ CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
continue;
/* An actor may have been destroyed or hidden between queuing and now */ natural_width = natural_height = 0;
if (clutter_actor_get_stage (queued_actor) != actor) clutter_actor_get_preferred_size (CLUTTER_ACTOR (stage),
continue; NULL, NULL,
&natural_width, &natural_height);
if (queued_actor == actor) box.x1 = 0;
CLUTTER_NOTE (ACTOR, " Deep relayout of stage %s", box.y1 = 0;
_clutter_actor_get_debug_name (queued_actor)); box.x2 = natural_width;
else box.y2 = natural_height;
CLUTTER_NOTE (ACTOR, " Shallow relayout of actor %s",
_clutter_actor_get_debug_name (queued_actor));
CLUTTER_SET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT); CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage",
(int) natural_width,
(int) natural_height);
old_version = priv->pending_relayouts_version; clutter_actor_allocate (CLUTTER_ACTOR (stage),
clutter_actor_allocate_preferred_size (queued_actor, &box, CLUTTER_ALLOCATION_NONE);
CLUTTER_ALLOCATION_NONE);
CLUTTER_UNSET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT); CLUTTER_UNSET_PRIVATE_FLAGS (stage, 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 static void
@@ -1434,12 +1388,16 @@ clutter_stage_do_redraw (ClutterStage *stage)
static GSList * static GSList *
_clutter_stage_check_updated_pointers (ClutterStage *stage) _clutter_stage_check_updated_pointers (ClutterStage *stage)
{ {
ClutterStagePrivate *priv = stage->priv;
ClutterBackend *backend; ClutterBackend *backend;
ClutterSeat *seat; ClutterSeat *seat;
GSList *updating = NULL; GSList *updating = NULL;
GList *l, *devices; GList *l, *devices;
cairo_region_t *clip;
graphene_point_t point; graphene_point_t point;
clip = _clutter_stage_window_get_redraw_clip (priv->impl);
backend = clutter_get_default_backend (); backend = clutter_get_default_backend ();
seat = clutter_backend_get_default_seat (backend); seat = clutter_backend_get_default_seat (backend);
devices = clutter_seat_list_devices (seat); devices = clutter_seat_list_devices (seat);
@@ -1447,8 +1405,6 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
for (l = devices; l; l = l->next) for (l = devices; l; l = l->next)
{ {
ClutterInputDevice *dev = l->data; ClutterInputDevice *dev = l->data;
ClutterStageView *view;
const cairo_region_t *clip;
if (clutter_input_device_get_device_mode (dev) != if (clutter_input_device_get_device_mode (dev) !=
CLUTTER_INPUT_MODE_MASTER) CLUTTER_INPUT_MODE_MASTER)
@@ -1464,11 +1420,6 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
if (!clutter_input_device_get_coords (dev, NULL, &point)) if (!clutter_input_device_get_coords (dev, NULL, &point))
continue; continue;
view = clutter_stage_get_view_at (stage, point.x, point.y);
if (!view)
continue;
clip = clutter_stage_view_peek_redraw_clip (view);
if (!clip || cairo_region_contains_point (clip, point.x, point.y)) if (!clip || cairo_region_contains_point (clip, point.x, point.y))
updating = g_slist_prepend (updating, dev); updating = g_slist_prepend (updating, dev);
break; break;
@@ -1556,7 +1507,7 @@ _clutter_stage_do_update (ClutterStage *stage)
while (pointers) 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); pointers = g_slist_delete_link (pointers, pointers);
} }
@@ -1569,31 +1520,20 @@ static void
clutter_stage_real_queue_relayout (ClutterActor *self) clutter_stage_real_queue_relayout (ClutterActor *self)
{ {
ClutterStage *stage = CLUTTER_STAGE (self); ClutterStage *stage = CLUTTER_STAGE (self);
ClutterStagePrivate *priv = stage->priv;
ClutterActorClass *parent_class; ClutterActorClass *parent_class;
clutter_stage_queue_actor_relayout (stage, self); if (!priv->relayout_pending)
{
_clutter_stage_schedule_update (stage);
priv->relayout_pending = TRUE;
}
/* chain up */ /* chain up */
parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class); parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
parent_class->queue_relayout (self); parent_class->queue_relayout (self);
} }
static gboolean
is_full_stage_redraw_queued (ClutterStage *stage)
{
GList *l;
for (l = _clutter_stage_peek_stage_views (stage); l; l = l->next)
{
ClutterStageView *view = l->data;
if (!clutter_stage_view_has_full_redraw_clip (view))
return FALSE;
}
return TRUE;
}
static gboolean static gboolean
clutter_stage_real_queue_redraw (ClutterActor *actor, clutter_stage_real_queue_redraw (ClutterActor *actor,
ClutterActor *leaf, ClutterActor *leaf,
@@ -1615,12 +1555,12 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
if (stage_window == NULL) if (stage_window == NULL)
return TRUE; return TRUE;
if (is_full_stage_redraw_queued (stage)) if (_clutter_stage_window_ignoring_redraw_clips (stage_window))
return FALSE; return FALSE;
if (redraw_clip == NULL) if (redraw_clip == NULL)
{ {
clutter_stage_add_redraw_clip (stage, NULL); _clutter_stage_window_add_redraw_clip (stage_window, NULL);
return FALSE; return FALSE;
} }
@@ -1652,20 +1592,43 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
stage_clip.width = intersection_box.x2 - stage_clip.x; stage_clip.width = intersection_box.x2 - stage_clip.x;
stage_clip.height = intersection_box.y2 - stage_clip.y; stage_clip.height = intersection_box.y2 - stage_clip.y;
clutter_stage_add_redraw_clip (stage, &stage_clip); _clutter_stage_window_add_redraw_clip (stage_window, &stage_clip);
return FALSE; return FALSE;
} }
gboolean gboolean
_clutter_stage_has_full_redraw_queued (ClutterStage *stage) _clutter_stage_has_full_redraw_queued (ClutterStage *stage)
{ {
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage)) ClutterStageWindow *stage_window = _clutter_stage_get_window (stage);
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage) || stage_window == NULL)
return FALSE; return FALSE;
if (!stage->priv->redraw_pending) if (stage->priv->redraw_pending &&
!_clutter_stage_window_has_redraw_clips (stage_window))
return TRUE;
else
return FALSE; return FALSE;
}
return is_full_stage_redraw_queued (stage); cairo_region_t *
clutter_stage_get_redraw_clip (ClutterStage *stage)
{
ClutterStagePrivate *priv;
cairo_rectangle_int_t clip;
cairo_region_t *region;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
priv = stage->priv;
region = _clutter_stage_window_get_redraw_clip (priv->impl);
if (region)
return region;
/* Set clip to the full extents of the stage */
_clutter_stage_window_get_geometry (priv->impl, &clip);
return cairo_region_create_rectangle (&clip);
} }
static ClutterActor * static ClutterActor *
@@ -1677,25 +1640,24 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
{ {
ClutterMainContext *context = _clutter_context_get_default (); ClutterMainContext *context = _clutter_context_get_default ();
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
int i; int i;
g_assert (context->pick_mode == CLUTTER_PICK_NONE); g_assert (context->pick_mode == CLUTTER_PICK_NONE);
if (mode != priv->cached_pick_mode) if (mode != priv->cached_pick_mode)
{ {
ClutterPickContext *pick_context;
_clutter_stage_clear_pick_stack (stage); _clutter_stage_clear_pick_stack (stage);
pick_context = clutter_pick_context_new_for_view (view); cogl_push_framebuffer (fb);
context->pick_mode = mode; context->pick_mode = mode;
setup_view_for_pick_or_paint (stage, view, NULL); setup_view_for_pick_or_paint (stage, view, NULL);
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context); clutter_actor_pick (CLUTTER_ACTOR (stage));
context->pick_mode = CLUTTER_PICK_NONE; context->pick_mode = CLUTTER_PICK_NONE;
priv->cached_pick_mode = mode; priv->cached_pick_mode = mode;
clutter_pick_context_destroy (pick_context); cogl_pop_framebuffer ();
add_pick_stack_weak_refs (stage); add_pick_stack_weak_refs (stage);
} }
@@ -1958,8 +1920,6 @@ clutter_stage_dispose (GObject *object)
(GDestroyNotify) free_queue_redraw_entry); (GDestroyNotify) free_queue_redraw_entry);
priv->pending_queue_redraws = NULL; priv->pending_queue_redraws = NULL;
g_clear_pointer (&priv->pending_relayouts, g_hash_table_destroy);
/* this will release the reference on the stage */ /* this will release the reference on the stage */
stage_manager = clutter_stage_manager_get_default (); stage_manager = clutter_stage_manager_get_default ();
_clutter_stage_manager_remove_stage (stage_manager, stage); _clutter_stage_manager_remove_stage (stage_manager, stage);
@@ -1994,11 +1954,13 @@ clutter_stage_finalize (GObject *object)
} }
static void static void
clutter_stage_real_paint_view (ClutterStage *stage, clutter_stage_real_paint_view (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view)
const cairo_region_t *redraw_clip)
{ {
clutter_stage_do_paint_view (stage, view, redraw_clip); ClutterStagePrivate *priv = stage->priv;
const cairo_rectangle_int_t *clip = &priv->view_clip;
clutter_stage_do_paint_view (stage, view, clip);
} }
static void static void
@@ -2205,7 +2167,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
/** /**
* ClutterStage::after-paint: * ClutterStage::after-paint:
* @stage: the stage that received the event * @stage: the stage that received the event
* @paint_Context: the paint context
* *
* The ::after-paint signal is emitted after the stage is painted, * The ::after-paint signal is emitted after the stage is painted,
* but before the results are displayed on the screen. * but before the results are displayed on the screen.
@@ -2224,7 +2185,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
* ClutterStage::paint-view: * ClutterStage::paint-view:
* @stage: the stage that received the event * @stage: the stage that received the event
* @view: a #ClutterStageView * @view: a #ClutterStageView
* @redraw_clip: a #cairo_region_t with the redraw clip
* *
* The ::paint-view signal is emitted before a #ClutterStageView is being * The ::paint-view signal is emitted before a #ClutterStageView is being
* painted. * painted.
@@ -2239,9 +2199,8 @@ clutter_stage_class_init (ClutterStageClass *klass)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageClass, paint_view), G_STRUCT_OFFSET (ClutterStageClass, paint_view),
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_NONE, 1,
CLUTTER_TYPE_STAGE_VIEW, CLUTTER_TYPE_STAGE_VIEW);
G_TYPE_POINTER);
/** /**
* ClutterStage::presented: (skip) * ClutterStage::presented: (skip)
@@ -2319,11 +2278,7 @@ clutter_stage_init (ClutterStage *self)
clutter_actor_set_background_color (CLUTTER_ACTOR (self), clutter_actor_set_background_color (CLUTTER_ACTOR (self),
&default_stage_color); &default_stage_color);
priv->pending_relayouts = g_hash_table_new_full (NULL, priv->relayout_pending = TRUE;
NULL,
g_object_unref,
NULL);
clutter_stage_queue_actor_relayout (self, CLUTTER_ACTOR (self));
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
clutter_stage_set_title (self, g_get_prgname ()); clutter_stage_set_title (self, g_get_prgname ());
@@ -2817,17 +2772,14 @@ clutter_stage_read_pixels (ClutterStage *stage,
.height = height, .height = height,
}); });
cairo_region_get_extents (clip, &clip_rect); cairo_region_get_extents (clip, &clip_rect);
cairo_region_destroy (clip);
if (clip_rect.width == 0 || clip_rect.height == 0) if (clip_rect.width == 0 || clip_rect.height == 0)
{ return NULL;
cairo_region_destroy (clip);
return NULL;
}
framebuffer = clutter_stage_view_get_framebuffer (view); framebuffer = clutter_stage_view_get_framebuffer (view);
clutter_stage_do_paint_view (stage, view, clip); cogl_push_framebuffer (framebuffer);
clutter_stage_do_paint_view (stage, view, &clip_rect);
cairo_region_destroy (clip);
view_scale = clutter_stage_view_get_scale (view); view_scale = clutter_stage_view_get_scale (view);
pixel_width = roundf (clip_rect.width * view_scale); pixel_width = roundf (clip_rect.width * view_scale);
@@ -2841,6 +2793,8 @@ clutter_stage_read_pixels (ClutterStage *stage,
COGL_PIXEL_FORMAT_RGBA_8888, COGL_PIXEL_FORMAT_RGBA_8888,
pixels); pixels);
cogl_pop_framebuffer ();
return pixels; return pixels;
} }
@@ -3402,9 +3356,10 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
priv = stage->priv; priv = stage->priv;
if (!_clutter_stage_needs_update (stage)) if (!priv->relayout_pending && !priv->redraw_pending)
_clutter_stage_schedule_update (stage); _clutter_stage_schedule_update (stage);
priv->relayout_pending = TRUE;
priv->redraw_pending = TRUE; priv->redraw_pending = TRUE;
master_clock = _clutter_master_clock_get_default (); master_clock = _clutter_master_clock_get_default ();
@@ -3746,21 +3701,6 @@ _clutter_stage_clear_update_time (ClutterStage *stage)
_clutter_stage_window_clear_update_time (stage_window); _clutter_stage_window_clear_update_time (stage_window);
} }
int64_t
_clutter_stage_get_next_presentation_time (ClutterStage *stage)
{
ClutterStageWindow *stage_window;
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return 0;
stage_window = _clutter_stage_get_window (stage);
if (stage_window == NULL)
return 0;
return _clutter_stage_window_get_next_presentation_time (stage_window);
}
ClutterPaintVolume * ClutterPaintVolume *
_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage) _clutter_stage_paint_volume_stack_allocate (ClutterStage *stage)
{ {
@@ -4074,6 +4014,18 @@ clutter_stage_get_motion_events_enabled (ClutterStage *stage)
return stage->priv->motion_events_enabled; 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 void
_clutter_stage_add_pointer_drag_actor (ClutterStage *stage, _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device, ClutterInputDevice *device,
@@ -4349,6 +4301,7 @@ capture_view (ClutterStage *stage,
texture_width, texture_height); texture_width, texture_height);
cairo_surface_set_device_scale (image, view_scale, view_scale); cairo_surface_set_device_scale (image, view_scale, view_scale);
data = cairo_image_surface_get_data (image); data = cairo_image_surface_get_data (image);
stride = cairo_image_surface_get_stride (image); stride = cairo_image_surface_get_stride (image);
@@ -4358,20 +4311,6 @@ capture_view (ClutterStage *stage,
cairo_surface_mark_dirty (capture->image); cairo_surface_mark_dirty (capture->image);
} }
/**
* clutter_stage_capture:
* @stage: a #ClutterStage
* @paint: whether to pain the frame
* @rect: a #cairo_rectangle_int_t in stage coordinates
* @out_captures: (out) (array length=out_n_captures): an array of
* #ClutterCapture
* @out_n_captures: (out): the number of captures in @out_captures
*
* Captures the stage pixels of @rect into @captures. @rect is in stage
* coordinates.
*
* Returns: %TRUE if a #ClutterCapture has been created, %FALSE otherwise
*/
gboolean gboolean
clutter_stage_capture (ClutterStage *stage, clutter_stage_capture (ClutterStage *stage,
gboolean paint, gboolean paint,
@@ -4473,100 +4412,6 @@ clutter_stage_get_capture_final_size (ClutterStage *stage,
return TRUE; return TRUE;
} }
/**
* clutter_stage_paint_to_framebuffer: (skip)
*/
void
clutter_stage_paint_to_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer,
const cairo_rectangle_int_t *rect,
float scale,
ClutterPaintFlag paint_flags)
{
ClutterStagePrivate *priv = stage->priv;
ClutterPaintContext *paint_context;
cairo_region_t *redraw_clip;
redraw_clip = cairo_region_create_rectangle (rect);
paint_context = clutter_paint_context_new_for_framebuffer (framebuffer);
cairo_region_destroy (redraw_clip);
cogl_framebuffer_push_matrix (framebuffer);
cogl_framebuffer_set_projection_matrix (framebuffer, &priv->projection);
cogl_framebuffer_set_viewport (framebuffer,
-(rect->x * scale),
-(rect->y * scale),
priv->viewport[2] * scale,
priv->viewport[3] * scale);
clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
cogl_framebuffer_pop_matrix (framebuffer);
clutter_paint_context_destroy (paint_context);
}
/**
* clutter_stage_paint_to_buffer: (skip)
*/
gboolean
clutter_stage_paint_to_buffer (ClutterStage *stage,
const cairo_rectangle_int_t *rect,
float scale,
uint8_t *data,
int stride,
CoglPixelFormat format,
ClutterPaintFlag paint_flags,
GError **error)
{
ClutterBackend *clutter_backend = clutter_get_default_backend ();
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_backend);
int texture_width, texture_height;
CoglTexture2D *texture;
CoglOffscreen *offscreen;
CoglFramebuffer *framebuffer;
CoglBitmap *bitmap;
texture_width = (int) roundf (rect->width * scale);
texture_height = (int) roundf (rect->height * scale);
texture = cogl_texture_2d_new_with_size (cogl_context,
texture_width,
texture_height);
if (!texture)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to create %dx%d texture",
texture_width, texture_height);
return FALSE;
}
offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture));
framebuffer = COGL_FRAMEBUFFER (offscreen);
cogl_object_unref (texture);
if (!cogl_framebuffer_allocate (framebuffer, error))
return FALSE;
clutter_stage_paint_to_framebuffer (stage, framebuffer,
rect, scale, paint_flags);
bitmap = cogl_bitmap_new_for_data (cogl_context,
texture_width, texture_height,
format,
stride,
data);
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
0, 0,
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);
cogl_object_unref (bitmap);
cogl_object_unref (framebuffer);
return TRUE;
}
static void static void
capture_view_into (ClutterStage *stage, capture_view_into (ClutterStage *stage,
gboolean paint, gboolean paint,
@@ -4575,17 +4420,82 @@ capture_view_into (ClutterStage *stage,
uint8_t *data, uint8_t *data,
int stride) int stride)
{ {
g_autoptr (GError) error = NULL; CoglFramebuffer *framebuffer;
ClutterBackend *backend;
CoglContext *context;
CoglBitmap *bitmap;
cairo_rectangle_int_t view_layout;
float view_scale; float view_scale;
float texture_width;
float texture_height;
g_return_if_fail (CLUTTER_IS_STAGE (stage)); g_return_if_fail (CLUTTER_IS_STAGE (stage));
framebuffer = clutter_stage_view_get_framebuffer (view);
if (paint)
{
cogl_push_framebuffer (framebuffer);
_clutter_stage_maybe_setup_viewport (stage, view);
clutter_stage_do_paint_view (stage, view, rect);
}
view_scale = clutter_stage_view_get_scale (view); view_scale = clutter_stage_view_get_scale (view);
if (!clutter_stage_paint_to_buffer (stage, rect, view_scale, data, stride, texture_width = roundf (rect->width * view_scale);
CLUTTER_CAIRO_FORMAT_ARGB32, texture_height = roundf (rect->height * view_scale);
CLUTTER_PAINT_FLAG_NO_CURSORS,
&error)) backend = clutter_get_default_backend ();
g_warning ("Failed to capture stage: %s", error->message); context = clutter_backend_get_cogl_context (backend);
bitmap = cogl_bitmap_new_for_data (context,
texture_width, texture_height,
CLUTTER_CAIRO_FORMAT_ARGB32,
stride,
data);
clutter_stage_view_get_layout (view, &view_layout);
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
roundf ((rect->x - view_layout.x) * view_scale),
roundf ((rect->y - view_layout.y) * view_scale),
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);
if (paint)
cogl_pop_framebuffer ();
cogl_object_unref (bitmap);
}
static ClutterStageView *
get_view_at_rect (ClutterStage *stage,
cairo_rectangle_int_t *rect)
{
ClutterStagePrivate *priv = stage->priv;
GList *views = _clutter_stage_window_get_views (priv->impl);
GList *l;
for (l = views; l; l = l->next)
{
ClutterStageView *view = l->data;
cairo_rectangle_int_t view_layout;
cairo_region_t *region;
cairo_rectangle_int_t view_capture_rect;
clutter_stage_view_get_layout (view, &view_layout);
region = cairo_region_create_rectangle (&view_layout);
cairo_region_intersect_rectangle (region, rect);
cairo_region_get_extents (region, &view_capture_rect);
cairo_region_destroy (region);
if (view_capture_rect.width == 0 || view_capture_rect.height == 0)
continue;
g_assert (view_capture_rect.width == rect->width &&
view_capture_rect.height == rect->height);
return view;
}
return NULL;
} }
void void
@@ -4594,36 +4504,11 @@ clutter_stage_capture_into (ClutterStage *stage,
cairo_rectangle_int_t *rect, cairo_rectangle_int_t *rect,
uint8_t *data) uint8_t *data)
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStageView *view;
GList *l;
int bpp = 4; int bpp = 4;
int stride;
stride = rect->width * 4; view = get_view_at_rect (stage, rect);
capture_view_into (stage, paint, view, rect, data, rect->width * bpp);
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
{
ClutterStageView *view = l->data;
cairo_rectangle_int_t view_layout;
cairo_region_t *region;
cairo_rectangle_int_t capture_rect;
int x_offset, y_offset;
clutter_stage_view_get_layout (view, &view_layout);
region = cairo_region_create_rectangle (&view_layout);
cairo_region_intersect_rectangle (region, rect);
cairo_region_get_extents (region, &capture_rect);
cairo_region_destroy (region);
x_offset = capture_rect.x - rect->x;
y_offset = capture_rect.y - rect->y;
capture_view_into (stage, paint, view,
&capture_rect,
data + (x_offset * bpp) + (y_offset * stride),
stride);
}
} }
/** /**

View File

@@ -84,9 +84,8 @@ struct _ClutterStageClass
gboolean (* delete_event) (ClutterStage *stage, gboolean (* delete_event) (ClutterStage *stage,
ClutterEvent *event); ClutterEvent *event);
void (* paint_view) (ClutterStage *stage, void (* paint_view) (ClutterStage *stage,
ClutterStageView *view, ClutterStageView *view);
const cairo_region_t *redraw_clip);
/*< private >*/ /*< private >*/
/* padding for future expansion */ /* padding for future expansion */
@@ -206,6 +205,8 @@ guchar * clutter_stage_read_pixels (ClutterStage
gint width, gint width,
gint height); gint height);
CLUTTER_EXPORT
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_ensure_viewport (ClutterStage *stage); void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
@@ -233,8 +234,8 @@ CLUTTER_EXPORT
gboolean clutter_stage_capture (ClutterStage *stage, gboolean clutter_stage_capture (ClutterStage *stage,
gboolean paint, gboolean paint,
cairo_rectangle_int_t *rect, cairo_rectangle_int_t *rect,
ClutterCapture **out_captures, ClutterCapture **captures,
int *out_n_captures); int *n_captures);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage, ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
float x, float x,

View File

@@ -348,23 +348,13 @@ clutter_text_input_focus_request_surrounding (ClutterInputFocus *focus)
static void static void
clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus, clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
int offset, guint offset,
guint len) guint len)
{ {
ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text; ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
int cursor;
int start;
cursor = clutter_text_get_cursor_position (clutter_text);
start = cursor + offset;
if (start < 0)
{
g_warning ("The offset '%d' of deleting surrounding is larger than the cursor pos '%d'",
offset, cursor);
return;
}
if (clutter_text_get_editable (clutter_text)) if (clutter_text_get_editable (clutter_text))
clutter_text_delete_text (clutter_text, start, len); clutter_text_delete_text (clutter_text, offset, len);
} }
static void static void
@@ -2008,7 +1998,7 @@ selection_paint (ClutterText *self,
color->blue, color->blue,
paint_opacity * color->alpha / 255); paint_opacity * color->alpha / 255);
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color); cogl_pango_render_layout (layout, priv->text_x, 0, &cogl_color, 0);
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
} }
@@ -2565,8 +2555,7 @@ clutter_text_compute_layout_offsets (ClutterText *self,
#define TEXT_PADDING 2 #define TEXT_PADDING 2
static void static void
clutter_text_paint (ClutterActor *self, clutter_text_paint (ClutterActor *self)
ClutterPaintContext *paint_context)
{ {
ClutterText *text = CLUTTER_TEXT (self); ClutterText *text = CLUTTER_TEXT (self);
ClutterTextPrivate *priv = text->priv; ClutterTextPrivate *priv = text->priv;
@@ -2584,7 +2573,7 @@ clutter_text_paint (ClutterActor *self,
float alloc_height; float alloc_height;
float resource_scale; float resource_scale;
fb = clutter_paint_context_get_framebuffer (paint_context); fb = cogl_get_draw_framebuffer ();
/* Note that if anything in this paint method changes it needs to be /* Note that if anything in this paint method changes it needs to be
reflected in the get_paint_volume implementation which is tightly reflected in the get_paint_volume implementation which is tightly
@@ -2772,7 +2761,7 @@ clutter_text_paint (ClutterActor *self,
priv->text_color.green, priv->text_color.green,
priv->text_color.blue, priv->text_color.blue,
real_opacity); real_opacity);
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color); cogl_pango_render_layout (layout, priv->text_x, priv->text_y, &color, 0);
selection_paint (text, fb); selection_paint (text, fb);

View File

@@ -1038,15 +1038,15 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
* to correpondingly reduce elapsed_time_delta to reflect the correct * to correpondingly reduce elapsed_time_delta to reflect the correct
* range of times */ * range of times */
if (priv->direction == CLUTTER_TIMELINE_FORWARD) if (priv->direction == CLUTTER_TIMELINE_FORWARD)
{ {
elapsed_time_delta -= (priv->elapsed_time - priv->duration); elapsed_time_delta -= (priv->elapsed_time - priv->duration);
priv->elapsed_time = priv->duration; priv->elapsed_time = priv->duration;
} }
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD) else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
{ {
elapsed_time_delta -= - priv->elapsed_time; elapsed_time_delta -= - priv->elapsed_time;
priv->elapsed_time = 0; priv->elapsed_time = 0;
} }
end_msecs = priv->elapsed_time; end_msecs = priv->elapsed_time;
@@ -1756,12 +1756,12 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
} }
if (msecs != 0) if (msecs != 0)
{ {
/* Avoid accumulating error */ /* Avoid accumulating error */
priv->last_frame_time += msecs; priv->last_frame_time += msecs;
priv->msecs_delta = msecs; priv->msecs_delta = msecs;
clutter_timeline_do_frame (timeline); clutter_timeline_do_frame (timeline);
} }
} }
} }

View File

@@ -214,16 +214,6 @@ _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
} }
} }
gboolean
clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2)
{
return ((src1->x == src2->x) &&
(src1->y == src2->y) &&
(src1->width == src2->width) &&
(src1->height == src2->height));
}
float float
_clutter_util_matrix_determinant (const ClutterMatrix *matrix) _clutter_util_matrix_determinant (const ClutterMatrix *matrix)
{ {

View File

@@ -47,7 +47,7 @@
#include "clutter-stage-private.h" #include "clutter-stage-private.h"
#include "clutter-stage-view-private.h" #include "clutter-stage-view-private.h"
#define MAX_STACK_RECTS 256 #include "cogl/cogl-trace.h"
typedef struct _ClutterStageViewCoglPrivate typedef struct _ClutterStageViewCoglPrivate
{ {
@@ -235,12 +235,7 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
stage_cogl->update_time = next_presentation_time - max_render_time_allowed; stage_cogl->update_time = next_presentation_time - max_render_time_allowed;
if (stage_cogl->update_time == stage_cogl->last_update_time) if (stage_cogl->update_time == stage_cogl->last_update_time)
{ stage_cogl->update_time = stage_cogl->last_update_time + refresh_interval;
stage_cogl->update_time += refresh_interval;
next_presentation_time += refresh_interval;
}
stage_cogl->next_presentation_time = next_presentation_time;
} }
static gint64 static gint64
@@ -261,29 +256,6 @@ clutter_stage_cogl_clear_update_time (ClutterStageWindow *stage_window)
stage_cogl->last_update_time = stage_cogl->update_time; stage_cogl->last_update_time = stage_cogl->update_time;
stage_cogl->update_time = -1; stage_cogl->update_time = -1;
stage_cogl->next_presentation_time = -1;
}
static int64_t
clutter_stage_cogl_get_next_presentation_time (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
int64_t now = g_get_monotonic_time ();
if (stage_cogl->next_presentation_time > 0 &&
stage_cogl->next_presentation_time <= now)
{
CLUTTER_NOTE (BACKEND,
"Missed some frames. Something blocked for over "
"%" G_GINT64_FORMAT "ms.",
(now - stage_cogl->next_presentation_time) / 1000);
stage_cogl->update_time = -1;
clutter_stage_cogl_schedule_update (stage_window,
stage_cogl->last_sync_delay);
}
return stage_cogl->next_presentation_time;
} }
static ClutterActor * static ClutterActor *
@@ -316,6 +288,97 @@ clutter_stage_cogl_resize (ClutterStageWindow *stage_window,
{ {
} }
static gboolean
clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* NB: at the start of each new frame there is an implied clip that
* clips everything (i.e. nothing would be drawn) so we need to make
* sure we return True in the un-initialized case here.
*/
if (!stage_cogl->initialized_redraw_clip ||
(stage_cogl->initialized_redraw_clip &&
stage_cogl->redraw_clip))
return TRUE;
else
return FALSE;
}
static gboolean
clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* NB: a NULL clip means a full stage redraw is required */
if (stage_cogl->initialized_redraw_clip &&
!stage_cogl->redraw_clip)
return TRUE;
else
return FALSE;
}
/* A redraw clip represents (in stage coordinates) the bounding box of
* something that needs to be redrawn. Typically they are added to the
* StageWindow as a result of clutter_actor_queue_clipped_redraw() by
* actors such as ClutterGLXTexturePixmap. All redraw clips are
* discarded after the next paint.
*
* A NULL stage_clip means the whole stage needs to be redrawn.
*
* What we do with this information:
* - we keep track of the bounding box for all redraw clips
* - when we come to redraw; we scissor the redraw to that box and use
* glBlitFramebuffer to present the redraw to the front
* buffer.
*/
static void
clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *stage_clip)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* If we are already forced to do a full stage redraw then bail early */
if (clutter_stage_cogl_ignoring_redraw_clips (stage_window))
return;
/* A NULL stage clip means a full stage redraw has been queued and
* we keep track of this by setting a NULL redraw_clip.
*/
if (stage_clip == NULL)
{
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->initialized_redraw_clip = TRUE;
return;
}
/* Ignore requests to add degenerate/empty clip rectangles */
if (stage_clip->width == 0 || stage_clip->height == 0)
return;
if (!stage_cogl->redraw_clip)
{
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
}
else
{
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
}
stage_cogl->initialized_redraw_clip = TRUE;
}
static cairo_region_t *
clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
return cairo_region_copy (stage_cogl->redraw_clip);
return NULL;
}
static inline gboolean static inline gboolean
valid_buffer_age (ClutterStageViewCogl *view_cogl, valid_buffer_age (ClutterStageViewCogl *view_cogl,
int age) int age)
@@ -332,8 +395,7 @@ valid_buffer_age (ClutterStageViewCogl *view_cogl,
static void static void
paint_damage_region (ClutterStageWindow *stage_window, paint_damage_region (ClutterStageWindow *stage_window,
ClutterStageView *view, ClutterStageView *view,
cairo_region_t *swap_region, cairo_region_t *swap_region)
cairo_region_t *queued_redraw_clip)
{ {
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view); CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
@@ -370,7 +432,8 @@ paint_damage_region (ClutterStageWindow *stage_window,
} }
/* Red for the clip */ /* Red for the clip */
if (queued_redraw_clip) if (stage_cogl->initialized_redraw_clip &&
stage_cogl->redraw_clip)
{ {
static CoglPipeline *overlay_red = NULL; static CoglPipeline *overlay_red = NULL;
@@ -380,13 +443,13 @@ paint_damage_region (ClutterStageWindow *stage_window,
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33); cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
} }
n_rects = cairo_region_num_rectangles (queued_redraw_clip); n_rects = cairo_region_num_rectangles (stage_cogl->redraw_clip);
for (i = 0; i < n_rects; i++) for (i = 0; i < n_rects; i++)
{ {
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
float x_1, x_2, y_1, y_2; float x_1, x_2, y_1, y_2;
cairo_region_get_rectangle (queued_redraw_clip, i, &rect); cairo_region_get_rectangle (stage_cogl->redraw_clip, i, &rect);
x_1 = rect.x; x_1 = rect.x;
x_2 = rect.x + rect.width; x_2 = rect.x + rect.width;
y_1 = rect.y; y_1 = rect.y;
@@ -408,6 +471,9 @@ swap_framebuffer (ClutterStageWindow *stage_window,
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view); CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
int *damage, n_rects, i; int *damage, n_rects, i;
if (G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)))
paint_damage_region (stage_window, view, swap_region);
n_rects = cairo_region_num_rectangles (swap_region); n_rects = cairo_region_num_rectangles (swap_region);
damage = g_newa (int, n_rects * 4); damage = g_newa (int, n_rects * 4);
for (i = 0; i < n_rects; i++) for (i = 0; i < n_rects; i++)
@@ -470,52 +536,34 @@ scale_and_clamp_rect (const graphene_rect_t *rect,
_clutter_util_rectangle_int_extents (&tmp, dest); _clutter_util_rectangle_int_extents (&tmp, dest);
} }
static cairo_region_t *
offset_scale_and_clamp_region (const cairo_region_t *region,
int offset_x,
int offset_y,
float scale)
{
int n_rects, i;
cairo_rectangle_int_t *rects;
g_autofree cairo_rectangle_int_t *freeme = NULL;
n_rects = cairo_region_num_rectangles (region);
if (n_rects == 0)
return cairo_region_create ();
if (n_rects < MAX_STACK_RECTS)
rects = g_newa (cairo_rectangle_int_t, n_rects);
else
rects = freeme = g_new (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
cairo_region_get_rectangle (region, i, &rects[i]);
for (i = 0; i < n_rects; i++)
{
graphene_rect_t tmp;
_clutter_util_rect_from_rectangle (&rects[i], &tmp);
graphene_rect_offset (&tmp, offset_x, offset_y);
scale_and_clamp_rect (&tmp, scale, &rects[i]);
}
return cairo_region_create_rectangles (rects, n_rects);
}
static void static void
paint_stage (ClutterStageCogl *stage_cogl, paint_stage (ClutterStageCogl *stage_cogl,
ClutterStageView *view, ClutterStageView *view,
cairo_region_t *redraw_clip) cairo_region_t *clip)
{ {
ClutterStage *stage = stage_cogl->wrapper; ClutterStage *stage = stage_cogl->wrapper;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t paint_rect;
cairo_rectangle_int_t view_rect;
graphene_rect_t rect;
float fb_scale;
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
cairo_region_get_extents (clip, &clip_rect);
_clutter_util_rect_from_rectangle (&clip_rect, &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
_clutter_stage_maybe_setup_viewport (stage, view); _clutter_stage_maybe_setup_viewport (stage, view);
clutter_stage_paint_view (stage, view, redraw_clip); _clutter_stage_paint_view (stage, view, &paint_rect);
clutter_stage_view_after_paint (view); clutter_stage_view_after_paint (view, &paint_rect);
} }
static void static void
@@ -635,7 +683,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
clutter_stage_view_cogl_get_instance_private (view_cogl); clutter_stage_view_cogl_get_instance_private (view_cogl);
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view); CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
cairo_rectangle_int_t view_rect; cairo_rectangle_int_t view_rect;
gboolean is_full_redraw; gboolean have_clip;
gboolean may_use_clipped_redraw; gboolean may_use_clipped_redraw;
gboolean use_clipped_redraw; gboolean use_clipped_redraw;
gboolean can_blit_sub_buffer; gboolean can_blit_sub_buffer;
@@ -644,7 +692,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
gboolean swap_with_damage; gboolean swap_with_damage;
ClutterActor *wrapper; ClutterActor *wrapper;
cairo_region_t *redraw_clip; cairo_region_t *redraw_clip;
cairo_region_t *queued_redraw_clip = NULL;
cairo_region_t *fb_clip_region; cairo_region_t *fb_clip_region;
cairo_region_t *swap_region; cairo_region_t *swap_region;
cairo_rectangle_int_t redraw_rect; cairo_rectangle_int_t redraw_rect;
@@ -652,7 +699,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
float fb_scale; float fb_scale;
int subpixel_compensation = 0; int subpixel_compensation = 0;
int fb_width, fb_height; int fb_width, fb_height;
int buffer_age;
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper); wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
@@ -667,46 +713,55 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled (); has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
redraw_clip = clutter_stage_view_take_redraw_clip (view);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
queued_redraw_clip = cairo_region_copy (redraw_clip);
/* NB: a NULL redraw clip == full stage redraw */ /* NB: a NULL redraw clip == full stage redraw */
if (!redraw_clip) if (!stage_cogl->redraw_clip)
is_full_redraw = TRUE; have_clip = FALSE;
else else
is_full_redraw = FALSE;
may_use_clipped_redraw =
_clutter_stage_window_can_clip_redraws (stage_window) &&
(can_blit_sub_buffer || has_buffer_age) &&
!is_full_redraw &&
/* some drivers struggle to get going and produce some junk
* frames when starting up... */
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3;
if (has_buffer_age)
{ {
buffer_age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb)); cairo_region_t *view_region;
if (!valid_buffer_age (view_cogl, buffer_age)) redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
{
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", buffer_age); view_region = cairo_region_create_rectangle (&view_rect);
may_use_clipped_redraw = FALSE; cairo_region_intersect (redraw_clip, view_region);
}
have_clip = !cairo_region_equal (redraw_clip, view_region);
cairo_region_destroy (view_region);
} }
if (may_use_clipped_redraw) may_use_clipped_redraw = FALSE;
if (_clutter_stage_window_can_clip_redraws (stage_window) &&
(can_blit_sub_buffer || has_buffer_age) &&
have_clip &&
/* some drivers struggle to get going and produce some junk
* frames when starting up... */
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{ {
fb_clip_region = offset_scale_and_clamp_region (redraw_clip, graphene_rect_t rect;
-view_rect.x, cairo_rectangle_int_t *rects;
-view_rect.y, int n_rects, i;
fb_scale);
may_use_clipped_redraw = TRUE;
fb_clip_region = cairo_region_create ();
n_rects = cairo_region_num_rectangles (redraw_clip);
rects = g_new (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t new_fb_clip_rect;
cairo_region_get_rectangle (redraw_clip, i, &rects[i]);
_clutter_util_rect_from_rectangle (&rects[i], &rect);
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &new_fb_clip_rect);
cairo_region_union_rectangle (fb_clip_region, &new_fb_clip_rect);
}
g_free (rects);
if (fb_scale != floorf (fb_scale)) if (fb_scale != floorf (fb_scale))
{ {
int n_rects, i;
cairo_rectangle_int_t *rects;
subpixel_compensation = ceilf (fb_scale); subpixel_compensation = ceilf (fb_scale);
n_rects = cairo_region_num_rectangles (fb_clip_region); n_rects = cairo_region_num_rectangles (fb_clip_region);
@@ -725,16 +780,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
} }
else else
{ {
cairo_rectangle_int_t fb_rect; cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
fb_clip_region = cairo_region_create_rectangle (&rect);
fb_rect = (cairo_rectangle_int_t) { redraw_clip = cairo_region_copy (fb_clip_region);
.width = fb_width,
.height = fb_height,
};
fb_clip_region = cairo_region_create_rectangle (&fb_rect);
g_clear_pointer (&redraw_clip, cairo_region_destroy);
redraw_clip = cairo_region_create_rectangle (&view_rect);
} }
if (may_use_clipped_redraw && if (may_use_clipped_redraw &&
@@ -750,43 +798,62 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
{ {
if (use_clipped_redraw && !clip_region_empty) if (use_clipped_redraw && !clip_region_empty)
{ {
cairo_region_t *fb_damage; int age;
cairo_region_t *view_damage;
int i;
fill_current_damage_history (view, fb_clip_region); age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
fb_damage = cairo_region_create (); if (valid_buffer_age (view_cogl, age))
for (i = 1; i <= buffer_age; i++)
{ {
int damage_index; graphene_rect_t rect;
cairo_rectangle_int_t damage_region;
cairo_rectangle_int_t *rects;
int n_rects, i;
damage_index = DAMAGE_HISTORY (view_priv->damage_index - i - 1); fill_current_damage_history (view, fb_clip_region);
cairo_region_union (fb_damage,
view_priv->damage_history[damage_index]); for (i = 1; i <= age; i++)
{
cairo_region_t *fb_damage =
view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
cairo_region_union (fb_clip_region, fb_damage);
}
/* Update the redraw clip state with the extra damage. */
n_rects = cairo_region_num_rectangles (fb_clip_region);
rects = g_newa (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
_clutter_util_rect_from_rectangle (&rects[i], &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
_clutter_util_rectangle_offset (&damage_region,
view_rect.x,
view_rect.y,
&damage_region);
cairo_region_union_rectangle (stage_cogl->redraw_clip,
&damage_region);
}
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
age,
cairo_region_num_rectangles (fb_clip_region));
swap_with_damage = TRUE;
} }
else
{
cairo_rectangle_int_t fb_damage;
/* Update the fb clip region with the extra damage. */ CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
cairo_region_union (fb_clip_region, fb_damage); use_clipped_redraw = FALSE;
fb_damage = (cairo_rectangle_int_t) {
view_damage = offset_scale_and_clamp_region (fb_damage, .x = 0,
0, 0, .y = 0,
1.0f / fb_scale); .width = ceilf (view_rect.width * fb_scale),
cairo_region_translate (view_damage, view_rect.x, view_rect.y); .height = ceilf (view_rect.height * fb_scale)
cairo_region_intersect_rectangle (view_damage, &view_rect); };
fill_current_damage_history_rectangle (view, &fb_damage);
/* Update the redraw clip region with the extra damage. */ }
cairo_region_union (redraw_clip, view_damage);
cairo_region_destroy (view_damage);
cairo_region_destroy (fb_damage);
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
buffer_age,
cairo_region_num_rectangles (fb_clip_region));
swap_with_damage = TRUE;
} }
else if (!use_clipped_redraw) else if (!use_clipped_redraw)
{ {
@@ -802,6 +869,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
} }
} }
cogl_push_framebuffer (fb);
if (use_clipped_redraw && clip_region_empty) if (use_clipped_redraw && clip_region_empty)
{ {
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n"); CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
@@ -811,6 +879,8 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cairo_rectangle_int_t clip_rect; cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t scissor_rect; cairo_rectangle_int_t scissor_rect;
stage_cogl->using_clipped_redraw = TRUE;
if (cairo_region_num_rectangles (fb_clip_region) == 1) if (cairo_region_num_rectangles (fb_clip_region) == 1)
{ {
cairo_region_get_extents (fb_clip_region, &clip_rect); cairo_region_get_extents (fb_clip_region, &clip_rect);
@@ -838,9 +908,11 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_framebuffer_push_region_clip (fb, fb_clip_region); cogl_framebuffer_push_region_clip (fb, fb_clip_region);
} }
paint_stage (stage_cogl, view, redraw_clip); paint_stage (stage_cogl, view, fb_clip_region);
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE;
} }
else else
{ {
@@ -868,15 +940,27 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
scissor_rect.width, scissor_rect.width,
scissor_rect.height); scissor_rect.height);
paint_stage (stage_cogl, view, redraw_clip); paint_stage (stage_cogl, view, fb_clip_region);
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
} }
else else
{ {
paint_stage (stage_cogl, view, redraw_clip); cairo_rectangle_int_t clip;
cairo_region_t *view_region;
clip = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
view_region = cairo_region_create_rectangle (&clip);
paint_stage (stage_cogl, view, view_region);
cairo_region_destroy (view_region);
} }
} }
cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect); cairo_region_get_extents (redraw_clip, &redraw_rect);
@@ -945,8 +1029,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
do_swap_buffer = TRUE; do_swap_buffer = TRUE;
} }
g_clear_pointer (&redraw_clip, cairo_region_destroy); if (redraw_clip)
g_clear_pointer (&fb_clip_region, cairo_region_destroy); cairo_region_destroy (redraw_clip);
if (fb_clip_region)
cairo_region_destroy (fb_clip_region);
if (do_swap_buffer) if (do_swap_buffer)
{ {
@@ -966,13 +1052,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
swap_region = transformed_swap_region; swap_region = transformed_swap_region;
} }
if (queued_redraw_clip)
{
paint_damage_region (stage_window, view,
swap_region, queued_redraw_clip);
cairo_region_destroy (queued_redraw_clip);
}
res = swap_framebuffer (stage_window, res = swap_framebuffer (stage_window,
view, view,
swap_region, swap_region,
@@ -984,7 +1063,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
} }
else else
{ {
g_clear_pointer (&queued_redraw_clip, cairo_region_destroy);
return FALSE; return FALSE;
} }
} }
@@ -1002,10 +1080,8 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
{ {
ClutterStageView *view = l->data; ClutterStageView *view = l->data;
if (!clutter_stage_view_has_redraw_clip (view)) swap_event =
continue; clutter_stage_cogl_redraw_view (stage_window, view) || swap_event;
swap_event |= clutter_stage_cogl_redraw_view (stage_window, view);
} }
_clutter_stage_emit_after_paint (stage_cogl->wrapper); _clutter_stage_emit_after_paint (stage_cogl->wrapper);
@@ -1021,6 +1097,10 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
stage_cogl->pending_swaps++; stage_cogl->pending_swaps++;
} }
/* reset the redraw clipping for the next paint... */
stage_cogl->initialized_redraw_clip = FALSE;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->frame_count++; stage_cogl->frame_count++;
COGL_TRACE_END (ClutterStageCoglRedraw); COGL_TRACE_END (ClutterStageCoglRedraw);
@@ -1038,7 +1118,10 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
iface->schedule_update = clutter_stage_cogl_schedule_update; iface->schedule_update = clutter_stage_cogl_schedule_update;
iface->get_update_time = clutter_stage_cogl_get_update_time; iface->get_update_time = clutter_stage_cogl_get_update_time;
iface->clear_update_time = clutter_stage_cogl_clear_update_time; iface->clear_update_time = clutter_stage_cogl_clear_update_time;
iface->get_next_presentation_time = clutter_stage_cogl_get_next_presentation_time; iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
iface->redraw = clutter_stage_cogl_redraw; iface->redraw = clutter_stage_cogl_redraw;
} }
@@ -1084,7 +1167,6 @@ _clutter_stage_cogl_init (ClutterStageCogl *stage)
stage->refresh_rate = 0.0; stage->refresh_rate = 0.0;
stage->update_time = -1; stage->update_time = -1;
stage->next_presentation_time = -1;
} }
static void static void

View File

@@ -5,6 +5,12 @@
#include <clutter/clutter-backend.h> #include <clutter/clutter-backend.h>
#include <clutter/clutter-stage.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" #include "clutter/clutter-stage-window.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -48,7 +54,6 @@ struct _ClutterStageCogl
gint64 last_presentation_time; gint64 last_presentation_time;
gint64 update_time; gint64 update_time;
int64_t last_update_time; int64_t last_update_time;
int64_t next_presentation_time;
/* We only enable clipped redraws after 2 frames, since we've seen /* We only enable clipped redraws after 2 frames, since we've seen
* a lot of drivers can struggle to get going and may output some * a lot of drivers can struggle to get going and may output some
@@ -56,6 +61,14 @@ struct _ClutterStageCogl
unsigned int frame_count; unsigned int frame_count;
gint last_sync_delay; gint last_sync_delay;
cairo_region_t *redraw_clip;
guint initialized_redraw_clip : 1;
/* TRUE if the current paint cycle has a clipped redraw. In that
case bounding_redraw_clip specifies the the bounds. */
guint using_clipped_redraw : 1;
}; };
struct _ClutterStageCoglClass struct _ClutterStageCoglClass

View File

@@ -277,30 +277,28 @@ clutter_container_iface_init (ClutterContainerIface *iface)
} }
static void static void
clutter_group_real_paint (ClutterActor *actor, clutter_group_real_paint (ClutterActor *actor)
ClutterPaintContext *paint_context)
{ {
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'", CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'",
_clutter_actor_get_debug_name (actor)); _clutter_actor_get_debug_name (actor));
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, paint_context); g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'", CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'",
_clutter_actor_get_debug_name (actor)); _clutter_actor_get_debug_name (actor));
} }
static void static void
clutter_group_real_pick (ClutterActor *actor, clutter_group_real_pick (ClutterActor *actor)
ClutterPickContext *pick_context)
{ {
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
/* Chain up so we get a bounding box pained (if we are reactive) */ /* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick_context); CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, pick_context); g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
} }
static void static void

View File

@@ -78,12 +78,10 @@ static const ClutterColor default_border_color = { 0, 0, 0, 255 };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR) G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR)
static void static void
clutter_rectangle_paint (ClutterActor *self, clutter_rectangle_paint (ClutterActor *self)
ClutterPaintContext *paint_context)
{ {
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv; ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
CoglFramebuffer *framebuffer = CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
clutter_paint_context_get_framebuffer (paint_context);
static CoglPipeline *default_color_pipeline = NULL; static CoglPipeline *default_color_pipeline = NULL;
CoglPipeline *content_pipeline; CoglPipeline *content_pipeline;
ClutterActorBox alloc; ClutterActorBox alloc;

View File

@@ -233,7 +233,7 @@ clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native)
GSettingsSchemaSource *source = g_settings_schema_source_get_default (); GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
GSettingsSchema *schema = g_settings_schema_source_lookup (source, GSettingsSchema *schema = g_settings_schema_source_lookup (source,
xsettings_path, xsettings_path,
TRUE); FALSE);
if (!schema) if (!schema)
{ {

View File

@@ -37,6 +37,12 @@
#include <glib.h> #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-egl-headers.h"
#include <clutter/clutter.h> #include <clutter/clutter.h>

View File

@@ -57,13 +57,11 @@ clutter_headers = [
'clutter-mutter.h', 'clutter-mutter.h',
'clutter-offscreen-effect.h', 'clutter-offscreen-effect.h',
'clutter-page-turn-effect.h', 'clutter-page-turn-effect.h',
'clutter-paint-context.h',
'clutter-paint-nodes.h', 'clutter-paint-nodes.h',
'clutter-paint-node.h', 'clutter-paint-node.h',
'clutter-pan-action.h', 'clutter-pan-action.h',
'clutter-path-constraint.h', 'clutter-path-constraint.h',
'clutter-path.h', 'clutter-path.h',
'clutter-pick-context.h',
'clutter-property-transition.h', 'clutter-property-transition.h',
'clutter-rotate-action.h', 'clutter-rotate-action.h',
'clutter-script.h', 'clutter-script.h',
@@ -147,13 +145,11 @@ clutter_sources = [
'clutter-master-clock-default.c', 'clutter-master-clock-default.c',
'clutter-offscreen-effect.c', 'clutter-offscreen-effect.c',
'clutter-page-turn-effect.c', 'clutter-page-turn-effect.c',
'clutter-paint-context.c',
'clutter-paint-nodes.c', 'clutter-paint-nodes.c',
'clutter-paint-node.c', 'clutter-paint-node.c',
'clutter-pan-action.c', 'clutter-pan-action.c',
'clutter-path-constraint.c', 'clutter-path-constraint.c',
'clutter-path.c', 'clutter-path.c',
'clutter-pick-context.c',
'clutter-property-transition.c', 'clutter-property-transition.c',
'clutter-rotate-action.c', 'clutter-rotate-action.c',
'clutter-script.c', 'clutter-script.c',
@@ -204,7 +200,6 @@ clutter_private_headers = [
'clutter-master-clock.h', 'clutter-master-clock.h',
'clutter-master-clock-default.h', 'clutter-master-clock-default.h',
'clutter-offscreen-effect-private.h', 'clutter-offscreen-effect-private.h',
'clutter-paint-context-private.h',
'clutter-paint-node-private.h', 'clutter-paint-node-private.h',
'clutter-paint-volume-private.h', 'clutter-paint-volume-private.h',
'clutter-private.h', 'clutter-private.h',

View File

@@ -81,7 +81,6 @@ struct _CoglPangoDisplayListNode
GArray *rectangles; GArray *rectangles;
/* A primitive representing those vertices */ /* A primitive representing those vertices */
CoglPrimitive *primitive; CoglPrimitive *primitive;
guint has_color : 1;
} texture; } texture;
struct struct
@@ -421,9 +420,7 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
cogl_color_get_red_byte (&node->color), cogl_color_get_red_byte (&node->color),
cogl_color_get_green_byte (&node->color), cogl_color_get_green_byte (&node->color),
cogl_color_get_blue_byte (&node->color), cogl_color_get_blue_byte (&node->color),
(cogl_color_get_alpha_byte (&node->color) * cogl_color_get_alpha_byte (color));
cogl_color_get_alpha_byte (color) /
255));
else else
draw_color = *color; draw_color = *color;
cogl_color_premultiply (&draw_color); cogl_color_premultiply (&draw_color);

View File

@@ -58,29 +58,27 @@ struct _CoglPangoGlyphCacheValue
/* This will be set to TRUE when the glyph atlas is reorganized /* This will be set to TRUE when the glyph atlas is reorganized
which means the glyph will need to be redrawn */ which means the glyph will need to be redrawn */
guint dirty : 1; gboolean dirty;
/* Set to TRUE if the glyph has colors (eg. emoji) */
guint has_color : 1;
}; };
typedef void (* CoglPangoGlyphCacheDirtyFunc) (PangoFont *font, typedef void (* CoglPangoGlyphCacheDirtyFunc) (PangoFont *font,
PangoGlyph glyph, PangoGlyph glyph,
CoglPangoGlyphCacheValue *value); CoglPangoGlyphCacheValue *value);
COGL_EXPORT CoglPangoGlyphCache * CoglPangoGlyphCache *
cogl_pango_glyph_cache_new (CoglContext *ctx, cogl_pango_glyph_cache_new (CoglContext *ctx,
gboolean use_mipmapping); gboolean use_mipmapping);
COGL_EXPORT void void
cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache); cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache);
COGL_EXPORT CoglPangoGlyphCacheValue * CoglPangoGlyphCacheValue *
cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache, cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
gboolean create, gboolean create,
PangoFont *font, PangoFont *font,
PangoGlyph glyph); PangoGlyph glyph);
COGL_EXPORT void void
cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache); cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache);
void void

View File

@@ -50,7 +50,6 @@
#include <pango/pangocairo.h> #include <pango/pangocairo.h>
#include <pango/pango-renderer.h> #include <pango/pango-renderer.h>
#include <cairo.h> #include <cairo.h>
#include <cairo-ft.h>
#include "cogl/cogl-debug.h" #include "cogl/cogl-debug.h"
#include "cogl/cogl-context-private.h" #include "cogl/cogl-context-private.h"
@@ -455,6 +454,34 @@ 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 void
cogl_pango_show_layout_line (CoglFramebuffer *fb, cogl_pango_show_layout_line (CoglFramebuffer *fb,
PangoLayoutLine *line, PangoLayoutLine *line,
@@ -492,6 +519,19 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
priv->display_list = NULL; 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 void
_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer) _cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer)
{ {
@@ -527,24 +567,6 @@ cogl_pango_renderer_get_cached_glyph (PangoRenderer *renderer,
create, font, glyph); create, font, glyph);
} }
static gboolean
font_has_color_glyphs (const PangoFont *font)
{
cairo_scaled_font_t *scaled_font;
gboolean has_color = FALSE;
scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *) font);
if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_FT)
{
FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
has_color = (FT_HAS_COLOR (ft_face) != 0);
cairo_ft_scaled_font_unlock_face (scaled_font);
}
return has_color;
}
static void static void
cogl_pango_renderer_set_dirty_glyph (PangoFont *font, cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
PangoGlyph glyph, PangoGlyph glyph,
@@ -619,8 +641,6 @@ cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
cairo_image_surface_get_data (surface)); cairo_image_surface_get_data (surface));
cairo_surface_destroy (surface); cairo_surface_destroy (surface);
value->has_color = font_has_color_glyphs (font);
} }
static void static void
@@ -719,7 +739,6 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
PangoRenderPart part) PangoRenderPart part)
{ {
PangoColor *pango_color = pango_renderer_get_color (renderer, part); PangoColor *pango_color = pango_renderer_get_color (renderer, part);
uint16_t alpha = pango_renderer_get_alpha (renderer, part);
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer); CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
if (pango_color) if (pango_color)
@@ -730,7 +749,7 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
pango_color->red >> 8, pango_color->red >> 8,
pango_color->green >> 8, pango_color->green >> 8,
pango_color->blue >> 8, pango_color->blue >> 8,
alpha ? alpha >> 8 : 0xff); 0xff);
_cogl_pango_display_list_set_color_override (priv->display_list, &color); _cogl_pango_display_list_set_color_override (priv->display_list, &color);
} }
@@ -842,13 +861,14 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
CoglPangoGlyphCacheValue *cache_value; CoglPangoGlyphCacheValue *cache_value;
int i; int i;
cogl_pango_renderer_set_color_for_part (renderer,
PANGO_RENDER_PART_FOREGROUND);
for (i = 0; i < glyphs->num_glyphs; i++) for (i = 0; i < glyphs->num_glyphs; i++)
{ {
PangoGlyphInfo *gi = glyphs->glyphs + i; PangoGlyphInfo *gi = glyphs->glyphs + i;
float x, y; float x, y;
cogl_pango_renderer_set_color_for_part (renderer,
PANGO_RENDER_PART_FOREGROUND);
cogl_pango_renderer_get_device_units (renderer, cogl_pango_renderer_get_device_units (renderer,
xi + gi->geometry.x_offset, xi + gi->geometry.x_offset,
yi + gi->geometry.y_offset, yi + gi->geometry.y_offset,
@@ -905,19 +925,6 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
x += (float)(cache_value->draw_x); x += (float)(cache_value->draw_x);
y += (float)(cache_value->draw_y); y += (float)(cache_value->draw_y);
/* Do not override color if the glyph/font provide its own */
if (cache_value->has_color)
{
CoglColor color;
uint16_t alpha;
alpha = pango_renderer_get_alpha (renderer,
PANGO_RENDER_PART_FOREGROUND);
cogl_color_init_from_4ub (&color, 0xff, 0xff, 0xff,
alpha ? alpha >> 8 : 0xff);
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
}
cogl_pango_renderer_draw_glyph (priv, cache_value, x, y); cogl_pango_renderer_draw_glyph (priv, cache_value, x, y);
} }
} }

View File

@@ -75,7 +75,7 @@ typedef PangoCairoFontMap CoglPangoFontMap;
* *
* Since: 1.14 * Since: 1.14
*/ */
COGL_EXPORT PangoFontMap * PangoFontMap *
cogl_pango_font_map_new (void); cogl_pango_font_map_new (void);
/** /**
@@ -86,7 +86,7 @@ cogl_pango_font_map_new (void);
* *
* Returns: (transfer full): the newly created context: free with g_object_unref(). * Returns: (transfer full): the newly created context: free with g_object_unref().
*/ */
COGL_EXPORT PangoContext * PangoContext *
cogl_pango_font_map_create_context (CoglPangoFontMap *font_map); cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
/** /**
@@ -102,7 +102,7 @@ cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
* *
* Since: 1.14 * Since: 1.14
*/ */
COGL_EXPORT void void
cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map, cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
double dpi); double dpi);
@@ -114,7 +114,7 @@ cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT void void
cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map); cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map);
/** /**
@@ -129,7 +129,7 @@ cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map);
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT void void
cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout); cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout);
/** /**
@@ -142,7 +142,7 @@ cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout);
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT void void
cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map, cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map,
gboolean value); gboolean value);
@@ -157,7 +157,7 @@ cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map,
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT gboolean gboolean
cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map); cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map);
/** /**
@@ -170,7 +170,7 @@ cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map);
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT PangoRenderer * PangoRenderer *
cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map); cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map);
/** /**
@@ -187,7 +187,7 @@ cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map);
* *
* Since: 1.14 * Since: 1.14
*/ */
COGL_EXPORT void void
cogl_pango_show_layout (CoglFramebuffer *framebuffer, cogl_pango_show_layout (CoglFramebuffer *framebuffer,
PangoLayout *layout, PangoLayout *layout,
float x, float x,
@@ -208,7 +208,7 @@ cogl_pango_show_layout (CoglFramebuffer *framebuffer,
* *
* Since: 1.14 * Since: 1.14
*/ */
COGL_EXPORT void void
cogl_pango_show_layout_line (CoglFramebuffer *framebuffer, cogl_pango_show_layout_line (CoglFramebuffer *framebuffer,
PangoLayoutLine *line, PangoLayoutLine *line,
float x, float x,
@@ -227,7 +227,72 @@ cogl_pango_show_layout_line (CoglFramebuffer *framebuffer,
typedef struct _CoglPangoRenderer CoglPangoRenderer; typedef struct _CoglPangoRenderer CoglPangoRenderer;
typedef struct _CoglPangoRendererClass CoglPangoRendererClass; typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
COGL_EXPORT GType cogl_pango_renderer_get_type (void) G_GNUC_CONST; 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 G_END_DECLS

View File

@@ -7,3 +7,6 @@ cogl_pango_font_map_new
cogl_pango_font_map_set_resolution cogl_pango_font_map_set_resolution
cogl_pango_font_map_set_use_mipmapping cogl_pango_font_map_set_use_mipmapping
cogl_pango_renderer_get_type cogl_pango_renderer_get_type
cogl_pango_render_layout
cogl_pango_render_layout_line
cogl_pango_render_layout_subpixel

View File

@@ -0,0 +1,6 @@
{
global:
cogl_pango_*;
local:
*;
};

View File

@@ -20,13 +20,19 @@ cogl_pango_deps = [
libmutter_cogl_dep, libmutter_cogl_dep,
] ]
libmutter_cogl_pango_map = 'libmutter-cogl-pango.map'
libmutter_cogl_pango_link_args = [
'-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
libmutter_cogl_pango_map),
]
libmutter_cogl_pango = shared_library('mutter-cogl-pango-' + libmutter_api_version, libmutter_cogl_pango = shared_library('mutter-cogl-pango-' + libmutter_api_version,
sources: [cogl_pango_sources, cogl_pango_public_headers], sources: [cogl_pango_sources, cogl_pango_public_headers],
version: '0.0.0', version: '0.0.0',
soversion: 0, soversion: 0,
c_args: cogl_c_args, c_args: cogl_c_args,
include_directories: [cogl_includepath, cogl_path_includepath], include_directories: [cogl_includepath, cogl_path_includepath],
gnu_symbol_visibility: 'hidden', link_depends: libmutter_cogl_pango_map,
link_args: libmutter_cogl_pango_link_args,
dependencies: [cogl_pango_deps], dependencies: [cogl_pango_deps],
install_rpath: pkglibdir, install_rpath: pkglibdir,
install_dir: pkglibdir, install_dir: pkglibdir,

View File

@@ -50,7 +50,6 @@ G_BEGIN_DECLS
* *
* Returns: a #GType that can be used with the GLib type system. * Returns: a #GType that can be used with the GLib type system.
*/ */
COGL_EXPORT
GType cogl_path_get_gtype (void); GType cogl_path_get_gtype (void);
#define cogl_path_new cogl2_path_new #define cogl_path_new cogl2_path_new
@@ -65,7 +64,7 @@ GType cogl_path_get_gtype (void);
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT CoglPath * CoglPath *
cogl_path_new (void); cogl_path_new (void);
/** /**
@@ -83,7 +82,7 @@ cogl_path_new (void);
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT CoglPath * CoglPath *
cogl_path_copy (CoglPath *path); cogl_path_copy (CoglPath *path);
/** /**
@@ -97,7 +96,7 @@ cogl_path_copy (CoglPath *path);
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT gboolean gboolean
cogl_is_path (void *object); cogl_is_path (void *object);
#define cogl_path_move_to cogl2_path_move_to #define cogl_path_move_to cogl2_path_move_to
@@ -111,7 +110,7 @@ cogl_is_path (void *object);
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_move_to (CoglPath *path, cogl_path_move_to (CoglPath *path,
float x, float x,
float y); float y);
@@ -128,7 +127,7 @@ cogl_path_move_to (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_rel_move_to (CoglPath *path, cogl_path_rel_move_to (CoglPath *path,
float x, float x,
float y); float y);
@@ -144,7 +143,7 @@ cogl_path_rel_move_to (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_line_to (CoglPath *path, cogl_path_line_to (CoglPath *path,
float x, float x,
float y); float y);
@@ -160,7 +159,7 @@ cogl_path_line_to (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_rel_line_to (CoglPath *path, cogl_path_rel_line_to (CoglPath *path,
float x, float x,
float y); float y);
@@ -188,7 +187,7 @@ cogl_path_rel_line_to (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_arc (CoglPath *path, cogl_path_arc (CoglPath *path,
float center_x, float center_x,
float center_y, float center_y,
@@ -213,7 +212,7 @@ cogl_path_arc (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_curve_to (CoglPath *path, cogl_path_curve_to (CoglPath *path,
float x_1, float x_1,
float y_1, float y_1,
@@ -239,7 +238,7 @@ cogl_path_curve_to (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_rel_curve_to (CoglPath *path, cogl_path_rel_curve_to (CoglPath *path,
float x_1, float x_1,
float y_1, float y_1,
@@ -257,7 +256,7 @@ cogl_path_rel_curve_to (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_close (CoglPath *path); cogl_path_close (CoglPath *path);
#define cogl_path_line cogl2_path_line #define cogl_path_line cogl2_path_line
@@ -274,7 +273,7 @@ cogl_path_close (CoglPath *path);
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_line (CoglPath *path, cogl_path_line (CoglPath *path,
float x_1, float x_1,
float y_1, float y_1,
@@ -302,7 +301,7 @@ cogl_path_line (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_polyline (CoglPath *path, cogl_path_polyline (CoglPath *path,
const float *coords, const float *coords,
int num_points); int num_points);
@@ -324,7 +323,7 @@ cogl_path_polyline (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_polygon (CoglPath *path, cogl_path_polygon (CoglPath *path,
const float *coords, const float *coords,
int num_points); int num_points);
@@ -342,7 +341,7 @@ cogl_path_polygon (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_rectangle (CoglPath *path, cogl_path_rectangle (CoglPath *path,
float x_1, float x_1,
float y_1, float y_1,
@@ -362,7 +361,7 @@ cogl_path_rectangle (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_ellipse (CoglPath *path, cogl_path_ellipse (CoglPath *path,
float center_x, float center_x,
float center_y, float center_y,
@@ -385,7 +384,7 @@ cogl_path_ellipse (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_round_rectangle (CoglPath *path, cogl_path_round_rectangle (CoglPath *path,
float x_1, float x_1,
float y_1, float y_1,
@@ -407,7 +406,7 @@ cogl_path_round_rectangle (CoglPath *path,
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT void void
cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule); cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule);
#define cogl_path_get_fill_rule cogl2_path_get_fill_rule #define cogl_path_get_fill_rule cogl2_path_get_fill_rule
@@ -420,9 +419,29 @@ cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule);
* *
* Since: 2.0 * Since: 2.0
*/ */
COGL_EXPORT CoglPathFillRule CoglPathFillRule
cogl_path_get_fill_rule (CoglPath *path); 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: * cogl_framebuffer_fill_path:
* @framebuffer: A #CoglFramebuffer * @framebuffer: A #CoglFramebuffer
@@ -442,11 +461,24 @@ cogl_path_get_fill_rule (CoglPath *path);
* *
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT void void
cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer, cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglPath *path); 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: * cogl_framebuffer_stroke_path:
* @framebuffer: A #CoglFramebuffer * @framebuffer: A #CoglFramebuffer
@@ -459,7 +491,7 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
* *
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT void void
cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer, cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglPath *path); CoglPath *path);
@@ -477,10 +509,26 @@ cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
* Since: 1.0 * Since: 1.0
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT void void
cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer, cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
CoglPath *path); 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 G_END_DECLS
#endif /* __COGL_PATH_FUNCTIONS_H__ */ #endif /* __COGL_PATH_FUNCTIONS_H__ */

View File

@@ -385,6 +385,38 @@ _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 void
cogl2_path_move_to (CoglPath *path, cogl2_path_move_to (CoglPath *path,
float x, float x,
@@ -1472,6 +1504,12 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
COGL_FRAMEBUFFER_STATE_CLIP; COGL_FRAMEBUFFER_STATE_CLIP;
} }
void
cogl_clip_push_from_path (CoglPath *path)
{
cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path);
}
static void static void
_cogl_path_build_stroke_attribute_buffer (CoglPath *path) _cogl_path_build_stroke_attribute_buffer (CoglPath *path)
{ {

View File

@@ -0,0 +1,17 @@
{
global:
cogl_framebuffer_*;
cogl_path_*;
cogl_is_*;
cogl_clip_*;
cogl_get_*;
cogl_set_*;
cogl2_framebuffer_*;
cogl2_path_*;
cogl2_is_*;
cogl2_clip_*;
cogl2_get_*;
cogl2_set_*;
local:
*;
};

View File

@@ -53,13 +53,19 @@ cogl_path_c_args = [
cogl_c_args, cogl_c_args,
] ]
libmutter_cogl_path_map = 'libmutter-cogl-path.map'
libmutter_cogl_path_link_args = [
'-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
libmutter_cogl_path_map),
]
libmutter_cogl_path = shared_library('mutter-cogl-path-' + libmutter_api_version, libmutter_cogl_path = shared_library('mutter-cogl-path-' + libmutter_api_version,
sources: [cogl_path_sources, cogl_path_public_headers], sources: [cogl_path_sources, cogl_path_public_headers],
version: '0.0.0', version: '0.0.0',
soversion: 0, soversion: 0,
c_args: cogl_path_c_args, c_args: cogl_path_c_args,
include_directories: [cogl_includepath, cogl_path_includepath], include_directories: [cogl_includepath, cogl_path_includepath],
gnu_symbol_visibility: 'hidden', link_depends: libmutter_cogl_path_map,
link_args: libmutter_cogl_path_link_args,
dependencies: libmutter_cogl_dep, dependencies: libmutter_cogl_dep,
install_rpath: pkglibdir, install_rpath: pkglibdir,
install_dir: pkglibdir, install_dir: pkglibdir,

View File

@@ -65,12 +65,12 @@ CoglAtlasTexture *
_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp, _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
gboolean can_convert_in_place); gboolean can_convert_in_place);
COGL_EXPORT void void
_cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx, _cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
GHookFunc callback, GHookFunc callback,
void *user_data); void *user_data);
COGL_EXPORT void void
_cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx, _cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
GHookFunc callback, GHookFunc callback,
void *user_data); void *user_data);

View File

@@ -252,14 +252,16 @@ _cogl_atlas_texture_foreach_sub_texture_in_region (
static void static void
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, _cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s, GLenum wrap_mode_s,
GLenum wrap_mode_t) GLenum wrap_mode_t,
GLenum wrap_mode_p)
{ {
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
/* Forward on to the sub texture */ /* Forward on to the sub texture */
_cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture, _cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture,
wrap_mode_s, wrap_mode_s,
wrap_mode_t); wrap_mode_t,
wrap_mode_p);
} }
static void static void

View File

@@ -74,7 +74,6 @@ typedef struct _CoglAtlasTexture CoglAtlasTexture;
* *
* Returns: a #GType that can be used with the GLib type system. * Returns: a #GType that can be used with the GLib type system.
*/ */
COGL_EXPORT
GType cogl_atlas_texture_get_gtype (void); GType cogl_atlas_texture_get_gtype (void);
/** /**
@@ -109,7 +108,7 @@ GType cogl_atlas_texture_get_gtype (void);
* Since: 1.16 * Since: 1.16
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglAtlasTexture * CoglAtlasTexture *
cogl_atlas_texture_new_with_size (CoglContext *ctx, cogl_atlas_texture_new_with_size (CoglContext *ctx,
int width, int width,
int height); int height);
@@ -147,7 +146,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
* Since: 1.16 * Since: 1.16
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglAtlasTexture * CoglAtlasTexture *
cogl_atlas_texture_new_from_file (CoglContext *ctx, cogl_atlas_texture_new_from_file (CoglContext *ctx,
const char *filename, const char *filename,
GError **error); GError **error);
@@ -192,7 +191,7 @@ cogl_atlas_texture_new_from_file (CoglContext *ctx,
* Since: 1.16 * Since: 1.16
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglAtlasTexture * CoglAtlasTexture *
cogl_atlas_texture_new_from_data (CoglContext *ctx, cogl_atlas_texture_new_from_data (CoglContext *ctx,
int width, int width,
int height, int height,
@@ -232,7 +231,7 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
* Since: 1.16 * Since: 1.16
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglAtlasTexture * CoglAtlasTexture *
cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp); cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp);
/** /**
@@ -247,7 +246,7 @@ cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp);
* Since: 1.16 * Since: 1.16
* Stability: Unstable * Stability: Unstable
*/ */
COGL_EXPORT gboolean gboolean
cogl_is_atlas_texture (void *object); cogl_is_atlas_texture (void *object);
G_END_DECLS G_END_DECLS

View File

@@ -64,12 +64,12 @@ struct _CoglAtlas
GHookList post_reorganize_callbacks; GHookList post_reorganize_callbacks;
}; };
COGL_EXPORT CoglAtlas * CoglAtlas *
_cogl_atlas_new (CoglPixelFormat texture_format, _cogl_atlas_new (CoglPixelFormat texture_format,
CoglAtlasFlags flags, CoglAtlasFlags flags,
CoglAtlasUpdatePositionCallback update_position_cb); CoglAtlasUpdatePositionCallback update_position_cb);
COGL_EXPORT gboolean gboolean
_cogl_atlas_reserve_space (CoglAtlas *atlas, _cogl_atlas_reserve_space (CoglAtlas *atlas,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
@@ -87,7 +87,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
int height, int height,
CoglPixelFormat format); CoglPixelFormat format);
COGL_EXPORT void void
_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas, _cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
GHookFunc pre_callback, GHookFunc pre_callback,
GHookFunc post_callback, GHookFunc post_callback,

View File

@@ -64,7 +64,6 @@ G_BEGIN_DECLS
* *
* Returns: a #GType that can be used with the GLib type system. * Returns: a #GType that can be used with the GLib type system.
*/ */
COGL_EXPORT
GType cogl_attribute_buffer_get_gtype (void); GType cogl_attribute_buffer_get_gtype (void);
/** /**
@@ -90,7 +89,7 @@ GType cogl_attribute_buffer_get_gtype (void);
* *
* Stability: Unstable * Stability: Unstable
*/ */
COGL_EXPORT CoglAttributeBuffer * CoglAttributeBuffer *
cogl_attribute_buffer_new_with_size (CoglContext *context, cogl_attribute_buffer_new_with_size (CoglContext *context,
size_t bytes); size_t bytes);
@@ -123,7 +122,7 @@ cogl_attribute_buffer_new_with_size (CoglContext *context,
* Since: 1.4 * Since: 1.4
* Stability: Unstable * Stability: Unstable
*/ */
COGL_EXPORT CoglAttributeBuffer * CoglAttributeBuffer *
cogl_attribute_buffer_new (CoglContext *context, cogl_attribute_buffer_new (CoglContext *context,
size_t bytes, size_t bytes,
const void *data); const void *data);
@@ -140,7 +139,7 @@ cogl_attribute_buffer_new (CoglContext *context,
* Since: 1.4 * Since: 1.4
* Stability: Unstable * Stability: Unstable
*/ */
COGL_EXPORT gboolean gboolean
cogl_is_attribute_buffer (void *object); cogl_is_attribute_buffer (void *object);
G_END_DECLS G_END_DECLS

View File

@@ -90,16 +90,17 @@ typedef enum
COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0, COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0,
COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1, COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1,
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2, 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 /* By default the vertex attribute drawing code will assume that if
there is a color attribute array enabled then we can't determine there is a color attribute array enabled then we can't determine
if the colors will be opaque so we need to enabling if the colors will be opaque so we need to enabling
blending. However when drawing from the journal we know what the blending. However when drawing from the journal we know what the
contents of the color array is so we can override this by passing contents of the color array is so we can override this by passing
this flag. */ this flag. */
COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 3, COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 4,
/* This forcibly disables the debug option to divert all drawing to /* This forcibly disables the debug option to divert all drawing to
* wireframes */ * wireframes */
COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 4 COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5
} CoglDrawFlags; } CoglDrawFlags;
/* During CoglContext initialization we register the "cogl_color_in" /* During CoglContext initialization we register the "cogl_color_in"

View File

@@ -168,6 +168,35 @@ validate_n_components (const CoglAttributeNameState *name_state,
{ {
switch (name_state->name_id) 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: case COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY:
if (G_UNLIKELY (n_components != 1)) if (G_UNLIKELY (n_components != 1))
{ {
@@ -176,10 +205,6 @@ validate_n_components (const CoglAttributeNameState *name_state,
return FALSE; return FALSE;
} }
break; 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: case COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY:
return TRUE; return TRUE;
} }
@@ -625,6 +650,15 @@ _cogl_flush_attributes_state (CoglFramebuffer *framebuffer,
* when the framebuffer really does get drawn to. */ * when the framebuffer really does get drawn to. */
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer); _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, ctx->driver_vtable->flush_attributes_state (framebuffer,
pipeline, pipeline,
&layers_state, &layers_state,

View File

@@ -63,7 +63,6 @@ G_BEGIN_DECLS
* *
* Returns: a #GType that can be used with the GLib type system. * Returns: a #GType that can be used with the GLib type system.
*/ */
COGL_EXPORT
GType cogl_attribute_get_gtype (void); GType cogl_attribute_get_gtype (void);
/** /**
@@ -156,7 +155,7 @@ GType cogl_attribute_get_gtype (void);
*/ */
/* XXX: look for a precedent to see if the stride/offset args should /* XXX: look for a precedent to see if the stride/offset args should
* have a different order. */ * have a different order. */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new (CoglAttributeBuffer *attribute_buffer, cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
const char *name, const char *name,
size_t stride, size_t stride,
@@ -184,7 +183,7 @@ cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant @value. * representing the given constant @value.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_1f (CoglContext *context, cogl_attribute_new_const_1f (CoglContext *context,
const char *name, const char *name,
float value); float value);
@@ -211,7 +210,7 @@ cogl_attribute_new_const_1f (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant vector. * representing the given constant vector.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_2f (CoglContext *context, cogl_attribute_new_const_2f (CoglContext *context,
const char *name, const char *name,
float component0, float component0,
@@ -243,7 +242,7 @@ cogl_attribute_new_const_2f (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant vector. * representing the given constant vector.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_3f (CoglContext *context, cogl_attribute_new_const_3f (CoglContext *context,
const char *name, const char *name,
float component0, float component0,
@@ -278,7 +277,7 @@ cogl_attribute_new_const_3f (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant vector. * representing the given constant vector.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_4f (CoglContext *context, cogl_attribute_new_const_4f (CoglContext *context,
const char *name, const char *name,
float component0, float component0,
@@ -307,7 +306,7 @@ cogl_attribute_new_const_4f (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant vector. * representing the given constant vector.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_2fv (CoglContext *context, cogl_attribute_new_const_2fv (CoglContext *context,
const char *name, const char *name,
const float *value); const float *value);
@@ -336,7 +335,7 @@ cogl_attribute_new_const_2fv (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant vector. * representing the given constant vector.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_3fv (CoglContext *context, cogl_attribute_new_const_3fv (CoglContext *context,
const char *name, const char *name,
const float *value); const float *value);
@@ -366,7 +365,7 @@ cogl_attribute_new_const_3fv (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant vector. * representing the given constant vector.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_4fv (CoglContext *context, cogl_attribute_new_const_4fv (CoglContext *context,
const char *name, const char *name,
const float *value); const float *value);
@@ -399,7 +398,7 @@ cogl_attribute_new_const_4fv (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant matrix. * representing the given constant matrix.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_2x2fv (CoglContext *context, cogl_attribute_new_const_2x2fv (CoglContext *context,
const char *name, const char *name,
const float *matrix2x2, const float *matrix2x2,
@@ -434,7 +433,7 @@ cogl_attribute_new_const_2x2fv (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant matrix. * representing the given constant matrix.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_3x3fv (CoglContext *context, cogl_attribute_new_const_3x3fv (CoglContext *context,
const char *name, const char *name,
const float *matrix3x3, const float *matrix3x3,
@@ -469,7 +468,7 @@ cogl_attribute_new_const_3x3fv (CoglContext *context,
* Return value: (transfer full): A newly allocated #CoglAttribute * Return value: (transfer full): A newly allocated #CoglAttribute
* representing the given constant matrix. * representing the given constant matrix.
*/ */
COGL_EXPORT CoglAttribute * CoglAttribute *
cogl_attribute_new_const_4x4fv (CoglContext *context, cogl_attribute_new_const_4x4fv (CoglContext *context,
const char *name, const char *name,
const float *matrix4x4, const float *matrix4x4,
@@ -493,7 +492,7 @@ cogl_attribute_new_const_4x4fv (CoglContext *context,
* Stability: unstable * Stability: unstable
* Since: 1.10 * Since: 1.10
*/ */
COGL_EXPORT void void
cogl_attribute_set_normalized (CoglAttribute *attribute, cogl_attribute_set_normalized (CoglAttribute *attribute,
gboolean normalized); gboolean normalized);
@@ -507,7 +506,7 @@ cogl_attribute_set_normalized (CoglAttribute *attribute,
* Stability: unstable * Stability: unstable
* Since: 1.10 * Since: 1.10
*/ */
COGL_EXPORT gboolean gboolean
cogl_attribute_get_normalized (CoglAttribute *attribute); cogl_attribute_get_normalized (CoglAttribute *attribute);
/** /**
@@ -520,7 +519,7 @@ cogl_attribute_get_normalized (CoglAttribute *attribute);
* Stability: unstable * Stability: unstable
* Since: 1.10 * Since: 1.10
*/ */
COGL_EXPORT CoglAttributeBuffer * CoglAttributeBuffer *
cogl_attribute_get_buffer (CoglAttribute *attribute); cogl_attribute_get_buffer (CoglAttribute *attribute);
/** /**
@@ -533,7 +532,7 @@ cogl_attribute_get_buffer (CoglAttribute *attribute);
* Stability: unstable * Stability: unstable
* Since: 1.10 * Since: 1.10
*/ */
COGL_EXPORT void void
cogl_attribute_set_buffer (CoglAttribute *attribute, cogl_attribute_set_buffer (CoglAttribute *attribute,
CoglAttributeBuffer *attribute_buffer); CoglAttributeBuffer *attribute_buffer);
@@ -546,7 +545,7 @@ cogl_attribute_set_buffer (CoglAttribute *attribute,
* Return value: %TRUE if the @object references a #CoglAttribute, * Return value: %TRUE if the @object references a #CoglAttribute,
* %FALSE otherwise * %FALSE otherwise
*/ */
COGL_EXPORT gboolean gboolean
cogl_is_attribute (void *object); cogl_is_attribute (void *object);
G_END_DECLS G_END_DECLS

View File

@@ -54,7 +54,6 @@ G_BEGIN_DECLS
* *
* Returns: a #GType that can be used with the GLib type system. * Returns: a #GType that can be used with the GLib type system.
*/ */
COGL_EXPORT
GType cogl_bitmap_get_gtype (void); GType cogl_bitmap_get_gtype (void);
/** /**
@@ -81,7 +80,7 @@ GType cogl_bitmap_get_gtype (void);
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT CoglBitmap * CoglBitmap *
cogl_bitmap_new_from_file (const char *filename, cogl_bitmap_new_from_file (const char *filename,
GError **error); GError **error);
@@ -104,7 +103,7 @@ cogl_bitmap_new_from_file (const char *filename,
* Since: 1.8 * Since: 1.8
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglBitmap * CoglBitmap *
cogl_bitmap_new_from_buffer (CoglBuffer *buffer, cogl_bitmap_new_from_buffer (CoglBuffer *buffer,
CoglPixelFormat format, CoglPixelFormat format,
int width, int width,
@@ -141,7 +140,7 @@ cogl_bitmap_new_from_buffer (CoglBuffer *buffer,
* Since: 1.10 * Since: 1.10
* Stability: Unstable * Stability: Unstable
*/ */
COGL_EXPORT CoglBitmap * CoglBitmap *
cogl_bitmap_new_with_size (CoglContext *context, cogl_bitmap_new_with_size (CoglContext *context,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
@@ -167,7 +166,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
* Since: 1.10 * Since: 1.10
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglBitmap * CoglBitmap *
cogl_bitmap_new_for_data (CoglContext *context, cogl_bitmap_new_for_data (CoglContext *context,
int width, int width,
int height, int height,
@@ -183,7 +182,7 @@ cogl_bitmap_new_for_data (CoglContext *context,
* Since: 1.10 * Since: 1.10
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT CoglPixelFormat CoglPixelFormat
cogl_bitmap_get_format (CoglBitmap *bitmap); cogl_bitmap_get_format (CoglBitmap *bitmap);
/** /**
@@ -194,7 +193,7 @@ cogl_bitmap_get_format (CoglBitmap *bitmap);
* Since: 1.10 * Since: 1.10
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT int int
cogl_bitmap_get_width (CoglBitmap *bitmap); cogl_bitmap_get_width (CoglBitmap *bitmap);
/** /**
@@ -205,7 +204,7 @@ cogl_bitmap_get_width (CoglBitmap *bitmap);
* Since: 1.10 * Since: 1.10
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT int int
cogl_bitmap_get_height (CoglBitmap *bitmap); cogl_bitmap_get_height (CoglBitmap *bitmap);
/** /**
@@ -218,7 +217,7 @@ cogl_bitmap_get_height (CoglBitmap *bitmap);
* Since: 1.10 * Since: 1.10
* Stability: unstable * Stability: unstable
*/ */
COGL_EXPORT int int
cogl_bitmap_get_rowstride (CoglBitmap *bitmap); cogl_bitmap_get_rowstride (CoglBitmap *bitmap);
/** /**
@@ -232,7 +231,7 @@ cogl_bitmap_get_rowstride (CoglBitmap *bitmap);
* Stability: unstable * Stability: unstable
* Since: 1.10 * Since: 1.10
*/ */
COGL_EXPORT CoglPixelBuffer * CoglPixelBuffer *
cogl_bitmap_get_buffer (CoglBitmap *bitmap); cogl_bitmap_get_buffer (CoglBitmap *bitmap);
/** /**
@@ -248,7 +247,7 @@ cogl_bitmap_get_buffer (CoglBitmap *bitmap);
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT gboolean gboolean
cogl_bitmap_get_size_from_file (const char *filename, cogl_bitmap_get_size_from_file (const char *filename,
int *width, int *width,
int *height); int *height);
@@ -264,7 +263,7 @@ cogl_bitmap_get_size_from_file (const char *filename,
* *
* Since: 1.0 * Since: 1.0
*/ */
COGL_EXPORT gboolean gboolean
cogl_is_bitmap (void *object); cogl_is_bitmap (void *object);
/** /**
@@ -298,7 +297,6 @@ typedef enum
COGL_BITMAP_ERROR_CORRUPT_IMAGE COGL_BITMAP_ERROR_CORRUPT_IMAGE
} CoglBitmapError; } CoglBitmapError;
COGL_EXPORT
uint32_t cogl_bitmap_error_quark (void); uint32_t cogl_bitmap_error_quark (void);
G_END_DECLS G_END_DECLS

View File

@@ -509,7 +509,7 @@ parse_argument (const char *string, /* original user string */
if (parsing_factor) if (parsing_factor)
arg->factor.is_color = TRUE; arg->factor.is_color = TRUE;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_ARG_STATE_SCRAPING_COLOR_SRC_NAME: case PARSER_ARG_STATE_SCRAPING_COLOR_SRC_NAME:
if (!is_symbol_char (*p)) if (!is_symbol_char (*p))
{ {
@@ -540,7 +540,7 @@ parse_argument (const char *string, /* original user string */
else else
continue; continue;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_ARG_STATE_MAYBE_COLOR_MASK: case PARSER_ARG_STATE_MAYBE_COLOR_MASK:
if (*p != '[') if (*p != '[')
{ {
@@ -554,7 +554,7 @@ parse_argument (const char *string, /* original user string */
state = PARSER_ARG_STATE_SCRAPING_MASK; state = PARSER_ARG_STATE_SCRAPING_MASK;
mark = p; mark = p;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_ARG_STATE_SCRAPING_MASK: case PARSER_ARG_STATE_SCRAPING_MASK:
if (*p == ']') if (*p == ']')
{ {
@@ -687,7 +687,7 @@ parse_argument (const char *string, /* original user string */
arg->factor.is_one = TRUE; arg->factor.is_one = TRUE;
state = PARSER_ARG_STATE_EXPECT_END; state = PARSER_ARG_STATE_EXPECT_END;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_ARG_STATE_EXPECT_END: case PARSER_ARG_STATE_EXPECT_END:
if (*p != ',' && *p != ')') if (*p != ',' && *p != ')')
{ {
@@ -787,7 +787,7 @@ _cogl_blend_string_compile (const char *string,
mark = p; mark = p;
state = PARSER_STATE_SCRAPING_DEST_CHANNELS; state = PARSER_STATE_SCRAPING_DEST_CHANNELS;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_STATE_SCRAPING_DEST_CHANNELS: case PARSER_STATE_SCRAPING_DEST_CHANNELS:
if (*p != '=') if (*p != '=')
continue; continue;
@@ -810,7 +810,7 @@ _cogl_blend_string_compile (const char *string,
mark = p; mark = p;
state = PARSER_STATE_SCRAPING_FUNCTION_NAME; state = PARSER_STATE_SCRAPING_FUNCTION_NAME;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_STATE_SCRAPING_FUNCTION_NAME: case PARSER_STATE_SCRAPING_FUNCTION_NAME:
if (*p != '(') if (*p != '(')
{ {
@@ -832,7 +832,7 @@ _cogl_blend_string_compile (const char *string,
current_arg = 0; current_arg = 0;
state = PARSER_STATE_EXPECT_ARG_START; state = PARSER_STATE_EXPECT_ARG_START;
G_GNUC_FALLTHROUGH; /* fall through */
case PARSER_STATE_EXPECT_ARG_START: case PARSER_STATE_EXPECT_ARG_START:
if (*p != '(' && *p != ',') if (*p != '(' && *p != ',')
continue; continue;

Some files were not shown because too many files have changed in this diff Show More