Compare commits
261 Commits
wip/kms-co
...
wip/carlos
Author | SHA1 | Date | |
---|---|---|---|
435e1a47ac | |||
40a76590dd | |||
f2b3dd318f | |||
942883577e | |||
23fa59b77c | |||
9678fd5306 | |||
563e7139b6 | |||
2e9faaf67a | |||
4918893326 | |||
3e5960b5a2 | |||
b294e62aed | |||
c63f54b7a7 | |||
3186e45ae5 | |||
ed7afd9e80 | |||
683f18639e | |||
e17494f3bd | |||
c36c865987 | |||
a99f579127 | |||
acc7b83322 | |||
95662fd3d8 | |||
b3980f7a94 | |||
ac626f7334 | |||
b622a8b55d | |||
b6170dbe7b | |||
d6bf4800ed | |||
a60457c2d8 | |||
33d1bae03f | |||
013b336690 | |||
096d78479b | |||
68fca552d7 | |||
18e0a8f7bf | |||
cd2ee44216 | |||
ebf9ac091d | |||
cf791c09f0 | |||
1d8807a171 | |||
f18e2d2e62 | |||
71c3f4af31 | |||
3078394951 | |||
a7f4f5b291 | |||
bd1630a12c | |||
67d5ebb187 | |||
ba7b8a5de3 | |||
d54c548aac | |||
f01db80387 | |||
5e0989532e | |||
673f4295e8 | |||
1f04b1ae69 | |||
26a7387f40 | |||
bd5266a05e | |||
eb3ffeff0a | |||
0731eb629c | |||
34a38827b7 | |||
3076895e98 | |||
0e4c23c985 | |||
fb49e9def7 | |||
45e77c1d87 | |||
cf107c89b8 | |||
6a8830a551 | |||
4523251849 | |||
5f4e8789df | |||
eaf0aa1f07 | |||
96da0c60bd | |||
da36575d7f | |||
7716a418ce | |||
6ab2e30fff | |||
8b0289a5ba | |||
d810c0576d | |||
82f56054d4 | |||
de362537c6 | |||
ba9fb16048 | |||
148cba3270 | |||
c5bb2e3f56 | |||
049e7882b7 | |||
f297a5faa5 | |||
40e6aa7d94 | |||
668be1f4bd | |||
a444a4c5f5 | |||
05da4a6094 | |||
db8fcc0537 | |||
86a5358812 | |||
ff8ed70f84 | |||
179d5ba6a6 | |||
98892391d7 | |||
45a8806e65 | |||
e1fa0734a9 | |||
8665084df1 | |||
62072838c9 | |||
c5b7d73ce2 | |||
0556138b9f | |||
d57dbe1d4c | |||
5d646a5d6f | |||
e82a657cd9 | |||
8c89ea5f0a | |||
8cfa8dc0c1 | |||
bdf5e3f357 | |||
94682e69aa | |||
160cc9182d | |||
cd293f764e | |||
a5d0cfe8fb | |||
ba0f17f5b1 | |||
16875340cb | |||
959a418cc3 | |||
7c7ccb2e43 | |||
cada2b54fe | |||
3ecae81809 | |||
4f2b217a6a | |||
b1a1d4e13d | |||
f7315c9a36 | |||
9ac52f0340 | |||
f059466337 | |||
dcd0f4322a | |||
65d8f27b6b | |||
bdceb3acdb | |||
8e204e036a | |||
553211dd81 | |||
97010ac64d | |||
c2d03bf73e | |||
22c8f179d2 | |||
d4ff5e2d31 | |||
2773e8adf8 | |||
e17d70a592 | |||
da213febdc | |||
7c2e926c44 | |||
c474ad6a53 | |||
877ecc1bb4 | |||
0d0286d59e | |||
23f77a1b63 | |||
317ce05a27 | |||
a8155a0471 | |||
5e7fa20f06 | |||
3a688988e0 | |||
34ff206604 | |||
5c1be2233d | |||
e1751ad9ee | |||
84cc89e19a | |||
ea4665bf51 | |||
227d272049 | |||
e53db92a7b | |||
dd2b1278a0 | |||
f2e2fcf758 | |||
dfd44ff971 | |||
943b069996 | |||
2a56de80a2 | |||
69a0c1dc80 | |||
1b4709794e | |||
1cc249fe18 | |||
446bd04b6c | |||
9234fcb624 | |||
59a697f773 | |||
d49d10b14f | |||
4c15d32b55 | |||
73eaf51770 | |||
81ee8886ce | |||
658c741420 | |||
65cc8c1ea2 | |||
d9597d2148 | |||
fc3831c797 | |||
ce86f90efb | |||
b5f50028f2 | |||
2c388e2155 | |||
fb6e2743ec | |||
6ee006c851 | |||
107e521553 | |||
7735a919d1 | |||
9f617ae43d | |||
104bdde746 | |||
2a990cc140 | |||
3e41568074 | |||
66ae09b670 | |||
7b97c7b35e | |||
ca318c1520 | |||
cbb4f6c892 | |||
092b3edb51 | |||
8d6d2d07dd | |||
fa461525ee | |||
8e510a07c4 | |||
e153524748 | |||
eb8a1f42bc | |||
89cd9d382d | |||
488991b0f6 | |||
e2330617ac | |||
5e6d98e79f | |||
5eaf655224 | |||
2c1553570f | |||
c937dd5ba3 | |||
26b76ee95d | |||
006eb6d81e | |||
0cdf13ac12 | |||
0a3f25c303 | |||
105a3f757a | |||
f376a318ba | |||
4b88c1832a | |||
fc8aa1cdb1 | |||
7049b2f274 | |||
0f51ae7cf0 | |||
437f6b3d59 | |||
05e1a6c2ca | |||
25c1a85384 | |||
bba8f6c53e | |||
dbe9daeb76 | |||
8fd55fef85 | |||
acfd03da30 | |||
f352c3d79d | |||
4bf0bd3f55 | |||
76f2579e44 | |||
0706e021f5 | |||
b5775e3d85 | |||
cd70595b50 | |||
1d2913d9b9 | |||
b8a49a682e | |||
82901f89d5 | |||
c9c53cb55f | |||
1e637bd7e1 | |||
63a0b702c9 | |||
031003a5dc | |||
b69d2aa6a0 | |||
d7d2612218 | |||
7a0340c57d | |||
0863bd2408 | |||
594cc7c7d6 | |||
0b19078b2b | |||
7811865e84 | |||
0e69fe0781 | |||
26b08d87a8 | |||
321ab3b367 | |||
4d0869e206 | |||
d13cea6ccb | |||
6922f0e16a | |||
31df06d94e | |||
ecec9a7eaa | |||
ab7af2d0c5 | |||
f92e0bec0b | |||
7a22f6fd3f | |||
850ef51879 | |||
ef2e04a613 | |||
e16b75a0b7 | |||
8cdcf529e9 | |||
280167f217 | |||
a72f3fdabb | |||
dd6227e3bf | |||
1271ce1cab | |||
998114791f | |||
8a73324a0f | |||
9065edfc95 | |||
5111e33948 | |||
4cf828323d | |||
35776c5d29 | |||
2f27b8d5fa | |||
be4131b3c4 | |||
854feafa83 | |||
f423736a70 | |||
fdbac25e0d | |||
bcfac0d6dc | |||
682d43b5ab | |||
cd273e82ad | |||
3c0067dc69 | |||
a957c2f0c2 | |||
908203c735 | |||
2f072af02b | |||
de98fb29da | |||
82c92177ff |
@ -1,4 +1,4 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
|
||||
stages:
|
||||
- review
|
||||
@ -28,10 +28,10 @@ build-mutter:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-native-backend:
|
||||
build-without-native-backend-and-wayland:
|
||||
stage: build
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
|
@ -1,39 +1,28 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
#
|
||||
|
||||
FROM fedora:30
|
||||
FROM fedora:31
|
||||
|
||||
RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
dnf copr enable -y hergertme/sysprof-3 && \
|
||||
dnf -y update && dnf -y upgrade && \
|
||||
|
||||
dnf builddep -y mutter && \
|
||||
|
||||
# Until Fedora catches up with meson build-deps
|
||||
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \
|
||||
|
||||
# Until Fedora catches up with mesa bug fixes
|
||||
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
|
||||
# Until Fedora catches up with new build-deps
|
||||
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' && \
|
||||
|
||||
# For running unit tests
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
|
||||
|
||||
dnf install -y sysprof-devel && \
|
||||
|
||||
dnf install -y intltool redhat-rpm-config make && \
|
||||
|
||||
# GNOME Shell
|
||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
||||
# New dep this cycle
|
||||
dnf install -y 'pkgconfig(gnome-autoar-0)' && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
|
||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||
|
||||
|
@ -40,11 +40,12 @@ function commit_message_subject_is_compliant() {
|
||||
return 0
|
||||
}
|
||||
|
||||
RET=0
|
||||
for commit in $commits; do
|
||||
commit_short=$(echo $commit | cut -c -8)
|
||||
|
||||
if ! commit_message_has_url $commit; then
|
||||
echo "Missing merge request or issue URL on commit $commit_short"
|
||||
echo "Commit $commit_short needs a merge request or issue URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -52,6 +53,8 @@ for commit in $commits; do
|
||||
if [ $? != 0 ]; then
|
||||
echo "Commit message for $commit_short is not compliant:"
|
||||
echo "$errors"
|
||||
exit 1
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
||||
|
87
NEWS
87
NEWS
@ -1,3 +1,90 @@
|
||||
3.35.1
|
||||
======
|
||||
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
|
||||
* Respond to frame callbacks regardless of damage [Jonas; !839]
|
||||
* selection [Carlos; !842]
|
||||
* Fix Night Light on wayland [Jonas; !840]
|
||||
* Fix various copy+paste/DND regressions [Carlos; !848, #789, #842,
|
||||
#793, #845, #854]
|
||||
* Misc. bug fixes and cleanups [Daniel, Marco, Jonas, Georges;
|
||||
!841, !764, !837, !846]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Carlos Garnacho, Tim Klocke,
|
||||
Georges Basile Stavracas Neto, Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
3.34.1
|
||||
======
|
||||
* Fix startup of X11 session services on wayland [Carlos; #771]
|
||||
* Fix _NET_ACTIVE_WINDOW emission [Carlos; #751]
|
||||
* Fix initial view perspective [Marco; !803]
|
||||
* Fix screenshots and window animations when scaled [Robert; !758]
|
||||
* Re-enable coredumps when capabilities are set [Jonas; !811]
|
||||
* Fix scaling of DND surface actors [Robert; !780]
|
||||
* Optimize blitting of untransformed offscreen stage views [Olivier; !809, !820]
|
||||
* Fix freeze of pointer event delivery on X11 [Olivier; !821]
|
||||
* Fix scaling of stylus input coordinates with HiDPI [Dorian; !830]
|
||||
* Fix memory leak when using implicit animations [Jonas; !828]
|
||||
* Fix numlock state for native backend [Carlos; #769]
|
||||
* Fixed crashes [Marco, Olivier, Jonas Å.; !805, #823, !808, !825,
|
||||
#844, !826, #779]
|
||||
* Misc. bug fixes and cleanups [Jonas Å., Georges, Jonas D., Michal, Daniel,
|
||||
Iain, Adam, Marco, Carlos, Ting-Wei, Hans, Robert; !787, !795, !791, !797,
|
||||
!772, !775, !799, !778, !785, !782, !796, #819, !814, !769, !817, !783, !786,
|
||||
!829, !774, #822]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Hans de Goede, Adam Jackson, Ting-Wei Lan, Iain Lane, Michal Lazo,
|
||||
Robert Mader, Georges Basile Stavracas Neto, Dorian Stoll, Daniel van Vugt,
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Milo Casagrande [it], Nathan Follens [nl], Matej Urbančič [sl],
|
||||
Ask Hjorth Larsen [da], Alan Mortensen [da], Jordi Mas [ca]
|
||||
|
||||
3.34.0
|
||||
======
|
||||
* Fix xdg-output v3 support [Olivier; !771]
|
||||
* Fix crash when changing decoration state [Jonas; !773]
|
||||
* Add and remove connectors on hot-plug [Jonas; !743]
|
||||
|
||||
Contributors:
|
||||
Olivier Fourdan, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Rafael Fontenelle [pt_BR], Gwan-gyeong Mun [ko], Christian Kirbach [de],
|
||||
Claude Paroz [fr], Milo Casagrande [it], Emin Tufan Çetin [tr],
|
||||
Ryuta Fujii [ja]
|
||||
|
||||
3.33.92
|
||||
=======
|
||||
* Turn MetaShapedTexture into a ClutterContent implementation [Georges; !409]
|
||||
* Restore inhibit shortcut for overlay key [Olivier; #734]
|
||||
* Misc. pointer a11y improvements [Jonas D., Olivier; !746, !747, !745, !761]
|
||||
* Fix position of drag surfaces [Robert; !684]
|
||||
* Implement subsurface.place_below() for parents [Robert; !664]
|
||||
* Add meta_window_actor_get_image() [Jonas Å.; !752]
|
||||
* Revert faulty optimization from !719 [Jonas Å.; #735]
|
||||
* Add additional sysprof trace points [Jonas Å.; !757, !765]
|
||||
* Remove GLX "threaded swap wait" used on Nvidia [Daniel; !602]
|
||||
* Implement geometric picking [Daniel; !189]
|
||||
* Fix lost keyboard focus after DND [Olivier; #747]
|
||||
* Misc. bug fixes and cleanups [Florian, Carlos, Piotr, Hans, Georges, Robert,
|
||||
Ray, Mart, Rémi; !740, !672, !749, !751, !753, !730, !755, !756, !750, !715,
|
||||
#738944, !657, !768]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Rémi Bernon, Piotr Drąg, Jonas Dreßler, Olivier Fourdan,
|
||||
Carlos Garnacho, Hans de Goede, Robert Mader, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Mart Raudsepp, Ray Strode, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Piotr Drąg [pl], Марко Костић [sr], Rūdolfs Mazurs [lv], Matej Urbančič [sl],
|
||||
Balázs Úr [hu], Fran Dieguez [gl], Jordi Mas [ca], Anders Jonsson [sv],
|
||||
Trần Ngọc Quân [vi], Tim Sabsch [de], Fabio Tomat [fur], Goran Vidović [hr],
|
||||
Marek Černocký [cs]
|
||||
|
||||
3.33.91
|
||||
=======
|
||||
* Fix primary selection copy and paste between X11 and wayland [Hans; #702]
|
||||
|
@ -657,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
|
||||
ClutterActor *actor = NULL;
|
||||
gint top_level_x, top_level_y;
|
||||
gfloat f_width, f_height;
|
||||
ClutterVertex verts[4];
|
||||
graphene_point3d_t verts[4];
|
||||
ClutterActor *stage = NULL;
|
||||
|
||||
g_return_if_fail (CALLY_IS_ACTOR (component));
|
||||
|
@ -1438,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
|
||||
PangoLayout *layout;
|
||||
PangoRectangle extents;
|
||||
const gchar *text_value;
|
||||
ClutterVertex verts[4];
|
||||
graphene_point3d_t verts[4];
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (text);
|
||||
if (actor == NULL) /* State is defunct */
|
||||
@ -2294,7 +2294,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
|
||||
gint index, x_window, y_window, x_toplevel, y_toplevel;
|
||||
gint x_temp, y_temp;
|
||||
gboolean ret;
|
||||
ClutterVertex verts[4];
|
||||
graphene_point3d_t verts[4];
|
||||
PangoLayout *layout;
|
||||
gint x_layout, y_layout;
|
||||
|
||||
|
@ -340,7 +340,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
/**
|
||||
* clutter_actor_box_from_vertices:
|
||||
* @box: a #ClutterActorBox
|
||||
* @verts: (array fixed-size=4): array of four #ClutterVertex
|
||||
* @verts: (array fixed-size=4): array of four #graphene_point3d_t
|
||||
*
|
||||
* Calculates the bounding box represented by the four vertices; for details
|
||||
* of the vertex array see clutter_actor_get_abs_allocation_vertices().
|
||||
@ -348,8 +348,8 @@ clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
const ClutterVertex verts[])
|
||||
clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
const graphene_point3d_t verts[])
|
||||
{
|
||||
gfloat x_1, x_2, y_1, y_2;
|
||||
|
||||
|
@ -135,7 +135,7 @@ struct _AnchorCoord
|
||||
} fraction;
|
||||
|
||||
/* Use when is_fractional == FALSE */
|
||||
ClutterVertex units;
|
||||
graphene_point3d_t units;
|
||||
} v;
|
||||
};
|
||||
|
||||
@ -163,7 +163,7 @@ struct _SizeRequest
|
||||
struct _ClutterLayoutInfo
|
||||
{
|
||||
/* fixed position coordinates */
|
||||
ClutterPoint fixed_pos;
|
||||
graphene_point_t fixed_pos;
|
||||
|
||||
ClutterMargin margin;
|
||||
|
||||
@ -173,8 +173,8 @@ struct _ClutterLayoutInfo
|
||||
guint x_expand : 1;
|
||||
guint y_expand : 1;
|
||||
|
||||
ClutterSize minimum;
|
||||
ClutterSize natural;
|
||||
graphene_size_t minimum;
|
||||
graphene_size_t natural;
|
||||
};
|
||||
|
||||
const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self);
|
||||
@ -203,13 +203,13 @@ struct _ClutterTransformInfo
|
||||
AnchorCoord anchor;
|
||||
|
||||
/* translation */
|
||||
ClutterVertex translation;
|
||||
graphene_point3d_t translation;
|
||||
|
||||
/* z_position */
|
||||
gfloat z_position;
|
||||
|
||||
/* transformation center */
|
||||
ClutterPoint pivot;
|
||||
graphene_point_t pivot;
|
||||
gfloat pivot_z;
|
||||
|
||||
CoglMatrix transform;
|
||||
@ -242,9 +242,6 @@ ClutterAnimationInfo * _clutter_actor_get_animation_info
|
||||
ClutterTransition * _clutter_actor_create_transition (ClutterActor *self,
|
||||
GParamSpec *pspec,
|
||||
...);
|
||||
ClutterTransition * _clutter_actor_get_transition (ClutterActor *self,
|
||||
GParamSpec *pspec);
|
||||
|
||||
gboolean _clutter_actor_foreach_child (ClutterActor *self,
|
||||
ClutterForeachCallback callback,
|
||||
gpointer user_data);
|
||||
@ -277,6 +274,9 @@ void _clutter_actor_set_enable_paint_unmapped
|
||||
void _clutter_actor_set_has_pointer (ClutterActor *self,
|
||||
gboolean has_pointer);
|
||||
|
||||
void _clutter_actor_set_has_key_focus (ClutterActor *self,
|
||||
gboolean has_key_focus);
|
||||
|
||||
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
||||
ClutterRedrawFlags flags,
|
||||
const ClutterPaintVolume *clip_volume);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -233,8 +233,7 @@ struct _ClutterActorClass
|
||||
ClutterActor *old_parent);
|
||||
|
||||
void (* destroy) (ClutterActor *self);
|
||||
void (* pick) (ClutterActor *actor,
|
||||
const ClutterColor *color);
|
||||
void (* pick) (ClutterActor *actor);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
@ -354,6 +353,10 @@ void clutter_actor_paint
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_paint (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick (ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_pick (ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
||||
@ -431,7 +434,7 @@ void clutter_actor_get_allocation_box
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_allocation_vertices (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
ClutterVertex verts[]);
|
||||
graphene_point3d_t *verts);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_allocation (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@ -817,16 +820,16 @@ gboolean clutter_actor_transform_stage_point
|
||||
gfloat *y_out);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
|
||||
ClutterVertex verts[]);
|
||||
graphene_point3d_t *verts);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_apply_transform_to_point (ClutterActor *self,
|
||||
const ClutterVertex *point,
|
||||
ClutterVertex *vertex);
|
||||
const graphene_point3d_t *point,
|
||||
graphene_point3d_t *vertex);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
const ClutterVertex *point,
|
||||
ClutterVertex *vertex);
|
||||
const graphene_point3d_t *point,
|
||||
graphene_point3d_t *vertex);
|
||||
|
||||
/* Implicit animations */
|
||||
CLUTTER_EXPORT
|
||||
|
@ -93,10 +93,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free)
|
||||
|
||||
#endif /* __GI_SCANNER__ */
|
||||
|
||||
|
@ -627,7 +627,7 @@ clutter_backend_init (ClutterBackend *self)
|
||||
self->units_per_em = -1.0;
|
||||
self->units_serial = 1;
|
||||
|
||||
self->dummy_onscreen = COGL_INVALID_HANDLE;
|
||||
self->dummy_onscreen = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1012,7 +1012,7 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
|
||||
void
|
||||
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
|
||||
{
|
||||
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
|
||||
if (backend->dummy_onscreen == NULL)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -152,7 +152,9 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
|
||||
gfloat source_width, source_height;
|
||||
gfloat actor_width, actor_height;
|
||||
ClutterVertex source_position = { 0., };
|
||||
graphene_point3d_t source_position;
|
||||
|
||||
source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
|
||||
|
||||
if (bind->source == NULL)
|
||||
return;
|
||||
|
@ -182,7 +182,7 @@ clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
gfloat cur_width, cur_height;
|
||||
ClutterVertex origin;
|
||||
graphene_point3d_t origin;
|
||||
|
||||
clutter_paint_volume_get_origin (volume, &origin);
|
||||
cur_width = clutter_paint_volume_get_width (volume);
|
||||
|
@ -118,37 +118,6 @@ container_real_remove (ClutterContainer *container,
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
ClutterCallback callback;
|
||||
gpointer data;
|
||||
} ForeachClosure;
|
||||
|
||||
static gboolean
|
||||
foreach_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
ForeachClosure *clos = data;
|
||||
|
||||
clos->callback (actor, clos->data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ForeachClosure clos;
|
||||
|
||||
clos.callback = callback;
|
||||
clos.data = user_data;
|
||||
|
||||
_clutter_actor_foreach_child (CLUTTER_ACTOR (container),
|
||||
foreach_cb,
|
||||
&clos);
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_raise (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
@ -243,7 +212,6 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
|
||||
iface->add = container_real_add;
|
||||
iface->remove = container_real_remove;
|
||||
iface->foreach = container_real_foreach;
|
||||
iface->raise = container_real_raise;
|
||||
iface->lower = container_real_lower;
|
||||
iface->sort_depth_order = container_real_sort_depth_order;
|
||||
@ -533,15 +501,6 @@ clutter_container_remove_valist (ClutterContainer *container,
|
||||
container_remove_valist (container, first_actor, var_args);
|
||||
}
|
||||
|
||||
static void
|
||||
get_children_cb (ClutterActor *child,
|
||||
gpointer data)
|
||||
{
|
||||
GList **children = data;
|
||||
|
||||
*children = g_list_prepend (*children, child);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_get_children:
|
||||
* @container: a #ClutterContainer
|
||||
@ -559,108 +518,9 @@ get_children_cb (ClutterActor *child,
|
||||
GList *
|
||||
clutter_container_get_children (ClutterContainer *container)
|
||||
{
|
||||
GList *retval;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
|
||||
|
||||
retval = NULL;
|
||||
clutter_container_foreach (container, get_children_cb, &retval);
|
||||
|
||||
return g_list_reverse (retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_foreach:
|
||||
* @container: a #ClutterContainer
|
||||
* @callback: (scope call): a function to be called for each child
|
||||
* @user_data: data to be passed to the function, or %NULL
|
||||
*
|
||||
* Calls @callback for each child of @container that was added
|
||||
* by the application (with clutter_container_add_actor()). Does
|
||||
* not iterate over "internal" children that are part of the
|
||||
* container's own implementation, if any.
|
||||
*
|
||||
* This function calls the #ClutterContainerIface.foreach()
|
||||
* virtual function, which has been deprecated.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_get_first_child() or
|
||||
* clutter_actor_get_last_child() to retrieve the beginning of
|
||||
* the list of children, and clutter_actor_get_next_sibling()
|
||||
* and clutter_actor_get_previous_sibling() to iterate over it;
|
||||
* alternatively, use the #ClutterActorIter API.
|
||||
*/
|
||||
void
|
||||
clutter_container_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
if (iface->foreach != container_real_foreach)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::foreach() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
CLUTTER_CONTAINER_GET_IFACE (container)->foreach (container,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_foreach_with_internals:
|
||||
* @container: a #ClutterContainer
|
||||
* @callback: (scope call): a function to be called for each child
|
||||
* @user_data: data to be passed to the function, or %NULL
|
||||
*
|
||||
* Calls @callback for each child of @container, including "internal"
|
||||
* children built in to the container itself that were never added
|
||||
* by the application.
|
||||
*
|
||||
* This function calls the #ClutterContainerIface.foreach_with_internals()
|
||||
* virtual function, which has been deprecated.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: See clutter_container_foreach().
|
||||
*/
|
||||
void
|
||||
clutter_container_foreach_with_internals (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
if (iface->foreach_with_internals != NULL)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
if (iface->foreach_with_internals != NULL)
|
||||
iface->foreach_with_internals (container, callback, user_data);
|
||||
else
|
||||
iface->foreach (container, callback, user_data);
|
||||
return clutter_actor_get_children (CLUTTER_ACTOR (container));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,14 +59,6 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
* function is deprecated, and it should not be overridden.
|
||||
* @remove: virtual function for removing an actor from the container. This
|
||||
* virtual function is deprecated, and it should not be overridden.
|
||||
* @foreach: virtual function for iterating over the container's children.
|
||||
* This virtual function is deprecated, and it should not be overridden.
|
||||
* @foreach_with_internals: virtual functions for iterating over the
|
||||
* container's children, both added using the #ClutterContainer API
|
||||
* and internal children. The implementation of this virtual function
|
||||
* is required only if the #ClutterContainer implementation has
|
||||
* internal children. This virtual function is deprecated, and it should
|
||||
* not be overridden.
|
||||
* @raise: virtual function for raising a child. This virtual function is
|
||||
* deprecated and it should not be overridden.
|
||||
* @lower: virtual function for lowering a child. This virtual function is
|
||||
@ -88,7 +80,7 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
* @actor_removed: class handler for #ClutterContainer::actor-removed
|
||||
* @child_notify: class handler for #ClutterContainer::child-notify
|
||||
*
|
||||
* Base interface for container actors. The @add, @remove and @foreach
|
||||
* Base interface for container actors. The @add and @remove
|
||||
* virtual functions must be provided by any implementation; the other
|
||||
* virtual functions are optional.
|
||||
*
|
||||
@ -104,13 +96,6 @@ struct _ClutterContainerIface
|
||||
ClutterActor *actor);
|
||||
void (* remove) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void (* foreach) (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (* foreach_with_internals) (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* child stacking */
|
||||
void (* raise) (ClutterContainer *container,
|
||||
|
@ -6,45 +6,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_DEBUG_MISC = 1 << 0,
|
||||
CLUTTER_DEBUG_ACTOR = 1 << 1,
|
||||
CLUTTER_DEBUG_TEXTURE = 1 << 2,
|
||||
CLUTTER_DEBUG_EVENT = 1 << 3,
|
||||
CLUTTER_DEBUG_PAINT = 1 << 4,
|
||||
CLUTTER_DEBUG_PANGO = 1 << 5,
|
||||
CLUTTER_DEBUG_BACKEND = 1 << 6,
|
||||
CLUTTER_DEBUG_SCHEDULER = 1 << 7,
|
||||
CLUTTER_DEBUG_SCRIPT = 1 << 8,
|
||||
CLUTTER_DEBUG_SHADER = 1 << 9,
|
||||
CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
|
||||
CLUTTER_DEBUG_ANIMATION = 1 << 11,
|
||||
CLUTTER_DEBUG_LAYOUT = 1 << 12,
|
||||
CLUTTER_DEBUG_PICK = 1 << 13,
|
||||
CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
|
||||
CLUTTER_DEBUG_CLIPPING = 1 << 15,
|
||||
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16
|
||||
} ClutterDebugFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
|
||||
} ClutterPickDebugFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
|
||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
|
||||
CLUTTER_DEBUG_REDRAWS = 1 << 2,
|
||||
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
|
||||
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
|
||||
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
|
||||
CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
|
||||
CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
|
||||
CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
|
||||
} ClutterDrawDebugFlag;
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
|
||||
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
|
||||
|
@ -177,7 +177,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
|
||||
if (priv->is_dirty)
|
||||
{
|
||||
ClutterRect rect;
|
||||
graphene_rect_t rect;
|
||||
gboolean mapped_buffer;
|
||||
CoglVertexP3T2C4 *verts;
|
||||
ClutterActor *actor;
|
||||
@ -193,8 +193,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
*/
|
||||
if (clutter_offscreen_effect_get_target_rect (effect, &rect))
|
||||
{
|
||||
width = clutter_rect_get_width (&rect);
|
||||
height = clutter_rect_get_height (&rect);
|
||||
width = graphene_rect_get_width (&rect);
|
||||
height = graphene_rect_get_height (&rect);
|
||||
}
|
||||
else
|
||||
clutter_actor_get_size (actor, &width, &height);
|
||||
|
@ -7,10 +7,6 @@
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-animatable.h"
|
||||
#include "deprecated/clutter-animation.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-behaviour-depth.h"
|
||||
#include "deprecated/clutter-behaviour-opacity.h"
|
||||
#include "deprecated/clutter-behaviour-scale.h"
|
||||
#include "deprecated/clutter-bin-layout.h"
|
||||
#include "deprecated/clutter-box.h"
|
||||
#include "deprecated/clutter-cairo-texture.h"
|
||||
|
@ -210,6 +210,8 @@ ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceMa
|
||||
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager);
|
||||
|
||||
/* input device */
|
||||
CLUTTER_EXPORT
|
||||
|
@ -607,6 +607,20 @@ _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
|
||||
manager_class->compress_motion (device_manager, event, to_discard);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_device_manager_get_core_device (device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
if (core_pointer)
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
|
||||
_clutter_input_pointer_a11y_add_device (core_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
||||
ClutterKbdA11ySettings *b)
|
||||
|
@ -81,7 +81,7 @@ struct _ClutterDragActionPrivate
|
||||
gint y_drag_threshold;
|
||||
ClutterActor *drag_handle;
|
||||
ClutterDragAxis drag_axis;
|
||||
ClutterRect drag_area;
|
||||
graphene_rect_t drag_area;
|
||||
|
||||
ClutterInputDevice *device;
|
||||
ClutterEventSequence *sequence;
|
||||
@ -542,7 +542,7 @@ clutter_drag_action_real_drag_motion (ClutterDragAction *action,
|
||||
|
||||
if (action->priv->drag_area_set)
|
||||
{
|
||||
ClutterRect *drag_area = &action->priv->drag_area;
|
||||
graphene_rect_t *drag_area = &action->priv->drag_area;
|
||||
|
||||
x = CLAMP (x, drag_area->origin.x, drag_area->origin.x + drag_area->size.width);
|
||||
y = CLAMP (y, drag_area->origin.y, drag_area->origin.y + drag_area->size.height);
|
||||
@ -811,7 +811,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass)
|
||||
g_param_spec_boxed ("drag-area",
|
||||
P_("Drag Area"),
|
||||
P_("Constrains the dragging to a rectangle"),
|
||||
CLUTTER_TYPE_RECT,
|
||||
GRAPHENE_TYPE_RECT,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
@ -1267,10 +1267,10 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
|
||||
/**
|
||||
* clutter_drag_action_get_drag_area:
|
||||
* @action: a #ClutterDragAction
|
||||
* @drag_area: (out caller-allocates): a #ClutterRect to be filled
|
||||
* @drag_area: (out caller-allocates): a #graphene_rect_t to be filled
|
||||
*
|
||||
* Retrieves the "drag area" associated with @action, that
|
||||
* is a #ClutterRect that constrains the actor movements,
|
||||
* is a #graphene_rect_t that constrains the actor movements,
|
||||
* in parents coordinates.
|
||||
*
|
||||
* Returns: %TRUE if the actor is actually constrained (and thus
|
||||
@ -1278,7 +1278,7 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
|
||||
*/
|
||||
gboolean
|
||||
clutter_drag_action_get_drag_area (ClutterDragAction *action,
|
||||
ClutterRect *drag_area)
|
||||
graphene_rect_t *drag_area)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_DRAG_ACTION (action), FALSE);
|
||||
|
||||
@ -1298,8 +1298,8 @@ clutter_drag_action_get_drag_area (ClutterDragAction *action,
|
||||
* If @drag_area is %NULL, the actor is not constrained.
|
||||
*/
|
||||
void
|
||||
clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
||||
const ClutterRect *drag_area)
|
||||
clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
||||
const graphene_rect_t *drag_area)
|
||||
{
|
||||
ClutterDragActionPrivate *priv;
|
||||
|
||||
|
@ -141,11 +141,11 @@ void clutter_drag_action_get_motion_coords (ClutterDragAction *actio
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
|
||||
ClutterRect *drag_area);
|
||||
graphene_rect_t *drag_area);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
||||
const ClutterRect *drag_area);
|
||||
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
||||
const graphene_rect_t *drag_area);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -12,8 +12,7 @@ gboolean _clutter_effect_modify_paint_volume (ClutterEffect
|
||||
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
|
||||
void _clutter_effect_paint (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void _clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void _clutter_effect_pick (ClutterEffect *effect);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -100,13 +100,13 @@
|
||||
* // Clear the previous state //
|
||||
* if (self->rect_1)
|
||||
* {
|
||||
* cogl_handle_unref (self->rect_1);
|
||||
* cogl_object_unref (self->rect_1);
|
||||
* self->rect_1 = NULL;
|
||||
* }
|
||||
*
|
||||
* if (self->rect_2)
|
||||
* {
|
||||
* cogl_handle_unref (self->rect_2);
|
||||
* cogl_object_unref (self->rect_2);
|
||||
* self->rect_2 = NULL;
|
||||
* }
|
||||
*
|
||||
@ -216,14 +216,13 @@ clutter_effect_real_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_pick (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags)
|
||||
clutter_effect_real_pick (ClutterEffect *effect)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
ClutterActor *actor;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_paint (actor);
|
||||
clutter_actor_continue_pick (actor);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -288,12 +287,11 @@ _clutter_effect_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags)
|
||||
_clutter_effect_pick (ClutterEffect *effect)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, flags);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -82,8 +82,7 @@ struct _ClutterEffectClass
|
||||
|
||||
void (* paint) (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void (* pick) (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void (* pick) (ClutterEffect *effect);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_effect4) (void);
|
||||
|
@ -970,8 +970,6 @@ typedef enum
|
||||
/**
|
||||
* ClutterFeatureFlags:
|
||||
* @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
|
||||
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
|
||||
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
|
||||
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
|
||||
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
|
||||
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
|
||||
@ -987,8 +985,6 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3),
|
||||
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 4),
|
||||
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 5),
|
||||
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
|
||||
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
|
||||
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
|
||||
@ -1217,8 +1213,7 @@ typedef enum
|
||||
* @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag
|
||||
* @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag
|
||||
*
|
||||
* Flags for clutter_texture_set_from_rgb_data() and
|
||||
* clutter_texture_set_from_yuv_data().
|
||||
* Flags for clutter_texture_set_from_rgb_data().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
|
@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
|
||||
gfloat *x,
|
||||
gfloat *y)
|
||||
{
|
||||
ClutterPoint coords;
|
||||
graphene_point_t coords;
|
||||
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
@ -386,15 +386,15 @@ clutter_event_get_coords (const ClutterEvent *event,
|
||||
/**
|
||||
* clutter_event_get_position:
|
||||
* @event: a #ClutterEvent
|
||||
* @position: a #ClutterPoint
|
||||
* @position: a #graphene_point_t
|
||||
*
|
||||
* Retrieves the event coordinates as a #ClutterPoint.
|
||||
* Retrieves the event coordinates as a #graphene_point_t.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_event_get_position (const ClutterEvent *event,
|
||||
ClutterPoint *position)
|
||||
graphene_point_t *position)
|
||||
{
|
||||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (position != NULL);
|
||||
@ -415,42 +415,42 @@ clutter_event_get_position (const ClutterEvent *event,
|
||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||
case CLUTTER_PAD_STRIP:
|
||||
case CLUTTER_PAD_RING:
|
||||
clutter_point_init (position, 0.f, 0.f);
|
||||
graphene_point_init (position, 0.f, 0.f);
|
||||
break;
|
||||
|
||||
case CLUTTER_ENTER:
|
||||
case CLUTTER_LEAVE:
|
||||
clutter_point_init (position, event->crossing.x, event->crossing.y);
|
||||
graphene_point_init (position, event->crossing.x, event->crossing.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
clutter_point_init (position, event->button.x, event->button.y);
|
||||
graphene_point_init (position, event->button.x, event->button.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_MOTION:
|
||||
clutter_point_init (position, event->motion.x, event->motion.y);
|
||||
graphene_point_init (position, event->motion.x, event->motion.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
case CLUTTER_TOUCH_END:
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
clutter_point_init (position, event->touch.x, event->touch.y);
|
||||
graphene_point_init (position, event->touch.x, event->touch.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_SCROLL:
|
||||
clutter_point_init (position, event->scroll.x, event->scroll.y);
|
||||
graphene_point_init (position, event->scroll.x, event->scroll.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCHPAD_PINCH:
|
||||
clutter_point_init (position, event->touchpad_pinch.x,
|
||||
event->touchpad_pinch.y);
|
||||
graphene_point_init (position, event->touchpad_pinch.x,
|
||||
event->touchpad_pinch.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCHPAD_SWIPE:
|
||||
clutter_point_init (position, event->touchpad_swipe.x,
|
||||
event->touchpad_swipe.y);
|
||||
graphene_point_init (position, event->touchpad_swipe.x,
|
||||
event->touchpad_swipe.y);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1796,12 +1796,12 @@ float
|
||||
clutter_event_get_distance (const ClutterEvent *source,
|
||||
const ClutterEvent *target)
|
||||
{
|
||||
ClutterPoint p0, p1;
|
||||
graphene_point_t p0, p1;
|
||||
|
||||
clutter_event_get_position (source, &p0);
|
||||
clutter_event_get_position (source, &p1);
|
||||
|
||||
return clutter_point_distance (&p0, &p1, NULL, NULL);
|
||||
return graphene_point_distance (&p0, &p1, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1822,17 +1822,17 @@ double
|
||||
clutter_event_get_angle (const ClutterEvent *source,
|
||||
const ClutterEvent *target)
|
||||
{
|
||||
ClutterPoint p0, p1;
|
||||
graphene_point_t p0, p1;
|
||||
float x_distance, y_distance;
|
||||
double angle;
|
||||
|
||||
clutter_event_get_position (source, &p0);
|
||||
clutter_event_get_position (target, &p1);
|
||||
|
||||
if (clutter_point_equals (&p0, &p1))
|
||||
if (graphene_point_equal (&p0, &p1))
|
||||
return 0;
|
||||
|
||||
clutter_point_distance (&p0, &p1, &x_distance, &y_distance);
|
||||
graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
|
||||
|
||||
angle = atan2 (x_distance, y_distance);
|
||||
|
||||
|
@ -686,7 +686,7 @@ void clutter_event_get_coords (const ClutterEv
|
||||
gfloat *y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_event_get_position (const ClutterEvent *event,
|
||||
ClutterPoint *position);
|
||||
graphene_point_t *position);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_event_get_distance (const ClutterEvent *source,
|
||||
const ClutterEvent *target);
|
||||
|
@ -33,8 +33,6 @@
|
||||
*
|
||||
* It is possible to ask whether Clutter has support for specific features at
|
||||
* run-time.
|
||||
*
|
||||
* See also cogl_get_features() and #CoglFeatureFlags
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
@ -60,20 +58,13 @@ typedef struct ClutterFeatures
|
||||
static ClutterFeatures* __features = NULL;
|
||||
|
||||
static ClutterFeatureFlags
|
||||
clutter_features_from_cogl (guint cogl_flags)
|
||||
clutter_features_from_cogl (void)
|
||||
{
|
||||
ClutterFeatureFlags clutter_flags = 0;
|
||||
|
||||
if (cogl_flags & COGL_FEATURE_TEXTURE_YUV)
|
||||
clutter_flags |= CLUTTER_FEATURE_TEXTURE_YUV;
|
||||
|
||||
if (cogl_flags & COGL_FEATURE_TEXTURE_READ_PIXELS)
|
||||
clutter_flags |= CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
|
||||
|
||||
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
|
||||
|
||||
if (cogl_flags & COGL_FEATURE_OFFSCREEN)
|
||||
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
|
||||
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
|
||||
|
||||
return clutter_flags;
|
||||
}
|
||||
@ -101,7 +92,7 @@ _clutter_feature_init (GError **error)
|
||||
if (!_clutter_backend_create_context (context->backend, error))
|
||||
return FALSE;
|
||||
|
||||
__features->flags = (clutter_features_from_cogl (cogl_get_features ())
|
||||
__features->flags = (clutter_features_from_cogl ()
|
||||
| _clutter_backend_get_features (context->backend));
|
||||
|
||||
__features->features_set = TRUE;
|
||||
|
111
clutter/clutter/clutter-graphene.c
Normal file
111
clutter/clutter/clutter-graphene.c
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2019 Endless, Inc
|
||||
* Copyright (C) 2009, 2010 Intel Corp
|
||||
*
|
||||
* 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-graphene.h"
|
||||
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-types.h"
|
||||
|
||||
static gboolean
|
||||
graphene_point_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_point_t *ap = g_value_get_boxed (a);
|
||||
const graphene_point_t *bp = g_value_get_boxed (b);
|
||||
graphene_point_t res;
|
||||
|
||||
graphene_point_interpolate (ap, bp, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
graphene_point3d_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_point3d_t *av = g_value_get_boxed (a);
|
||||
const graphene_point3d_t *bv = g_value_get_boxed (b);
|
||||
graphene_point3d_t res;
|
||||
|
||||
graphene_point3d_interpolate (av, bv, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
graphene_rect_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_rect_t *rect_a = g_value_get_boxed (a);
|
||||
const graphene_rect_t *rect_b = g_value_get_boxed (b);
|
||||
graphene_rect_t res;
|
||||
|
||||
graphene_rect_interpolate (rect_a, rect_b, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
graphene_size_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_size_t *as = g_value_get_boxed (a);
|
||||
const graphene_size_t *bs = g_value_get_boxed (b);
|
||||
graphene_size_t res;
|
||||
|
||||
graphene_size_interpolate (as, bs, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_graphene_init (void)
|
||||
{
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT,
|
||||
graphene_point_progress);
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
|
||||
graphene_point3d_progress);
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_RECT,
|
||||
graphene_rect_progress);
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,
|
||||
graphene_size_progress);
|
||||
}
|
30
clutter/clutter/clutter-graphene.h
Normal file
30
clutter/clutter/clutter-graphene.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2019 Endless, Inc
|
||||
* Copyright (C) 2009, 2010 Intel Corp
|
||||
*
|
||||
* 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_GRAPHENE_H
|
||||
#define CLUTTER_GRAPHENE_H
|
||||
|
||||
void clutter_graphene_init (void);
|
||||
|
||||
#endif
|
@ -991,7 +991,7 @@ clutter_input_device_get_enabled (ClutterInputDevice *device)
|
||||
gboolean
|
||||
clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterPoint *point)
|
||||
graphene_point_t *point)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||
g_return_val_if_fail (point != NULL, FALSE);
|
||||
@ -1038,7 +1038,7 @@ _clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterStage *stage;
|
||||
ClutterActor *new_cursor_actor;
|
||||
ClutterActor *old_cursor_actor;
|
||||
ClutterPoint point = { -1, -1 };
|
||||
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
|
||||
ClutterInputDeviceType device_type = device->device_type;
|
||||
|
||||
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
|
||||
|
@ -58,7 +58,7 @@ gint clutter_input_device_get_device_id (ClutterInputDev
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterPoint *point);
|
||||
graphene_point_t *point);
|
||||
CLUTTER_EXPORT
|
||||
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
|
@ -89,8 +89,8 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
|
||||
}
|
||||
|
||||
void
|
||||
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const ClutterRect *rect)
|
||||
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
ClutterInputFocusPrivate *priv;
|
||||
|
||||
|
@ -57,8 +57,8 @@ gboolean clutter_input_focus_is_focused (ClutterInputFocus *focus);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_reset (ClutterInputFocus *focus);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const ClutterRect *rect);
|
||||
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const graphene_rect_t *rect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,
|
||||
|
@ -26,8 +26,8 @@ ClutterInputFocus * clutter_input_method_get_focus (ClutterInputMethod *method);
|
||||
|
||||
void clutter_input_method_reset (ClutterInputMethod *method);
|
||||
|
||||
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
|
||||
const ClutterRect *rect);
|
||||
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
|
||||
const graphene_rect_t *rect);
|
||||
void clutter_input_method_set_surrounding (ClutterInputMethod *method,
|
||||
const gchar *text,
|
||||
guint cursor,
|
||||
|
@ -187,7 +187,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, CLUTTER_TYPE_RECT);
|
||||
G_TYPE_NONE, 1, GRAPHENE_TYPE_RECT);
|
||||
|
||||
pspecs[PROP_CONTENT_HINTS] =
|
||||
g_param_spec_flags ("content-hints",
|
||||
@ -377,8 +377,8 @@ clutter_input_method_reset (ClutterInputMethod *im)
|
||||
}
|
||||
|
||||
void
|
||||
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
|
||||
const ClutterRect *rect)
|
||||
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
|
||||
|
||||
|
@ -42,8 +42,8 @@ struct _ClutterInputMethodClass
|
||||
|
||||
void (* reset) (ClutterInputMethod *im);
|
||||
|
||||
void (* set_cursor_location) (ClutterInputMethod *im,
|
||||
const ClutterRect *rect);
|
||||
void (* set_cursor_location) (ClutterInputMethod *im,
|
||||
const graphene_rect_t *rect);
|
||||
void (* set_surrounding) (ClutterInputMethod *im,
|
||||
const gchar *text,
|
||||
guint cursor,
|
||||
|
@ -329,9 +329,6 @@ layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
||||
/* let the alpha take ownership of the timeline */
|
||||
g_object_unref (timeline);
|
||||
|
||||
g_signal_connect_swapped (timeline, "completed",
|
||||
G_CALLBACK (clutter_layout_manager_end_animation),
|
||||
manager);
|
||||
g_signal_connect_swapped (timeline, "new-frame",
|
||||
G_CALLBACK (clutter_layout_manager_layout_changed),
|
||||
manager);
|
||||
@ -375,9 +372,6 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
|
||||
if (clutter_timeline_is_playing (timeline))
|
||||
clutter_timeline_stop (timeline);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (timeline,
|
||||
G_CALLBACK (clutter_layout_manager_end_animation),
|
||||
manager);
|
||||
g_signal_handlers_disconnect_by_func (timeline,
|
||||
G_CALLBACK (clutter_layout_manager_layout_changed),
|
||||
manager);
|
||||
|
@ -213,15 +213,6 @@ void clutter_layout_manager_child_get_property (ClutterLayoutMa
|
||||
const gchar *property_name,
|
||||
GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAlpha * clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_layout_manager_end_animation (ClutterLayoutManager *manager);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_LAYOUT_MANAGER_H__ */
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-feature.h"
|
||||
#include "clutter-input-pointer-a11y-private.h"
|
||||
#include "clutter-graphene.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-mutter.h"
|
||||
@ -2194,6 +2195,8 @@ clutter_base_init (void)
|
||||
|
||||
/* initialise the Big Clutter Lock™ if necessary */
|
||||
clutter_threads_init_default ();
|
||||
|
||||
clutter_graphene_init ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2602,6 +2605,36 @@ clutter_check_windowing_backend (const char *backend_type)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_add_debug_flags: (skip)
|
||||
*
|
||||
* Adds the debug flags passed to the list of debug flags.
|
||||
*/
|
||||
void
|
||||
clutter_add_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags)
|
||||
{
|
||||
clutter_debug_flags |= debug_flags;
|
||||
clutter_paint_debug_flags |= draw_flags;
|
||||
clutter_pick_debug_flags |= pick_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_remove_debug_flags: (skip)
|
||||
*
|
||||
* Removes the debug flags passed from the list of debug flags.
|
||||
*/
|
||||
void
|
||||
clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags)
|
||||
{
|
||||
clutter_debug_flags &= ~debug_flags;
|
||||
clutter_paint_debug_flags &= ~draw_flags;
|
||||
clutter_pick_debug_flags &= ~pick_flags;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
|
||||
{
|
||||
|
@ -34,6 +34,45 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_DEBUG_MISC = 1 << 0,
|
||||
CLUTTER_DEBUG_ACTOR = 1 << 1,
|
||||
CLUTTER_DEBUG_TEXTURE = 1 << 2,
|
||||
CLUTTER_DEBUG_EVENT = 1 << 3,
|
||||
CLUTTER_DEBUG_PAINT = 1 << 4,
|
||||
CLUTTER_DEBUG_PANGO = 1 << 5,
|
||||
CLUTTER_DEBUG_BACKEND = 1 << 6,
|
||||
CLUTTER_DEBUG_SCHEDULER = 1 << 7,
|
||||
CLUTTER_DEBUG_SCRIPT = 1 << 8,
|
||||
CLUTTER_DEBUG_SHADER = 1 << 9,
|
||||
CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
|
||||
CLUTTER_DEBUG_ANIMATION = 1 << 11,
|
||||
CLUTTER_DEBUG_LAYOUT = 1 << 12,
|
||||
CLUTTER_DEBUG_PICK = 1 << 13,
|
||||
CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
|
||||
CLUTTER_DEBUG_CLIPPING = 1 << 15,
|
||||
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
|
||||
} ClutterDebugFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
|
||||
} ClutterPickDebugFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
|
||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
|
||||
CLUTTER_DEBUG_REDRAWS = 1 << 2,
|
||||
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
|
||||
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
|
||||
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
|
||||
CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
|
||||
CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
|
||||
CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
|
||||
} ClutterDrawDebugFlag;
|
||||
|
||||
/**
|
||||
* CLUTTER_INIT_ERROR:
|
||||
*
|
||||
@ -158,6 +197,15 @@ guint clutter_get_default_frame_rate (void);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_check_windowing_backend (const char *backend_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -86,7 +86,7 @@ struct _ClutterOffscreenEffectPrivate
|
||||
ClutterActor *actor;
|
||||
ClutterActor *stage;
|
||||
|
||||
ClutterVertex position;
|
||||
graphene_point3d_t position;
|
||||
|
||||
int fbo_offset_x;
|
||||
int fbo_offset_y;
|
||||
@ -119,7 +119,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
||||
/* clear out the previous state */
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_handle_unref (priv->offscreen);
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
|
||||
@ -199,13 +199,13 @@ update_fbo (ClutterEffect *effect,
|
||||
|
||||
if (priv->texture != NULL)
|
||||
{
|
||||
cogl_handle_unref (priv->texture);
|
||||
cogl_object_unref (priv->texture);
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_handle_unref (priv->offscreen);
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ update_fbo (ClutterEffect *effect,
|
||||
{
|
||||
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
||||
|
||||
cogl_handle_unref (priv->target);
|
||||
cogl_object_unref (priv->target);
|
||||
priv->target = NULL;
|
||||
|
||||
priv->target_width = 0;
|
||||
@ -250,9 +250,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
gfloat target_width = -1, target_height = -1;
|
||||
gfloat resource_scale;
|
||||
gfloat ceiled_resource_scale;
|
||||
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
|
||||
graphene_point3d_t local_offset;
|
||||
gfloat old_viewport[4];
|
||||
|
||||
local_offset = GRAPHENE_POINT3D_INIT (0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
|
||||
return FALSE;
|
||||
|
||||
@ -487,13 +489,13 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
|
||||
if (priv->offscreen)
|
||||
cogl_handle_unref (priv->offscreen);
|
||||
cogl_object_unref (priv->offscreen);
|
||||
|
||||
if (priv->target)
|
||||
cogl_handle_unref (priv->target);
|
||||
cogl_object_unref (priv->target);
|
||||
|
||||
if (priv->texture)
|
||||
cogl_handle_unref (priv->texture);
|
||||
cogl_object_unref (priv->texture);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||
}
|
||||
@ -537,7 +539,7 @@ clutter_offscreen_effect_init (ClutterOffscreenEffect *self)
|
||||
* used instead of clutter_offscreen_effect_get_target() when the
|
||||
* effect subclass wants to paint using its own material.
|
||||
*
|
||||
* Return value: (transfer none): a #CoglHandle or %COGL_INVALID_HANDLE. The
|
||||
* Return value: (transfer none): a #CoglHandle or %NULL. The
|
||||
* returned texture is owned by Clutter and it should not be
|
||||
* modified or freed
|
||||
*
|
||||
@ -602,7 +604,7 @@ clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
* Calls the create_texture() virtual function of the @effect
|
||||
*
|
||||
* Return value: (transfer full): a handle to a Cogl texture, or
|
||||
* %COGL_INVALID_HANDLE. The returned handle has its reference
|
||||
* %NULL. The returned handle has its reference
|
||||
* count increased.
|
||||
*
|
||||
* Since: 1.4
|
||||
@ -682,7 +684,7 @@ clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
|
||||
*/
|
||||
gboolean
|
||||
clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
|
||||
ClutterRect *rect)
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv;
|
||||
|
||||
@ -694,11 +696,11 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
|
||||
if (priv->texture == NULL)
|
||||
return FALSE;
|
||||
|
||||
clutter_rect_init (rect,
|
||||
priv->position.x,
|
||||
priv->position.y,
|
||||
cogl_texture_get_width (priv->texture),
|
||||
cogl_texture_get_height (priv->texture));
|
||||
graphene_rect_init (rect,
|
||||
priv->position.x,
|
||||
priv->position.y,
|
||||
cogl_texture_get_width (priv->texture),
|
||||
cogl_texture_get_height (priv->texture));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ gboolean clutter_offscreen_effect_get_target_size (ClutterOffscree
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
|
||||
ClutterRect *rect);
|
||||
graphene_rect_t *rect);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -139,30 +139,6 @@ ClutterPaintNode * clutter_paint_node_get_last_child (Clutter
|
||||
G_GNUC_INTERNAL
|
||||
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
|
||||
|
||||
#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ())
|
||||
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
|
||||
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
|
||||
|
||||
/*
|
||||
* ClutterLayerNode:
|
||||
*
|
||||
* The #ClutterLayerNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterLayerNode ClutterLayerNode;
|
||||
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
|
||||
|
||||
GType _clutter_layer_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterPaintNode * _clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */
|
||||
|
@ -1099,12 +1099,12 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
json_builder_set_member_name (builder, "path");
|
||||
json_builder_add_int_value (builder, (gint64) op->op.path);
|
||||
json_builder_add_int_value (builder, (intptr_t) op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
json_builder_set_member_name (builder, "primitive");
|
||||
json_builder_add_int_value (builder, (gint64) op->op.primitive);
|
||||
json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
|
||||
break;
|
||||
|
||||
case PAINT_OP_INVALID:
|
||||
|
@ -183,35 +183,31 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
}
|
||||
|
||||
/*
|
||||
* Transform node
|
||||
*
|
||||
* A private PaintNode, that changes the modelview of its child
|
||||
* nodes.
|
||||
* ClutterTransformNode
|
||||
*/
|
||||
|
||||
#define clutter_transform_node_get_type _clutter_transform_node_get_type
|
||||
|
||||
typedef struct _ClutterTransformNode {
|
||||
struct _ClutterTransformNode
|
||||
{
|
||||
ClutterPaintNode parent_instance;
|
||||
|
||||
CoglMatrix modelview;
|
||||
} ClutterTransformNode;
|
||||
CoglMatrix transform;
|
||||
};
|
||||
|
||||
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
|
||||
struct _ClutterTransformNodeClass
|
||||
{
|
||||
ClutterPaintNodeClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterTransformNode *tnode = (ClutterTransformNode *) node;
|
||||
CoglMatrix matrix;
|
||||
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
cogl_matrix_multiply (&matrix, &matrix, &tnode->modelview);
|
||||
cogl_set_modelview_matrix (&matrix);
|
||||
cogl_framebuffer_push_matrix (fb);
|
||||
cogl_framebuffer_transform (fb, &transform_node->transform);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -219,7 +215,9 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
static void
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
cogl_pop_matrix ();
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_framebuffer_pop_matrix (fb);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -235,18 +233,24 @@ clutter_transform_node_class_init (ClutterTransformNodeClass *klass)
|
||||
static void
|
||||
clutter_transform_node_init (ClutterTransformNode *self)
|
||||
{
|
||||
cogl_matrix_init_identity (&self->modelview);
|
||||
cogl_matrix_init_identity (&self->transform);
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_transform_node_new:
|
||||
* @transform: (nullable): the transform matrix to apply
|
||||
*
|
||||
* Return value: (transfer full): the newly created #ClutterTransformNode.
|
||||
* Use clutter_paint_node_unref() when done.
|
||||
*/
|
||||
ClutterPaintNode *
|
||||
_clutter_transform_node_new (const CoglMatrix *modelview)
|
||||
clutter_transform_node_new (const CoglMatrix *transform)
|
||||
{
|
||||
ClutterTransformNode *res;
|
||||
|
||||
res = _clutter_paint_node_create (_clutter_transform_node_get_type ());
|
||||
|
||||
if (modelview != NULL)
|
||||
res->modelview = *modelview;
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_TRANSFORM_NODE);
|
||||
if (transform)
|
||||
res->transform = *transform;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
}
|
||||
@ -1078,10 +1082,101 @@ clutter_clip_node_new (void)
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterLayerNode (private)
|
||||
* ClutterActorNode
|
||||
*/
|
||||
|
||||
#define clutter_layer_node_get_type _clutter_layer_node_get_type
|
||||
struct _ClutterActorNode
|
||||
{
|
||||
ClutterPaintNode parent_instance;
|
||||
|
||||
ClutterActor *actor;
|
||||
};
|
||||
|
||||
struct _ClutterActorNodeClass
|
||||
{
|
||||
ClutterPaintNodeClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
clutter_actor_continue_paint (actor_node->actor);
|
||||
}
|
||||
|
||||
static JsonNode *
|
||||
clutter_actor_node_serialize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
g_autoptr (JsonBuilder) builder = NULL;
|
||||
const char *debug_name;
|
||||
|
||||
debug_name = _clutter_actor_get_debug_name (actor_node->actor);
|
||||
|
||||
builder = json_builder_new ();
|
||||
|
||||
json_builder_begin_object (builder);
|
||||
json_builder_set_member_name (builder, "actor");
|
||||
json_builder_add_string_value (builder, debug_name);
|
||||
json_builder_end_object (builder);
|
||||
|
||||
return json_builder_get_root (builder);
|
||||
}
|
||||
static void
|
||||
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
|
||||
{
|
||||
ClutterPaintNodeClass *node_class;
|
||||
|
||||
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
|
||||
node_class->pre_draw = clutter_actor_node_pre_draw;
|
||||
node_class->draw = clutter_actor_node_draw;
|
||||
node_class->serialize = clutter_actor_node_serialize;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_init (ClutterActorNode *self)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_actor_node_new:
|
||||
* @actor: the actor to paint
|
||||
*
|
||||
* Creates a new #ClutterActorNode.
|
||||
*
|
||||
* The actor is painted together with any effects
|
||||
* applied to it. Children of this node will draw
|
||||
* over the actor contents.
|
||||
*
|
||||
* Return value: (transfer full): the newly created #ClutterActorNode.
|
||||
* Use clutter_paint_node_unref() when done.
|
||||
*/
|
||||
ClutterPaintNode *
|
||||
clutter_actor_node_new (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorNode *res;
|
||||
|
||||
g_assert (actor != NULL);
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_ACTOR_NODE);
|
||||
res->actor = actor;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ClutterLayerNode
|
||||
*/
|
||||
|
||||
struct _ClutterLayerNode
|
||||
{
|
||||
@ -1268,11 +1363,11 @@ clutter_layer_node_init (ClutterLayerNode *self)
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterPaintNode *
|
||||
_clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity)
|
||||
clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity)
|
||||
{
|
||||
ClutterLayerNode *res;
|
||||
CoglColor color;
|
||||
|
@ -143,6 +143,25 @@ CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
|
||||
const ClutterColor *color);
|
||||
|
||||
#define CLUTTER_TYPE_ACTOR_NODE (clutter_actor_node_get_type ())
|
||||
#define CLUTTER_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_NODE, ClutterActorNode))
|
||||
#define CLUTTER_IS_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_NODE))
|
||||
|
||||
/**
|
||||
* ClutterActorNode:
|
||||
*
|
||||
* The #ClutterActorNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*/
|
||||
typedef struct _ClutterActorNode ClutterActorNode;
|
||||
typedef struct _ClutterActorNode ClutterActorNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_actor_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_actor_node_new (ClutterActor *actor);
|
||||
|
||||
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
|
||||
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
|
||||
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
|
||||
@ -163,6 +182,54 @@ CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
const ClutterColor *clear_color,
|
||||
CoglBufferBit clear_flags);
|
||||
|
||||
#define CLUTTER_TYPE_LAYER_NODE (clutter_layer_node_get_type ())
|
||||
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
|
||||
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
|
||||
|
||||
/*
|
||||
* ClutterLayerNode:
|
||||
*
|
||||
* The #ClutterLayerNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterLayerNode ClutterLayerNode;
|
||||
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_layer_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity);
|
||||
|
||||
|
||||
#define CLUTTER_TYPE_TRANSFORM_NODE (clutter_transform_node_get_type ())
|
||||
#define CLUTTER_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSFORM_NODE, ClutterTransformNode))
|
||||
#define CLUTTER_IS_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSFORM_NODE))
|
||||
|
||||
/*
|
||||
* ClutterTransformNode:
|
||||
*
|
||||
* The #ClutterLayerNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterTransformNode ClutterTransformNode;
|
||||
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_transform_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_transform_node_new (const CoglMatrix *projection);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PAINT_NODES_H__ */
|
||||
|
@ -58,7 +58,7 @@ struct _ClutterPaintVolume
|
||||
* elements 4, 5, 6 and 7 most of the time for 2D actors when
|
||||
* calculating the projected paint box.
|
||||
*/
|
||||
ClutterVertex vertices[8];
|
||||
graphene_point3d_t vertices[8];
|
||||
|
||||
/* As an optimization for internally managed PaintVolumes we allow
|
||||
* initializing ClutterPaintVolume variables allocated on the stack
|
||||
|
@ -63,7 +63,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
|
||||
|
||||
pv->actor = actor;
|
||||
|
||||
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
|
||||
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
|
||||
|
||||
pv->is_static = FALSE;
|
||||
pv->is_empty = TRUE;
|
||||
@ -96,7 +96,7 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
|
||||
{
|
||||
pv->actor = actor;
|
||||
|
||||
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
|
||||
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
|
||||
|
||||
pv->is_static = TRUE;
|
||||
pv->is_empty = TRUE;
|
||||
@ -170,7 +170,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
|
||||
/**
|
||||
* clutter_paint_volume_set_origin:
|
||||
* @pv: a #ClutterPaintVolume
|
||||
* @origin: a #ClutterVertex
|
||||
* @origin: a #graphene_point3d_t
|
||||
*
|
||||
* Sets the origin of the paint volume.
|
||||
*
|
||||
@ -182,8 +182,8 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||
const ClutterVertex *origin)
|
||||
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||
const graphene_point3d_t *origin)
|
||||
{
|
||||
static const int key_vertices[4] = { 0, 1, 3, 4 };
|
||||
float dx, dy, dz;
|
||||
@ -210,7 +210,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||
/**
|
||||
* clutter_paint_volume_get_origin:
|
||||
* @pv: a #ClutterPaintVolume
|
||||
* @vertex: (out): the return location for a #ClutterVertex
|
||||
* @vertex: (out): the return location for a #graphene_point3d_t
|
||||
*
|
||||
* Retrieves the origin of the #ClutterPaintVolume.
|
||||
*
|
||||
@ -218,7 +218,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||
*/
|
||||
void
|
||||
clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
|
||||
ClutterVertex *vertex)
|
||||
graphene_point3d_t *vertex)
|
||||
{
|
||||
g_return_if_fail (pv != NULL);
|
||||
g_return_if_fail (vertex != NULL);
|
||||
@ -659,7 +659,7 @@ clutter_paint_volume_union_box (ClutterPaintVolume *pv,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterPaintVolume volume;
|
||||
ClutterVertex origin;
|
||||
graphene_point3d_t origin;
|
||||
|
||||
g_return_if_fail (pv != NULL);
|
||||
g_return_if_fail (box != NULL);
|
||||
@ -757,7 +757,7 @@ _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
gfloat x_min, y_min, x_max, y_max;
|
||||
ClutterVertex *vertices;
|
||||
graphene_point3d_t *vertices;
|
||||
int count;
|
||||
gint i;
|
||||
|
||||
@ -878,9 +878,9 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
|
||||
|
||||
cogl_matrix_transform_points (matrix,
|
||||
3,
|
||||
sizeof (ClutterVertex),
|
||||
sizeof (graphene_point3d_t),
|
||||
pv->vertices,
|
||||
sizeof (ClutterVertex),
|
||||
sizeof (graphene_point3d_t),
|
||||
pv->vertices,
|
||||
transform_count);
|
||||
|
||||
@ -896,7 +896,7 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
|
||||
{
|
||||
int count;
|
||||
int i;
|
||||
ClutterVertex origin;
|
||||
graphene_point3d_t origin;
|
||||
float max_x;
|
||||
float max_y;
|
||||
float max_z;
|
||||
@ -1075,7 +1075,7 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
|
||||
const ClutterPlane *planes)
|
||||
{
|
||||
int vertex_count;
|
||||
ClutterVertex *vertices = pv->vertices;
|
||||
graphene_point3d_t *vertices = pv->vertices;
|
||||
gboolean partial = FALSE;
|
||||
int i;
|
||||
int j;
|
||||
@ -1097,24 +1097,18 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
const ClutterPlane *plane = &planes[i];
|
||||
int out = 0;
|
||||
for (j = 0; j < vertex_count; j++)
|
||||
{
|
||||
ClutterVertex p;
|
||||
float distance;
|
||||
graphene_vec3_t v;
|
||||
|
||||
/* XXX: for perspective projections this can be optimized
|
||||
* out because all the planes should pass through the origin
|
||||
* so (0,0,0) is a valid v0. */
|
||||
p.x = vertices[j].x - planes[i].v0[0];
|
||||
p.y = vertices[j].y - planes[i].v0[1];
|
||||
p.z = vertices[j].z - planes[i].v0[2];
|
||||
graphene_vec3_init (&v,
|
||||
vertices[j].x - graphene_vec3_get_x (&plane->v0),
|
||||
vertices[j].y - graphene_vec3_get_y (&plane->v0),
|
||||
vertices[j].z - graphene_vec3_get_z (&plane->v0));
|
||||
|
||||
distance = (planes[i].n[0] * p.x +
|
||||
planes[i].n[1] * p.y +
|
||||
planes[i].n[2] * p.z);
|
||||
|
||||
if (distance < 0)
|
||||
if (graphene_vec3_dot (&plane->n, &v) < 0)
|
||||
out++;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,7 @@
|
||||
* and bezier curves.
|
||||
*
|
||||
* A #ClutterPath contains a description of a path consisting of
|
||||
* straight lines and bezier curves. This can be used in a
|
||||
* #ClutterBehaviourPath to animate an actor moving along the path.
|
||||
* straight lines and bezier curves.
|
||||
*
|
||||
* The path consists of a series of nodes. Each node is one of the
|
||||
* following four types:
|
||||
@ -244,9 +243,6 @@ clutter_path_finalize (GObject *object)
|
||||
*
|
||||
* Creates a new #ClutterPath instance with no nodes.
|
||||
*
|
||||
* The object has a floating reference so if you add it to a
|
||||
* #ClutterBehaviourPath then you do not need to unref it.
|
||||
*
|
||||
* Return value: the newly created #ClutterPath
|
||||
*
|
||||
* Since: 1.0
|
||||
@ -267,9 +263,6 @@ clutter_path_new (void)
|
||||
* @desc. See clutter_path_add_string() for details of the format of
|
||||
* the string.
|
||||
*
|
||||
* The object has a floating reference so if you add it to a
|
||||
* #ClutterBehaviourPath then you do not need to unref it.
|
||||
*
|
||||
* Return value: the newly created #ClutterPath
|
||||
*
|
||||
* Since: 1.0
|
||||
|
@ -64,10 +64,10 @@ typedef struct _ClutterVertex4 ClutterVertex4;
|
||||
#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f))
|
||||
|
||||
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
|
||||
#define CLUTTER_ACTOR_IS_INTERNAL_CHILD(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_INTERNAL_CHILD) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
|
||||
@ -105,12 +105,10 @@ typedef enum
|
||||
|
||||
/* Used to avoid recursion */
|
||||
CLUTTER_IN_PAINT = 1 << 5,
|
||||
CLUTTER_IN_PICK = 1 << 6,
|
||||
|
||||
/* Used to avoid recursion */
|
||||
CLUTTER_IN_RELAYOUT = 1 << 6,
|
||||
|
||||
/* a flag for internal children of Containers (DEPRECATED) */
|
||||
CLUTTER_INTERNAL_CHILD = 1 << 7
|
||||
CLUTTER_IN_RELAYOUT = 1 << 7,
|
||||
} ClutterPrivateFlags;
|
||||
|
||||
/*
|
||||
@ -224,17 +222,17 @@ void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
|
||||
|
||||
GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
|
||||
|
||||
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
const CoglMatrix *projection,
|
||||
const float *viewport,
|
||||
const ClutterVertex *vertices_in,
|
||||
ClutterVertex *vertices_out,
|
||||
int n_vertices);
|
||||
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
const CoglMatrix *projection,
|
||||
const float *viewport,
|
||||
const graphene_point3d_t *vertices_in,
|
||||
graphene_point3d_t *vertices_out,
|
||||
int n_vertices);
|
||||
|
||||
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
|
||||
ClutterRect *dest);
|
||||
graphene_rect_t *dest);
|
||||
|
||||
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
|
||||
void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
|
||||
cairo_rectangle_int_t *dest);
|
||||
|
||||
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
|
||||
@ -282,10 +280,10 @@ void _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
|
||||
float factor);
|
||||
|
||||
gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
|
||||
ClutterVertex *scale_p,
|
||||
graphene_point3d_t *scale_p,
|
||||
float shear_p[3],
|
||||
ClutterVertex *rotate_p,
|
||||
ClutterVertex *translate_p,
|
||||
graphene_point3d_t *rotate_p,
|
||||
graphene_point3d_t *translate_p,
|
||||
ClutterVertex4 *perspective_p);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@ -296,8 +294,8 @@ PangoDirection _clutter_pango_find_base_dir (const gchar *text,
|
||||
|
||||
typedef struct _ClutterPlane
|
||||
{
|
||||
float v0[3];
|
||||
float n[3];
|
||||
graphene_vec3_t v0;
|
||||
graphene_vec3_t n;
|
||||
} ClutterPlane;
|
||||
|
||||
typedef enum _ClutterCullResult
|
||||
@ -315,6 +313,8 @@ gboolean _clutter_run_progress_function (GType gtype,
|
||||
gdouble progress,
|
||||
GValue *retval);
|
||||
|
||||
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PRIVATE_H__ */
|
||||
|
@ -352,63 +352,64 @@ _clutter_script_parse_knot (ClutterScript *script,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_geometry_from_array (JsonArray *array,
|
||||
ClutterGeometry *geometry)
|
||||
parse_rect_from_array (JsonArray *array,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
if (json_array_get_length (array) != 4)
|
||||
return FALSE;
|
||||
|
||||
geometry->x = json_array_get_int_element (array, 0);
|
||||
geometry->y = json_array_get_int_element (array, 1);
|
||||
geometry->width = json_array_get_int_element (array, 2);
|
||||
geometry->height = json_array_get_int_element (array, 3);
|
||||
graphene_rect_init (rect,
|
||||
json_array_get_int_element (array, 0),
|
||||
json_array_get_int_element (array, 1),
|
||||
json_array_get_int_element (array, 2),
|
||||
json_array_get_int_element (array, 3));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_geometry_from_object (JsonObject *object,
|
||||
ClutterGeometry *geometry)
|
||||
parse_rect_from_object (JsonObject *object,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
if (json_object_has_member (object, "x"))
|
||||
geometry->x = json_object_get_int_member (object, "x");
|
||||
rect->origin.x = json_object_get_int_member (object, "x");
|
||||
else
|
||||
geometry->x = 0;
|
||||
rect->origin.x = 0;
|
||||
|
||||
if (json_object_has_member (object, "y"))
|
||||
geometry->y = json_object_get_int_member (object, "y");
|
||||
rect->origin.y = json_object_get_int_member (object, "y");
|
||||
else
|
||||
geometry->y = 0;
|
||||
rect->origin.y = 0;
|
||||
|
||||
if (json_object_has_member (object, "width"))
|
||||
geometry->width = json_object_get_int_member (object, "width");
|
||||
rect->size.width = json_object_get_int_member (object, "width");
|
||||
else
|
||||
geometry->width = 0;
|
||||
rect->size.width = 0;
|
||||
|
||||
if (json_object_has_member (object, "height"))
|
||||
geometry->height = json_object_get_int_member (object, "height");
|
||||
rect->size.height = json_object_get_int_member (object, "height");
|
||||
else
|
||||
geometry->height = 0;
|
||||
rect->size.height = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_script_parse_geometry (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterGeometry *geometry)
|
||||
_clutter_script_parse_rect (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
|
||||
g_return_val_if_fail (node != NULL, FALSE);
|
||||
g_return_val_if_fail (geometry != NULL, FALSE);
|
||||
g_return_val_if_fail (rect != NULL, FALSE);
|
||||
|
||||
switch (JSON_NODE_TYPE (node))
|
||||
{
|
||||
case JSON_NODE_ARRAY:
|
||||
return parse_geometry_from_array (json_node_get_array (node), geometry);
|
||||
return parse_rect_from_array (json_node_get_array (node), rect);
|
||||
|
||||
case JSON_NODE_OBJECT:
|
||||
return parse_geometry_from_object (json_node_get_object (node), geometry);
|
||||
return parse_rect_from_object (json_node_get_object (node), rect);
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -492,8 +493,8 @@ _clutter_script_parse_color (ClutterScript *script,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_point_from_array (JsonArray *array,
|
||||
ClutterPoint *point)
|
||||
parse_point_from_array (JsonArray *array,
|
||||
graphene_point_t *point)
|
||||
{
|
||||
if (json_array_get_length (array) != 2)
|
||||
return FALSE;
|
||||
@ -505,8 +506,8 @@ parse_point_from_array (JsonArray *array,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_point_from_object (JsonObject *object,
|
||||
ClutterPoint *point)
|
||||
parse_point_from_object (JsonObject *object,
|
||||
graphene_point_t *point)
|
||||
{
|
||||
if (json_object_has_member (object, "x"))
|
||||
point->x = json_object_get_double_member (object, "x");
|
||||
@ -522,9 +523,9 @@ parse_point_from_object (JsonObject *object,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_script_parse_point (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterPoint *point)
|
||||
_clutter_script_parse_point (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
graphene_point_t *point)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
|
||||
g_return_val_if_fail (node != NULL, FALSE);
|
||||
@ -546,8 +547,8 @@ _clutter_script_parse_point (ClutterScript *script,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_size_from_array (JsonArray *array,
|
||||
ClutterSize *size)
|
||||
parse_size_from_array (JsonArray *array,
|
||||
graphene_size_t *size)
|
||||
{
|
||||
if (json_array_get_length (array) != 2)
|
||||
return FALSE;
|
||||
@ -559,8 +560,8 @@ parse_size_from_array (JsonArray *array,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_size_from_object (JsonObject *object,
|
||||
ClutterSize *size)
|
||||
parse_size_from_object (JsonObject *object,
|
||||
graphene_size_t *size)
|
||||
{
|
||||
if (json_object_has_member (object, "width"))
|
||||
size->width = json_object_get_double_member (object, "width");
|
||||
@ -576,9 +577,9 @@ parse_size_from_object (JsonObject *object,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_script_parse_size (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterSize *size)
|
||||
_clutter_script_parse_size (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
graphene_size_t *size)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
|
||||
g_return_val_if_fail (node != NULL, FALSE);
|
||||
@ -1328,11 +1329,11 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (p_type == CLUTTER_TYPE_GEOMETRY)
|
||||
else if (p_type == GRAPHENE_TYPE_RECT)
|
||||
{
|
||||
ClutterGeometry geom = { 0, };
|
||||
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
/* geometry := {
|
||||
/* rect := {
|
||||
* "x" : (int),
|
||||
* "y" : (int),
|
||||
* "width" : (int),
|
||||
@ -1340,9 +1341,9 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
* }
|
||||
*/
|
||||
|
||||
if (_clutter_script_parse_geometry (script, node, &geom))
|
||||
if (_clutter_script_parse_rect (script, node, &rect))
|
||||
{
|
||||
g_value_set_boxed (value, &geom);
|
||||
g_value_set_boxed (value, &rect);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -1364,9 +1365,9 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (p_type == CLUTTER_TYPE_POINT)
|
||||
else if (p_type == GRAPHENE_TYPE_POINT)
|
||||
{
|
||||
ClutterPoint point = CLUTTER_POINT_INIT_ZERO;
|
||||
graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
|
||||
|
||||
if (_clutter_script_parse_point (script, node, &point))
|
||||
{
|
||||
@ -1374,9 +1375,9 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (p_type == CLUTTER_TYPE_SIZE)
|
||||
else if (p_type == GRAPHENE_TYPE_SIZE)
|
||||
{
|
||||
ClutterSize size = CLUTTER_SIZE_INIT_ZERO;
|
||||
graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
|
||||
|
||||
if (_clutter_script_parse_size (script, node, &size))
|
||||
{
|
||||
@ -1417,15 +1418,15 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_GEOMETRY))
|
||||
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_RECT))
|
||||
{
|
||||
ClutterGeometry geom = { 0, };
|
||||
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
/* geometry := [ (int), (int), (int), (int) ] */
|
||||
/* rect := [ (int), (int), (int), (int) ] */
|
||||
|
||||
if (_clutter_script_parse_geometry (script, node, &geom))
|
||||
if (_clutter_script_parse_rect (script, node, &rect))
|
||||
{
|
||||
g_value_set_boxed (value, &geom);
|
||||
g_value_set_boxed (value, &rect);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -1441,9 +1442,9 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_POINT))
|
||||
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_POINT))
|
||||
{
|
||||
ClutterPoint point = CLUTTER_POINT_INIT_ZERO;
|
||||
graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
|
||||
|
||||
if (_clutter_script_parse_point (script, node, &point))
|
||||
{
|
||||
@ -1451,9 +1452,9 @@ _clutter_script_parse_node (ClutterScript *script,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_SIZE))
|
||||
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_SIZE))
|
||||
{
|
||||
ClutterSize size = CLUTTER_SIZE_INIT_ZERO;
|
||||
graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
|
||||
|
||||
if (_clutter_script_parse_size (script, node, &size))
|
||||
{
|
||||
|
@ -122,20 +122,20 @@ gboolean _clutter_script_flags_from_string (GType gtype,
|
||||
gboolean _clutter_script_parse_knot (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterKnot *knot);
|
||||
gboolean _clutter_script_parse_geometry (ClutterScript *script,
|
||||
gboolean _clutter_script_parse_rect (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterGeometry *geometry);
|
||||
graphene_rect_t *rect);
|
||||
gboolean _clutter_script_parse_color (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterColor *color);
|
||||
GObject *_clutter_script_parse_alpha (ClutterScript *script,
|
||||
JsonNode *node);
|
||||
gboolean _clutter_script_parse_point (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterPoint *point);
|
||||
gboolean _clutter_script_parse_point (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
graphene_point_t *point);
|
||||
gboolean _clutter_script_parse_size (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
ClutterSize *size);
|
||||
graphene_size_t *size);
|
||||
|
||||
gboolean _clutter_script_parse_translatable_string (ClutterScript *script,
|
||||
JsonNode *node,
|
||||
|
@ -75,65 +75,6 @@
|
||||
* packing rules of Clutter still apply, and an actor cannot be packed
|
||||
* in multiple containers without unparenting it in between).
|
||||
*
|
||||
* Behaviours and timelines can also be defined inside a UI definition
|
||||
* buffer:
|
||||
*
|
||||
* <informalexample><programlisting><![CDATA[
|
||||
* {
|
||||
* "id" : "rotate-behaviour",
|
||||
* "type" : "ClutterBehaviourRotate",
|
||||
* "angle-start" : 0.0,
|
||||
* "angle-end" : 360.0,
|
||||
* "axis" : "z-axis",
|
||||
* "alpha" : {
|
||||
* "timeline" : { "duration" : 4000, "loop" : true },
|
||||
* "mode" : "easeInSine"
|
||||
* }
|
||||
* }
|
||||
* ]]></programlisting></informalexample>
|
||||
*
|
||||
* And then to apply a defined behaviour to an actor defined inside the
|
||||
* definition of an actor, the "behaviour" member can be used:
|
||||
*
|
||||
* <informalexample><programlisting><![CDATA[
|
||||
* {
|
||||
* "id" : "my-rotating-actor",
|
||||
* "type" : "ClutterTexture",
|
||||
* ...
|
||||
* "behaviours" : [ "rotate-behaviour" ]
|
||||
* }
|
||||
* ]]></programlisting></informalexample>
|
||||
*
|
||||
* A #ClutterAlpha belonging to a #ClutterBehaviour can only be defined
|
||||
* implicitly like in the example above, or explicitly by setting the
|
||||
* "alpha" property to point to a previously defined #ClutterAlpha, e.g.:
|
||||
*
|
||||
* <informalexample><programlisting><![CDATA[
|
||||
* {
|
||||
* "id" : "rotate-behaviour",
|
||||
* "type" : "ClutterBehaviourRotate",
|
||||
* "angle-start" : 0.0,
|
||||
* "angle-end" : 360.0,
|
||||
* "axis" : "z-axis",
|
||||
* "alpha" : {
|
||||
* "id" : "rotate-alpha",
|
||||
* "type" : "ClutterAlpha",
|
||||
* "timeline" : {
|
||||
* "id" : "rotate-timeline",
|
||||
* "type : "ClutterTimeline",
|
||||
* "duration" : 4000,
|
||||
* "loop" : true
|
||||
* },
|
||||
* "function" : "custom_sine_alpha"
|
||||
* }
|
||||
* }
|
||||
* ]]></programlisting></informalexample>
|
||||
*
|
||||
* Implicitely defined #ClutterAlpha<!-- -->s and #ClutterTimeline<!-- -->s
|
||||
* can omit the `id`, as well as the `type` members, but will not be available
|
||||
* using clutter_script_get_object() (they can, however, be extracted using the
|
||||
* #ClutterBehaviour and #ClutterAlpha API respectively).
|
||||
*
|
||||
* Signal handlers can be defined inside a Clutter UI definition file and
|
||||
* then autoconnected to their respective signals using the
|
||||
* clutter_script_connect_signals() function:
|
||||
@ -210,7 +151,6 @@
|
||||
* function
|
||||
* "type_func" := the GType function name, for non-standard classes
|
||||
* "children" := an array of names or objects to add as children
|
||||
* "behaviours" := an array of names or objects to apply to an actor
|
||||
* "signals" := an array of signal definitions to connect to an object
|
||||
* "is-default" := a boolean flag used when defining the #ClutterStage;
|
||||
* if set to "true" the default stage will be used instead
|
||||
@ -246,7 +186,6 @@
|
||||
#include "clutter-debug.h"
|
||||
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-state.h"
|
||||
|
||||
@ -524,11 +463,10 @@ clutter_script_init (ClutterScript *script)
|
||||
/**
|
||||
* clutter_script_new:
|
||||
*
|
||||
* Creates a new #ClutterScript instance. #ClutterScript can be used
|
||||
* to load objects definitions for scenegraph elements, like actors,
|
||||
* or behavioural elements, like behaviours and timelines. The
|
||||
* definitions must be encoded using the JavaScript Object Notation (JSON)
|
||||
* language.
|
||||
* Creates a new #ClutterScript instance. #ClutterScript can be used to load
|
||||
* objects definitions for scenegraph elements, like actors, or behavioural
|
||||
* elements, like timelines. The definitions must be encoded using the
|
||||
* JavaScript Object Notation (JSON) language.
|
||||
*
|
||||
* Return value: the newly created #ClutterScript instance. Use
|
||||
* g_object_unref() when done.
|
||||
@ -863,9 +801,7 @@ construct_each_objects (gpointer key,
|
||||
if (oinfo->object == NULL)
|
||||
_clutter_script_construct_object (script, oinfo);
|
||||
|
||||
/* this will take care of setting up properties,
|
||||
* adding children and applying behaviours
|
||||
*/
|
||||
/* this will take care of setting up properties and adding children */
|
||||
_clutter_script_apply_properties (script, oinfo);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
struct _ClutterScrollActorPrivate
|
||||
{
|
||||
ClutterPoint scroll_to;
|
||||
graphene_point_t scroll_to;
|
||||
|
||||
ClutterScrollMode scroll_mode;
|
||||
|
||||
@ -94,19 +94,19 @@ G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_
|
||||
clutter_animatable_iface_init))
|
||||
|
||||
static void
|
||||
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
|
||||
const ClutterPoint *point)
|
||||
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
|
||||
const graphene_point_t *point)
|
||||
{
|
||||
ClutterScrollActorPrivate *priv = self->priv;
|
||||
ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||
ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY;
|
||||
float dx, dy;
|
||||
|
||||
if (clutter_point_equals (&priv->scroll_to, point))
|
||||
if (graphene_point_equal (&priv->scroll_to, point))
|
||||
return;
|
||||
|
||||
if (point == NULL)
|
||||
clutter_point_init (&priv->scroll_to, 0.f, 0.f);
|
||||
graphene_point_init (&priv->scroll_to, 0.f, 0.f);
|
||||
else
|
||||
priv->scroll_to = *point;
|
||||
|
||||
@ -216,7 +216,7 @@ clutter_scroll_actor_set_final_state (ClutterAnimatable *animatable,
|
||||
if (strcmp (property_name, "scroll-to") == 0)
|
||||
{
|
||||
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
|
||||
const ClutterPoint *point = g_value_get_boxed (value);
|
||||
const graphene_point_t *point = g_value_get_boxed (value);
|
||||
|
||||
clutter_scroll_actor_set_scroll_to_internal (self, point);
|
||||
}
|
||||
@ -248,7 +248,7 @@ clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
|
||||
g_param_spec_boxed ("scroll-to",
|
||||
"Scroll To",
|
||||
"The point to scroll the actor to",
|
||||
CLUTTER_TYPE_POINT,
|
||||
GRAPHENE_TYPE_POINT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
CLUTTER_PARAM_ANIMATABLE);
|
||||
@ -322,7 +322,7 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
|
||||
/**
|
||||
* clutter_scroll_actor_scroll_to_point:
|
||||
* @actor: a #ClutterScrollActor
|
||||
* @point: a #ClutterPoint
|
||||
* @point: a #graphene_point_t
|
||||
*
|
||||
* Scrolls the contents of @actor so that @point is the new origin
|
||||
* of the visible area.
|
||||
@ -335,8 +335,8 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
||||
const ClutterPoint *point)
|
||||
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
||||
const graphene_point_t *point)
|
||||
{
|
||||
ClutterScrollActorPrivate *priv;
|
||||
const ClutterAnimationInfo *info;
|
||||
@ -390,10 +390,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
||||
|
||||
/* if a transition already exist, update its bounds */
|
||||
clutter_transition_set_from (priv->transition,
|
||||
CLUTTER_TYPE_POINT,
|
||||
GRAPHENE_TYPE_POINT,
|
||||
&priv->scroll_to);
|
||||
clutter_transition_set_to (priv->transition,
|
||||
CLUTTER_TYPE_POINT,
|
||||
GRAPHENE_TYPE_POINT,
|
||||
point);
|
||||
|
||||
/* always use the current easing state */
|
||||
@ -417,10 +417,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
|
||||
const ClutterRect *rect)
|
||||
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
ClutterRect n_rect;
|
||||
graphene_rect_t n_rect;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
|
||||
g_return_if_fail (rect != NULL);
|
||||
@ -428,7 +428,7 @@ clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
|
||||
n_rect = *rect;
|
||||
|
||||
/* normalize, so that we have a valid origin */
|
||||
clutter_rect_normalize (&n_rect);
|
||||
graphene_rect_normalize (&n_rect);
|
||||
|
||||
clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin);
|
||||
}
|
||||
|
@ -86,11 +86,11 @@ CLUTTER_EXPORT
|
||||
ClutterScrollMode clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
||||
const ClutterPoint *point);
|
||||
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
|
||||
const graphene_point_t *point);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
|
||||
const ClutterRect *rect);
|
||||
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
|
||||
const graphene_rect_t *rect);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -177,18 +177,18 @@ clutter_shader_effect_clear (ClutterShaderEffect *self,
|
||||
{
|
||||
ClutterShaderEffectPrivate *priv = self->priv;
|
||||
|
||||
if (priv->shader != COGL_INVALID_HANDLE)
|
||||
if (priv->shader != NULL)
|
||||
{
|
||||
cogl_handle_unref (priv->shader);
|
||||
cogl_object_unref (priv->shader);
|
||||
|
||||
priv->shader = COGL_INVALID_HANDLE;
|
||||
priv->shader = NULL;
|
||||
}
|
||||
|
||||
if (priv->program != COGL_INVALID_HANDLE)
|
||||
if (priv->program != NULL)
|
||||
{
|
||||
cogl_handle_unref (priv->program);
|
||||
cogl_object_unref (priv->program);
|
||||
|
||||
priv->program = COGL_INVALID_HANDLE;
|
||||
priv->program = NULL;
|
||||
}
|
||||
|
||||
if (reset_uniforms && priv->uniforms != NULL)
|
||||
@ -208,7 +208,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
|
||||
gpointer key, value;
|
||||
gsize size;
|
||||
|
||||
if (priv->program == COGL_INVALID_HANDLE)
|
||||
if (priv->program == NULL)
|
||||
return;
|
||||
|
||||
if (priv->uniforms == NULL)
|
||||
@ -333,7 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return COGL_INVALID_HANDLE;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
CLUTTER_TYPE_SHADER_EFFECT,
|
||||
ClutterShaderEffectClassPrivate);
|
||||
|
||||
if (class_priv->shader == COGL_INVALID_HANDLE)
|
||||
if (class_priv->shader == NULL)
|
||||
{
|
||||
gchar *source;
|
||||
|
||||
@ -387,10 +387,10 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
}
|
||||
}
|
||||
|
||||
priv->shader = cogl_handle_ref (class_priv->shader);
|
||||
priv->shader = cogl_object_ref (class_priv->shader);
|
||||
|
||||
if (class_priv->program != COGL_INVALID_HANDLE)
|
||||
priv->program = cogl_handle_ref (class_priv->program);
|
||||
if (class_priv->program != NULL)
|
||||
priv->program = cogl_object_ref (class_priv->program);
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,13 +404,13 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
|
||||
/* If the source hasn't been set then we'll try to get it from the
|
||||
static source instead */
|
||||
if (priv->shader == COGL_INVALID_HANDLE)
|
||||
if (priv->shader == NULL)
|
||||
clutter_shader_effect_try_static_source (self);
|
||||
|
||||
/* we haven't been prepared or we don't have support for
|
||||
* GLSL shaders in Clutter
|
||||
*/
|
||||
if (priv->program == COGL_INVALID_HANDLE)
|
||||
if (priv->program == NULL)
|
||||
goto out;
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Applying the shader effect of type '%s'",
|
||||
@ -500,6 +500,7 @@ static void
|
||||
clutter_shader_effect_init (ClutterShaderEffect *effect)
|
||||
{
|
||||
effect->priv = clutter_shader_effect_get_instance_private (effect);
|
||||
effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -533,7 +534,7 @@ clutter_shader_effect_new (ClutterShaderType shader_type)
|
||||
* Retrieves a pointer to the shader's handle
|
||||
*
|
||||
* Return value: (transfer none): a pointer to the shader's handle,
|
||||
* or %COGL_INVALID_HANDLE
|
||||
* or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
@ -541,7 +542,7 @@ CoglHandle
|
||||
clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
|
||||
COGL_INVALID_HANDLE);
|
||||
NULL);
|
||||
|
||||
return effect->priv->shader;
|
||||
}
|
||||
@ -553,7 +554,7 @@ clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
|
||||
* Retrieves a pointer to the program's handle
|
||||
*
|
||||
* Return value: (transfer none): a pointer to the program's handle,
|
||||
* or %COGL_INVALID_HANDLE
|
||||
* or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
@ -561,7 +562,7 @@ CoglHandle
|
||||
clutter_shader_effect_get_program (ClutterShaderEffect *effect)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
|
||||
COGL_INVALID_HANDLE);
|
||||
NULL);
|
||||
|
||||
return effect->priv->program;
|
||||
}
|
||||
@ -891,7 +892,7 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
|
||||
|
||||
priv = effect->priv;
|
||||
|
||||
if (priv->shader != COGL_INVALID_HANDLE)
|
||||
if (priv->shader != NULL)
|
||||
return TRUE;
|
||||
|
||||
priv->shader = clutter_shader_effect_create_shader (effect);
|
||||
|
@ -79,18 +79,18 @@ gint64 _clutter_stage_get_update_time (ClutterStage *stage);
|
||||
void _clutter_stage_clear_update_time (ClutterStage *stage);
|
||||
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
||||
|
||||
void clutter_stage_log_pick (ClutterStage *stage,
|
||||
const ClutterPoint *vertices,
|
||||
ClutterActor *actor);
|
||||
void clutter_stage_log_pick (ClutterStage *stage,
|
||||
const graphene_point_t *vertices,
|
||||
ClutterActor *actor);
|
||||
|
||||
void clutter_stage_push_pick_clip (ClutterStage *stage,
|
||||
const ClutterPoint *vertices);
|
||||
void clutter_stage_push_pick_clip (ClutterStage *stage,
|
||||
const graphene_point_t *vertices);
|
||||
|
||||
void clutter_stage_pop_pick_clip (ClutterStage *stage);
|
||||
|
||||
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
|
||||
gint x,
|
||||
gint y,
|
||||
float x,
|
||||
float y,
|
||||
ClutterPickMode mode);
|
||||
|
||||
ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
|
||||
@ -133,9 +133,9 @@ gboolean _clutter_stage_update_state (ClutterStage *stag
|
||||
|
||||
void _clutter_stage_set_scale_factor (ClutterStage *stage,
|
||||
int factor);
|
||||
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
ClutterRect *rect,
|
||||
float *view_scale);
|
||||
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
graphene_rect_t *rect,
|
||||
float *view_scale);
|
||||
|
||||
void _clutter_stage_presented (ClutterStage *stage,
|
||||
CoglFrameEvent frame_event,
|
||||
|
@ -143,6 +143,21 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
CoglMatrix matrix;
|
||||
|
||||
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
|
||||
if (cogl_matrix_is_identity (&matrix))
|
||||
{
|
||||
int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
|
||||
int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
|
||||
|
||||
if (cogl_blit_framebuffer (priv->offscreen,
|
||||
priv->framebuffer,
|
||||
0, 0,
|
||||
0, 0,
|
||||
fb_width, fb_height,
|
||||
NULL))
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
|
||||
cogl_framebuffer_push_matrix (priv->framebuffer);
|
||||
|
||||
|
@ -235,19 +235,35 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
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_bounds != NULL)
|
||||
return iface->get_redraw_clip_bounds (window, stage_clip);
|
||||
if (iface->get_redraw_clip != NULL)
|
||||
return iface->get_redraw_clip (window);
|
||||
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
cairo_region_t *redraw_clip;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
redraw_clip = _clutter_stage_window_get_redraw_clip (window);
|
||||
if (!redraw_clip)
|
||||
return FALSE;
|
||||
|
||||
cairo_region_get_extents (redraw_clip, stage_clip);
|
||||
cairo_region_destroy (redraw_clip);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -55,9 +55,7 @@ struct _ClutterStageWindowInterface
|
||||
cairo_rectangle_int_t *stage_rectangle);
|
||||
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
|
||||
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
|
||||
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *clip);
|
||||
|
||||
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
|
||||
|
||||
void (* set_accept_focus) (ClutterStageWindow *stage_window,
|
||||
gboolean accept_focus);
|
||||
@ -102,6 +100,7 @@ gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWin
|
||||
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
|
||||
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *clip);
|
||||
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
|
||||
|
||||
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||
gboolean accept_focus);
|
||||
|
@ -86,8 +86,6 @@
|
||||
* fully opaque actors covering the whole visible area of the stage,
|
||||
* i.e. when no blending with the stage color happens over the whole
|
||||
* stage viewport
|
||||
*
|
||||
* A series of hints that enable or disable behaviours on the stage
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_STAGE >*/
|
||||
{
|
||||
@ -107,7 +105,7 @@ struct _ClutterStageQueueRedrawEntry
|
||||
|
||||
typedef struct _PickRecord
|
||||
{
|
||||
ClutterPoint vertex[4];
|
||||
graphene_point_t vertex[4];
|
||||
ClutterActor *actor;
|
||||
int clip_stack_top;
|
||||
} PickRecord;
|
||||
@ -115,7 +113,7 @@ typedef struct _PickRecord
|
||||
typedef struct _PickClipRecord
|
||||
{
|
||||
int prev;
|
||||
ClutterPoint vertex[4];
|
||||
graphene_point_t vertex[4];
|
||||
} PickClipRecord;
|
||||
|
||||
struct _ClutterStagePrivate
|
||||
@ -129,8 +127,6 @@ struct _ClutterStagePrivate
|
||||
CoglMatrix view;
|
||||
float viewport[4];
|
||||
|
||||
ClutterFog fog;
|
||||
|
||||
gchar *title;
|
||||
ClutterActor *key_focused_actor;
|
||||
|
||||
@ -173,7 +169,6 @@ struct _ClutterStagePrivate
|
||||
guint relayout_pending : 1;
|
||||
guint redraw_pending : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint use_fog : 1;
|
||||
guint throttle_motion_events : 1;
|
||||
guint use_alpha : 1;
|
||||
guint min_size_changed : 1;
|
||||
@ -191,8 +186,6 @@ enum
|
||||
PROP_CURSOR_VISIBLE,
|
||||
PROP_PERSPECTIVE,
|
||||
PROP_TITLE,
|
||||
PROP_USE_FOG,
|
||||
PROP_FOG,
|
||||
PROP_USE_ALPHA,
|
||||
PROP_KEY_FOCUS,
|
||||
PROP_NO_CLEAR_HINT,
|
||||
@ -226,6 +219,7 @@ static void capture_view_into (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *rect,
|
||||
uint8_t *data,
|
||||
int stride);
|
||||
static void clutter_stage_update_view_perspective (ClutterStage *stage);
|
||||
|
||||
static void clutter_container_iface_init (ClutterContainerIface *iface);
|
||||
|
||||
@ -248,20 +242,6 @@ clutter_stage_real_remove (ClutterContainer *container,
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), child);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (container));
|
||||
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
callback (child, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_raise (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
@ -292,7 +272,6 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
{
|
||||
iface->add = clutter_stage_real_add;
|
||||
iface->remove = clutter_stage_real_remove;
|
||||
iface->foreach = clutter_stage_real_foreach;
|
||||
iface->raise = clutter_stage_real_raise;
|
||||
iface->lower = clutter_stage_real_lower;
|
||||
iface->sort_depth_order = clutter_stage_real_sort_depth_order;
|
||||
@ -395,9 +374,9 @@ _clutter_stage_clear_pick_stack (ClutterStage *stage)
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_log_pick (ClutterStage *stage,
|
||||
const ClutterPoint *vertices,
|
||||
ClutterActor *actor)
|
||||
clutter_stage_log_pick (ClutterStage *stage,
|
||||
const graphene_point_t *vertices,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
PickRecord rec;
|
||||
@ -409,7 +388,7 @@ clutter_stage_log_pick (ClutterStage *stage,
|
||||
|
||||
g_assert (!priv->pick_stack_frozen);
|
||||
|
||||
memcpy (rec.vertex, vertices, 4 * sizeof (ClutterPoint));
|
||||
memcpy (rec.vertex, vertices, 4 * sizeof (graphene_point_t));
|
||||
rec.actor = actor;
|
||||
rec.clip_stack_top = priv->pick_clip_stack_top;
|
||||
|
||||
@ -417,8 +396,8 @@ clutter_stage_log_pick (ClutterStage *stage,
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_push_pick_clip (ClutterStage *stage,
|
||||
const ClutterPoint *vertices)
|
||||
clutter_stage_push_pick_clip (ClutterStage *stage,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
PickClipRecord clip;
|
||||
@ -430,7 +409,7 @@ clutter_stage_push_pick_clip (ClutterStage *stage,
|
||||
g_assert (!priv->pick_stack_frozen);
|
||||
|
||||
clip.prev = priv->pick_clip_stack_top;
|
||||
memcpy (clip.vertex, vertices, 4 * sizeof (ClutterPoint));
|
||||
memcpy (clip.vertex, vertices, 4 * sizeof (graphene_point_t));
|
||||
|
||||
g_array_append_val (priv->pick_clip_stack, clip);
|
||||
priv->pick_clip_stack_top = priv->pick_clip_stack->len - 1;
|
||||
@ -463,7 +442,7 @@ clutter_stage_pop_pick_clip (ClutterStage *stage)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices)
|
||||
is_quadrilateral_axis_aligned_rectangle (const graphene_point_t *vertices)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -481,8 +460,8 @@ is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_inside_axis_aligned_rectangle (const ClutterPoint *point,
|
||||
const ClutterPoint *vertices)
|
||||
is_inside_axis_aligned_rectangle (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
float min_x = FLT_MAX;
|
||||
float max_x = FLT_MIN;
|
||||
@ -504,24 +483,79 @@ is_inside_axis_aligned_rectangle (const ClutterPoint *point,
|
||||
point->y < max_y);
|
||||
}
|
||||
|
||||
static int
|
||||
clutter_point_compare_line (const graphene_point_t *p,
|
||||
const graphene_point_t *a,
|
||||
const graphene_point_t *b)
|
||||
{
|
||||
graphene_vec3_t vec_pa;
|
||||
graphene_vec3_t vec_pb;
|
||||
graphene_vec3_t cross;
|
||||
float cross_z;
|
||||
|
||||
graphene_vec3_init (&vec_pa, p->x - a->x, p->y - a->y, 0.f);
|
||||
graphene_vec3_init (&vec_pb, p->x - b->x, p->y - b->y, 0.f);
|
||||
graphene_vec3_cross (&vec_pa, &vec_pb, &cross);
|
||||
cross_z = graphene_vec3_get_z (&cross);
|
||||
|
||||
if (cross_z > 0.f)
|
||||
return 1;
|
||||
else if (cross_z < 0.f)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_inside_input_region (const ClutterPoint *point,
|
||||
const ClutterPoint *vertices)
|
||||
is_inside_unaligned_rectangle (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
unsigned int i;
|
||||
int first_side;
|
||||
|
||||
first_side = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
int side;
|
||||
|
||||
side = clutter_point_compare_line (point,
|
||||
&vertices[i],
|
||||
&vertices[(i + 1) % 4]);
|
||||
|
||||
if (side)
|
||||
{
|
||||
if (first_side == 0)
|
||||
first_side = side;
|
||||
else if (side != first_side)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_side == 0)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_inside_input_region (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
|
||||
if (is_quadrilateral_axis_aligned_rectangle (vertices))
|
||||
return is_inside_axis_aligned_rectangle (point, vertices);
|
||||
else
|
||||
return clutter_point_inside_quadrilateral (point, vertices);
|
||||
return is_inside_unaligned_rectangle (point, vertices);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pick_record_contains_pixel (ClutterStage *stage,
|
||||
pick_record_contains_point (ClutterStage *stage,
|
||||
const PickRecord *rec,
|
||||
int x,
|
||||
int y)
|
||||
float x,
|
||||
float y)
|
||||
{
|
||||
const ClutterPoint point = CLUTTER_POINT_INIT (x, y);
|
||||
const graphene_point_t point = GRAPHENE_POINT_INIT (x, y);
|
||||
ClutterStagePrivate *priv;
|
||||
int clip_index;
|
||||
|
||||
@ -683,17 +717,6 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
flags | CLUTTER_DELEGATE_LAYOUT);
|
||||
}
|
||||
|
||||
/* XXX: Until Cogl becomes fully responsible for backend windows
|
||||
* Clutter need to manually keep it informed of the current window
|
||||
* size. We do this after the allocation above so that the stage
|
||||
* window has a chance to update the window size based on the
|
||||
* allocation.
|
||||
*/
|
||||
_clutter_stage_window_get_geometry (priv->impl, &window_size);
|
||||
|
||||
cogl_onscreen_clutter_backend_set_size (window_size.width,
|
||||
window_size.height);
|
||||
|
||||
/* reset the viewport if the allocation effectively changed */
|
||||
clutter_actor_get_allocation_box (self, &alloc);
|
||||
clutter_actor_box_get_size (&alloc, &new_width, &new_height);
|
||||
@ -734,8 +757,9 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
|
||||
Vector4 *tmp_poly;
|
||||
ClutterPlane *plane;
|
||||
int i;
|
||||
float b[3];
|
||||
float c[3];
|
||||
Vector4 *poly;
|
||||
graphene_vec3_t b;
|
||||
graphene_vec3_t c;
|
||||
int count;
|
||||
|
||||
tmp_poly = g_alloca (sizeof (Vector4) * n_vertices * 2);
|
||||
@ -802,23 +826,37 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
plane = &planes[i];
|
||||
memcpy (plane->v0, tmp_poly + i, sizeof (float) * 3);
|
||||
memcpy (b, tmp_poly + n_vertices + i, sizeof (float) * 3);
|
||||
memcpy (c, tmp_poly + n_vertices + i + 1, sizeof (float) * 3);
|
||||
cogl_vector3_subtract (b, b, plane->v0);
|
||||
cogl_vector3_subtract (c, c, plane->v0);
|
||||
cogl_vector3_cross_product (plane->n, b, c);
|
||||
cogl_vector3_normalize (plane->n);
|
||||
|
||||
poly = &tmp_poly[i];
|
||||
graphene_vec3_init (&plane->v0, poly->x, poly->y, poly->z);
|
||||
|
||||
poly = &tmp_poly[n_vertices + i];
|
||||
graphene_vec3_init (&b, poly->x, poly->y, poly->z);
|
||||
|
||||
poly = &tmp_poly[n_vertices + i + 1];
|
||||
graphene_vec3_init (&c, poly->x, poly->y, poly->z);
|
||||
|
||||
graphene_vec3_subtract (&b, &plane->v0, &b);
|
||||
graphene_vec3_subtract (&c, &plane->v0, &c);
|
||||
graphene_vec3_cross (&b, &c, &plane->n);
|
||||
graphene_vec3_normalize (&plane->n, &plane->n);
|
||||
}
|
||||
|
||||
plane = &planes[n_vertices - 1];
|
||||
memcpy (plane->v0, tmp_poly + 0, sizeof (float) * 3);
|
||||
memcpy (b, tmp_poly + (2 * n_vertices - 1), sizeof (float) * 3);
|
||||
memcpy (c, tmp_poly + n_vertices, sizeof (float) * 3);
|
||||
cogl_vector3_subtract (b, b, plane->v0);
|
||||
cogl_vector3_subtract (c, c, plane->v0);
|
||||
cogl_vector3_cross_product (plane->n, b, c);
|
||||
cogl_vector3_normalize (plane->n);
|
||||
|
||||
poly = &tmp_poly[0];
|
||||
graphene_vec3_init (&plane->v0, poly->x, poly->y, poly->z);
|
||||
|
||||
poly = &tmp_poly[2 * n_vertices - 1];
|
||||
graphene_vec3_init (&b, poly->x, poly->y, poly->z);
|
||||
|
||||
poly = &tmp_poly[n_vertices];
|
||||
graphene_vec3_init (&c, poly->x, poly->y, poly->z);
|
||||
|
||||
graphene_vec3_subtract (&b, &plane->v0, &b);
|
||||
graphene_vec3_subtract (&c, &plane->v0, &c);
|
||||
graphene_vec3_cross (&b, &c, &plane->n);
|
||||
graphene_vec3_normalize (&plane->n, &plane->n);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -841,9 +879,9 @@ _clutter_stage_update_active_framebuffer (ClutterStage *stage,
|
||||
* be able to cull them.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
@ -898,6 +936,14 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
|
||||
_clutter_stage_paint_volume_stack_free_all (stage);
|
||||
_clutter_stage_update_active_framebuffer (stage, framebuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
setup_view_for_pick_or_paint (stage, view, clip);
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage));
|
||||
}
|
||||
|
||||
@ -949,8 +995,7 @@ clutter_stage_paint (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_pick (ClutterActor *self,
|
||||
const ClutterColor *color)
|
||||
clutter_stage_pick (ClutterActor *self)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
@ -961,7 +1006,7 @@ clutter_stage_pick (ClutterActor *self,
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_paint (child);
|
||||
clutter_actor_pick (child);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1065,10 +1110,7 @@ clutter_stage_emit_key_focus_event (ClutterStage *stage,
|
||||
if (priv->key_focused_actor == NULL)
|
||||
return;
|
||||
|
||||
if (focus_in)
|
||||
g_signal_emit_by_name (priv->key_focused_actor, "key-focus-in");
|
||||
else
|
||||
g_signal_emit_by_name (priv->key_focused_actor, "key-focus-out");
|
||||
_clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), focus_in);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_KEY_FOCUS]);
|
||||
}
|
||||
@ -1374,7 +1416,7 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
|
||||
GSList *updating = NULL;
|
||||
const GSList *devices;
|
||||
cairo_rectangle_int_t clip;
|
||||
ClutterPoint point;
|
||||
graphene_point_t point;
|
||||
gboolean has_clip;
|
||||
|
||||
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
|
||||
@ -1591,6 +1633,26 @@ _clutter_stage_has_full_redraw_queued (ClutterStage *stage)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_redraw_clip_bounds:
|
||||
* @stage: A #ClutterStage
|
||||
@ -1628,8 +1690,8 @@ clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
|
||||
|
||||
static ClutterActor *
|
||||
_clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
gint x,
|
||||
gint y,
|
||||
float x,
|
||||
float y,
|
||||
ClutterPickMode mode,
|
||||
ClutterStageView *view)
|
||||
{
|
||||
@ -1647,7 +1709,8 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
cogl_push_framebuffer (fb);
|
||||
|
||||
context->pick_mode = mode;
|
||||
clutter_stage_do_paint_view (stage, view, NULL);
|
||||
setup_view_for_pick_or_paint (stage, view, NULL);
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage));
|
||||
context->pick_mode = CLUTTER_PICK_NONE;
|
||||
priv->cached_pick_mode = mode;
|
||||
|
||||
@ -1664,7 +1727,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
{
|
||||
const PickRecord *rec = &g_array_index (priv->pick_stack, PickRecord, i);
|
||||
|
||||
if (rec->actor && pick_record_contains_pixel (stage, rec, x, y))
|
||||
if (rec->actor && pick_record_contains_point (stage, rec, x, y))
|
||||
return rec->actor;
|
||||
}
|
||||
|
||||
@ -1700,8 +1763,8 @@ clutter_stage_get_view_at (ClutterStage *stage,
|
||||
|
||||
ClutterActor *
|
||||
_clutter_stage_do_pick (ClutterStage *stage,
|
||||
gint x,
|
||||
gint y,
|
||||
float x,
|
||||
float y,
|
||||
ClutterPickMode mode)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (stage);
|
||||
@ -1818,14 +1881,6 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_title (stage, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_USE_FOG:
|
||||
clutter_stage_set_use_fog (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_FOG:
|
||||
clutter_stage_set_fog (stage, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_USE_ALPHA:
|
||||
clutter_stage_set_use_alpha (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -1880,14 +1935,6 @@ clutter_stage_get_property (GObject *gobject,
|
||||
g_value_set_string (value, priv->title);
|
||||
break;
|
||||
|
||||
case PROP_USE_FOG:
|
||||
g_value_set_boolean (value, priv->use_fog);
|
||||
break;
|
||||
|
||||
case PROP_FOG:
|
||||
g_value_set_boxed (value, &priv->fog);
|
||||
break;
|
||||
|
||||
case PROP_USE_ALPHA:
|
||||
g_value_set_boolean (value, priv->use_alpha);
|
||||
break;
|
||||
@ -2073,41 +2120,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterStage:use-fog:
|
||||
*
|
||||
* Whether the stage should use a linear GL "fog" in creating the
|
||||
* depth-cueing effect, to enhance the perception of depth by fading
|
||||
* actors farther from the viewpoint.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: This property does not do anything.
|
||||
*/
|
||||
obj_props[PROP_USE_FOG] =
|
||||
g_param_spec_boolean ("use-fog",
|
||||
P_("Use Fog"),
|
||||
P_("Whether to enable depth cueing"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
|
||||
|
||||
/**
|
||||
* ClutterStage:fog:
|
||||
*
|
||||
* The settings for the GL "fog", used only if #ClutterStage:use-fog
|
||||
* is set to %TRUE
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: This property does not do anything.
|
||||
*/
|
||||
obj_props[PROP_FOG] =
|
||||
g_param_spec_boxed ("fog",
|
||||
P_("Fog"),
|
||||
P_("Settings for the depth cueing"),
|
||||
CLUTTER_TYPE_FOG,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
|
||||
|
||||
/**
|
||||
* ClutterStage:use-alpha:
|
||||
*
|
||||
@ -2345,7 +2357,6 @@ clutter_stage_init (ClutterStage *self)
|
||||
priv->event_queue = g_queue_new ();
|
||||
|
||||
priv->is_cursor_visible = TRUE;
|
||||
priv->use_fog = FALSE;
|
||||
priv->throttle_motion_events = TRUE;
|
||||
priv->min_size_changed = FALSE;
|
||||
priv->sync_delay = -1;
|
||||
@ -2354,33 +2365,6 @@ clutter_stage_init (ClutterStage *self)
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (self),
|
||||
&default_stage_color);
|
||||
|
||||
priv->perspective.fovy = 60.0; /* 60 Degrees */
|
||||
priv->perspective.aspect = (float) geom.width / (float) geom.height;
|
||||
priv->perspective.z_near = 0.1;
|
||||
priv->perspective.z_far = 100.0;
|
||||
|
||||
cogl_matrix_init_identity (&priv->projection);
|
||||
cogl_matrix_perspective (&priv->projection,
|
||||
priv->perspective.fovy,
|
||||
priv->perspective.aspect,
|
||||
priv->perspective.z_near,
|
||||
priv->perspective.z_far);
|
||||
cogl_matrix_get_inverse (&priv->projection,
|
||||
&priv->inverse_projection);
|
||||
cogl_matrix_init_identity (&priv->view);
|
||||
cogl_matrix_view_2d_in_perspective (&priv->view,
|
||||
priv->perspective.fovy,
|
||||
priv->perspective.aspect,
|
||||
priv->perspective.z_near,
|
||||
50, /* distance to 2d plane */
|
||||
geom.width,
|
||||
geom.height);
|
||||
|
||||
|
||||
/* FIXME - remove for 2.0 */
|
||||
priv->fog.z_near = 1.0;
|
||||
priv->fog.z_far = 2.0;
|
||||
|
||||
priv->relayout_pending = TRUE;
|
||||
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
||||
@ -2544,6 +2528,7 @@ clutter_stage_set_perspective (ClutterStage *stage,
|
||||
priv->has_custom_perspective = TRUE;
|
||||
|
||||
clutter_stage_set_perspective_internal (stage, perspective);
|
||||
clutter_stage_update_view_perspective (stage);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2670,6 +2655,7 @@ _clutter_stage_set_viewport (ClutterStage *stage,
|
||||
priv->viewport[2] = width;
|
||||
priv->viewport[3] = height;
|
||||
|
||||
clutter_stage_update_view_perspective (stage);
|
||||
_clutter_stage_dirty_viewport (stage);
|
||||
|
||||
queue_full_redraw (stage);
|
||||
@ -2922,8 +2908,8 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
ClutterActor *
|
||||
clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
||||
ClutterPickMode pick_mode,
|
||||
gint x,
|
||||
gint y)
|
||||
float x,
|
||||
float y)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
||||
|
||||
@ -3031,14 +3017,6 @@ clutter_stage_get_title (ClutterStage *stage)
|
||||
return stage->priv->title;
|
||||
}
|
||||
|
||||
static void
|
||||
on_key_focus_destroy (ClutterActor *actor,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
/* unset the key focus */
|
||||
clutter_stage_set_key_focus (stage, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_key_focus:
|
||||
* @stage: the #ClutterStage
|
||||
@ -3078,18 +3056,14 @@ clutter_stage_set_key_focus (ClutterStage *stage,
|
||||
old_focused_actor = priv->key_focused_actor;
|
||||
|
||||
/* set key_focused_actor to NULL before emitting the signal or someone
|
||||
* might hide the previously focused actor in the signal handler and we'd
|
||||
* get re-entrant call and get glib critical from g_object_weak_unref
|
||||
* might hide the previously focused actor in the signal handler
|
||||
*/
|
||||
g_signal_handlers_disconnect_by_func (priv->key_focused_actor,
|
||||
G_CALLBACK (on_key_focus_destroy),
|
||||
stage);
|
||||
priv->key_focused_actor = NULL;
|
||||
|
||||
g_signal_emit_by_name (old_focused_actor, "key-focus-out");
|
||||
_clutter_actor_set_has_key_focus (old_focused_actor, FALSE);
|
||||
}
|
||||
else
|
||||
g_signal_emit_by_name (stage, "key-focus-out");
|
||||
_clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), FALSE);
|
||||
|
||||
/* Note, if someone changes key focus in focus-out signal handler we'd be
|
||||
* overriding the latter call below moving the focus where it was originally
|
||||
@ -3099,14 +3073,10 @@ clutter_stage_set_key_focus (ClutterStage *stage,
|
||||
if (actor != NULL)
|
||||
{
|
||||
priv->key_focused_actor = actor;
|
||||
|
||||
g_signal_connect (actor,
|
||||
"destroy", G_CALLBACK (on_key_focus_destroy),
|
||||
stage);
|
||||
g_signal_emit_by_name (priv->key_focused_actor, "key-focus-in");
|
||||
_clutter_actor_set_has_key_focus (actor, TRUE);
|
||||
}
|
||||
else
|
||||
g_signal_emit_by_name (stage, "key-focus-in");
|
||||
_clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), TRUE);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_KEY_FOCUS]);
|
||||
}
|
||||
@ -3132,136 +3102,6 @@ clutter_stage_get_key_focus (ClutterStage *stage)
|
||||
return CLUTTER_ACTOR (stage);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_use_fog:
|
||||
* @stage: the #ClutterStage
|
||||
*
|
||||
* Gets whether the depth cueing effect is enabled on @stage.
|
||||
*
|
||||
* Return value: %TRUE if the depth cueing effect is enabled
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: This function will always return %FALSE
|
||||
*/
|
||||
gboolean
|
||||
clutter_stage_get_use_fog (ClutterStage *stage)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
|
||||
return stage->priv->use_fog;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_use_fog:
|
||||
* @stage: the #ClutterStage
|
||||
* @fog: %TRUE for enabling the depth cueing effect
|
||||
*
|
||||
* Sets whether the depth cueing effect on the stage should be enabled
|
||||
* or not.
|
||||
*
|
||||
* Depth cueing is a 3D effect that makes actors farther away from the
|
||||
* viewing point less opaque, by fading them with the stage color.
|
||||
|
||||
* The parameters of the GL fog used can be changed using the
|
||||
* clutter_stage_set_fog() function.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: Calling this function produces no visible effect
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_use_fog (ClutterStage *stage,
|
||||
gboolean fog)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_fog:
|
||||
* @stage: the #ClutterStage
|
||||
* @fog: a #ClutterFog structure
|
||||
*
|
||||
* Sets the fog (also known as "depth cueing") settings for the @stage.
|
||||
*
|
||||
* A #ClutterStage will only use a linear fog progression, which
|
||||
* depends solely on the distance from the viewer. The cogl_set_fog()
|
||||
* function in COGL exposes more of the underlying implementation,
|
||||
* and allows changing the for progression function. It can be directly
|
||||
* used by disabling the #ClutterStage:use-fog property and connecting
|
||||
* a signal handler to the #ClutterActor::paint signal on the @stage,
|
||||
* like:
|
||||
*
|
||||
* |[
|
||||
* clutter_stage_set_use_fog (stage, FALSE);
|
||||
* g_signal_connect (stage, "paint", G_CALLBACK (on_stage_paint), NULL);
|
||||
* ]|
|
||||
*
|
||||
* The paint signal handler will call cogl_set_fog() with the
|
||||
* desired settings:
|
||||
*
|
||||
* |[
|
||||
* static void
|
||||
* on_stage_paint (ClutterActor *actor)
|
||||
* {
|
||||
* ClutterColor stage_color = { 0, };
|
||||
* CoglColor fog_color = { 0, };
|
||||
*
|
||||
* // set the fog color to the stage background color
|
||||
* clutter_stage_get_color (CLUTTER_STAGE (actor), &stage_color);
|
||||
* cogl_color_init_from_4ub (&fog_color,
|
||||
* stage_color.red,
|
||||
* stage_color.green,
|
||||
* stage_color.blue,
|
||||
* stage_color.alpha);
|
||||
*
|
||||
* // enable fog //
|
||||
* cogl_set_fog (&fog_color,
|
||||
* COGL_FOG_MODE_EXPONENTIAL, // mode
|
||||
* 0.5, // density
|
||||
* 5.0, 30.0); // z_near and z_far
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* The fogging functions only work correctly when the visible actors use
|
||||
* unmultiplied alpha colors. By default Cogl will premultiply textures and
|
||||
* cogl_set_source_color() will premultiply colors, so unless you explicitly
|
||||
* load your textures requesting an unmultiplied internal format and use
|
||||
* cogl_material_set_color() you can only use fogging with fully opaque actors.
|
||||
* Support for premultiplied colors will improve in the future when we can
|
||||
* depend on fragment shaders.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: Fog settings are ignored.
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_fog (ClutterStage *stage,
|
||||
ClutterFog *fog)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_fog:
|
||||
* @stage: the #ClutterStage
|
||||
* @fog: (out): return location for a #ClutterFog structure
|
||||
*
|
||||
* Retrieves the current depth cueing settings from the stage.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: This function will always return the default
|
||||
* values of #ClutterFog
|
||||
*/
|
||||
void
|
||||
clutter_stage_get_fog (ClutterStage *stage,
|
||||
ClutterFog *fog)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail (fog != NULL);
|
||||
|
||||
*fog = stage->priv->fog;
|
||||
}
|
||||
|
||||
/*** Perspective boxed type ******/
|
||||
|
||||
static gpointer
|
||||
@ -3284,24 +3124,6 @@ G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective,
|
||||
clutter_perspective_copy,
|
||||
clutter_perspective_free);
|
||||
|
||||
static gpointer
|
||||
clutter_fog_copy (gpointer data)
|
||||
{
|
||||
if (G_LIKELY (data))
|
||||
return g_slice_dup (ClutterFog, data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_fog_free (gpointer data)
|
||||
{
|
||||
if (G_LIKELY (data))
|
||||
g_slice_free (ClutterFog, data);
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterFog, clutter_fog, clutter_fog_copy, clutter_fog_free);
|
||||
|
||||
/**
|
||||
* clutter_stage_new:
|
||||
*
|
||||
@ -3506,6 +3328,50 @@ calculate_z_translation (float z_near)
|
||||
+ z_near;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_update_view_perspective (ClutterStage *stage)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
ClutterPerspective perspective;
|
||||
float z_2d;
|
||||
|
||||
perspective = priv->perspective;
|
||||
|
||||
/* Ideally we want to regenerate the perspective matrix whenever
|
||||
* the size changes but if the user has provided a custom matrix
|
||||
* then we don't want to override it */
|
||||
if (!priv->has_custom_perspective)
|
||||
{
|
||||
perspective.fovy = 60.0; /* 60 Degrees */
|
||||
perspective.z_near = 0.1;
|
||||
perspective.aspect = priv->viewport[2] / priv->viewport[3];
|
||||
z_2d = calculate_z_translation (perspective.z_near);
|
||||
|
||||
/* NB: z_2d is only enough room for 85% of the stage_height between
|
||||
* the stage and the z_near plane. For behind the stage plane we
|
||||
* want a more consistent gap of 10 times the stage_height before
|
||||
* hitting the far plane so we calculate that relative to the final
|
||||
* height of the stage plane at the z_2d_distance we got... */
|
||||
perspective.z_far = z_2d +
|
||||
tanf (_DEG_TO_RAD (perspective.fovy / 2.0f)) * z_2d * 20.0f;
|
||||
|
||||
clutter_stage_set_perspective_internal (stage, &perspective);
|
||||
}
|
||||
else
|
||||
{
|
||||
z_2d = calculate_z_translation (perspective.z_near);
|
||||
}
|
||||
|
||||
cogl_matrix_init_identity (&priv->view);
|
||||
cogl_matrix_view_2d_in_perspective (&priv->view,
|
||||
perspective.fovy,
|
||||
perspective.aspect,
|
||||
perspective.z_near,
|
||||
z_2d,
|
||||
priv->viewport[2],
|
||||
priv->viewport[3]);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||
ClutterStageView *view)
|
||||
@ -3516,7 +3382,6 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||
if (clutter_stage_view_is_dirty_viewport (view))
|
||||
{
|
||||
cairo_rectangle_int_t view_layout;
|
||||
ClutterPerspective perspective;
|
||||
float fb_scale;
|
||||
float viewport_offset_x;
|
||||
float viewport_offset_y;
|
||||
@ -3524,7 +3389,6 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||
float viewport_y;
|
||||
float viewport_width;
|
||||
float viewport_height;
|
||||
float z_2d;
|
||||
|
||||
CLUTTER_NOTE (PAINT,
|
||||
"Setting up the viewport { w:%f, h:%f }",
|
||||
@ -3544,38 +3408,6 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||
viewport_x, viewport_y,
|
||||
viewport_width, viewport_height);
|
||||
|
||||
perspective = priv->perspective;
|
||||
|
||||
/* Ideally we want to regenerate the perspective matrix whenever
|
||||
* the size changes but if the user has provided a custom matrix
|
||||
* then we don't want to override it */
|
||||
if (!priv->has_custom_perspective)
|
||||
{
|
||||
perspective.aspect = priv->viewport[2] / priv->viewport[3];
|
||||
z_2d = calculate_z_translation (perspective.z_near);
|
||||
|
||||
/* NB: z_2d is only enough room for 85% of the stage_height between
|
||||
* the stage and the z_near plane. For behind the stage plane we
|
||||
* want a more consistent gap of 10 times the stage_height before
|
||||
* hitting the far plane so we calculate that relative to the final
|
||||
* height of the stage plane at the z_2d_distance we got... */
|
||||
perspective.z_far = z_2d +
|
||||
tanf (_DEG_TO_RAD (perspective.fovy / 2.0f)) * z_2d * 20.0f;
|
||||
|
||||
clutter_stage_set_perspective_internal (stage, &perspective);
|
||||
}
|
||||
else
|
||||
z_2d = calculate_z_translation (perspective.z_near);
|
||||
|
||||
cogl_matrix_init_identity (&priv->view);
|
||||
cogl_matrix_view_2d_in_perspective (&priv->view,
|
||||
perspective.fovy,
|
||||
perspective.aspect,
|
||||
perspective.z_near,
|
||||
z_2d,
|
||||
priv->viewport[2],
|
||||
priv->viewport[3]);
|
||||
|
||||
clutter_stage_view_set_dirty_viewport (view, FALSE);
|
||||
}
|
||||
|
||||
@ -4695,7 +4527,7 @@ clutter_stage_get_capture_final_size (ClutterStage *stage,
|
||||
|
||||
if (rect)
|
||||
{
|
||||
ClutterRect capture_rect;
|
||||
graphene_rect_t capture_rect;
|
||||
|
||||
_clutter_util_rect_from_rectangle (rect, &capture_rect);
|
||||
if (!_clutter_stage_get_max_view_scale_factor_for_rect (stage,
|
||||
@ -4902,9 +4734,9 @@ clutter_stage_update_resource_scales (ClutterStage *stage)
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
ClutterRect *rect,
|
||||
float *view_scale)
|
||||
_clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
graphene_rect_t *rect,
|
||||
float *view_scale)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
float scale = 0.0f;
|
||||
@ -4914,12 +4746,12 @@ _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
cairo_rectangle_int_t view_layout;
|
||||
ClutterRect view_rect;
|
||||
graphene_rect_t view_rect;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
_clutter_util_rect_from_rectangle (&view_layout, &view_rect);
|
||||
|
||||
if (clutter_rect_intersection (&view_rect, rect, NULL))
|
||||
if (graphene_rect_intersection (&view_rect, rect, NULL))
|
||||
scale = MAX (clutter_stage_view_get_scale (view), scale);
|
||||
}
|
||||
|
||||
|
@ -115,26 +115,6 @@ struct _ClutterPerspective
|
||||
gfloat z_far;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterFog:
|
||||
* @z_near: starting distance from the viewer to the near clipping
|
||||
* plane (always positive)
|
||||
* @z_far: final distance from the viewer to the far clipping
|
||||
* plane (always positive)
|
||||
*
|
||||
* Fog settings used to create the depth cueing effect.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.10: The fog-related API in #ClutterStage has been
|
||||
* deprecated as well.
|
||||
*/
|
||||
struct _ClutterFog
|
||||
{
|
||||
gfloat z_near;
|
||||
gfloat z_far;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterFrameInfo: (skip)
|
||||
*/
|
||||
@ -153,8 +133,6 @@ typedef struct _ClutterCapture
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_perspective_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_fog_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_stage_get_type (void) G_GNUC_CONST;
|
||||
|
||||
@ -223,8 +201,8 @@ gboolean clutter_stage_event (ClutterStage
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
||||
ClutterPickMode pick_mode,
|
||||
gint x,
|
||||
gint y);
|
||||
float x,
|
||||
float y);
|
||||
CLUTTER_EXPORT
|
||||
guchar * clutter_stage_read_pixels (ClutterStage *stage,
|
||||
gint x,
|
||||
@ -236,6 +214,8 @@ CLUTTER_EXPORT
|
||||
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *clip);
|
||||
CLUTTER_EXPORT
|
||||
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_ensure_viewport (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_ensure_redraw (ClutterStage *stage);
|
||||
|
@ -157,7 +157,7 @@ struct _ClutterTextPrivate
|
||||
gint text_logical_y;
|
||||
|
||||
/* Where to draw the cursor */
|
||||
ClutterRect cursor_rect;
|
||||
graphene_rect_t cursor_rect;
|
||||
ClutterColor cursor_color;
|
||||
guint cursor_size;
|
||||
|
||||
@ -1304,7 +1304,7 @@ static inline void
|
||||
update_cursor_location (ClutterText *self)
|
||||
{
|
||||
ClutterTextPrivate *priv = self->priv;
|
||||
ClutterRect rect;
|
||||
graphene_rect_t rect;
|
||||
float x, y;
|
||||
|
||||
if (!priv->editable)
|
||||
@ -1312,7 +1312,7 @@ update_cursor_location (ClutterText *self)
|
||||
|
||||
rect = priv->cursor_rect;
|
||||
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
|
||||
clutter_rect_offset (&rect, x, y);
|
||||
graphene_rect_offset (&rect, x, y);
|
||||
clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
|
||||
}
|
||||
|
||||
@ -1322,7 +1322,7 @@ clutter_text_ensure_cursor_position (ClutterText *self,
|
||||
{
|
||||
ClutterTextPrivate *priv = self->priv;
|
||||
gfloat x, y, cursor_height;
|
||||
ClutterRect cursor_rect = CLUTTER_RECT_INIT_ZERO;
|
||||
graphene_rect_t cursor_rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
gint position;
|
||||
|
||||
position = priv->position;
|
||||
@ -1345,25 +1345,17 @@ clutter_text_ensure_cursor_position (ClutterText *self,
|
||||
&x, &y,
|
||||
&cursor_height);
|
||||
|
||||
clutter_rect_init (&cursor_rect,
|
||||
x,
|
||||
y + CURSOR_Y_PADDING * scale,
|
||||
priv->cursor_size * scale,
|
||||
cursor_height - 2 * CURSOR_Y_PADDING * scale);
|
||||
graphene_rect_init (&cursor_rect,
|
||||
x,
|
||||
y + CURSOR_Y_PADDING * scale,
|
||||
priv->cursor_size * scale,
|
||||
cursor_height - 2 * CURSOR_Y_PADDING * scale);
|
||||
|
||||
if (!clutter_rect_equals (&priv->cursor_rect, &cursor_rect))
|
||||
if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
|
||||
{
|
||||
ClutterGeometry cursor_pos;
|
||||
|
||||
priv->cursor_rect = cursor_rect;
|
||||
|
||||
/* XXX:2.0 - remove */
|
||||
cursor_pos.x = clutter_rect_get_x (&priv->cursor_rect);
|
||||
cursor_pos.y = clutter_rect_get_y (&priv->cursor_rect);
|
||||
cursor_pos.width = clutter_rect_get_width (&priv->cursor_rect);
|
||||
cursor_pos.height = clutter_rect_get_height (&priv->cursor_rect);
|
||||
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_pos);
|
||||
|
||||
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_rect);
|
||||
g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
|
||||
|
||||
update_cursor_location (self);
|
||||
@ -2712,7 +2704,7 @@ clutter_text_paint (ClutterActor *self)
|
||||
|
||||
if (actor_width < text_width)
|
||||
{
|
||||
gint cursor_x = clutter_rect_get_x (&priv->cursor_rect);
|
||||
gint cursor_x = graphene_rect_get_x (&priv->cursor_rect);
|
||||
|
||||
if (priv->position == -1)
|
||||
{
|
||||
@ -2799,7 +2791,7 @@ add_selection_to_paint_volume (ClutterText *text,
|
||||
{
|
||||
ClutterPaintVolume *total_volume = user_data;
|
||||
ClutterPaintVolume rect_volume;
|
||||
ClutterVertex vertex;
|
||||
graphene_point3d_t vertex;
|
||||
|
||||
_clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
|
||||
|
||||
@ -2821,7 +2813,7 @@ clutter_text_get_paint_volume_for_cursor (ClutterText *text,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
ClutterVertex origin;
|
||||
graphene_point3d_t origin;
|
||||
|
||||
clutter_text_ensure_cursor_position (text, resource_scale);
|
||||
|
||||
@ -2864,7 +2856,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
|
||||
{
|
||||
PangoLayout *layout;
|
||||
PangoRectangle ink_rect;
|
||||
ClutterVertex origin;
|
||||
graphene_point3d_t origin;
|
||||
float resource_scale;
|
||||
|
||||
/* If the text is single line editable then it gets clipped to
|
||||
@ -4399,10 +4391,10 @@ clutter_text_class_init (ClutterTextClass *klass)
|
||||
/**
|
||||
* ClutterText::cursor-event:
|
||||
* @self: the #ClutterText that emitted the signal
|
||||
* @geometry: the coordinates of the cursor
|
||||
* @rect: the coordinates of the cursor
|
||||
*
|
||||
* The ::cursor-event signal is emitted whenever the cursor position
|
||||
* changes inside a #ClutterText actor. Inside @geometry it is stored
|
||||
* changes inside a #ClutterText actor. Inside @rect it is stored
|
||||
* the current position and size of the cursor, relative to the actor
|
||||
* itself.
|
||||
*
|
||||
@ -4417,7 +4409,7 @@ clutter_text_class_init (ClutterTextClass *klass)
|
||||
G_STRUCT_OFFSET (ClutterTextClass, cursor_event),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
GRAPHENE_TYPE_RECT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
/**
|
||||
* ClutterText::cursor-changed:
|
||||
@ -6780,8 +6772,8 @@ clutter_text_get_layout_offsets (ClutterText *self,
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
clutter_text_get_cursor_rect (ClutterText *self,
|
||||
ClutterRect *rect)
|
||||
clutter_text_get_cursor_rect (ClutterText *self,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_TEXT (self));
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
@ -82,7 +82,7 @@ struct _ClutterTextClass
|
||||
void (* text_changed) (ClutterText *self);
|
||||
void (* activate) (ClutterText *self);
|
||||
void (* cursor_event) (ClutterText *self,
|
||||
const ClutterGeometry *geometry);
|
||||
const graphene_rect_t *rect);
|
||||
void (* cursor_changed) (ClutterText *self);
|
||||
|
||||
/*< private >*/
|
||||
@ -230,7 +230,7 @@ CLUTTER_EXPORT
|
||||
guint clutter_text_get_cursor_size (ClutterText *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_text_get_cursor_rect (ClutterText *self,
|
||||
ClutterRect *rect);
|
||||
graphene_rect_t *rect);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_text_set_selectable (ClutterText *self,
|
||||
gboolean selectable);
|
||||
|
@ -46,8 +46,7 @@ G_BEGIN_DECLS
|
||||
* @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support
|
||||
* found
|
||||
* @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for
|
||||
* clutter_texture_set_from_rgb_data or
|
||||
* clutter_texture_set_from_yuv_data is unsupported.
|
||||
* clutter_texture_set_from_rgb_data is unsupported.
|
||||
*
|
||||
* Error enumeration for #ClutterTexture
|
||||
*
|
||||
|
@ -145,8 +145,8 @@ struct _ClutterTimelinePrivate
|
||||
ClutterStepMode step_mode;
|
||||
|
||||
/* cubic-bezier() parameters */
|
||||
ClutterPoint cb_1;
|
||||
ClutterPoint cb_2;
|
||||
graphene_point_t cb_1;
|
||||
graphene_point_t cb_2;
|
||||
|
||||
guint is_playing : 1;
|
||||
|
||||
@ -424,6 +424,11 @@ clutter_timeline_set_custom_property (ClutterScriptable *scriptable,
|
||||
g_object_set_property (G_OBJECT (scriptable), name, value);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_timeline_cancel_delay (ClutterTimeline *timeline)
|
||||
{
|
||||
g_clear_handle_id (&timeline->priv->delay_id, g_source_remove);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||
@ -550,11 +555,7 @@ clutter_timeline_dispose (GObject *object)
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
if (priv->delay_id)
|
||||
{
|
||||
g_source_remove (priv->delay_id);
|
||||
priv->delay_id = 0;
|
||||
}
|
||||
clutter_timeline_cancel_delay (self);
|
||||
|
||||
if (priv->progress_notify != NULL)
|
||||
{
|
||||
@ -845,8 +846,8 @@ clutter_timeline_init (ClutterTimeline *self)
|
||||
self->priv->step_mode = CLUTTER_STEP_MODE_END;
|
||||
|
||||
/* default cubic-bezier() paramereters are (0, 0, 1, 1) */
|
||||
clutter_point_init (&self->priv->cb_1, 0, 0);
|
||||
clutter_point_init (&self->priv->cb_2, 1, 1);
|
||||
graphene_point_init (&self->priv->cb_1, 0, 0);
|
||||
graphene_point_init (&self->priv->cb_2, 1, 1);
|
||||
}
|
||||
|
||||
struct CheckIfMarkerHitClosure
|
||||
@ -1213,14 +1214,10 @@ clutter_timeline_pause (ClutterTimeline *timeline)
|
||||
|
||||
priv = timeline->priv;
|
||||
|
||||
if (priv->delay_id == 0 && !priv->is_playing)
|
||||
return;
|
||||
clutter_timeline_cancel_delay (timeline);
|
||||
|
||||
if (priv->delay_id)
|
||||
{
|
||||
g_source_remove (priv->delay_id);
|
||||
priv->delay_id = 0;
|
||||
}
|
||||
if (!priv->is_playing)
|
||||
return;
|
||||
|
||||
priv->msecs_delta = 0;
|
||||
set_is_playing (timeline, FALSE);
|
||||
@ -2488,9 +2485,9 @@ clutter_timeline_get_step_progress (ClutterTimeline *timeline,
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
const ClutterPoint *c_1,
|
||||
const ClutterPoint *c_2)
|
||||
clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
const graphene_point_t *c_1,
|
||||
const graphene_point_t *c_2)
|
||||
{
|
||||
ClutterTimelinePrivate *priv;
|
||||
|
||||
@ -2525,9 +2522,9 @@ clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
* Since: 1.12
|
||||
*/
|
||||
gboolean
|
||||
clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
ClutterPoint *c_1,
|
||||
ClutterPoint *c_2)
|
||||
clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
graphene_point_t *c_1,
|
||||
graphene_point_t *c_2)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
|
||||
|
||||
|
@ -208,13 +208,13 @@ gboolean clutter_timeline_get_step_progress
|
||||
gint *n_steps,
|
||||
ClutterStepMode *step_mode);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
const ClutterPoint *c_1,
|
||||
const ClutterPoint *c_2);
|
||||
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
const graphene_point_t *c_1,
|
||||
const graphene_point_t *c_2);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
ClutterPoint *c_1,
|
||||
ClutterPoint *c_2);
|
||||
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
|
||||
graphene_point_t *c_1,
|
||||
graphene_point_t *c_2);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline);
|
||||
|
@ -134,7 +134,6 @@ clutter_transition_stopped (ClutterTimeline *timeline,
|
||||
clutter_transition_detach (CLUTTER_TRANSITION (timeline),
|
||||
priv->animatable);
|
||||
g_clear_object (&priv->animatable);
|
||||
g_object_unref (timeline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,20 +33,16 @@
|
||||
#include <clutter/clutter-macros.h>
|
||||
#include <clutter/clutter-enums.h>
|
||||
|
||||
#include <graphene-gobject.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
|
||||
#define CLUTTER_TYPE_FOG (clutter_fog_get_type ())
|
||||
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
|
||||
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
|
||||
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
|
||||
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
|
||||
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
|
||||
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
|
||||
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
|
||||
#define CLUTTER_TYPE_POINT (clutter_point_get_type ())
|
||||
#define CLUTTER_TYPE_SIZE (clutter_size_get_type ())
|
||||
#define CLUTTER_TYPE_RECT (clutter_rect_get_type ())
|
||||
|
||||
typedef struct _ClutterActor ClutterActor;
|
||||
|
||||
@ -79,14 +75,9 @@ typedef struct _ClutterPathNode ClutterPathNode;
|
||||
|
||||
typedef struct _ClutterActorBox ClutterActorBox;
|
||||
typedef struct _ClutterColor ClutterColor;
|
||||
typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - remove */
|
||||
typedef struct _ClutterKnot ClutterKnot;
|
||||
typedef struct _ClutterMargin ClutterMargin;
|
||||
typedef struct _ClutterPerspective ClutterPerspective;
|
||||
typedef struct _ClutterPoint ClutterPoint;
|
||||
typedef struct _ClutterRect ClutterRect;
|
||||
typedef struct _ClutterSize ClutterSize;
|
||||
typedef struct _ClutterVertex ClutterVertex;
|
||||
|
||||
typedef struct _ClutterAlpha ClutterAlpha;
|
||||
typedef struct _ClutterAnimation ClutterAnimation;
|
||||
@ -113,8 +104,6 @@ typedef union _ClutterEvent ClutterEvent;
|
||||
*/
|
||||
typedef struct _ClutterEventSequence ClutterEventSequence;
|
||||
|
||||
typedef struct _ClutterFog ClutterFog; /* deprecated */
|
||||
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
|
||||
typedef struct _ClutterShader ClutterShader; /* deprecated */
|
||||
|
||||
/**
|
||||
@ -137,310 +126,6 @@ typedef struct _ClutterShader ClutterShader; /* deprecated */
|
||||
*/
|
||||
typedef struct _ClutterPaintVolume ClutterPaintVolume;
|
||||
|
||||
/**
|
||||
* ClutterPoint:
|
||||
* @x: X coordinate, in pixels
|
||||
* @y: Y coordinate, in pixels
|
||||
*
|
||||
* A point in 2D space.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
struct _ClutterPoint
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
/**
|
||||
* CLUTTER_POINT_INIT:
|
||||
* @x: X coordinate
|
||||
* @y: Y coordinate
|
||||
*
|
||||
* A simple macro for initializing a #ClutterPoint when declaring it, e.g.:
|
||||
*
|
||||
* |[
|
||||
* ClutterPoint p = CLUTTER_POINT_INIT (100, 100);
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_POINT_INIT(x,y) { (x), (y) }
|
||||
|
||||
/**
|
||||
* CLUTTER_POINT_INIT_ZERO:
|
||||
*
|
||||
* A simple macro for initializing a #ClutterPoint to (0, 0) when
|
||||
* declaring it.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_POINT_INIT_ZERO CLUTTER_POINT_INIT (0.f, 0.f)
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_point_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const ClutterPoint * clutter_point_zero (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterPoint * clutter_point_alloc (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterPoint * clutter_point_init (ClutterPoint *point,
|
||||
float x,
|
||||
float y);
|
||||
CLUTTER_EXPORT
|
||||
ClutterPoint * clutter_point_copy (const ClutterPoint *point);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_point_free (ClutterPoint *point);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_point_equals (const ClutterPoint *a,
|
||||
const ClutterPoint *b);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_point_distance (const ClutterPoint *a,
|
||||
const ClutterPoint *b,
|
||||
float *x_distance,
|
||||
float *y_distance);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_point_inside_quadrilateral (const ClutterPoint *point,
|
||||
const ClutterPoint *vertices);
|
||||
|
||||
/**
|
||||
* ClutterSize:
|
||||
* @width: the width, in pixels
|
||||
* @height: the height, in pixels
|
||||
*
|
||||
* A size, in 2D space.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
struct _ClutterSize
|
||||
{
|
||||
float width;
|
||||
float height;
|
||||
};
|
||||
|
||||
/**
|
||||
* CLUTTER_SIZE_INIT:
|
||||
* @width: the width
|
||||
* @height: the height
|
||||
*
|
||||
* A simple macro for initializing a #ClutterSize when declaring it, e.g.:
|
||||
*
|
||||
* |[
|
||||
* ClutterSize s = CLUTTER_SIZE_INIT (200, 200);
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_SIZE_INIT(width,height) { (width), (height) }
|
||||
|
||||
/**
|
||||
* CLUTTER_SIZE_INIT_ZERO:
|
||||
*
|
||||
* A simple macro for initializing a #ClutterSize to (0, 0) when
|
||||
* declaring it.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_SIZE_INIT_ZERO CLUTTER_SIZE_INIT (0.f, 0.f)
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_size_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterSize * clutter_size_alloc (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterSize * clutter_size_init (ClutterSize *size,
|
||||
float width,
|
||||
float height);
|
||||
CLUTTER_EXPORT
|
||||
ClutterSize * clutter_size_copy (const ClutterSize *size);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_size_free (ClutterSize *size);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_size_equals (const ClutterSize *a,
|
||||
const ClutterSize *b);
|
||||
|
||||
/**
|
||||
* ClutterRect:
|
||||
* @origin: the origin of the rectangle
|
||||
* @size: the size of the rectangle
|
||||
*
|
||||
* The location and size of a rectangle.
|
||||
*
|
||||
* The width and height of a #ClutterRect can be negative; Clutter considers
|
||||
* a rectangle with an origin of [ 0.0, 0.0 ] and a size of [ 10.0, 10.0 ] to
|
||||
* be equivalent to a rectangle with origin of [ 10.0, 10.0 ] and size of
|
||||
* [ -10.0, -10.0 ].
|
||||
*
|
||||
* Application code can normalize rectangles using clutter_rect_normalize():
|
||||
* this function will ensure that the width and height of a #ClutterRect are
|
||||
* positive values. All functions taking a #ClutterRect as an argument will
|
||||
* implicitly normalize it before computing eventual results. For this reason
|
||||
* it is safer to access the contents of a #ClutterRect by using the provided
|
||||
* API at all times, instead of directly accessing the structure members.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
struct _ClutterRect
|
||||
{
|
||||
ClutterPoint origin;
|
||||
ClutterSize size;
|
||||
};
|
||||
|
||||
/**
|
||||
* CLUTTER_RECT_INIT:
|
||||
* @x: the X coordinate
|
||||
* @y: the Y coordinate
|
||||
* @width: the width
|
||||
* @height: the height
|
||||
*
|
||||
* A simple macro for initializing a #ClutterRect when declaring it, e.g.:
|
||||
*
|
||||
* |[
|
||||
* ClutterRect r = CLUTTER_RECT_INIT (100, 100, 200, 200);
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_RECT_INIT(x,y,width,height) { { (x), (y) }, { (width), (height) } }
|
||||
|
||||
/**
|
||||
* CLUTTER_RECT_INIT_ZERO:
|
||||
*
|
||||
* A simple macro for initializing a #ClutterRect to (0, 0, 0, 0) when
|
||||
* declaring it.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_RECT_INIT_ZERO CLUTTER_RECT_INIT (0.f, 0.f, 0.f, 0.f)
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_rect_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const ClutterRect * clutter_rect_zero (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterRect * clutter_rect_alloc (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterRect * clutter_rect_init (ClutterRect *rect,
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
float height);
|
||||
CLUTTER_EXPORT
|
||||
ClutterRect * clutter_rect_copy (const ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_free (ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_rect_equals (ClutterRect *a,
|
||||
ClutterRect *b);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterRect * clutter_rect_normalize (ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_get_center (ClutterRect *rect,
|
||||
ClutterPoint *center);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_rect_contains_point (ClutterRect *rect,
|
||||
ClutterPoint *point);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_rect_contains_rect (ClutterRect *a,
|
||||
ClutterRect *b);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_union (ClutterRect *a,
|
||||
ClutterRect *b,
|
||||
ClutterRect *res);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_rect_intersection (ClutterRect *a,
|
||||
ClutterRect *b,
|
||||
ClutterRect *res);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_offset (ClutterRect *rect,
|
||||
float d_x,
|
||||
float d_y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_inset (ClutterRect *rect,
|
||||
float d_x,
|
||||
float d_y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_scale (ClutterRect *rect,
|
||||
float s_x,
|
||||
float s_y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_rect_clamp_to_pixel (ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_rect_get_x (ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_rect_get_y (ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_rect_get_width (ClutterRect *rect);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_rect_get_height (ClutterRect *rect);
|
||||
|
||||
/**
|
||||
* ClutterVertex:
|
||||
* @x: X coordinate of the vertex
|
||||
* @y: Y coordinate of the vertex
|
||||
* @z: Z coordinate of the vertex
|
||||
*
|
||||
* A point in 3D space, expressed in pixels
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
struct _ClutterVertex
|
||||
{
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
gfloat z;
|
||||
};
|
||||
|
||||
/**
|
||||
* CLUTTER_VERTEX_INIT:
|
||||
* @x: the X coordinate of the vertex
|
||||
* @y: the Y coordinate of the vertex
|
||||
* @z: the Z coordinate of the vertex
|
||||
*
|
||||
* A simple macro for initializing a #ClutterVertex when declaring it, e.g.:
|
||||
*
|
||||
* |[
|
||||
* ClutterVertex v = CLUTTER_VERTEX_INIT (x, y, z);
|
||||
* ]|
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
#define CLUTTER_VERTEX_INIT(x,y,z) { (x), (y), (z) }
|
||||
|
||||
/**
|
||||
* CLUTTER_VERTEX_INIT_ZERO:
|
||||
*
|
||||
* A simple macro for initializing a #ClutterVertex to (0, 0, 0).
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
#define CLUTTER_VERTEX_INIT_ZERO CLUTTER_VERTEX_INIT (0.f, 0.f, 0.f)
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_vertex_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
ClutterVertex *clutter_vertex_new (gfloat x,
|
||||
gfloat y,
|
||||
gfloat z);
|
||||
CLUTTER_EXPORT
|
||||
ClutterVertex *clutter_vertex_alloc (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterVertex *clutter_vertex_init (ClutterVertex *vertex,
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
gfloat z);
|
||||
CLUTTER_EXPORT
|
||||
ClutterVertex *clutter_vertex_copy (const ClutterVertex *vertex);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_vertex_free (ClutterVertex *vertex);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_vertex_equal (const ClutterVertex *vertex_a,
|
||||
const ClutterVertex *vertex_b);
|
||||
|
||||
/**
|
||||
* ClutterActorBox:
|
||||
* @x1: X coordinate of the top left corner
|
||||
@ -544,8 +229,8 @@ gboolean clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
const ClutterVertex verts[]);
|
||||
void clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
const graphene_point3d_t verts[]);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_box_interpolate (const ClutterActorBox *initial,
|
||||
const ClutterActorBox *final,
|
||||
@ -571,41 +256,6 @@ CLUTTER_EXPORT
|
||||
void clutter_actor_box_scale (ClutterActorBox *box,
|
||||
gfloat scale);
|
||||
|
||||
/**
|
||||
* ClutterGeometry:
|
||||
* @x: X coordinate of the top left corner of an actor
|
||||
* @y: Y coordinate of the top left corner of an actor
|
||||
* @width: width of an actor
|
||||
* @height: height of an actor
|
||||
*
|
||||
* The rectangle containing an actor's bounding box, measured in pixels.
|
||||
*
|
||||
* You should not use #ClutterGeometry, or operate on its fields
|
||||
* directly; you should use #cairo_rectangle_int_t or #ClutterRect if you
|
||||
* need a rectangle type, depending on the precision required.
|
||||
*
|
||||
* Deprecated: 1.16
|
||||
*/
|
||||
struct _ClutterGeometry
|
||||
{
|
||||
/*< public >*/
|
||||
gint x;
|
||||
gint y;
|
||||
guint width;
|
||||
guint height;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_geometry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_geometry_union (const ClutterGeometry *geometry_a,
|
||||
const ClutterGeometry *geometry_b,
|
||||
ClutterGeometry *result);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_geometry_intersects (const ClutterGeometry *geometry0,
|
||||
const ClutterGeometry *geometry1);
|
||||
|
||||
/**
|
||||
* ClutterKnot:
|
||||
* @x: X coordinate of the knot
|
||||
@ -677,10 +327,10 @@ void clutter_paint_volume_free (ClutterPaintVolume
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
|
||||
const ClutterVertex *origin);
|
||||
const graphene_point3d_t *origin);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
|
||||
ClutterVertex *vertex);
|
||||
graphene_point3d_t *vertex);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
|
||||
gfloat width);
|
||||
|
@ -51,8 +51,8 @@ void
|
||||
_clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
const CoglMatrix *projection,
|
||||
const float *viewport,
|
||||
const ClutterVertex *vertices_in,
|
||||
ClutterVertex *vertices_out,
|
||||
const graphene_point3d_t *vertices_in,
|
||||
graphene_point3d_t *vertices_out,
|
||||
int n_vertices)
|
||||
{
|
||||
CoglMatrix modelview_projection;
|
||||
@ -69,7 +69,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
modelview);
|
||||
cogl_matrix_project_points (&modelview_projection,
|
||||
3,
|
||||
sizeof (ClutterVertex),
|
||||
sizeof (graphene_point3d_t),
|
||||
vertices_in,
|
||||
sizeof (ClutterVertex4),
|
||||
vertices_tmp,
|
||||
@ -79,7 +79,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
{
|
||||
cogl_matrix_transform_points (modelview,
|
||||
3,
|
||||
sizeof (ClutterVertex),
|
||||
sizeof (graphene_point3d_t),
|
||||
vertices_in,
|
||||
sizeof (ClutterVertex4),
|
||||
vertices_tmp,
|
||||
@ -97,7 +97,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
for (i = 0; i < n_vertices; i++)
|
||||
{
|
||||
ClutterVertex4 vertex_tmp = vertices_tmp[i];
|
||||
ClutterVertex *vertex_out = &vertices_out[i];
|
||||
graphene_point3d_t *vertex_out = &vertices_out[i];
|
||||
/* Finally translate from OpenGL coords to window coords */
|
||||
vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x, vertex_tmp.w,
|
||||
viewport[2], viewport[0]);
|
||||
@ -108,9 +108,9 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
|
||||
void
|
||||
_clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
|
||||
ClutterRect *dest)
|
||||
graphene_rect_t *dest)
|
||||
{
|
||||
*dest = (ClutterRect) {
|
||||
*dest = (graphene_rect_t) {
|
||||
.origin = {
|
||||
.x = src->x,
|
||||
.y = src->y
|
||||
@ -123,12 +123,12 @@ _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_util_rectangle_int_extents (const ClutterRect *src,
|
||||
_clutter_util_rectangle_int_extents (const graphene_rect_t *src,
|
||||
cairo_rectangle_int_t *dest)
|
||||
{
|
||||
ClutterRect tmp = *src;
|
||||
graphene_rect_t tmp = *src;
|
||||
|
||||
clutter_rect_clamp_to_pixel (&tmp);
|
||||
graphene_rect_round_extents (&tmp, &tmp);
|
||||
|
||||
*dest = (cairo_rectangle_int_t) {
|
||||
.x = tmp.origin.x,
|
||||
@ -299,48 +299,12 @@ _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
|
||||
matrix->zw += matrix->yw * factor;
|
||||
}
|
||||
|
||||
static float
|
||||
_clutter_util_vertex_length (const ClutterVertex *vertex)
|
||||
{
|
||||
return sqrtf (vertex->x * vertex->x + vertex->y * vertex->y + vertex->z * vertex->z);
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_util_vertex_normalize (ClutterVertex *vertex)
|
||||
{
|
||||
float factor = _clutter_util_vertex_length (vertex);
|
||||
|
||||
if (factor == 0.f)
|
||||
return;
|
||||
|
||||
vertex->x /= factor;
|
||||
vertex->y /= factor;
|
||||
vertex->z /= factor;
|
||||
}
|
||||
|
||||
static float
|
||||
_clutter_util_vertex_dot (const ClutterVertex *v1,
|
||||
const ClutterVertex *v2)
|
||||
{
|
||||
return v1->x * v2->x + v1->y * v2->y + v1->z * v2->z;
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_util_vertex_cross (const ClutterVertex *v1,
|
||||
const ClutterVertex *v2,
|
||||
ClutterVertex *res)
|
||||
{
|
||||
res->x = v1->y * v2->z - v2->y * v1->z;
|
||||
res->y = v1->z * v2->x - v2->z * v1->x;
|
||||
res->z = v1->x * v2->y - v2->x * v1->y;
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_util_vertex_combine (const ClutterVertex *a,
|
||||
const ClutterVertex *b,
|
||||
double ascl,
|
||||
double bscl,
|
||||
ClutterVertex *res)
|
||||
_clutter_util_vertex_combine (const graphene_point3d_t *a,
|
||||
const graphene_point3d_t *b,
|
||||
double ascl,
|
||||
double bscl,
|
||||
graphene_point3d_t *res)
|
||||
{
|
||||
res->x = (ascl * a->x) + (bscl * b->x);
|
||||
res->y = (ascl * a->y) + (bscl * b->y);
|
||||
@ -388,16 +352,16 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
|
||||
*/
|
||||
gboolean
|
||||
_clutter_util_matrix_decompose (const ClutterMatrix *src,
|
||||
ClutterVertex *scale_p,
|
||||
graphene_point3d_t *scale_p,
|
||||
float shear_p[3],
|
||||
ClutterVertex *rotate_p,
|
||||
ClutterVertex *translate_p,
|
||||
graphene_point3d_t *rotate_p,
|
||||
graphene_point3d_t *translate_p,
|
||||
ClutterVertex4 *perspective_p)
|
||||
{
|
||||
CoglMatrix matrix = *src;
|
||||
CoglMatrix perspective;
|
||||
ClutterVertex4 vertex_tmp;
|
||||
ClutterVertex row[3], pdum;
|
||||
graphene_point3d_t row[3], pdum;
|
||||
int i, j;
|
||||
|
||||
#define XY_SHEAR 0
|
||||
@ -485,34 +449,34 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
|
||||
}
|
||||
|
||||
/* compute scale.x and normalize the first row */
|
||||
scale_p->x = _clutter_util_vertex_length (&row[0]);
|
||||
_clutter_util_vertex_normalize (&row[0]);
|
||||
scale_p->x = graphene_point3d_length (&row[0]);
|
||||
graphene_point3d_normalize (&row[0], &row[0]);
|
||||
|
||||
/* compute XY shear and make the second row orthogonal to the first */
|
||||
shear_p[XY_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[1]);
|
||||
shear_p[XY_SHEAR] = graphene_point3d_dot (&row[0], &row[1]);
|
||||
_clutter_util_vertex_combine (&row[1], &row[0],
|
||||
1.0, -shear_p[XY_SHEAR],
|
||||
&row[1]);
|
||||
|
||||
/* compute the Y scale and normalize the second row */
|
||||
scale_p->y = _clutter_util_vertex_length (&row[1]);
|
||||
_clutter_util_vertex_normalize (&row[1]);
|
||||
scale_p->y = graphene_point3d_length (&row[1]);
|
||||
graphene_point3d_normalize (&row[1], &row[1]);
|
||||
shear_p[XY_SHEAR] /= scale_p->y;
|
||||
|
||||
/* compute XZ and YZ shears, orthogonalize the third row */
|
||||
shear_p[XZ_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[2]);
|
||||
shear_p[XZ_SHEAR] = graphene_point3d_dot (&row[0], &row[2]);
|
||||
_clutter_util_vertex_combine (&row[2], &row[0],
|
||||
1.0, -shear_p[XZ_SHEAR],
|
||||
&row[2]);
|
||||
|
||||
shear_p[YZ_SHEAR] = _clutter_util_vertex_dot (&row[1], &row[2]);
|
||||
shear_p[YZ_SHEAR] = graphene_point3d_dot (&row[1], &row[2]);
|
||||
_clutter_util_vertex_combine (&row[2], &row[1],
|
||||
1.0, -shear_p[YZ_SHEAR],
|
||||
&row[2]);
|
||||
|
||||
/* get the Z scale and normalize the third row*/
|
||||
scale_p->z = _clutter_util_vertex_length (&row[2]);
|
||||
_clutter_util_vertex_normalize (&row[2]);
|
||||
scale_p->z = graphene_point3d_length (&row[2]);
|
||||
graphene_point3d_normalize (&row[2], &row[2]);
|
||||
shear_p[XZ_SHEAR] /= scale_p->z;
|
||||
shear_p[YZ_SHEAR] /= scale_p->z;
|
||||
|
||||
@ -520,8 +484,8 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
|
||||
* check for a coordinate system flip; if the determinant
|
||||
* is -1, then negate the matrix and scaling factors
|
||||
*/
|
||||
_clutter_util_vertex_cross (&row[1], &row[2], &pdum);
|
||||
if (_clutter_util_vertex_dot (&row[0], &pdum) < 0.f)
|
||||
graphene_point3d_cross (&row[1], &row[2], &pdum);
|
||||
if (graphene_point3d_dot (&row[0], &pdum) < 0.f)
|
||||
{
|
||||
scale_p->x *= -1.f;
|
||||
|
||||
|
@ -80,9 +80,9 @@ struct _ClutterZoomActionPrivate
|
||||
|
||||
ZoomPoint points[2];
|
||||
|
||||
ClutterPoint initial_focal_point;
|
||||
ClutterPoint focal_point;
|
||||
ClutterPoint transformed_focal_point;
|
||||
graphene_point_t initial_focal_point;
|
||||
graphene_point_t focal_point;
|
||||
graphene_point_t transformed_focal_point;
|
||||
|
||||
gfloat initial_x;
|
||||
gfloat initial_y;
|
||||
@ -238,13 +238,13 @@ clutter_zoom_action_gesture_cancel (ClutterGestureAction *action,
|
||||
static gboolean
|
||||
clutter_zoom_action_real_zoom (ClutterZoomAction *action,
|
||||
ClutterActor *actor,
|
||||
ClutterPoint *focal_point,
|
||||
graphene_point_t *focal_point,
|
||||
gdouble factor)
|
||||
{
|
||||
ClutterZoomActionPrivate *priv = action->priv;
|
||||
gfloat x, y, z;
|
||||
gdouble scale_x, scale_y;
|
||||
ClutterVertex out, in;
|
||||
graphene_point3d_t out, in;
|
||||
|
||||
in.x = priv->transformed_focal_point.x;
|
||||
in.y = priv->transformed_focal_point.y;
|
||||
@ -400,7 +400,7 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
|
||||
_clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE,
|
||||
G_TYPE_BOOLEAN, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
CLUTTER_TYPE_POINT,
|
||||
GRAPHENE_TYPE_POINT,
|
||||
G_TYPE_DOUBLE);
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
|
||||
/**
|
||||
* clutter_zoom_action_get_focal_point:
|
||||
* @action: a #ClutterZoomAction
|
||||
* @point: (out): a #ClutterPoint
|
||||
* @point: (out): a #graphene_point_t
|
||||
*
|
||||
* Retrieves the focal point of the current zoom
|
||||
*
|
||||
@ -486,7 +486,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
|
||||
*/
|
||||
void
|
||||
clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
|
||||
ClutterPoint *point)
|
||||
graphene_point_t *point)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
|
||||
g_return_if_fail (point != NULL);
|
||||
@ -497,7 +497,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
|
||||
/**
|
||||
* clutter_zoom_action_get_transformed_focal_point:
|
||||
* @action: a #ClutterZoomAction
|
||||
* @point: (out): a #ClutterPoint
|
||||
* @point: (out): a #graphene_point_t
|
||||
*
|
||||
* Retrieves the focal point relative to the actor's coordinates of
|
||||
* the current zoom
|
||||
@ -506,7 +506,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
|
||||
*/
|
||||
void
|
||||
clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
|
||||
ClutterPoint *point)
|
||||
graphene_point_t *point)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
|
||||
g_return_if_fail (point != NULL);
|
||||
|
@ -79,7 +79,7 @@ struct _ClutterZoomActionClass
|
||||
/*< public >*/
|
||||
gboolean (* zoom) (ClutterZoomAction *action,
|
||||
ClutterActor *actor,
|
||||
ClutterPoint *focal_point,
|
||||
graphene_point_t *focal_point,
|
||||
gdouble factor);
|
||||
|
||||
/*< private >*/
|
||||
@ -104,10 +104,10 @@ ClutterZoomAxis clutter_zoom_action_get_zoom_axis (ClutterZoomActi
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
|
||||
ClutterPoint *point);
|
||||
graphene_point_t *point);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
|
||||
ClutterPoint *point);
|
||||
graphene_point_t *point);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -56,7 +56,7 @@ typedef struct _ClutterStageViewCoglPrivate
|
||||
*/
|
||||
#define DAMAGE_HISTORY_MAX 16
|
||||
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
|
||||
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
|
||||
cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
|
||||
unsigned int damage_index;
|
||||
} ClutterStageViewCoglPrivate;
|
||||
|
||||
@ -204,7 +204,7 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
|
||||
if (max_render_time_allowed <= 0)
|
||||
{
|
||||
g_warning ("Unsupported monitor refresh rate detected. "
|
||||
"(Refresh rate: %.3f, refresh interval: %ld)",
|
||||
"(Refresh rate: %.3f, refresh interval: %" G_GINT64_FORMAT ")",
|
||||
refresh_rate,
|
||||
refresh_interval);
|
||||
stage_cogl->update_time = now;
|
||||
@ -296,13 +296,10 @@ clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *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.
|
||||
*
|
||||
* NB: a clip width of 0 means a full stage redraw has been queued
|
||||
* so we effectively don't have any redraw clips in that case.
|
||||
*/
|
||||
if (!stage_cogl->initialized_redraw_clip ||
|
||||
(stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->bounding_redraw_clip.width != 0))
|
||||
stage_cogl->redraw_clip))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -313,9 +310,9 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
/* NB: a clip width of 0 means a full stage redraw is required */
|
||||
/* NB: a NULL clip means a full stage redraw is required */
|
||||
if (stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->bounding_redraw_clip.width == 0)
|
||||
!stage_cogl->redraw_clip)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -346,11 +343,11 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||
return;
|
||||
|
||||
/* A NULL stage clip means a full stage redraw has been queued and
|
||||
* we keep track of this by setting a zero width
|
||||
* stage_cogl->bounding_redraw_clip */
|
||||
* we keep track of this by setting a NULL redraw_clip.
|
||||
*/
|
||||
if (stage_clip == NULL)
|
||||
{
|
||||
stage_cogl->bounding_redraw_clip.width = 0;
|
||||
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
|
||||
stage_cogl->initialized_redraw_clip = TRUE;
|
||||
return;
|
||||
}
|
||||
@ -359,34 +356,27 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||
if (stage_clip->width == 0 || stage_clip->height == 0)
|
||||
return;
|
||||
|
||||
if (!stage_cogl->initialized_redraw_clip)
|
||||
if (!stage_cogl->redraw_clip)
|
||||
{
|
||||
stage_cogl->bounding_redraw_clip = *stage_clip;
|
||||
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
|
||||
}
|
||||
else if (stage_cogl->bounding_redraw_clip.width > 0)
|
||||
else
|
||||
{
|
||||
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
|
||||
stage_clip,
|
||||
&stage_cogl->bounding_redraw_clip);
|
||||
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
|
||||
}
|
||||
|
||||
stage_cogl->initialized_redraw_clip = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
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_clip = stage_cogl->bounding_redraw_clip;
|
||||
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
|
||||
return cairo_region_copy (stage_cogl->redraw_clip);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
@ -403,37 +393,47 @@ valid_buffer_age (ClutterStageViewCogl *view_cogl,
|
||||
}
|
||||
|
||||
static void
|
||||
paint_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_rectangle_int_t *swap_region)
|
||||
paint_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *swap_region)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||
static CoglPipeline *overlay_blue = NULL;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (stage_cogl->wrapper);
|
||||
float x_1 = swap_region->x;
|
||||
float x_2 = swap_region->x + swap_region->width;
|
||||
float y_1 = swap_region->y;
|
||||
float y_2 = swap_region->y + swap_region->height;
|
||||
CoglMatrix modelview;
|
||||
CoglMatrix transform;
|
||||
int n_rects, i;
|
||||
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
clutter_actor_get_transform (actor, &transform);
|
||||
cogl_framebuffer_transform (framebuffer, &transform);
|
||||
|
||||
/* Blue for the swap region */
|
||||
if (G_UNLIKELY (overlay_blue == NULL))
|
||||
{
|
||||
overlay_blue = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
|
||||
}
|
||||
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
cogl_matrix_init_identity (&modelview);
|
||||
_clutter_actor_apply_modelview_transform (actor, &modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
|
||||
/* Blue for the swap region */
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
|
||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
y_2 = rect.y + rect.height;
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
|
||||
}
|
||||
|
||||
/* Red for the clip */
|
||||
if (stage_cogl->initialized_redraw_clip)
|
||||
if (stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->redraw_clip)
|
||||
{
|
||||
static CoglPipeline *overlay_red = NULL;
|
||||
|
||||
@ -443,55 +443,63 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
|
||||
}
|
||||
|
||||
x_1 = stage_cogl->bounding_redraw_clip.x;
|
||||
x_2 = stage_cogl->bounding_redraw_clip.x + stage_cogl->bounding_redraw_clip.width;
|
||||
y_1 = stage_cogl->bounding_redraw_clip.y;
|
||||
y_2 = stage_cogl->bounding_redraw_clip.y + stage_cogl->bounding_redraw_clip.height;
|
||||
n_rects = cairo_region_num_rectangles (stage_cogl->redraw_clip);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
|
||||
cairo_region_get_rectangle (stage_cogl->redraw_clip, i, &rect);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
y_2 = rect.y + rect.height;
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
|
||||
}
|
||||
}
|
||||
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_rectangle_int_t *swap_region,
|
||||
gboolean swap_with_damage)
|
||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *swap_region,
|
||||
gboolean swap_with_damage)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
int damage[4], ndamage;
|
||||
|
||||
damage[0] = swap_region->x;
|
||||
damage[1] = swap_region->y;
|
||||
damage[2] = swap_region->width;
|
||||
damage[3] = swap_region->height;
|
||||
|
||||
if (swap_region->width != 0)
|
||||
ndamage = 1;
|
||||
else
|
||||
ndamage = 0;
|
||||
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);
|
||||
damage = g_newa (int, n_rects * 4);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||
damage[i * 4] = rect.x;
|
||||
damage[i * 4 + 1] = rect.y;
|
||||
damage[i * 4 + 2] = rect.width;
|
||||
damage[i * 4 + 3] = rect.height;
|
||||
}
|
||||
|
||||
if (cogl_is_onscreen (framebuffer))
|
||||
{
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||
|
||||
/* push on the screen */
|
||||
if (ndamage == 1 && !swap_with_damage)
|
||||
if (n_rects > 0 && !swap_with_damage)
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"cogl_onscreen_swap_region (onscreen: %p, "
|
||||
"x: %d, y: %d, "
|
||||
"width: %d, height: %d)",
|
||||
onscreen,
|
||||
damage[0], damage[1], damage[2], damage[3]);
|
||||
"cogl_onscreen_swap_region (onscreen: %p)",
|
||||
onscreen);
|
||||
|
||||
cogl_onscreen_swap_region (onscreen,
|
||||
damage, ndamage);
|
||||
damage, n_rects);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -501,7 +509,7 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
onscreen);
|
||||
|
||||
cogl_onscreen_swap_buffers_with_damage (onscreen,
|
||||
damage, ndamage);
|
||||
damage, n_rects);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -516,81 +524,126 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
scale_and_clamp_rect (const graphene_rect_t *rect,
|
||||
float scale,
|
||||
cairo_rectangle_int_t *dest)
|
||||
|
||||
{
|
||||
graphene_rect_t tmp = *rect;
|
||||
|
||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||
}
|
||||
|
||||
static void
|
||||
paint_stage (ClutterStageCogl *stage_cogl,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
cairo_region_t *clip)
|
||||
{
|
||||
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_paint_view (stage, view, clip);
|
||||
_clutter_stage_paint_view (stage, view, &paint_rect);
|
||||
|
||||
if (clutter_stage_view_get_onscreen (view) !=
|
||||
clutter_stage_view_get_framebuffer (view))
|
||||
{
|
||||
clutter_stage_view_blit_offscreen (view, clip);
|
||||
clutter_stage_view_blit_offscreen (view, &paint_rect);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fill_current_damage_history_and_step (ClutterStageView *view)
|
||||
fill_current_damage_history (ClutterStageView *view,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
|
||||
ClutterStageViewCoglPrivate *view_priv =
|
||||
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
||||
cairo_rectangle_int_t view_rect;
|
||||
float fb_scale;
|
||||
cairo_rectangle_int_t *current_fb_damage;
|
||||
cairo_region_t **current_fb_damage;
|
||||
|
||||
current_fb_damage =
|
||||
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
|
||||
clutter_stage_view_get_layout (view, &view_rect);
|
||||
fb_scale = clutter_stage_view_get_scale (view);
|
||||
|
||||
*current_fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
g_clear_pointer (current_fb_damage, cairo_region_destroy);
|
||||
*current_fb_damage = cairo_region_copy (damage);
|
||||
view_priv->damage_index++;
|
||||
}
|
||||
|
||||
static void
|
||||
transform_swap_region_to_onscreen (ClutterStageView *view,
|
||||
cairo_rectangle_int_t *swap_region)
|
||||
fill_current_damage_history_rectangle (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect)
|
||||
{
|
||||
cairo_region_t *damage;
|
||||
|
||||
damage = cairo_region_create_rectangle (rect);
|
||||
fill_current_damage_history (view, damage);
|
||||
cairo_region_destroy (damage);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
transform_swap_region_to_onscreen (ClutterStageView *view,
|
||||
cairo_region_t *swap_region)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
cairo_rectangle_int_t layout;
|
||||
gfloat x1, y1, x2, y2;
|
||||
gint width, height;
|
||||
int n_rects, i;
|
||||
cairo_rectangle_int_t *rects;
|
||||
cairo_region_t *transformed_region;
|
||||
|
||||
framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
clutter_stage_view_get_layout (view, &layout);
|
||||
|
||||
x1 = (float) swap_region->x / layout.width;
|
||||
y1 = (float) swap_region->y / layout.height;
|
||||
x2 = (float) (swap_region->x + swap_region->width) / layout.width;
|
||||
y2 = (float) (swap_region->y + swap_region->height) / layout.height;
|
||||
|
||||
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
|
||||
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
|
||||
|
||||
width = cogl_framebuffer_get_width (framebuffer);
|
||||
height = cogl_framebuffer_get_height (framebuffer);
|
||||
|
||||
x1 = floor (x1 * width);
|
||||
y1 = floor (height - (y1 * height));
|
||||
x2 = ceil (x2 * width);
|
||||
y2 = ceil (height - (y2 * height));
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
gfloat x1, y1, x2, y2;
|
||||
|
||||
*swap_region = (cairo_rectangle_int_t) {
|
||||
.x = x1,
|
||||
.y = y1,
|
||||
.width = x2 - x1,
|
||||
.height = y2 - y1
|
||||
};
|
||||
cairo_region_get_rectangle (swap_region, i, &rects[i]);
|
||||
|
||||
x1 = (float) rects[i].x / layout.width;
|
||||
y1 = (float) rects[i].y / layout.height;
|
||||
x2 = (float) (rects[i].x + rects[i].width) / layout.width;
|
||||
y2 = (float) (rects[i].y + rects[i].height) / layout.height;
|
||||
|
||||
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
|
||||
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
|
||||
|
||||
x1 = floor (x1 * width);
|
||||
y1 = floor (height - (y1 * height));
|
||||
x2 = ceil (x2 * width);
|
||||
y2 = ceil (height - (y2 * height));
|
||||
|
||||
rects[i].x = x1;
|
||||
rects[i].y = y1;
|
||||
rects[i].width = x2 - x1;
|
||||
rects[i].height = y2 - y1;
|
||||
}
|
||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
||||
|
||||
return transformed_region;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -624,18 +677,6 @@ is_buffer_age_enabled (void)
|
||||
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_and_clamp_rect (const ClutterRect *rect,
|
||||
float scale,
|
||||
cairo_rectangle_int_t *dest)
|
||||
|
||||
{
|
||||
ClutterRect tmp = *rect;
|
||||
|
||||
clutter_rect_scale (&tmp, scale, scale);
|
||||
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view)
|
||||
@ -654,9 +695,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
gboolean do_swap_buffer;
|
||||
gboolean swap_with_damage;
|
||||
ClutterActor *wrapper;
|
||||
cairo_rectangle_int_t redraw_clip;
|
||||
cairo_rectangle_int_t swap_region;
|
||||
cairo_rectangle_int_t fb_clip_region;
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_region_t *fb_clip_region;
|
||||
cairo_region_t *swap_region;
|
||||
cairo_rectangle_int_t redraw_rect;
|
||||
gboolean clip_region_empty;
|
||||
float fb_scale;
|
||||
int subpixel_compensation = 0;
|
||||
@ -675,20 +717,19 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
|
||||
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
|
||||
|
||||
/* NB: a zero width redraw clip == full stage redraw */
|
||||
if (stage_cogl->bounding_redraw_clip.width == 0)
|
||||
/* NB: a NULL redraw clip == full stage redraw */
|
||||
if (!stage_cogl->redraw_clip)
|
||||
have_clip = FALSE;
|
||||
else
|
||||
{
|
||||
redraw_clip = stage_cogl->bounding_redraw_clip;
|
||||
_clutter_util_rectangle_intersection (&redraw_clip,
|
||||
&view_rect,
|
||||
&redraw_clip);
|
||||
cairo_region_t *view_region;
|
||||
redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
|
||||
|
||||
have_clip = !(redraw_clip.x == view_rect.x &&
|
||||
redraw_clip.y == view_rect.y &&
|
||||
redraw_clip.width == view_rect.width &&
|
||||
redraw_clip.height == view_rect.height);
|
||||
view_region = cairo_region_create_rectangle (&view_rect);
|
||||
cairo_region_intersect (redraw_clip, view_region);
|
||||
|
||||
have_clip = !cairo_region_equal (redraw_clip, view_region);
|
||||
cairo_region_destroy (view_region);
|
||||
}
|
||||
|
||||
may_use_clipped_redraw = FALSE;
|
||||
@ -699,26 +740,53 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
* frames when starting up... */
|
||||
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
|
||||
{
|
||||
ClutterRect rect;
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t *rects;
|
||||
int n_rects, i;
|
||||
|
||||
may_use_clipped_redraw = TRUE;
|
||||
|
||||
_clutter_util_rect_from_rectangle (&redraw_clip, &rect);
|
||||
clutter_rect_offset (&rect, -view_rect.x, -view_rect.y);
|
||||
scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region);
|
||||
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))
|
||||
{
|
||||
subpixel_compensation = ceilf (fb_scale);
|
||||
fb_clip_region.x -= subpixel_compensation;
|
||||
fb_clip_region.y -= subpixel_compensation;
|
||||
fb_clip_region.width += 2 * subpixel_compensation;
|
||||
fb_clip_region.height += 2 * subpixel_compensation;
|
||||
|
||||
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]);
|
||||
rects[i].x -= subpixel_compensation;
|
||||
rects[i].y -= subpixel_compensation;
|
||||
rects[i].width += 2 * subpixel_compensation;
|
||||
rects[i].height += 2 * subpixel_compensation;
|
||||
}
|
||||
cairo_region_destroy (fb_clip_region);
|
||||
fb_clip_region = cairo_region_create_rectangles (rects, n_rects);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fb_clip_region = (cairo_rectangle_int_t) { 0 };
|
||||
cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
|
||||
fb_clip_region = cairo_region_create_rectangle (&rect);
|
||||
redraw_clip = cairo_region_copy (fb_clip_region);
|
||||
}
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
@ -727,71 +795,81 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
else
|
||||
use_clipped_redraw = FALSE;
|
||||
|
||||
clip_region_empty = may_use_clipped_redraw && fb_clip_region.width == 0;
|
||||
clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (fb_clip_region);
|
||||
|
||||
swap_with_damage = FALSE;
|
||||
if (has_buffer_age)
|
||||
{
|
||||
if (use_clipped_redraw && !clip_region_empty)
|
||||
if (use_clipped_redraw)
|
||||
{
|
||||
int age, i;
|
||||
cairo_rectangle_int_t *current_fb_damage =
|
||||
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
|
||||
int age;
|
||||
|
||||
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
|
||||
|
||||
if (valid_buffer_age (view_cogl, age))
|
||||
{
|
||||
ClutterRect rect;
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t damage_region;
|
||||
cairo_rectangle_int_t *rects;
|
||||
int n_rects, i;
|
||||
|
||||
*current_fb_damage = fb_clip_region;
|
||||
fill_current_damage_history (view, fb_clip_region);
|
||||
|
||||
for (i = 1; i <= age; i++)
|
||||
{
|
||||
cairo_rectangle_int_t *fb_damage =
|
||||
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
|
||||
|
||||
_clutter_util_rectangle_union (&fb_clip_region,
|
||||
fb_damage,
|
||||
&fb_clip_region);
|
||||
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 bounding redraw clip state with the extra damage. */
|
||||
_clutter_util_rect_from_rectangle (&fb_clip_region, &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);
|
||||
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
|
||||
&damage_region,
|
||||
&stage_cogl->bounding_redraw_clip);
|
||||
/* 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: x=%d, y=%d, width=%d, height=%d\n",
|
||||
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
|
||||
age,
|
||||
fb_clip_region.x,
|
||||
fb_clip_region.y,
|
||||
fb_clip_region.width,
|
||||
fb_clip_region.height);
|
||||
cairo_region_num_rectangles (fb_clip_region));
|
||||
|
||||
swap_with_damage = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t fb_damage;
|
||||
|
||||
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
|
||||
use_clipped_redraw = FALSE;
|
||||
*current_fb_damage = (cairo_rectangle_int_t) {
|
||||
fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = view_rect.width * fb_scale,
|
||||
.height = view_rect.height * fb_scale
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
fill_current_damage_history_rectangle (view, &fb_damage);
|
||||
}
|
||||
}
|
||||
else if (!use_clipped_redraw)
|
||||
{
|
||||
fill_current_damage_history_and_step (view);
|
||||
cairo_rectangle_int_t fb_damage;
|
||||
|
||||
fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
fill_current_damage_history_rectangle (view, &fb_damage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -802,11 +880,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
else if (use_clipped_redraw)
|
||||
{
|
||||
ClutterRect rect;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_int_t scissor_rect;
|
||||
cairo_rectangle_int_t paint_rect;
|
||||
|
||||
calculate_scissor_region (&fb_clip_region,
|
||||
cairo_region_get_extents (fb_clip_region, &clip_rect);
|
||||
|
||||
calculate_scissor_region (&clip_rect,
|
||||
subpixel_compensation,
|
||||
fb_width, fb_height,
|
||||
&scissor_rect);
|
||||
@ -826,14 +905,8 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
_clutter_util_rect_from_rectangle (&fb_clip_region, &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);
|
||||
paint_stage (stage_cogl, view, fb_clip_region);
|
||||
|
||||
paint_stage (stage_cogl, view, &paint_rect);
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
|
||||
stage_cogl->using_clipped_redraw = FALSE;
|
||||
@ -843,16 +916,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
|
||||
|
||||
/* If we are trying to debug redraw issues then we want to pass
|
||||
* the bounding_redraw_clip so it can be visualized */
|
||||
* the redraw_clip so it can be visualized */
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
|
||||
may_use_clipped_redraw &&
|
||||
!clip_region_empty)
|
||||
{
|
||||
ClutterRect rect;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_int_t scissor_rect;
|
||||
cairo_rectangle_int_t paint_rect;
|
||||
|
||||
calculate_scissor_region (&fb_clip_region,
|
||||
cairo_region_get_extents (fb_clip_region, &clip_rect);
|
||||
|
||||
calculate_scissor_region (&clip_rect,
|
||||
subpixel_compensation,
|
||||
fb_width, fb_height,
|
||||
&scissor_rect);
|
||||
@ -863,31 +937,40 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
_clutter_util_rect_from_rectangle (&fb_clip_region, &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);
|
||||
paint_stage (stage_cogl, view, fb_clip_region);
|
||||
|
||||
paint_stage (stage_cogl, view, &paint_rect);
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
else
|
||||
paint_stage (stage_cogl, view, &view_rect);
|
||||
{
|
||||
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);
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
|
||||
{
|
||||
CoglContext *ctx = cogl_framebuffer_get_context (fb);
|
||||
static CoglPipeline *outline = NULL;
|
||||
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
|
||||
float x_1 = redraw_clip.x;
|
||||
float x_2 = redraw_clip.x + redraw_clip.width;
|
||||
float y_1 = redraw_clip.y;
|
||||
float y_2 = redraw_clip.y + redraw_clip.height;
|
||||
float x_1 = redraw_rect.x;
|
||||
float x_2 = redraw_rect.x + redraw_rect.width;
|
||||
float y_1 = redraw_rect.y;
|
||||
float y_2 = redraw_rect.y + redraw_rect.height;
|
||||
CoglVertexP2 quad[4] = {
|
||||
{ x_1, y_1 },
|
||||
{ x_2, y_1 },
|
||||
@ -933,32 +1016,47 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_region = fb_clip_region;
|
||||
g_assert (swap_region.width > 0);
|
||||
swap_region = cairo_region_copy (fb_clip_region);
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_region = (cairo_rectangle_int_t) { 0 };
|
||||
swap_region = cairo_region_create ();
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
|
||||
if (redraw_clip)
|
||||
cairo_region_destroy (redraw_clip);
|
||||
if (fb_clip_region)
|
||||
cairo_region_destroy (fb_clip_region);
|
||||
|
||||
if (do_swap_buffer)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||
"Paint (swap framebuffer)");
|
||||
|
||||
if (clutter_stage_view_get_onscreen (view) !=
|
||||
clutter_stage_view_get_framebuffer (view))
|
||||
{
|
||||
transform_swap_region_to_onscreen (view, &swap_region);
|
||||
cairo_region_t *transformed_swap_region;
|
||||
|
||||
transformed_swap_region =
|
||||
transform_swap_region_to_onscreen (view, swap_region);
|
||||
cairo_region_destroy (swap_region);
|
||||
swap_region = transformed_swap_region;
|
||||
}
|
||||
|
||||
return swap_framebuffer (stage_window,
|
||||
view,
|
||||
&swap_region,
|
||||
swap_with_damage);
|
||||
res = swap_framebuffer (stage_window,
|
||||
view,
|
||||
swap_region,
|
||||
swap_with_damage);
|
||||
|
||||
cairo_region_destroy (swap_region);
|
||||
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -998,6 +1096,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
|
||||
/* 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++;
|
||||
|
||||
@ -1019,7 +1118,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
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_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
|
||||
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
|
||||
iface->redraw = clutter_stage_cogl_redraw;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ struct _ClutterStageCogl
|
||||
|
||||
gint last_sync_delay;
|
||||
|
||||
cairo_rectangle_int_t bounding_redraw_clip;
|
||||
cairo_region_t *redraw_clip;
|
||||
|
||||
guint initialized_redraw_clip : 1;
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-actor.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
/**
|
||||
* clutter_actor_get_allocation_geometry:
|
||||
* @self: A #ClutterActor
|
||||
* @geom: (out): allocation geometry in pixels
|
||||
*
|
||||
* Gets the layout box an actor has been assigned. The allocation can
|
||||
* only be assumed valid inside a paint() method; anywhere else, it
|
||||
* may be out-of-date.
|
||||
*
|
||||
* An allocation does not incorporate the actor's scale or anchor point;
|
||||
* those transformations do not affect layout, only rendering.
|
||||
*
|
||||
* The returned rectangle is in pixels.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.12: Use clutter_actor_get_allocation_box() instead.
|
||||
*/
|
||||
void
|
||||
clutter_actor_get_allocation_geometry (ClutterActor *self,
|
||||
ClutterGeometry *geom)
|
||||
{
|
||||
ClutterActorBox box;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
g_return_if_fail (geom != NULL);
|
||||
|
||||
clutter_actor_get_allocation_box (self, &box);
|
||||
|
||||
geom->x = CLUTTER_NEARBYINT (clutter_actor_box_get_x (&box));
|
||||
geom->y = CLUTTER_NEARBYINT (clutter_actor_box_get_y (&box));
|
||||
geom->width = CLUTTER_NEARBYINT (clutter_actor_box_get_width (&box));
|
||||
geom->height = CLUTTER_NEARBYINT (clutter_actor_box_get_height (&box));
|
||||
}
|
@ -145,10 +145,6 @@ CLUTTER_DEPRECATED
|
||||
void clutter_actor_get_transformation_matrix (ClutterActor *self,
|
||||
ClutterMatrix *matrix);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR (clutter_actor_get_allocation_box)
|
||||
void clutter_actor_get_allocation_geometry (ClutterActor *self,
|
||||
ClutterGeometry *geom);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */
|
||||
|
@ -39,9 +39,7 @@
|
||||
* be available any more in the next major version of Clutter.
|
||||
*
|
||||
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which
|
||||
* translates the time T into an adimensional factor alpha. The factor can
|
||||
* then be used to drive a #ClutterBehaviour, which will translate the
|
||||
* alpha value into something meaningful for a #ClutterActor.
|
||||
* translates the time T into an adimensional factor alpha.
|
||||
*
|
||||
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
|
||||
* instance using clutter_alpha_set_timeline(). You should also set an
|
||||
@ -59,9 +57,6 @@
|
||||
* pause, stop or resume the #ClutterAlpha from calling the alpha function by
|
||||
* using the appropriate functions of the #ClutterTimeline object.
|
||||
*
|
||||
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it
|
||||
* is internally used by the #ClutterAnimation API.
|
||||
*
|
||||
* #ClutterAlpha is available since Clutter 0.2.
|
||||
*
|
||||
* #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and
|
||||
@ -78,9 +73,7 @@
|
||||
*
|
||||
* The following JSON fragment defines a #ClutterAlpha
|
||||
* using a #ClutterTimeline with id "sine-timeline" and an alpha
|
||||
* function called `my_sine_alpha`. The defined #ClutterAlpha
|
||||
* instance can be reused in multiple #ClutterBehaviour
|
||||
* definitions or for #ClutterAnimation definitions.
|
||||
* function called `my_sine_alpha`.
|
||||
*
|
||||
* |[
|
||||
* {
|
||||
@ -645,9 +638,6 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha)
|
||||
* bind a #ClutterTimeline object to the #ClutterAlpha instance
|
||||
* using clutter_alpha_set_timeline().
|
||||
*
|
||||
* You should use the newly created #ClutterAlpha instance inside
|
||||
* a #ClutterBehaviour object.
|
||||
*
|
||||
* Return value: the newly created empty #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 0.2
|
||||
|
@ -57,13 +57,6 @@
|
||||
* #ClutterAnimatable interface it is possible for that instance to
|
||||
* control the way the initial and final states are interpolated.
|
||||
*
|
||||
* #ClutterAnimations are distinguished from #ClutterBehaviours
|
||||
* because the former can only control #GObject properties of a single
|
||||
* #GObject instance, while the latter can control multiple properties
|
||||
* using accessor functions inside the #ClutterBehaviour
|
||||
* `alpha_notify` virtual function, and can control multiple #ClutterActors
|
||||
* as well.
|
||||
*
|
||||
* For convenience, it is possible to use the clutter_actor_animate()
|
||||
* function call which will take care of setting up and tearing down
|
||||
* a #ClutterAnimation instance and animate an actor between its current
|
||||
@ -2220,7 +2213,7 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
|
||||
*
|
||||
* Will animate the "rotation-angle-z" property between the current value
|
||||
* and 360 degrees, and set the "rotation-center-z" property to the fixed
|
||||
* value of the #ClutterVertex "center".
|
||||
* value of the #graphene_point3d_t "center".
|
||||
*
|
||||
* This function will implicitly create a #ClutterAnimation object which
|
||||
* will be assigned to the @actor and will be returned to the developer
|
||||
|
@ -1,303 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "deprecated/clutter-actor.h"
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-behaviour-depth.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour-depth
|
||||
* @Title: ClutterBehaviourDepth
|
||||
* @short_description: A behaviour controlling the Z position
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() instead
|
||||
*
|
||||
* #ClutterBehaviourDepth is a simple #ClutterBehaviour controlling the
|
||||
* depth of a set of actors between a start and end depth.
|
||||
*
|
||||
* #ClutterBehaviourDepth is available since Clutter 0.4.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:depth property and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
*/
|
||||
|
||||
struct _ClutterBehaviourDepthPrivate
|
||||
{
|
||||
gint depth_start;
|
||||
gint depth_end;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_DEPTH_START,
|
||||
PROP_DEPTH_END
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourDepth,
|
||||
clutter_behaviour_depth,
|
||||
CLUTTER_TYPE_BEHAVIOUR)
|
||||
|
||||
static void
|
||||
alpha_notify_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
clutter_actor_set_depth (actor, GPOINTER_TO_INT (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
ClutterBehaviourDepthPrivate *priv;
|
||||
gint depth;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_DEPTH (behaviour)->priv;
|
||||
|
||||
/* Need to create factor as to avoid borking signedness */
|
||||
depth = (alpha_value * (priv->depth_end - priv->depth_start))
|
||||
+ priv->depth_start;
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, depth: %d", alpha_value, depth);
|
||||
|
||||
clutter_behaviour_actors_foreach (behaviour,
|
||||
alpha_notify_foreach,
|
||||
GINT_TO_POINTER (depth));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_applied (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (behaviour);
|
||||
|
||||
clutter_actor_set_depth (actor, depth->priv->depth_start);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEPTH_START:
|
||||
depth->priv->depth_start = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_DEPTH_END:
|
||||
depth->priv->depth_end = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEPTH_START:
|
||||
g_value_set_int (value, depth->priv->depth_start);
|
||||
break;
|
||||
case PROP_DEPTH_END:
|
||||
g_value_set_int (value, depth->priv->depth_end);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_behaviour_depth_set_property;
|
||||
gobject_class->get_property = clutter_behaviour_depth_get_property;
|
||||
|
||||
behaviour_class->alpha_notify = clutter_behaviour_depth_alpha_notify;
|
||||
behaviour_class->applied = clutter_behaviour_depth_applied;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourDepth:depth-start:
|
||||
*
|
||||
* Start depth level to apply to the actors.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DEPTH_START,
|
||||
g_param_spec_int ("depth-start",
|
||||
P_("Start Depth"),
|
||||
P_("Initial depth to apply"),
|
||||
G_MININT, G_MAXINT, 0,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
/**
|
||||
* ClutterBehaviourDepth:depth-end:
|
||||
*
|
||||
* End depth level to apply to the actors.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DEPTH_END,
|
||||
g_param_spec_int ("depth-end",
|
||||
P_("End Depth"),
|
||||
P_("Final depth to apply"),
|
||||
G_MININT, G_MAXINT, 0,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_init (ClutterBehaviourDepth *depth)
|
||||
{
|
||||
depth->priv = clutter_behaviour_depth_get_instance_private (depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_depth_new:
|
||||
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
|
||||
* @depth_start: initial value of the depth
|
||||
* @depth_end: final value of the depth
|
||||
*
|
||||
* Creates a new #ClutterBehaviourDepth which can be used to control
|
||||
* the ClutterActor:depth property of a set of #ClutterActor<!-- -->s.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
|
||||
* it can be set later with clutter_behaviour_set_alpha().
|
||||
*
|
||||
* Return value: (transfer full): the newly created behaviour
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterBehaviour *
|
||||
clutter_behaviour_depth_new (ClutterAlpha *alpha,
|
||||
gint depth_start,
|
||||
gint depth_end)
|
||||
{
|
||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_DEPTH,
|
||||
"alpha", alpha,
|
||||
"depth-start", depth_start,
|
||||
"depth-end", depth_end,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_depth_set_bounds:
|
||||
* @behaviour: a #ClutterBehaviourDepth
|
||||
* @depth_start: initial value of the depth
|
||||
* @depth_end: final value of the depth
|
||||
*
|
||||
* Sets the boundaries of the @behaviour.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint depth_start,
|
||||
gint depth_end)
|
||||
{
|
||||
ClutterBehaviourDepthPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
|
||||
|
||||
priv = behaviour->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (behaviour));
|
||||
|
||||
if (priv->depth_start != depth_start)
|
||||
{
|
||||
priv->depth_start = depth_start;
|
||||
g_object_notify (G_OBJECT (behaviour), "depth-start");
|
||||
}
|
||||
|
||||
if (priv->depth_end != depth_end)
|
||||
{
|
||||
priv->depth_end = depth_end;
|
||||
g_object_notify (G_OBJECT (behaviour), "depth-end");
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (behaviour));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_depth_get_bounds:
|
||||
* @behaviour: a #ClutterBehaviourDepth
|
||||
* @depth_start: (out): return location for the initial depth value, or %NULL
|
||||
* @depth_end: (out): return location for the final depth value, or %NULL
|
||||
*
|
||||
* Gets the boundaries of the @behaviour
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint *depth_start,
|
||||
gint *depth_end)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
|
||||
|
||||
if (depth_start)
|
||||
*depth_start = behaviour->priv->depth_start;
|
||||
|
||||
if (depth_end)
|
||||
*depth_end = behaviour->priv->depth_end;
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_DEPTH__
|
||||
#define __CLUTTER_BEHAVIOUR_DEPTH__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR_DEPTH (clutter_behaviour_depth_get_type ())
|
||||
#define CLUTTER_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepth))
|
||||
#define CLUTTER_IS_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
|
||||
#define CLUTTER_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
|
||||
#define CLUTTER_IS_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
|
||||
#define CLUTTER_BEHAVIOUR_DEPTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
|
||||
|
||||
typedef struct _ClutterBehaviourDepth ClutterBehaviourDepth;
|
||||
typedef struct _ClutterBehaviourDepthPrivate ClutterBehaviourDepthPrivate;
|
||||
typedef struct _ClutterBehaviourDepthClass ClutterBehaviourDepthClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourDepth:
|
||||
*
|
||||
* The #ClutterBehaviourDepth structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:depth
|
||||
* instead.
|
||||
*/
|
||||
struct _ClutterBehaviourDepth
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviour parent_instance;
|
||||
|
||||
ClutterBehaviourDepthPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourDepthClass:
|
||||
*
|
||||
* The #ClutterBehaviourDepthClass structure contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourDepthClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviourClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_depth_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:depth)
|
||||
ClutterBehaviour *clutter_behaviour_depth_new (ClutterAlpha *alpha,
|
||||
gint depth_start,
|
||||
gint depth_end);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint depth_start,
|
||||
gint depth_end);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint *depth_start,
|
||||
gint *depth_end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_DEPTH__ */
|
@ -1,310 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour-opacity
|
||||
* @Title: ClutterBehaviourOpacity
|
||||
* @short_description: A behaviour controlling opacity
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() instead.
|
||||
*
|
||||
* #ClutterBehaviourOpacity controls the opacity of a set of actors.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-behaviour-opacity.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
struct _ClutterBehaviourOpacityPrivate
|
||||
{
|
||||
guint8 opacity_start;
|
||||
guint8 opacity_end;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_OPACITY_START,
|
||||
PROP_OPACITY_END,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourOpacity,
|
||||
clutter_behaviour_opacity,
|
||||
CLUTTER_TYPE_BEHAVIOUR)
|
||||
|
||||
static void
|
||||
alpha_notify_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
clutter_actor_set_opacity (actor, GPOINTER_TO_UINT(data));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_alpha_notify (ClutterBehaviour *behave,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
ClutterBehaviourOpacityPrivate *priv;
|
||||
guint8 opacity;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv;
|
||||
|
||||
opacity = alpha_value
|
||||
* (priv->opacity_end - priv->opacity_start)
|
||||
+ priv->opacity_start;
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, opacity: %u",
|
||||
alpha_value,
|
||||
opacity);
|
||||
|
||||
clutter_behaviour_actors_foreach (behave,
|
||||
alpha_notify_foreach,
|
||||
GUINT_TO_POINTER ((guint) opacity));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_OPACITY_START:
|
||||
clutter_behaviour_opacity_set_bounds (self,
|
||||
g_value_get_uint (value),
|
||||
self->priv->opacity_end);
|
||||
break;
|
||||
|
||||
case PROP_OPACITY_END:
|
||||
clutter_behaviour_opacity_set_bounds (self,
|
||||
self->priv->opacity_start,
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_OPACITY_START:
|
||||
g_value_set_uint (value, self->priv->opacity_start);
|
||||
break;
|
||||
|
||||
case PROP_OPACITY_END:
|
||||
g_value_set_uint (value, self->priv->opacity_end);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
gobject_class->set_property = clutter_behaviour_opacity_set_property;
|
||||
gobject_class->get_property = clutter_behaviour_opacity_get_property;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacity:opacity-start:
|
||||
*
|
||||
* Initial opacity level of the behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_uint ("opacity-start",
|
||||
P_("Opacity Start"),
|
||||
P_("Initial opacity level"),
|
||||
0, 255,
|
||||
0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_OPACITY_START] = pspec;
|
||||
g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec);
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacity:opacity-end:
|
||||
*
|
||||
* Final opacity level of the behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_uint ("opacity-end",
|
||||
P_("Opacity End"),
|
||||
P_("Final opacity level"),
|
||||
0, 255,
|
||||
0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_OPACITY_END] = pspec;
|
||||
g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec);
|
||||
|
||||
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
|
||||
{
|
||||
self->priv = clutter_behaviour_opacity_get_instance_private (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_opacity_new:
|
||||
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
|
||||
* @opacity_start: minimum level of opacity
|
||||
* @opacity_end: maximum level of opacity
|
||||
*
|
||||
* Creates a new #ClutterBehaviourOpacity object, driven by @alpha
|
||||
* which controls the opacity property of every actor, making it
|
||||
* change in the interval between @opacity_start and @opacity_end.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
|
||||
* it can be set later with clutter_behaviour_set_alpha().
|
||||
*
|
||||
* Return value: the newly created #ClutterBehaviourOpacity
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterBehaviour *
|
||||
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
|
||||
"alpha", alpha,
|
||||
"opacity-start", opacity_start,
|
||||
"opacity-end", opacity_end,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_opacity_set_bounds:
|
||||
* @behaviour: a #ClutterBehaviourOpacity
|
||||
* @opacity_start: minimum level of opacity
|
||||
* @opacity_end: maximum level of opacity
|
||||
*
|
||||
* Sets the initial and final levels of the opacity applied by @behaviour
|
||||
* on each actor it controls.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end)
|
||||
{
|
||||
ClutterBehaviourOpacityPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
|
||||
|
||||
priv = behaviour->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (behaviour));
|
||||
|
||||
if (priv->opacity_start != opacity_start)
|
||||
{
|
||||
priv->opacity_start = opacity_start;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_START]);
|
||||
}
|
||||
|
||||
if (priv->opacity_end != opacity_end)
|
||||
{
|
||||
priv->opacity_end = opacity_end;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_END]);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (behaviour));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_opacity_get_bounds:
|
||||
* @behaviour: a #ClutterBehaviourOpacity
|
||||
* @opacity_start: (out): return location for the minimum level of opacity, or %NULL
|
||||
* @opacity_end: (out): return location for the maximum level of opacity, or %NULL
|
||||
*
|
||||
* Gets the initial and final levels of the opacity applied by @behaviour
|
||||
* on each actor it controls.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 *opacity_start,
|
||||
guint8 *opacity_end)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
|
||||
|
||||
if (opacity_start)
|
||||
*opacity_start = behaviour->priv->opacity_start;
|
||||
|
||||
if (opacity_end)
|
||||
*opacity_end = behaviour->priv->opacity_end;
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_OPACITY_H__
|
||||
#define __CLUTTER_BEHAVIOUR_OPACITY_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ())
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
|
||||
|
||||
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
|
||||
typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
|
||||
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacity:
|
||||
*
|
||||
* The #ClutterBehaviourOpacity structure contains only private data and
|
||||
* should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_actor_animate() and #ClutterActor:opacity
|
||||
* instead.
|
||||
*/
|
||||
struct _ClutterBehaviourOpacity
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviour parent;
|
||||
ClutterBehaviourOpacityPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacityClass:
|
||||
*
|
||||
* The #ClutterBehaviourOpacityClass structure contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourOpacityClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviourClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:opacity)
|
||||
ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 *opacity_start,
|
||||
guint8 *opacity_end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */
|
@ -1,437 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour-scale
|
||||
* @Title: ClutterBehaviourScale
|
||||
* @short_description: A behaviour controlling scale
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
|
||||
* and #ClutterActor:scale-y instead.
|
||||
*
|
||||
* A #ClutterBehaviourScale interpolates actors size between two values.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
|
||||
* properties, and clutter_actor_animate(), or #ClutterAnimator or
|
||||
* #ClutterState instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-actor.h"
|
||||
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-behaviour-scale.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterBehaviourScalePrivate
|
||||
{
|
||||
gdouble x_scale_start;
|
||||
gdouble y_scale_start;
|
||||
|
||||
gdouble x_scale_end;
|
||||
gdouble y_scale_end;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_X_SCALE_START,
|
||||
PROP_Y_SCALE_START,
|
||||
PROP_X_SCALE_END,
|
||||
PROP_Y_SCALE_END,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourScale,
|
||||
clutter_behaviour_scale,
|
||||
CLUTTER_TYPE_BEHAVIOUR)
|
||||
|
||||
typedef struct {
|
||||
gdouble scale_x;
|
||||
gdouble scale_y;
|
||||
} ScaleFrameClosure;
|
||||
|
||||
static void
|
||||
scale_frame_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
ScaleFrameClosure *closure = data;
|
||||
|
||||
clutter_actor_set_scale (actor, closure->scale_x, closure->scale_y);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
ScaleFrameClosure closure = { 0, };
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
|
||||
|
||||
/* Fix the start/end values, avoids potential rounding errors on large
|
||||
* values.
|
||||
*/
|
||||
if (alpha_value == 1.0)
|
||||
{
|
||||
closure.scale_x = priv->x_scale_end;
|
||||
closure.scale_y = priv->y_scale_end;
|
||||
}
|
||||
else if (alpha_value == 0)
|
||||
{
|
||||
closure.scale_x = priv->x_scale_start;
|
||||
closure.scale_y = priv->y_scale_start;
|
||||
}
|
||||
else
|
||||
{
|
||||
closure.scale_x = (priv->x_scale_end - priv->x_scale_start)
|
||||
* alpha_value
|
||||
+ priv->x_scale_start;
|
||||
|
||||
closure.scale_y = (priv->y_scale_end - priv->y_scale_start)
|
||||
* alpha_value
|
||||
+ priv->y_scale_start;
|
||||
}
|
||||
|
||||
clutter_behaviour_actors_foreach (behave,
|
||||
scale_frame_foreach,
|
||||
&closure);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_SCALE_START:
|
||||
priv->x_scale_start = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_X_SCALE_END:
|
||||
priv->x_scale_end = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_START:
|
||||
priv->y_scale_start = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_END:
|
||||
priv->y_scale_end = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_SCALE_START:
|
||||
g_value_set_double (value, priv->x_scale_start);
|
||||
break;
|
||||
|
||||
case PROP_X_SCALE_END:
|
||||
g_value_set_double (value, priv->x_scale_end);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_START:
|
||||
g_value_set_double (value, priv->y_scale_start);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_END:
|
||||
g_value_set_double (value, priv->y_scale_end);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||
GParamSpec *pspec = NULL;
|
||||
|
||||
gobject_class->set_property = clutter_behaviour_scale_set_property;
|
||||
gobject_class->get_property = clutter_behaviour_scale_get_property;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourScale:x-scale-start:
|
||||
*
|
||||
* The initial scaling factor on the X axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("x-scale-start",
|
||||
P_("X Start Scale"),
|
||||
P_("Initial scale on the X axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_X_SCALE_START] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_X_SCALE_START,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterBehaviourScale:x-scale-end:
|
||||
*
|
||||
* The final scaling factor on the X axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("x-scale-end",
|
||||
P_("X End Scale"),
|
||||
P_("Final scale on the X axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_X_SCALE_END] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_X_SCALE_END,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterBehaviourScale:y-scale-start:
|
||||
*
|
||||
* The initial scaling factor on the Y axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("y-scale-start",
|
||||
P_("Y Start Scale"),
|
||||
P_("Initial scale on the Y axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_Y_SCALE_START] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_Y_SCALE_START,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterBehaviourScale:y-scale-end:
|
||||
*
|
||||
* The final scaling factor on the Y axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("y-scale-end",
|
||||
P_("Y End Scale"),
|
||||
P_("Final scale on the Y axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_Y_SCALE_END] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_Y_SCALE_END,
|
||||
pspec);
|
||||
|
||||
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
self->priv = priv = clutter_behaviour_scale_get_instance_private (self);
|
||||
|
||||
priv->x_scale_start = priv->x_scale_end = 1.0;
|
||||
priv->y_scale_start = priv->y_scale_end = 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_new:
|
||||
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
|
||||
* @x_scale_start: initial scale factor on the X axis
|
||||
* @y_scale_start: initial scale factor on the Y axis
|
||||
* @x_scale_end: final scale factor on the X axis
|
||||
* @y_scale_end: final scale factor on the Y axis
|
||||
*
|
||||
* Creates a new #ClutterBehaviourScale instance.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
|
||||
* it can be set later with clutter_behaviour_set_alpha().
|
||||
*
|
||||
* Return value: (transfer full): the newly created #ClutterBehaviourScale
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterBehaviour *
|
||||
clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end)
|
||||
{
|
||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
|
||||
"alpha", alpha,
|
||||
"x-scale-start", x_scale_start,
|
||||
"y-scale-start", y_scale_start,
|
||||
"x-scale-end", x_scale_end,
|
||||
"y-scale-end", y_scale_end,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_set_bounds:
|
||||
* @scale: a #ClutterBehaviourScale
|
||||
* @x_scale_start: initial scale factor on the X axis
|
||||
* @y_scale_start: initial scale factor on the Y axis
|
||||
* @x_scale_end: final scale factor on the X axis
|
||||
* @y_scale_end: final scale factor on the Y axis
|
||||
*
|
||||
* Sets the bounds used by scale behaviour.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||
|
||||
priv = scale->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (scale));
|
||||
|
||||
if (priv->x_scale_start != x_scale_start)
|
||||
{
|
||||
priv->x_scale_start = x_scale_start;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_START]);
|
||||
}
|
||||
|
||||
if (priv->y_scale_start != y_scale_start)
|
||||
{
|
||||
priv->y_scale_start = y_scale_start;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_START]);
|
||||
}
|
||||
|
||||
if (priv->x_scale_end != x_scale_end)
|
||||
{
|
||||
priv->x_scale_end = x_scale_end;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_END]);
|
||||
}
|
||||
|
||||
if (priv->y_scale_end != y_scale_end)
|
||||
{
|
||||
priv->y_scale_end = y_scale_end;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_END]);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (scale));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_get_bounds:
|
||||
* @scale: a #ClutterBehaviourScale
|
||||
* @x_scale_start: (out): return location for the initial scale factor on the X
|
||||
* axis, or %NULL
|
||||
* @y_scale_start: (out): return location for the initial scale factor on the Y
|
||||
* axis, or %NULL
|
||||
* @x_scale_end: (out): return location for the final scale factor on the X axis,
|
||||
* or %NULL
|
||||
* @y_scale_end: (out): return location for the final scale factor on the Y axis,
|
||||
* or %NULL
|
||||
*
|
||||
* Retrieves the bounds used by scale behaviour.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble *x_scale_start,
|
||||
gdouble *y_scale_start,
|
||||
gdouble *x_scale_end,
|
||||
gdouble *y_scale_end)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||
|
||||
priv = scale->priv;
|
||||
|
||||
if (x_scale_start)
|
||||
*x_scale_start = priv->x_scale_start;
|
||||
|
||||
if (x_scale_end)
|
||||
*x_scale_end = priv->x_scale_end;
|
||||
|
||||
if (y_scale_start)
|
||||
*y_scale_start = priv->y_scale_start;
|
||||
|
||||
if (y_scale_end)
|
||||
*y_scale_end = priv->y_scale_end;
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
|
||||
#define __CLUTTER_BEHAVIOUR_SCALE_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR_SCALE (clutter_behaviour_scale_get_type ())
|
||||
#define CLUTTER_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
|
||||
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
|
||||
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE))
|
||||
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE))
|
||||
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
|
||||
|
||||
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
|
||||
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
|
||||
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourScale:
|
||||
*
|
||||
* The #ClutterBehaviourScale struct contains only private data and
|
||||
* should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
|
||||
* and #ClutterActor:scale-y instead.
|
||||
*/
|
||||
struct _ClutterBehaviourScale
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviour parent_instance;
|
||||
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourScaleClass:
|
||||
*
|
||||
* The #ClutterBehaviourScaleClass struct contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourScaleClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviourClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate with ClutterActor:scale-x and ClutterActor:scale-y)
|
||||
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble *x_scale_start,
|
||||
gdouble *y_scale_start,
|
||||
gdouble *x_scale_end,
|
||||
gdouble *y_scale_end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */
|
@ -1,657 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour
|
||||
* @Title: ClutterBehaviour
|
||||
* @short_description: Class for providing behaviours to actors
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
|
||||
* #ClutterState instead
|
||||
*
|
||||
* #ClutterBehaviour is the base class for implementing behaviours. A
|
||||
* behaviour is a controller object for #ClutterActor<!-- -->s; you can
|
||||
* use a behaviour to control one or more properties of an actor (such
|
||||
* as its opacity, or its position). A #ClutterBehaviour is driven by
|
||||
* an "alpha function" stored inside a #ClutterAlpha object; an alpha
|
||||
* function is a function depending solely on time. The alpha function
|
||||
* computes a value which is then applied to the properties of the
|
||||
* actors driven by a behaviour.
|
||||
*
|
||||
* Clutter provides some pre-defined behaviours, like #ClutterBehaviourPath,
|
||||
* which controls the position of a set of actors making them "walk" along
|
||||
* a set of nodes; #ClutterBehaviourOpacity, which controls the opacity
|
||||
* of a set of actors; #ClutterBehaviourScale, which controls the width
|
||||
* and height of a set of actors.
|
||||
*
|
||||
* To visualize the effects of different alpha functions on a
|
||||
* #ClutterBehaviour implementation it is possible to take the
|
||||
* #ClutterBehaviourPath as an example:
|
||||
*
|
||||
* 
|
||||
*
|
||||
* The actors position between the path's end points directly correlates
|
||||
* to the #ClutterAlpha's current alpha value driving the behaviour. With
|
||||
* the #ClutterAlpha's function set to a linear ramp the actor
|
||||
* will follow the path at a constant velocity, but when changing to
|
||||
* a sine wave the actor initially accelerates before quickly
|
||||
* decelerating.
|
||||
*
|
||||
* In order to implement a new behaviour you should subclass #ClutterBehaviour
|
||||
* and override the "alpha_notify" virtual function; inside the overridden
|
||||
* function you should obtain the alpha value from the #ClutterAlpha
|
||||
* instance bound to the behaviour and apply it to the desiderd property
|
||||
* (or properties) of every actor controlled by the behaviour.
|
||||
*
|
||||
* #ClutterBehaviour is available since Clutter 0.2.
|
||||
*
|
||||
* #ClutterBehaviour and its sub-classes have been discouraged sing Clutter
|
||||
* 1.0, and formally deprecated since Clutter 1.6. You should use the
|
||||
* [implicit animation][clutter-actor-animation] support inside #ClutterActor
|
||||
* if you still have code using #ClutterBehaviour.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-alpha.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-scriptable.h"
|
||||
#include "clutter-script-private.h"
|
||||
|
||||
struct _ClutterBehaviourPrivate
|
||||
{
|
||||
ClutterAlpha *alpha;
|
||||
|
||||
guint notify_id;
|
||||
GSList *actors;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ALPHA,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
enum
|
||||
{
|
||||
APPLIED,
|
||||
REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint behave_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour,
|
||||
clutter_behaviour,
|
||||
G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (ClutterBehaviour)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
||||
clutter_scriptable_iface_init))
|
||||
|
||||
static gboolean
|
||||
clutter_behaviour_parse_custom_node (ClutterScriptable *scriptable,
|
||||
ClutterScript *script,
|
||||
GValue *value,
|
||||
const gchar *name,
|
||||
JsonNode *node)
|
||||
{
|
||||
if (strncmp (name, "alpha", 5) == 0)
|
||||
{
|
||||
GObject *alpha;
|
||||
|
||||
alpha = _clutter_script_parse_alpha (script, node);
|
||||
if (alpha != NULL)
|
||||
{
|
||||
g_value_init (value, CLUTTER_TYPE_ALPHA);
|
||||
g_value_set_object (value, alpha);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||
{
|
||||
iface->parse_custom_node = clutter_behaviour_parse_custom_node;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBehaviour *self = CLUTTER_BEHAVIOUR (gobject);
|
||||
|
||||
clutter_behaviour_set_alpha (self, NULL);
|
||||
clutter_behaviour_remove_all (self);
|
||||
|
||||
G_OBJECT_CLASS (clutter_behaviour_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ALPHA:
|
||||
clutter_behaviour_set_alpha (behaviour, g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
|
||||
ClutterBehaviourPrivate *priv = behaviour->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ALPHA:
|
||||
g_value_set_object (value, priv->alpha);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_alpha_notify_unimplemented (ClutterBehaviour *behaviour,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
g_warning ("ClutterBehaviourClass::alpha_notify not implemented for '%s'",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (behaviour)));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_class_init (ClutterBehaviourClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = clutter_behaviour_dispose;
|
||||
object_class->set_property = clutter_behaviour_set_property;
|
||||
object_class->get_property = clutter_behaviour_get_property;
|
||||
|
||||
/**
|
||||
* ClutterBehaviour:alpha:
|
||||
*
|
||||
* The #ClutterAlpha object used to drive this behaviour. A #ClutterAlpha
|
||||
* object binds a #ClutterTimeline and a function which computes a value
|
||||
* (the "alpha") depending on the time. Each time the alpha value changes
|
||||
* the alpha-notify virtual function is called.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
obj_props[PROP_ALPHA] =
|
||||
g_param_spec_object ("alpha",
|
||||
P_("Alpha"),
|
||||
P_("Alpha Object to drive the behaviour"),
|
||||
CLUTTER_TYPE_ALPHA,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class,
|
||||
PROP_LAST,
|
||||
obj_props);
|
||||
|
||||
klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented;
|
||||
|
||||
/**
|
||||
* ClutterBehaviour::applied:
|
||||
* @behaviour: the #ClutterBehaviour that received the signal
|
||||
* @actor: the actor the behaviour was applied to.
|
||||
*
|
||||
* The ::apply signal is emitted each time the behaviour is applied
|
||||
* to an actor.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
behave_signals[APPLIED] =
|
||||
g_signal_new ("applied",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterBehaviourClass, applied),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
/**
|
||||
* ClutterBehaviour::removed:
|
||||
* @behaviour: the #ClutterBehaviour that received the signal
|
||||
* @actor: the removed actor
|
||||
*
|
||||
* The ::removed signal is emitted each time a behaviour is not applied
|
||||
* to an actor anymore.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
behave_signals[REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterBehaviourClass, removed),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_init (ClutterBehaviour *self)
|
||||
{
|
||||
self->priv = clutter_behaviour_get_instance_private (self);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_actor_on_destroy (ClutterActor *actor,
|
||||
ClutterBehaviour *behaviour)
|
||||
{
|
||||
clutter_behaviour_remove (behaviour, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_apply:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Applies @behave to @actor. This function adds a reference on
|
||||
* the actor.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_apply (ClutterBehaviour *behave,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = behave->priv;
|
||||
|
||||
if (g_slist_find (priv->actors, actor))
|
||||
{
|
||||
g_warning ("The behaviour of type %s already applies "
|
||||
"to the actor of type %s",
|
||||
g_type_name (G_OBJECT_TYPE (behave)),
|
||||
g_type_name (G_OBJECT_TYPE (actor)));
|
||||
return;
|
||||
}
|
||||
|
||||
priv->actors = g_slist_append (priv->actors, g_object_ref (actor));
|
||||
g_signal_connect (actor, "destroy",
|
||||
G_CALLBACK (remove_actor_on_destroy),
|
||||
behave);
|
||||
|
||||
g_signal_emit (behave, behave_signals[APPLIED], 0, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_is_applied:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Check if @behave applied to @actor.
|
||||
*
|
||||
* Return value: TRUE if actor has behaviour. FALSE otherwise.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
gboolean
|
||||
clutter_behaviour_is_applied (ClutterBehaviour *behave,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), FALSE);
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
||||
|
||||
return (g_slist_find (behave->priv->actors, actor) != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_remove:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Removes @actor from the list of #ClutterActor<!-- -->s to which
|
||||
* @behave applies. This function removes a reference on the actor.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_remove (ClutterBehaviour *behave,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = behave->priv;
|
||||
|
||||
if (!g_slist_find (priv->actors, actor))
|
||||
{
|
||||
g_warning ("The behaviour of type %s is not applied "
|
||||
"to the actor of type %s",
|
||||
g_type_name (G_OBJECT_TYPE (behave)),
|
||||
g_type_name (G_OBJECT_TYPE (actor)));
|
||||
return;
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (actor,
|
||||
G_CALLBACK (remove_actor_on_destroy),
|
||||
behave);
|
||||
|
||||
priv->actors = g_slist_remove (priv->actors, actor);
|
||||
|
||||
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
|
||||
|
||||
g_object_unref (actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_n_actors:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Gets the number of actors this behaviour is applied too.
|
||||
*
|
||||
* Return value: The number of applied actors
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
gint
|
||||
clutter_behaviour_get_n_actors (ClutterBehaviour *behave)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), 0);
|
||||
|
||||
return g_slist_length (behave->priv->actors);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_nth_actor:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @index_: the index of an actor this behaviour is applied too.
|
||||
*
|
||||
* Gets an actor the behaviour was applied to referenced by index num.
|
||||
*
|
||||
* Return value: (transfer none): A Clutter actor or NULL if @index_ is invalid.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
|
||||
gint index_)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
|
||||
|
||||
return g_slist_nth_data (behave->priv->actors, index_);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_behaviour_actors_foreach:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @func: (scope call): a function called for each actor
|
||||
* @data: optional data to be passed to the function, or %NULL
|
||||
*
|
||||
* Calls @func for every actor driven by @behave.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
|
||||
ClutterBehaviourForeachFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
for (l = behave->priv->actors; l != NULL; l = l->next)
|
||||
{
|
||||
ClutterActor *actor = l->data;
|
||||
|
||||
g_assert (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
func (behave, actor, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_alpha:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Retrieves the #ClutterAlpha object bound to @behave.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAlpha object, or %NULL if no alpha
|
||||
* object has been bound to this behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterAlpha *
|
||||
clutter_behaviour_get_alpha (ClutterBehaviour *behave)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
|
||||
|
||||
return behave->priv->alpha;
|
||||
}
|
||||
|
||||
static void
|
||||
notify_cb (GObject *object,
|
||||
GParamSpec *param_spec,
|
||||
ClutterBehaviour *behave)
|
||||
{
|
||||
ClutterBehaviourClass *klass;
|
||||
|
||||
klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "notify::alpha");
|
||||
|
||||
/* no actors, we can stop right here */
|
||||
if (behave->priv->actors == NULL)
|
||||
return;
|
||||
|
||||
if (klass->alpha_notify != NULL)
|
||||
{
|
||||
gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "calling %s::alpha_notify (%p, %.4f)",
|
||||
g_type_name (G_TYPE_FROM_CLASS (klass)),
|
||||
behave, alpha_value);
|
||||
|
||||
klass->alpha_notify (behave, alpha_value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_set_alpha:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
|
||||
*
|
||||
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
|
||||
* is what makes a behaviour work: for each tick of the timeline
|
||||
* used by #ClutterAlpha a new value of the alpha parameter is
|
||||
* computed by the alpha function; the value should be used by
|
||||
* the #ClutterBehaviour to update one or more properties of the
|
||||
* actors to which the behaviour applies.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_set_alpha (ClutterBehaviour *behave,
|
||||
ClutterAlpha *alpha)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
|
||||
|
||||
priv = behave->priv;
|
||||
|
||||
if (priv->alpha == alpha)
|
||||
return;
|
||||
|
||||
if (priv->notify_id)
|
||||
{
|
||||
CLUTTER_NOTE (ANIMATION, "removing previous notify-id (%d)",
|
||||
priv->notify_id);
|
||||
|
||||
g_signal_handler_disconnect (priv->alpha, priv->notify_id);
|
||||
priv->notify_id = 0;
|
||||
}
|
||||
|
||||
if (priv->alpha != NULL)
|
||||
{
|
||||
CLUTTER_NOTE (ANIMATION, "removing previous alpha object");
|
||||
|
||||
g_object_unref (priv->alpha);
|
||||
priv->alpha = NULL;
|
||||
}
|
||||
|
||||
if (alpha != NULL)
|
||||
{
|
||||
priv->alpha = g_object_ref_sink (alpha);
|
||||
|
||||
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
|
||||
G_CALLBACK(notify_cb),
|
||||
behave);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "setting new alpha object (%p, notify:%d)",
|
||||
priv->alpha, priv->notify_id);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_actors:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Retrieves all the actors to which @behave applies. It is not recommended
|
||||
* for derived classes to use this in there alpha notify method but use
|
||||
* #clutter_behaviour_actors_foreach as it avoids alot of needless allocations.
|
||||
*
|
||||
* Return value: (transfer container) (element-type Clutter.Actor): a list of
|
||||
* actors. You should free the returned list with g_slist_free() when
|
||||
* finished using it.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
GSList *
|
||||
clutter_behaviour_get_actors (ClutterBehaviour *behave)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
GSList *retval, *l;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
|
||||
|
||||
priv = behave->priv;
|
||||
retval = NULL;
|
||||
for (l = priv->actors; l != NULL; l = l->next)
|
||||
retval = g_slist_prepend (retval, l->data);
|
||||
|
||||
return g_slist_reverse (retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_remove_all:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Removes every actor from the list that @behave holds.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_remove_all (ClutterBehaviour *behave)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
|
||||
priv = behave->priv;
|
||||
for (l = priv->actors; l != NULL; l = l->next)
|
||||
{
|
||||
ClutterActor *actor = l->data;
|
||||
|
||||
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
|
||||
g_signal_handlers_disconnect_by_func (actor,
|
||||
G_CALLBACK (remove_actor_on_destroy),
|
||||
behave);
|
||||
g_object_unref (actor);
|
||||
}
|
||||
|
||||
g_slist_free (priv->actors);
|
||||
priv->actors = NULL;
|
||||
}
|
@ -1,170 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_H__
|
||||
#define __CLUTTER_BEHAVIOUR_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
|
||||
|
||||
#define CLUTTER_BEHAVIOUR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
|
||||
|
||||
typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
|
||||
typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourForeachFunc:
|
||||
* @behaviour: the #ClutterBehaviour
|
||||
* @actor: an actor driven by @behaviour
|
||||
* @data: (closure): optional data passed to the function
|
||||
*
|
||||
* This function is passed to clutter_behaviour_actors_foreach() and
|
||||
* will be called for each actor driven by @behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
typedef void (*ClutterBehaviourForeachFunc) (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* ClutterBehaviour:
|
||||
*
|
||||
* #ClutterBehaviour-struct contains only private data and should
|
||||
* be accessed with the functions below.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviour
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent;
|
||||
ClutterBehaviourPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourClass:
|
||||
* @alpha_notify: virtual function, called each time the #ClutterAlpha
|
||||
* computes a new alpha value; the actors to which the behaviour applies
|
||||
* should be changed in this function. Every subclass of #ClutterBehaviour
|
||||
* must implement this virtual function
|
||||
* @applied: signal class handler for the ClutterBehaviour::applied signal
|
||||
* @removed: signal class handler for the ClutterBehaviour::removed signal
|
||||
*
|
||||
* Base class for behaviours.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
/* vfunc, not signal */
|
||||
void (*alpha_notify) (ClutterBehaviour *behave,
|
||||
gdouble alpha_value);
|
||||
|
||||
/* signals */
|
||||
void (*applied) (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
void (*removed) (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
|
||||
/*< private >*/
|
||||
/* padding, for future expansion */
|
||||
void (*_clutter_behaviour1) (void);
|
||||
void (*_clutter_behaviour2) (void);
|
||||
void (*_clutter_behaviour3) (void);
|
||||
void (*_clutter_behaviour4) (void);
|
||||
void (*_clutter_behaviour5) (void);
|
||||
void (*_clutter_behaviour6) (void);
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_apply (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_remove (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_remove_all (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
|
||||
ClutterBehaviourForeachFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_DEPRECATED
|
||||
gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
|
||||
gint index_);
|
||||
CLUTTER_DEPRECATED
|
||||
GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
|
||||
ClutterAlpha *alpha);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_H__ */
|
@ -294,7 +294,7 @@ clutter_cairo_texture_context_destroy (void *data)
|
||||
cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (cairo));
|
||||
if (cairo_width == 0 ||
|
||||
cairo_height == 0 ||
|
||||
cogl_texture == COGL_INVALID_HANDLE)
|
||||
cogl_texture == NULL)
|
||||
{
|
||||
draw_context_destroy (ctxt);
|
||||
return;
|
||||
@ -507,7 +507,7 @@ clutter_cairo_texture_create_surface (ClutterCairoTexture *self,
|
||||
cairo_stride,
|
||||
cairo_data);
|
||||
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (self), cogl_texture);
|
||||
cogl_handle_unref (cogl_texture);
|
||||
cogl_object_unref (cogl_texture);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
@ -65,16 +65,6 @@ void clutter_container_remove_valist (ClutterContaine
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_get_children)
|
||||
GList * clutter_container_get_children (ClutterContainer *container);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_container_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_container_foreach_with_internals (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
|
||||
void clutter_container_raise_child (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
|
@ -170,20 +170,6 @@ clutter_group_real_actor_removed (ClutterContainer *container,
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
|
||||
|
||||
/* Using g_list_foreach instead of iterating the list manually
|
||||
because it has better protection against the current node being
|
||||
removed. This will happen for example if someone calls
|
||||
clutter_container_foreach(container, clutter_actor_destroy) */
|
||||
g_list_foreach (priv->children, (GFunc) callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_raise (ClutterContainer *container,
|
||||
ClutterActor *actor,
|
||||
@ -285,7 +271,6 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
iface->actor_added = clutter_group_real_actor_added;
|
||||
iface->remove = clutter_group_real_remove;
|
||||
iface->actor_removed = clutter_group_real_actor_removed;
|
||||
iface->foreach = clutter_group_real_foreach;
|
||||
iface->raise = clutter_group_real_raise;
|
||||
iface->lower = clutter_group_real_lower;
|
||||
iface->sort_depth_order = clutter_group_real_sort_depth_order;
|
||||
@ -306,15 +291,14 @@ clutter_group_real_paint (ClutterActor *actor)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_pick (ClutterActor *actor,
|
||||
const ClutterColor *pick)
|
||||
clutter_group_real_pick (ClutterActor *actor)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
/* Chain up so we get a bounding box pained (if we are reactive) */
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick);
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -391,21 +375,28 @@ clutter_group_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_show_all (ClutterActor *actor)
|
||||
clutter_group_real_show_all (ClutterActor *self)
|
||||
{
|
||||
clutter_container_foreach (CLUTTER_CONTAINER (actor),
|
||||
CLUTTER_CALLBACK (clutter_actor_show),
|
||||
NULL);
|
||||
clutter_actor_show (actor);
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *actor;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &actor))
|
||||
clutter_actor_show (actor);
|
||||
|
||||
clutter_actor_show (self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_hide_all (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
|
||||
clutter_actor_hide (actor);
|
||||
clutter_container_foreach (CLUTTER_CONTAINER (actor),
|
||||
CLUTTER_CALLBACK (clutter_actor_hide),
|
||||
NULL);
|
||||
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &actor))
|
||||
clutter_actor_hide (actor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1,87 +0,0 @@
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-layout-manager.h"
|
||||
|
||||
/**
|
||||
* clutter_layout_manager_begin_animation:
|
||||
* @manager: a #ClutterLayoutManager
|
||||
* @duration: the duration of the animation, in milliseconds
|
||||
* @mode: the easing mode of the animation
|
||||
*
|
||||
* Begins an animation of @duration milliseconds, using the provided
|
||||
* easing @mode
|
||||
*
|
||||
* The easing mode can be specified either as a #ClutterAnimationMode
|
||||
* or as a logical id returned by clutter_alpha_register_func()
|
||||
*
|
||||
* The result of this function depends on the @manager implementation
|
||||
*
|
||||
* Return value: (transfer none): The #ClutterAlpha created by the
|
||||
* layout manager; the returned instance is owned by the layout
|
||||
* manager and should not be unreferenced
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
ClutterAlpha *
|
||||
clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode)
|
||||
{
|
||||
ClutterLayoutManagerClass *klass;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
|
||||
|
||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||
|
||||
return klass->begin_animation (manager, duration, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_layout_manager_end_animation:
|
||||
* @manager: a #ClutterLayoutManager
|
||||
*
|
||||
* Ends an animation started by clutter_layout_manager_begin_animation()
|
||||
*
|
||||
* The result of this call depends on the @manager implementation
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_layout_manager_end_animation (ClutterLayoutManager *manager)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
|
||||
|
||||
CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->end_animation (manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_layout_manager_get_animation_progress:
|
||||
* @manager: a #ClutterLayoutManager
|
||||
*
|
||||
* Retrieves the progress of the animation, if one has been started by
|
||||
* clutter_layout_manager_begin_animation()
|
||||
*
|
||||
* The returned value has the same semantics of the #ClutterAlpha:alpha
|
||||
* value
|
||||
*
|
||||
* Return value: the progress of the animation
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
gdouble
|
||||
clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager)
|
||||
{
|
||||
ClutterLayoutManagerClass *klass;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), 1.0);
|
||||
|
||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||
|
||||
return klass->get_animation_progress (manager);
|
||||
}
|
@ -84,7 +84,7 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
static CoglPipeline *default_color_pipeline = NULL;
|
||||
CoglPipeline *content_pipeline;
|
||||
ClutterGeometry geom;
|
||||
ClutterActorBox alloc;
|
||||
CoglColor color;
|
||||
guint8 tmp_alpha;
|
||||
|
||||
@ -92,7 +92,7 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
"painting rect '%s'",
|
||||
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
||||
: "unknown");
|
||||
clutter_actor_get_allocation_geometry (self, &geom);
|
||||
clutter_actor_get_allocation_box (self, &alloc);
|
||||
|
||||
if (G_UNLIKELY (default_color_pipeline == NULL))
|
||||
{
|
||||
@ -140,40 +140,41 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
/* We paint the border and the content only if the rectangle
|
||||
* is big enough to show them
|
||||
*/
|
||||
if ((priv->border_width * 2) < geom.width &&
|
||||
(priv->border_width * 2) < geom.height)
|
||||
if ((priv->border_width * 2) < clutter_actor_box_get_width (&alloc) &&
|
||||
(priv->border_width * 2) < clutter_actor_box_get_height (&alloc))
|
||||
{
|
||||
/* paint the border. this sucks, but it's the only way to make a border */
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
border_pipeline,
|
||||
priv->border_width, 0,
|
||||
geom.width,
|
||||
clutter_actor_box_get_width (&alloc),
|
||||
priv->border_width);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
border_pipeline,
|
||||
geom.width - priv->border_width,
|
||||
clutter_actor_box_get_width (&alloc) - priv->border_width,
|
||||
priv->border_width,
|
||||
geom.width, geom.height);
|
||||
clutter_actor_box_get_width (&alloc),
|
||||
clutter_actor_box_get_height (&alloc));
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
border_pipeline,
|
||||
0, geom.height - priv->border_width,
|
||||
geom.width - priv->border_width,
|
||||
geom.height);
|
||||
0, clutter_actor_box_get_height (&alloc) - priv->border_width,
|
||||
clutter_actor_box_get_width (&alloc) - priv->border_width,
|
||||
clutter_actor_box_get_height (&alloc));
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
border_pipeline,
|
||||
0, 0,
|
||||
priv->border_width,
|
||||
geom.height - priv->border_width);
|
||||
clutter_actor_box_get_height (&alloc) - priv->border_width);
|
||||
|
||||
/* now paint the rectangle */
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
content_pipeline,
|
||||
priv->border_width, priv->border_width,
|
||||
geom.width - priv->border_width,
|
||||
geom.height - priv->border_width);
|
||||
clutter_actor_box_get_width (&alloc) - priv->border_width,
|
||||
clutter_actor_box_get_height (&alloc) - priv->border_width);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -183,7 +184,9 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
*/
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
border_pipeline,
|
||||
0, 0, geom.width, geom.height);
|
||||
0, 0,
|
||||
clutter_actor_box_get_width (&alloc),
|
||||
clutter_actor_box_get_height (&alloc));
|
||||
}
|
||||
|
||||
cogl_object_unref (border_pipeline);
|
||||
@ -192,7 +195,9 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
{
|
||||
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||
content_pipeline,
|
||||
0, 0, geom.width, geom.height);
|
||||
0, 0,
|
||||
clutter_actor_box_get_width (&alloc),
|
||||
clutter_actor_box_get_height (&alloc));
|
||||
}
|
||||
|
||||
cogl_object_unref (content_pipeline);
|
||||
|
@ -74,20 +74,6 @@ gboolean clutter_stage_is_default (ClutterStage *stage);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_queue_redraw)
|
||||
void clutter_stage_queue_redraw (ClutterStage *stage);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_stage_set_use_fog (ClutterStage *stage,
|
||||
gboolean fog);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_stage_get_use_fog (ClutterStage *stage);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_stage_set_fog (ClutterStage *stage,
|
||||
ClutterFog *fog);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_stage_get_fog (ClutterStage *stage,
|
||||
ClutterFog *fog);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_background_color)
|
||||
void clutter_stage_set_color (ClutterStage *stage,
|
||||
|
@ -438,7 +438,7 @@ set_viewport_with_buffer_under_fbo_source (ClutterActor *fbo_source,
|
||||
* falling back to a stage sized fbo with an offset of (0,0)
|
||||
*/
|
||||
|
||||
ClutterVertex verts[4];
|
||||
graphene_point3d_t verts[4];
|
||||
float x_min = G_MAXFLOAT, y_min = G_MAXFLOAT;
|
||||
int i;
|
||||
|
||||
@ -1229,7 +1229,7 @@ clutter_texture_get_cogl_material (ClutterTexture *texture)
|
||||
* Replaces the underlying Cogl material drawn by this actor with
|
||||
* @cogl_material. A reference to the material is taken so if the
|
||||
* handle is no longer needed it should be deref'd with
|
||||
* cogl_handle_unref. Texture data is attached to the material so
|
||||
* cogl_object_unref. Texture data is attached to the material so
|
||||
* calling this function also replaces the Cogl
|
||||
* texture. #ClutterTexture requires that the material have a texture
|
||||
* layer so you should set one on the material before calling this
|
||||
@ -1302,7 +1302,7 @@ get_first_layer_index (CoglPipeline *pipeline, int *layer_index)
|
||||
*
|
||||
* Retrieves the handle to the underlying COGL texture used for drawing
|
||||
* the actor. No extra reference is taken so if you need to keep the
|
||||
* handle then you should call cogl_handle_ref() on it.
|
||||
* handle then you should call cogl_object_ref() on it.
|
||||
*
|
||||
* The texture handle returned is the first layer of the material
|
||||
* handle used by the #ClutterTexture. If you need to access the other
|
||||
@ -1342,7 +1342,7 @@ clutter_texture_get_cogl_texture (ClutterTexture *texture)
|
||||
*
|
||||
* Replaces the underlying COGL texture drawn by this actor with
|
||||
* @cogl_tex. A reference to the texture is taken so if the handle is
|
||||
* no longer needed it should be deref'd with cogl_handle_unref.
|
||||
* no longer needed it should be deref'd with cogl_object_unref.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
@ -1595,67 +1595,6 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
|
||||
error);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_texture_set_from_yuv_data:
|
||||
* @texture: A #ClutterTexture
|
||||
* @data: (array): Image data in YUV type colorspace.
|
||||
* @width: Width in pixels of image data.
|
||||
* @height: Height in pixels of image data
|
||||
* @flags: #ClutterTextureFlags
|
||||
* @error: Return location for a #GError, or %NULL.
|
||||
*
|
||||
* Sets a #ClutterTexture from YUV image data. If an error occurred,
|
||||
* %FALSE is returned and @error is set.
|
||||
*
|
||||
* The YUV support depends on the driver; the format supported by the
|
||||
* few drivers exposing this capability are not really useful.
|
||||
*
|
||||
* The proper way to convert image data in any YUV colorspace to any
|
||||
* RGB colorspace is to use a fragment shader associated with the
|
||||
* #ClutterTexture material.
|
||||
*
|
||||
* Return value: %TRUE if the texture was successfully updated
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use a custom #ClutterContent implementation and
|
||||
* set up the Cogl pipeline using a #ClutterPipelineNode with a
|
||||
* fragment shader instead.
|
||||
*/
|
||||
gboolean
|
||||
clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
const guchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
ClutterTextureFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), FALSE);
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_TEXTURE_YUV))
|
||||
{
|
||||
g_set_error (error, CLUTTER_TEXTURE_ERROR,
|
||||
CLUTTER_TEXTURE_ERROR_NO_YUV,
|
||||
"YUV textures are not supported");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Convert the flags to a CoglPixelFormat */
|
||||
if ((flags & CLUTTER_TEXTURE_YUV_FLAG_YUV2))
|
||||
{
|
||||
g_set_error (error, CLUTTER_TEXTURE_ERROR,
|
||||
CLUTTER_TEXTURE_ERROR_BAD_FORMAT,
|
||||
"YUV2 textures are not supported");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return clutter_texture_set_from_data (texture, data,
|
||||
COGL_PIXEL_FORMAT_YUV,
|
||||
width, height,
|
||||
width * 3, 3,
|
||||
error);
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_texture_async_load_complete:
|
||||
* @self: a #ClutterTexture
|
||||
|
@ -123,14 +123,6 @@ gboolean clutter_texture_get_pick_with_alpha (ClutterTexture
|
||||
CLUTTER_DEPRECATED_FOR(ClutterOffscreenEffect)
|
||||
ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_texture_set_from_yuv_data (ClutterTexture *texture,
|
||||
const guchar *data,
|
||||
gint width,
|
||||
gint height,
|
||||
ClutterTextureFlags flags,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TEXTURE_DEPRECATED_H__ */
|
||||
|
@ -127,6 +127,7 @@ clutter_sources = [
|
||||
'clutter-flatten-effect.c',
|
||||
'clutter-flow-layout.c',
|
||||
'clutter-gesture-action.c',
|
||||
'clutter-graphene.c',
|
||||
'clutter-grid-layout.c',
|
||||
'clutter-image.c',
|
||||
'clutter-input-device.c',
|
||||
@ -191,6 +192,7 @@ clutter_private_headers = [
|
||||
'clutter-effect-private.h',
|
||||
'clutter-event-private.h',
|
||||
'clutter-flatten-effect.h',
|
||||
'clutter-graphene.h',
|
||||
'clutter-gesture-action-private.h',
|
||||
'clutter-id-pool.h',
|
||||
'clutter-input-focus-private.h',
|
||||
@ -220,10 +222,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-alpha.h',
|
||||
'deprecated/clutter-animatable.h',
|
||||
'deprecated/clutter-animation.h',
|
||||
'deprecated/clutter-behaviour.h',
|
||||
'deprecated/clutter-behaviour-depth.h',
|
||||
'deprecated/clutter-behaviour-opacity.h',
|
||||
'deprecated/clutter-behaviour-scale.h',
|
||||
'deprecated/clutter-bin-layout.h',
|
||||
'deprecated/clutter-box.h',
|
||||
'deprecated/clutter-cairo-texture.h',
|
||||
@ -240,17 +238,11 @@ clutter_deprecated_headers = [
|
||||
]
|
||||
|
||||
clutter_deprecated_sources = [
|
||||
'deprecated/clutter-actor-deprecated.c',
|
||||
'deprecated/clutter-alpha.c',
|
||||
'deprecated/clutter-animation.c',
|
||||
'deprecated/clutter-behaviour.c',
|
||||
'deprecated/clutter-behaviour-depth.c',
|
||||
'deprecated/clutter-behaviour-opacity.c',
|
||||
'deprecated/clutter-behaviour-scale.c',
|
||||
'deprecated/clutter-box.c',
|
||||
'deprecated/clutter-cairo-texture.c',
|
||||
'deprecated/clutter-group.c',
|
||||
'deprecated/clutter-layout-manager-deprecated.c',
|
||||
'deprecated/clutter-rectangle.c',
|
||||
'deprecated/clutter-state.c',
|
||||
'deprecated/clutter-table-layout.c',
|
||||
@ -454,6 +446,7 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
|
||||
libmutter_clutter_dep = declare_dependency(
|
||||
sources: [clutter_enum_types[1]],
|
||||
link_with: libmutter_clutter,
|
||||
dependencies: clutter_deps,
|
||||
)
|
||||
|
||||
if have_introspection
|
||||
|
@ -276,6 +276,7 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
|
||||
gboolean allocated = FALSE;
|
||||
CoglAttribute *attributes[2];
|
||||
CoglPrimitive *prim;
|
||||
CoglIndices *indices;
|
||||
int i;
|
||||
|
||||
n_verts = node->d.texture.rectangles->len * 4;
|
||||
@ -354,22 +355,11 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
|
||||
attributes,
|
||||
2 /* n_attributes */);
|
||||
|
||||
#ifdef CLUTTER_COGL_HAS_GL
|
||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS))
|
||||
cogl_primitive_set_mode (prim, GL_QUADS);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* GLES doesn't support GL_QUADS so instead we use a VBO
|
||||
with indexed vertices to generate GL_TRIANGLES from the
|
||||
quads */
|
||||
indices =
|
||||
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
|
||||
|
||||
CoglIndices *indices =
|
||||
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
|
||||
|
||||
cogl_primitive_set_indices (prim, indices,
|
||||
node->d.texture.rectangles->len * 6);
|
||||
}
|
||||
cogl_primitive_set_indices (prim, indices,
|
||||
node->d.texture.rectangles->len * 6);
|
||||
|
||||
node->d.texture.primitive = prim;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user