Compare commits

..

3 Commits

Author SHA1 Message Date
9582f7b207 monitor-manager/kms: Get hotplug events from MetaKms
This makes it clearer that MetaMonitorManagerKms keeps updated as
MetaKms updates its state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
2019-09-03 19:14:47 +02:00
5fa38f4cd5 kms/impl-device: Add and remove connectors on hot plug
Connectors may disappear and appear on hot plugs, e.g. when a docking
station is connected, so when processing a hot plug event, make sure we
remove connectors that are now gone, and add new ones that has appeared
since last time.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/728

https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
2019-09-03 19:14:47 +02:00
0ae31a45ab kms: Add assert to check that the main thread is blocked on impl task
This is so that we can have code in impl tasks that pokes at the main
context objects.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
2019-09-03 19:14:45 +02:00
601 changed files with 43130 additions and 11687 deletions

View File

@ -1,4 +1,4 @@
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
stages:
- review
@ -28,10 +28,10 @@ build-mutter:
- merge_requests
- /^.*$/
build-without-native-backend-and-wayland:
build-without-native-backend:
stage: build
script:
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:

View File

@ -1,28 +1,39 @@
# Rebuild and push with
#
# cd .gitlab-ci/
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
#
FROM fedora:31
FROM fedora:30
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 new build-deps
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' && \
# 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 && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center && \
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 && \

View File

@ -40,12 +40,11 @@ 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 "Commit $commit_short needs a merge request or issue URL"
echo "Missing merge request or issue URL on commit $commit_short"
exit 1
fi
@ -53,8 +52,6 @@ for commit in $commits; do
if [ $? != 0 ]; then
echo "Commit message for $commit_short is not compliant:"
echo "$errors"
RET=1
exit 1
fi
done
exit $RET

View File

@ -1,5 +1,6 @@
#!/usr/bin/bash
mutter_branch=$(git describe --contains --all HEAD)
gnome_shell_target=
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
@ -25,7 +26,8 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
fi
if [ -z "$gnome_shell_target" ]; then
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
gnome_shell_target=$(git branch -r -l origin/$mutter_branch)
gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})}
gnome_shell_target=${gnome_shell_target:-origin/master}
echo Using $gnome_shell_target instead
fi

152
NEWS
View File

@ -1,155 +1,3 @@
3.35.3
======
* backends/native: Correct dy value in pinch gesture event [Yariv; !974]
* Upload clipping rectangles in parallel [Daniel; !969]
* More cogl API cleanups [Adam; !978, !977, !973]
* Fix window recording on HiDPI [Pascal; !976]
* Fix top-left pixel being insensitive to clicks [Sebastian; #893]
* Misc. bug fixes and cleanups [Daniel, Adam; !979, !980]
Contributors:
Yariv Barkan, Adam Jackson, Sebastian Keller, Pascal Nowack, Daniel van Vugt
Translators:
Fran Dieguez [gl], Dz Chen [zh_CN]
3.35.2
======
* Don't emit focus event after destruction [Marco; gnome-shell#1704, !860]
* Add a notion of pixel format planes [Niels; !858]
* Replace various Cogl/Clutter types with Graphene [Georges; !458]
* Improve CoglJournal [Georges, Jasper; !402]
* Split pick and paint [Georges; !865]
* Remove deprecated/unused cogl/clutter APIs [Adam; !866, !878, !879, !880,
!885, !900, !902, !904, !896, !913, !922, !883, !903, !921, !933, !819]
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
* Allow changing Clutter debug flags at runtime [Georges; !862]
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas; !886]
* Fix triggering popups from stylus devices o wayland [Carlos; #886]
* Fix fallback to GLES2 [Adam; #635]
* Fix buffer age checks on multiple monitors [Carlos; !906]
* Adjust to Sysprof API change [Christian; !908]
* Improve support for (X11) fullscreen games under wayland [Hans; !739]
* Support shadow framebuffers for offscreen rendering [Olivier; !877]
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
* Respect NET_WM_TRANSIENT_FOR for override-redirect windows [Marco; !920]
* Kill window effects on destroy [Robert; !924]
* Remove deprecated ClutterTexture [Jonas; !932]
* Use regions instead of bounding box for clipping and culling [Carlos; !867]
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
* Do not stack transients underneath their always-on-top parent [Florian; #587]
* Add explicit paint/pick contexts [Jonas; !935]
* Fix KMS freeze after pageflip fallback [Pekka; !953]
* Fixed crashes [Robert, Carlos, Jonas, Marco, Hans, Tim; !856, !869, !912,
!895, !928, #591, !823, !960]
* Plugged memory leaks [Niels, Robert, Carlos, Marco; !847, !868, !873, #908]
* Misc. bug fixes and cleanups [Niels, Robert, Jonas, Marco, Carlos, Daniel,
Jan, Adam, Cosimo, Florian, Thomas, Georges, Hans, Corentin, Christian,
Benjamin; !853, !822, !451, !854, !816, !857, !859, !734, !844, !851, #876,
!874, !673, !692, !888, !889, !894, !901, !905, !872, !898, !911, !918, !863,
#878, !811, !893, !925, !926, !890, !931, !927, !934, !938, !940, !947, !941,
!929, !949, !952, !871, !955, !956, !958, !907, !965, !964, !966]
Contributors:
Marco Trevisan (Treviño), Jan Alexander Steffens (heftig),
Thomas Hindoe Paaboel Andersen, Benjamin Berg, Cosimo Cecchi, Tim Crawford,
Piotr Drąg, Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
Niels De Graef, Christian Hergert, Adam Jackson, Robert Mader,
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Corentin Noël,
Pekka Paalanen, Jasper St. Pierre, Christian Rauch, Daniel van Vugt,
Jonas Ådahl
Translators:
Bruce Cowan [en_GB]
3.35.1
======
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
* 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]

View File

@ -310,7 +310,11 @@ cally_actor_finalize (GObject *obj)
_cally_actor_clean_action_list (cally_actor);
g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
if (priv->action_idle_handler)
{
g_source_remove (priv->action_idle_handler);
priv->action_idle_handler = 0;
}
if (priv->action_queue)
{
@ -653,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
ClutterActor *actor = NULL;
gint top_level_x, top_level_y;
gfloat f_width, f_height;
graphene_point3d_t verts[4];
ClutterVertex verts[4];
ClutterActor *stage = NULL;
g_return_if_fail (CALLY_IS_ACTOR (component));

View File

@ -75,8 +75,8 @@ struct _CallyRootPrivate
GSList *stage_list;
/* signals id */
gulong stage_added_id;
gulong stage_removed_id;
guint stage_added_id;
guint stage_removed_id;
};
G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
@ -149,9 +149,11 @@ cally_root_finalize (GObject *object)
stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
g_clear_signal_handler (&root->priv->stage_added_id, stage_manager);
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager);
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
}

View File

@ -247,7 +247,11 @@ cally_text_finalize (GObject *obj)
/* g_object_unref (cally_text->priv->textutil); */
/* cally_text->priv->textutil = NULL; */
g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
if (cally_text->priv->insert_idle_handler)
{
g_source_remove (cally_text->priv->insert_idle_handler);
cally_text->priv->insert_idle_handler = 0;
}
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
}
@ -1434,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
PangoLayout *layout;
PangoRectangle extents;
const gchar *text_value;
graphene_point3d_t verts[4];
ClutterVertex verts[4];
actor = CALLY_GET_CLUTTER_ACTOR (text);
if (actor == NULL) /* State is defunct */
@ -2290,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;
graphene_point3d_t verts[4];
ClutterVertex verts[4];
PangoLayout *layout;
gint x_layout, y_layout;

View File

@ -0,0 +1,98 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:cally-texture
* @Title: CallyTexture
* @short_description: Implementation of the ATK interfaces for a #ClutterTexture
* @see_also: #ClutterTexture
*
* #CallyTexture implements the required ATK interfaces of #ClutterTexture
*
* In particular it sets a proper role for the texture.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "cally-texture.h"
#include "cally-actor-private.h"
#include "deprecated/clutter-texture.h"
/* AtkObject */
static void cally_texture_real_initialize (AtkObject *obj,
gpointer data);
G_DEFINE_TYPE (CallyTexture, cally_texture, CALLY_TYPE_ACTOR)
static void
cally_texture_class_init (CallyTextureClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = cally_texture_real_initialize;
}
static void
cally_texture_init (CallyTexture *texture)
{
/* nothing to do yet */
}
/**
* cally_texture_new:
* @actor: a #ClutterActor
*
* Creates a new #CallyTexture for the given @actor. @actor must be
* a #ClutterTexture.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_texture_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_TEXTURE (actor), NULL);
object = g_object_new (CALLY_TYPE_TEXTURE, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static void
cally_texture_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_texture_parent_class)->initialize (obj, data);
/* default role */
obj->role = ATK_ROLE_IMAGE;
}

View File

@ -0,0 +1,84 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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 __CALLY_TEXTURE_H__
#define __CALLY_TEXTURE_H__
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#include <clutter/clutter.h>
#include <cally/cally-actor.h>
G_BEGIN_DECLS
#define CALLY_TYPE_TEXTURE (cally_texture_get_type ())
#define CALLY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXTURE, CallyTexture))
#define CALLY_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXTURE, CallyTextureClass))
#define CALLY_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXTURE))
#define CALLY_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXTURE))
#define CALLY_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXTURE, CallyTextureClass))
typedef struct _CallyTexture CallyTexture;
typedef struct _CallyTextureClass CallyTextureClass;
typedef struct _CallyTexturePrivate CallyTexturePrivate;
/**
* CallyTexture:
*
* The <structname>CallyTexture</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyTexture
{
/*< private >*/
CallyActor parent;
CallyTexturePrivate *priv;
};
/**
* CallyTextureClass:
*
* The <structname>CallyTextureClass</structname> structure contains
* only private data
*
* Since: 1.4
*/
struct _CallyTextureClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
CLUTTER_EXPORT
GType cally_texture_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
AtkObject *cally_texture_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_TEXTURE_H__ */

View File

@ -39,6 +39,7 @@
#include "cally-group.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-rectangle.h"
#include "cally-clone.h"
@ -55,6 +56,7 @@ CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
@ -76,6 +78,7 @@ cally_accessibility_init (void)
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXTURE, cally_texture);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);

View File

@ -32,6 +32,7 @@
#include "cally-root.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-util.h"
#undef __CALLY_H_INSIDE__

View File

@ -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 #graphene_point3d_t
* @verts: (array fixed-size=4): array of four #ClutterVertex
*
* 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 graphene_point3d_t verts[])
clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[])
{
gfloat x_1, x_2, y_1, y_2;

View File

@ -51,7 +51,7 @@
struct _ClutterActorMetaPrivate
{
ClutterActor *actor;
gulong destroy_id;
guint destroy_id;
gchar *name;
@ -91,7 +91,11 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
if (meta->priv->actor == actor)
return;
g_clear_signal_handler (&meta->priv->destroy_id, meta->priv->actor);
if (meta->priv->destroy_id != 0)
{
g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id);
meta->priv->destroy_id = 0;
}
meta->priv->actor = actor;
@ -158,8 +162,8 @@ clutter_actor_meta_finalize (GObject *gobject)
{
ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv;
if (priv->actor != NULL)
g_clear_signal_handler (&priv->destroy_id, priv->actor);
if (priv->destroy_id != 0 && priv->actor != NULL)
g_signal_handler_disconnect (priv->actor, priv->destroy_id);
g_free (priv->name);

View File

@ -135,7 +135,7 @@ struct _AnchorCoord
} fraction;
/* Use when is_fractional == FALSE */
graphene_point3d_t units;
ClutterVertex units;
} v;
};
@ -163,7 +163,7 @@ struct _SizeRequest
struct _ClutterLayoutInfo
{
/* fixed position coordinates */
graphene_point_t fixed_pos;
ClutterPoint fixed_pos;
ClutterMargin margin;
@ -173,8 +173,8 @@ struct _ClutterLayoutInfo
guint x_expand : 1;
guint y_expand : 1;
graphene_size_t minimum;
graphene_size_t natural;
ClutterSize minimum;
ClutterSize natural;
};
const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self);
@ -203,13 +203,13 @@ struct _ClutterTransformInfo
AnchorCoord anchor;
/* translation */
graphene_point3d_t translation;
ClutterVertex translation;
/* z_position */
gfloat z_position;
/* transformation center */
graphene_point_t pivot;
ClutterPoint pivot;
gfloat pivot_z;
CoglMatrix transform;
@ -242,6 +242,9 @@ 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);
@ -274,9 +277,6 @@ 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);
@ -315,6 +315,7 @@ void _clutter_actor_queue_relayout_on_clones
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
float *resource_scale);

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,6 @@
#include <clutter/clutter-types.h>
#include <clutter/clutter-event.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-pick-context.h>
G_BEGIN_DECLS
@ -230,14 +228,13 @@ struct _ClutterActorClass
void (* unrealize) (ClutterActor *self);
void (* map) (ClutterActor *self);
void (* unmap) (ClutterActor *self);
void (* paint) (ClutterActor *self,
ClutterPaintContext *paint_context);
void (* paint) (ClutterActor *self);
void (* parent_set) (ClutterActor *actor,
ClutterActor *old_parent);
void (* destroy) (ClutterActor *self);
void (* pick) (ClutterActor *actor,
ClutterPickContext *pick_context);
const ClutterColor *color);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
@ -353,17 +350,9 @@ void clutter_actor_map
CLUTTER_EXPORT
void clutter_actor_unmap (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_paint (ClutterActor *self,
ClutterPaintContext *paint_context);
void clutter_actor_paint (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_continue_paint (ClutterActor *self,
ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_actor_pick (ClutterActor *actor,
ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_actor_continue_pick (ClutterActor *actor,
ClutterPickContext *pick_context);
void clutter_actor_continue_paint (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_queue_redraw (ClutterActor *self);
CLUTTER_EXPORT
@ -442,7 +431,7 @@ void clutter_actor_get_allocation_box
CLUTTER_EXPORT
void clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor,
graphene_point3d_t *verts);
ClutterVertex verts[]);
CLUTTER_EXPORT
gboolean clutter_actor_has_allocation (ClutterActor *self);
CLUTTER_EXPORT
@ -828,16 +817,16 @@ gboolean clutter_actor_transform_stage_point
gfloat *y_out);
CLUTTER_EXPORT
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
graphene_point3d_t *verts);
ClutterVertex verts[]);
CLUTTER_EXPORT
void clutter_actor_apply_transform_to_point (ClutterActor *self,
const graphene_point3d_t *point,
graphene_point3d_t *vertex);
const ClutterVertex *point,
ClutterVertex *vertex);
CLUTTER_EXPORT
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
ClutterActor *ancestor,
const graphene_point3d_t *point,
graphene_point3d_t *vertex);
const ClutterVertex *point,
ClutterVertex *vertex);
/* Implicit animations */
CLUTTER_EXPORT
@ -915,7 +904,6 @@ void clutter_actor_bind_model_with_properties
CLUTTER_EXPORT
void clutter_actor_pick_box (ClutterActor *self,
ClutterPickContext *pick_context,
const ClutterActorBox *box);
G_END_DECLS

View File

@ -54,6 +54,7 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
@ -63,6 +64,80 @@ clutter_animatable_default_init (ClutterAnimatableInterface *iface)
{
}
/**
* clutter_animatable_animate_property:
* @animatable: a #ClutterAnimatable
* @animation: a #ClutterAnimation
* @property_name: the name of the animated property
* @initial_value: the initial value of the animation interval
* @final_value: the final value of the animation interval
* @progress: the progress factor
* @value: return location for the animation value
*
* Calls the animate_property() virtual function for @animatable.
*
* The @initial_value and @final_value #GValue<!-- -->s must contain
* the same type; @value must have been initialized to the same
* type of @initial_value and @final_value.
*
* All implementation of the #ClutterAnimatable interface must
* implement this function.
*
* Return value: %TRUE if the value has been validated and can
* be applied to the #ClutterAnimatable, and %FALSE otherwise
*
* Since: 1.0
*
* Deprecated: 1.8: Use clutter_animatable_interpolate_value()
* instead
*/
gboolean
clutter_animatable_animate_property (ClutterAnimatable *animatable,
ClutterAnimation *animation,
const gchar *property_name,
const GValue *initial_value,
const GValue *final_value,
gdouble progress,
GValue *value)
{
ClutterAnimatableInterface *iface;
gboolean res;
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), FALSE);
g_return_val_if_fail (property_name != NULL, FALSE);
g_return_val_if_fail (initial_value != NULL && final_value != NULL, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (initial_value) != G_TYPE_INVALID, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (final_value) != G_TYPE_INVALID, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (value) == G_VALUE_TYPE (initial_value) &&
G_VALUE_TYPE (value) == G_VALUE_TYPE (final_value),
FALSE);
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
if (iface->animate_property == NULL)
{
ClutterInterval *interval;
interval = clutter_animation_get_interval (animation, property_name);
if (interval == NULL)
return FALSE;
res = clutter_animatable_interpolate_value (animatable, property_name,
interval,
progress,
value);
}
else
res = iface->animate_property (animatable, animation,
property_name,
initial_value, final_value,
progress,
value);
return res;
}
/**
* clutter_animatable_find_property:
* @animatable: a #ClutterAnimatable

View File

@ -90,10 +90,13 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
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__ */

View File

@ -141,6 +141,9 @@ gint32 _clutter_backend_get_units_serial (Clutter
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
CLUTTER_EXPORT
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
void clutter_set_allowed_drivers (const char *drivers);
CLUTTER_EXPORT

View File

@ -627,7 +627,7 @@ clutter_backend_init (ClutterBackend *self)
self->units_per_em = -1.0;
self->units_serial = 1;
self->dummy_onscreen = NULL;
self->dummy_onscreen = COGL_INVALID_HANDLE;
}
void
@ -1009,6 +1009,27 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
return PANGO_DIRECTION_NEUTRAL;
}
void
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
{
GError *internal_error = NULL;
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
&internal_error))
{
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
g_error_free (internal_error);
return;
}
}
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
}
void
clutter_set_allowed_drivers (const char *drivers)
{

File diff suppressed because it is too large Load Diff

View File

@ -49,10 +49,10 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-bin-layout.h"
#include "clutter-actor-private.h"
#include "clutter-animatable.h"
#include "clutter-bin-layout.h"
#include "clutter-child-meta.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
@ -698,3 +698,187 @@ clutter_bin_layout_new (ClutterBinAlignment x_align,
"y-align", y_align,
NULL);
}
/**
* clutter_bin_layout_set_alignment:
* @self: a #ClutterBinLayout
* @child: (allow-none): a child of @container
* @x_align: the horizontal alignment policy to be used for the @child
* inside @container
* @y_align: the vertical aligment policy to be used on the @child
* inside @container
*
* Sets the horizontal and vertical alignment policies to be applied
* to a @child of @self
*
* If @child is %NULL then the @x_align and @y_align values will
* be set as the default alignment policies
*
* Since: 1.2
*
* Deprecated: 1.12: Use the #ClutterActor:x-align and
* #ClutterActor:y-align properties of #ClutterActor instead.
*/
void
clutter_bin_layout_set_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align)
{
ClutterBinLayoutPrivate *priv;
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
g_return_if_fail (child == NULL || CLUTTER_IS_ACTOR (child));
priv = self->priv;
if (priv->container == NULL)
{
if (child == NULL)
{
set_x_align (self, x_align);
set_y_align (self, y_align);
}
else
g_warning ("The layout of type '%s' must be associated to "
"a ClutterContainer before setting the alignment "
"on its children",
G_OBJECT_TYPE_NAME (self));
return;
}
manager = CLUTTER_LAYOUT_MANAGER (self);
meta = clutter_layout_manager_get_child_meta (manager,
priv->container,
child);
g_assert (CLUTTER_IS_BIN_LAYER (meta));
set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align);
set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align);
}
/**
* clutter_bin_layout_get_alignment:
* @self: a #ClutterBinLayout
* @child: (allow-none): a child of @container
* @x_align: (out) (allow-none): return location for the horizontal
* alignment policy
* @y_align: (out) (allow-none): return location for the vertical
* alignment policy
*
* Retrieves the horizontal and vertical alignment policies for
* a child of @self
*
* If @child is %NULL the default alignment policies will be returned
* instead
*
* Since: 1.2
*
* Deprecated: 1.12: Use the #ClutterActor:x-align and the
* #ClutterActor:y-align properties of #ClutterActor instead.
*/
void
clutter_bin_layout_get_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment *x_align,
ClutterBinAlignment *y_align)
{
ClutterBinLayoutPrivate *priv;
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
ClutterBinLayer *layer;
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
priv = self->priv;
if (priv->container == NULL)
{
if (child == NULL)
{
if (x_align)
*x_align = priv->x_align;
if (y_align)
*y_align = priv->y_align;
}
else
g_warning ("The layout of type '%s' must be associated to "
"a ClutterContainer before getting the alignment "
"of its children",
G_OBJECT_TYPE_NAME (self));
return;
}
manager = CLUTTER_LAYOUT_MANAGER (self);
meta = clutter_layout_manager_get_child_meta (manager,
priv->container,
child);
g_assert (CLUTTER_IS_BIN_LAYER (meta));
layer = CLUTTER_BIN_LAYER (meta);
if (x_align)
*x_align = layer->x_align;
if (y_align)
*y_align = layer->y_align;
}
/**
* clutter_bin_layout_add:
* @self: a #ClutterBinLayout
* @child: a #ClutterActor
* @x_align: horizontal alignment policy for @child
* @y_align: vertical alignment policy for @child
*
* Adds a #ClutterActor to the container using @self and
* sets the alignment policies for it
*
* This function is equivalent to clutter_container_add_actor()
* and clutter_layout_manager_child_set_property() but it does not
* require a pointer to the #ClutterContainer associated to the
* #ClutterBinLayout
*
* Since: 1.2
*
* Deprecated: 1.12: Use clutter_actor_add_child() instead.
*/
void
clutter_bin_layout_add (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align)
{
ClutterBinLayoutPrivate *priv;
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
g_return_if_fail (CLUTTER_IS_ACTOR (child));
priv = self->priv;
if (priv->container == NULL)
{
g_warning ("The layout of type '%s' must be associated to "
"a ClutterContainer before adding children",
G_OBJECT_TYPE_NAME (self));
return;
}
clutter_container_add_actor (priv->container, child);
manager = CLUTTER_LAYOUT_MANAGER (self);
meta = clutter_layout_manager_get_child_meta (manager,
priv->container,
child);
g_assert (CLUTTER_IS_BIN_LAYER (meta));
set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align);
set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align);
}

View File

@ -152,9 +152,7 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
gfloat source_width, source_height;
gfloat actor_width, actor_height;
graphene_point3d_t source_position;
source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
ClutterVertex source_position = { 0., };
if (bind->source == NULL)
return;

View File

@ -99,8 +99,7 @@ G_DEFINE_TYPE (ClutterBlurEffect,
CLUTTER_TYPE_OFFSCREEN_EFFECT);
static gboolean
clutter_blur_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
clutter_blur_effect_pre_paint (ClutterEffect *effect)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
ClutterEffectClass *parent_class;
@ -125,7 +124,7 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect,
}
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
if (parent_class->pre_paint (effect, paint_context))
if (parent_class->pre_paint (effect))
{
ClutterOffscreenEffect *offscreen_effect =
CLUTTER_OFFSCREEN_EFFECT (effect);
@ -158,12 +157,10 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect,
}
static void
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
@ -185,7 +182,7 @@ clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
gfloat cur_width, cur_height;
graphene_point3d_t origin;
ClutterVertex origin;
clutter_paint_volume_get_origin (volume, &origin);
cur_width = clutter_paint_volume_get_width (volume);

View File

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

View File

@ -328,10 +328,9 @@ clutter_canvas_init (ClutterCanvas *self)
}
static void
clutter_canvas_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root,
ClutterPaintContext *paint_context)
clutter_canvas_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root)
{
ClutterCanvas *self = CLUTTER_CANVAS (content);
ClutterCanvasPrivate *priv = self->priv;

View File

@ -105,8 +105,8 @@ struct _ClutterClickActionPrivate
{
ClutterActor *stage;
gulong event_id;
gulong capture_id;
guint event_id;
guint capture_id;
guint long_press_id;
gint long_press_threshold;
@ -202,7 +202,11 @@ click_action_emit_long_press (gpointer data)
CLUTTER_LONG_PRESS_ACTIVATE,
&result);
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
@ -257,7 +261,8 @@ click_action_cancel_long_press (ClutterClickAction *action)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_clear_handle_id (&priv->long_press_id, g_source_remove);
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
g_signal_emit (action, click_signals[LONG_PRESS], 0,
actor,
@ -370,9 +375,17 @@ on_captured_event (ClutterActor *stage,
click_action_cancel_long_press (action);
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
if (priv->long_press_id != 0)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE;
@ -440,7 +453,7 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->event_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->event_id);
priv->event_id = 0;
}
@ -448,13 +461,17 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
if (priv->long_press_id != 0)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
@ -528,12 +545,24 @@ clutter_click_action_dispose (GObject *gobject)
{
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
g_clear_signal_handler (&priv->event_id,
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
if (priv->event_id)
{
g_signal_handler_disconnect (clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)),
priv->event_id);
priv->event_id = 0;
}
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
if (priv->long_press_id)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
}
@ -731,7 +760,11 @@ clutter_click_action_release (ClutterClickAction *action)
return;
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
click_action_cancel_long_press (action);
click_action_set_held (action, FALSE);

View File

@ -152,8 +152,7 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
}
static void
clutter_clone_paint (ClutterActor *actor,
ClutterPaintContext *paint_context)
clutter_clone_paint (ClutterActor *actor)
{
ClutterClone *self = CLUTTER_CLONE (actor);
ClutterClonePrivate *priv = self->priv;
@ -190,7 +189,7 @@ clutter_clone_paint (ClutterActor *actor,
if (clutter_actor_is_realized (priv->clone_source))
{
_clutter_actor_push_clone_paint ();
clutter_actor_paint (priv->clone_source, paint_context);
clutter_actor_paint (priv->clone_source);
_clutter_actor_pop_clone_paint ();
}
@ -401,7 +400,8 @@ clutter_clone_set_source_internal (ClutterClone *self,
if (priv->clone_source != NULL)
{
g_clear_signal_handler (&priv->source_destroy_id, priv->clone_source);
g_signal_handler_disconnect (priv->clone_source, priv->source_destroy_id);
priv->source_destroy_id = 0;
_clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self));
g_object_unref (priv->clone_source);
priv->clone_source = NULL;

View File

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

View File

@ -48,7 +48,7 @@
* Constraints provide a way to build user interfaces by using
* relations between #ClutterActors, without explicit fixed
* positioning and sizing, similarly to how fluid layout managers like
* #ClutterBoxLayout lay out their children.
* #ClutterBoxLayout and #ClutterTableLayout lay out their children.
*
* Constraints are attached to a #ClutterActor, and are available
* for inspection using clutter_actor_get_constraints().

View File

@ -118,6 +118,37 @@ 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,
@ -212,6 +243,7 @@ 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;
@ -384,6 +416,33 @@ clutter_container_add_actor (ClutterContainer *container,
container_add_actor (container, actor);
}
/**
* clutter_container_add_valist: (skip)
* @container: a #ClutterContainer
* @first_actor: the first #ClutterActor to add
* @var_args: list of actors to add, followed by %NULL
*
* Alternative va_list version of clutter_container_add().
*
* This function will call #ClutterContainerIface.add(), which is a
* deprecated virtual function. The default implementation will
* call clutter_actor_add_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
*/
void
clutter_container_add_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args)
{
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
container_add_valist (container, first_actor, var_args);
}
/**
* clutter_container_remove: (skip)
* @container: a #ClutterContainer
@ -447,6 +506,42 @@ clutter_container_remove_actor (ClutterContainer *container,
container_remove_actor (container, actor);
}
/**
* clutter_container_remove_valist: (skip)
* @container: a #ClutterContainer
* @first_actor: the first #ClutterActor to add
* @var_args: list of actors to remove, followed by %NULL
*
* Alternative va_list version of clutter_container_remove().
*
* This function will call #ClutterContainerIface.remove(), which is a
* deprecated virtual function. The default implementation will call
* clutter_actor_remove_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
*/
void
clutter_container_remove_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args)
{
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
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
@ -464,9 +559,108 @@ clutter_container_remove_actor (ClutterContainer *container,
GList *
clutter_container_get_children (ClutterContainer *container)
{
GList *retval;
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
return clutter_actor_get_children (CLUTTER_ACTOR (container));
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);
}
/**

View File

@ -59,6 +59,14 @@ 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
@ -80,7 +88,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 and @remove
* Base interface for container actors. The @add, @remove and @foreach
* virtual functions must be provided by any implementation; the other
* virtual functions are optional.
*
@ -96,6 +104,13 @@ 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,

View File

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

View File

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

View File

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

View File

@ -6,6 +6,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;
#ifdef CLUTTER_ENABLE_DEBUG
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)

View File

@ -147,7 +147,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->allocation_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->allocation_id);
priv->allocation_id = 0;
}
@ -166,20 +166,18 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
}
static void
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
ClutterDeformEffectPrivate *priv = self->priv;
CoglHandle material;
CoglPipeline *pipeline;
CoglDepthState depth_state;
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
if (priv->is_dirty)
{
graphene_rect_t rect;
ClutterRect rect;
gboolean mapped_buffer;
CoglVertexP3T2C4 *verts;
ClutterActor *actor;
@ -195,8 +193,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
*/
if (clutter_offscreen_effect_get_target_rect (effect, &rect))
{
width = graphene_rect_get_width (&rect);
height = graphene_rect_get_height (&rect);
width = clutter_rect_get_width (&rect);
height = clutter_rect_get_height (&rect);
}
else
clutter_actor_get_size (actor, &width, &height);

View File

@ -5,13 +5,24 @@
#include "deprecated/clutter-actor.h"
#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"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h"
#include "deprecated/clutter-state.h"
#include "deprecated/clutter-table-layout.h"
#include "deprecated/clutter-texture.h"
#include "deprecated/clutter-timeline.h"
#undef __CLUTTER_DEPRECATED_H_INSIDE__

View File

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

View File

@ -210,8 +210,6 @@ 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

View File

@ -607,20 +607,6 @@ _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)

View File

@ -81,7 +81,7 @@ struct _ClutterDragActionPrivate
gint y_drag_threshold;
ClutterActor *drag_handle;
ClutterDragAxis drag_axis;
graphene_rect_t drag_area;
ClutterRect drag_area;
ClutterInputDevice *device;
ClutterEventSequence *sequence;
@ -315,7 +315,11 @@ emit_drag_end (ClutterDragAction *action,
goto out;
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
clutter_stage_set_motion_events_enabled (priv->stage,
priv->motion_events_enabled);
@ -474,8 +478,8 @@ clutter_drag_action_set_actor (ClutterActorMeta *meta,
old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
{
g_clear_signal_handler (&priv->button_press_id, old_actor);
g_clear_signal_handler (&priv->touch_begin_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->button_press_id);
g_signal_handler_disconnect (old_actor, priv->touch_begin_id);
}
priv->button_press_id = 0;
@ -485,7 +489,7 @@ clutter_drag_action_set_actor (ClutterActorMeta *meta,
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
@ -538,7 +542,7 @@ clutter_drag_action_real_drag_motion (ClutterDragAction *action,
if (action->priv->drag_area_set)
{
graphene_rect_t *drag_area = &action->priv->drag_area;
ClutterRect *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);
@ -664,7 +668,7 @@ clutter_drag_action_dispose (GObject *gobject)
priv->motion_events_enabled);
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
@ -677,8 +681,8 @@ clutter_drag_action_dispose (GObject *gobject)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject));
if (actor != NULL)
{
g_clear_signal_handler (&priv->button_press_id, actor);
g_clear_signal_handler (&priv->touch_begin_id, actor);
g_signal_handler_disconnect (actor, priv->button_press_id);
g_signal_handler_disconnect (actor, priv->touch_begin_id);
}
priv->button_press_id = 0;
@ -807,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"),
GRAPHENE_TYPE_RECT,
CLUTTER_TYPE_RECT,
CLUTTER_PARAM_READWRITE);
/**
@ -1263,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 #graphene_rect_t to be filled
* @drag_area: (out caller-allocates): a #ClutterRect to be filled
*
* Retrieves the "drag area" associated with @action, that
* is a #graphene_rect_t that constrains the actor movements,
* is a #ClutterRect that constrains the actor movements,
* in parents coordinates.
*
* Returns: %TRUE if the actor is actually constrained (and thus
@ -1274,7 +1278,7 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
*/
gboolean
clutter_drag_action_get_drag_area (ClutterDragAction *action,
graphene_rect_t *drag_area)
ClutterRect *drag_area)
{
g_return_val_if_fail (CLUTTER_IS_DRAG_ACTION (action), FALSE);
@ -1294,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 graphene_rect_t *drag_area)
clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area)
{
ClutterDragActionPrivate *priv;

View File

@ -141,11 +141,11 @@ void clutter_drag_action_get_motion_coords (ClutterDragAction *actio
CLUTTER_EXPORT
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
graphene_rect_t *drag_area);
ClutterRect *drag_area);
CLUTTER_EXPORT
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
const graphene_rect_t *drag_area);
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area);
G_END_DECLS

View File

@ -107,7 +107,7 @@ drop_target_free (gpointer _data)
{
DropTarget *data = _data;
g_clear_signal_handler (&data->capture_id, data->stage);
g_signal_handler_disconnect (data->stage, data->capture_id);
g_hash_table_destroy (data->actions);
g_free (data);
}
@ -326,10 +326,12 @@ clutter_drop_action_set_actor (ClutterActorMeta *meta,
{
drop_action_unregister (CLUTTER_DROP_ACTION (meta));
g_clear_signal_handler (&priv->mapped_id, priv->actor);
if (priv->mapped_id != 0)
g_signal_handler_disconnect (priv->actor, priv->mapped_id);
priv->stage = NULL;
priv->actor = NULL;
priv->mapped_id = 0;
}
priv->actor = actor;

View File

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

View File

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

View File

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

View File

@ -970,6 +970,8 @@ 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.
@ -985,6 +987,8 @@ 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),
@ -1183,6 +1187,29 @@ typedef enum /*< prefix=CLUTTER_PAN >*/
CLUTTER_PAN_AXIS_AUTO
} ClutterPanAxis;
/**
* ClutterTableAlignment:
* @CLUTTER_TABLE_ALIGNMENT_START: Align the child to the top or to the
* left of a cell in the table, depending on the axis
* @CLUTTER_TABLE_ALIGNMENT_CENTER: Align the child to the center of
* a cell in the table
* @CLUTTER_TABLE_ALIGNMENT_END: Align the child to the bottom or to the
* right of a cell in the table, depending on the axis
*
* The alignment policies available on each axis of the #ClutterTableLayout
*
* Since: 1.4
*
* Deprecated: 1.22: Use the alignment properties of #ClutterActor
*/
typedef enum
{
CLUTTER_TABLE_ALIGNMENT_START,
CLUTTER_TABLE_ALIGNMENT_CENTER,
CLUTTER_TABLE_ALIGNMENT_END
} ClutterTableAlignment;
/**
* ClutterTextureFlags:
* @CLUTTER_TEXTURE_NONE: No flags
@ -1190,7 +1217,8 @@ typedef enum /*< prefix=CLUTTER_PAN >*/
* @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag
* @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag
*
* Flags for clutter_texture_set_from_rgb_data().
* Flags for clutter_texture_set_from_rgb_data() and
* clutter_texture_set_from_yuv_data().
*
* Since: 0.4
*

View File

@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
gfloat *x,
gfloat *y)
{
graphene_point_t coords;
ClutterPoint 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 #graphene_point_t
* @position: a #ClutterPoint
*
* Retrieves the event coordinates as a #graphene_point_t.
* Retrieves the event coordinates as a #ClutterPoint.
*
* Since: 1.12
*/
void
clutter_event_get_position (const ClutterEvent *event,
graphene_point_t *position)
ClutterPoint *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:
graphene_point_init (position, 0.f, 0.f);
clutter_point_init (position, 0.f, 0.f);
break;
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
graphene_point_init (position, event->crossing.x, event->crossing.y);
clutter_point_init (position, event->crossing.x, event->crossing.y);
break;
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
graphene_point_init (position, event->button.x, event->button.y);
clutter_point_init (position, event->button.x, event->button.y);
break;
case CLUTTER_MOTION:
graphene_point_init (position, event->motion.x, event->motion.y);
clutter_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:
graphene_point_init (position, event->touch.x, event->touch.y);
clutter_point_init (position, event->touch.x, event->touch.y);
break;
case CLUTTER_SCROLL:
graphene_point_init (position, event->scroll.x, event->scroll.y);
clutter_point_init (position, event->scroll.x, event->scroll.y);
break;
case CLUTTER_TOUCHPAD_PINCH:
graphene_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y);
clutter_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y);
break;
case CLUTTER_TOUCHPAD_SWIPE:
graphene_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y);
clutter_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)
{
graphene_point_t p0, p1;
ClutterPoint p0, p1;
clutter_event_get_position (source, &p0);
clutter_event_get_position (source, &p1);
return graphene_point_distance (&p0, &p1, NULL, NULL);
return clutter_point_distance (&p0, &p1, NULL, NULL);
}
/**
@ -1822,17 +1822,17 @@ double
clutter_event_get_angle (const ClutterEvent *source,
const ClutterEvent *target)
{
graphene_point_t p0, p1;
ClutterPoint p0, p1;
float x_distance, y_distance;
double angle;
clutter_event_get_position (source, &p0);
clutter_event_get_position (target, &p1);
if (graphene_point_equal (&p0, &p1))
if (clutter_point_equals (&p0, &p1))
return 0;
graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
clutter_point_distance (&p0, &p1, &x_distance, &y_distance);
angle = atan2 (x_distance, y_distance);
@ -2161,9 +2161,9 @@ clutter_event_get_scroll_source (const ClutterEvent *event)
ClutterScrollFinishFlags
clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_FINISHED_NONE);
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_SOURCE_UNKNOWN);
g_return_val_if_fail (event->type == CLUTTER_SCROLL,
CLUTTER_SCROLL_FINISHED_NONE);
CLUTTER_SCROLL_SOURCE_UNKNOWN);
return event->scroll.finish_flags;
}

View File

@ -686,7 +686,7 @@ void clutter_event_get_coords (const ClutterEv
gfloat *y);
CLUTTER_EXPORT
void clutter_event_get_position (const ClutterEvent *event,
graphene_point_t *position);
ClutterPoint *position);
CLUTTER_EXPORT
float clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target);

View File

@ -33,6 +33,8 @@
*
* 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"
@ -58,13 +60,20 @@ typedef struct ClutterFeatures
static ClutterFeatures* __features = NULL;
static ClutterFeatureFlags
clutter_features_from_cogl (void)
clutter_features_from_cogl (guint cogl_flags)
{
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;
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
if (cogl_flags & COGL_FEATURE_OFFSCREEN)
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
return clutter_flags;
}
@ -92,7 +101,7 @@ _clutter_feature_init (GError **error)
if (!_clutter_backend_create_context (context->backend, error))
return FALSE;
__features->flags = (clutter_features_from_cogl ()
__features->flags = (clutter_features_from_cogl (cogl_get_features ())
| _clutter_backend_get_features (context->backend));
__features->features_set = TRUE;

View File

@ -118,7 +118,7 @@ struct _ClutterGestureActionPrivate
gint requested_nb_points;
GArray *points;
gulong actor_capture_id;
guint actor_capture_id;
gulong stage_capture_id;
ClutterGestureTriggerEdge edge;
@ -308,7 +308,11 @@ cancel_gesture (ClutterGestureAction *action)
priv->in_gesture = FALSE;
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
if (priv->stage_capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
priv->stage_capture_id = 0;
}
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
@ -477,8 +481,11 @@ stage_captured_event_cb (ClutterActor *stage,
break;
}
if (priv->points->len == 0)
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
if (priv->points->len == 0 && priv->stage_capture_id)
{
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
priv->stage_capture_id = 0;
}
return CLUTTER_EVENT_PROPAGATE;
}
@ -531,7 +538,7 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->actor_capture_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->actor_capture_id);
priv->actor_capture_id = 0;
}
@ -539,7 +546,7 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
if (priv->stage_capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
priv->stage_capture_id = 0;
priv->stage = NULL;

View File

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

View File

@ -44,12 +44,12 @@
* SECTION:clutter-grid-layout
* @Short_description: A layout manager for a grid of actors
* @Title: ClutterGridLayout
* @See_also: #ClutterBoxLayout
* @See_also: #ClutterTableLayout, #ClutterBoxLayout
*
* #ClutterGridLayout is a layout manager which arranges its child widgets in
* rows and columns. It is a very similar to #ClutterBoxLayout, but it
* consistently uses #ClutterActor's alignment and expansion flags instead of
* custom child properties.
* rows and columns. It is a very similar to #ClutterTableLayout and
* #ClutterBoxLayout, but it consistently uses #ClutterActor's
* alignment and expansion flags instead of custom child properties.
*
* Children are added using clutter_grid_layout_attach(). They can span
* multiple rows or columns. It is also possible to add a child next to an

View File

@ -118,10 +118,9 @@ clutter_image_init (ClutterImage *self)
}
static void
clutter_image_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root,
ClutterPaintContext *paint_context)
clutter_image_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root)
{
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
ClutterPaintNode *node;

View File

@ -991,7 +991,7 @@ clutter_input_device_get_enabled (ClutterInputDevice *device)
gboolean
clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point)
ClutterPoint *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;
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
ClutterPoint point = { -1, -1 };
ClutterInputDeviceType device_type = device->device_type;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&

View File

@ -58,7 +58,7 @@ gint clutter_input_device_get_device_id (ClutterInputDev
CLUTTER_EXPORT
gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point);
ClutterPoint *point);
CLUTTER_EXPORT
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
CLUTTER_EXPORT

View File

@ -89,8 +89,8 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
}
void
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const graphene_rect_t *rect)
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect)
{
ClutterInputFocusPrivate *priv;

View File

@ -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 graphene_rect_t *rect);
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect);
CLUTTER_EXPORT
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,

View File

@ -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 graphene_rect_t *rect);
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
const ClutterRect *rect);
void clutter_input_method_set_surrounding (ClutterInputMethod *method,
const gchar *text,
guint cursor,

View File

@ -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, GRAPHENE_TYPE_RECT);
G_TYPE_NONE, 1, CLUTTER_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 graphene_rect_t *rect)
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
const ClutterRect *rect)
{
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));

View File

@ -42,8 +42,8 @@ struct _ClutterInputMethodClass
void (* reset) (ClutterInputMethod *im);
void (* set_cursor_location) (ClutterInputMethod *im,
const graphene_rect_t *rect);
void (* set_cursor_location) (ClutterInputMethod *im,
const ClutterRect *rect);
void (* set_surrounding) (ClutterInputMethod *im,
const gchar *text,
guint cursor,

View File

@ -197,8 +197,8 @@ stop_secondary_click_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->secondary_click_timer)
{
g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
g_source_remove);
g_source_remove (device->ptr_a11y_data->secondary_click_timer);
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
@ -511,7 +511,8 @@ stop_dwell_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->dwell_timer)
{
g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
g_source_remove (device->ptr_a11y_data->dwell_timer);
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE;
g_signal_emit_by_name (device->device_manager,

View File

@ -58,6 +58,10 @@ die "Could not open file keysymdef.h: $!\n"
die "Could not open file clutter-keysyms.h: $!\n"
unless open(OUT_KEYSYMS, ">:utf8", "clutter-keysyms.h");
# Output: clutter/clutter/deprecated/clutter-keysyms.h
die "Could not open file clutter-keysyms-compat.h: $!\n"
unless open(OUT_KEYSYMS_COMPAT, ">:utf8", "deprecated/clutter-keysyms.h");
my $LICENSE_HEADER= <<EOF;
/* Clutter
*
@ -81,6 +85,7 @@ my $LICENSE_HEADER= <<EOF;
EOF
print OUT_KEYSYMS $LICENSE_HEADER;
print OUT_KEYSYMS_COMPAT $LICENSE_HEADER;
print OUT_KEYSYMS<<EOF;
@ -99,6 +104,23 @@ print OUT_KEYSYMS<<EOF;
EOF
print OUT_KEYSYMS_COMPAT<<EOF;
/*
* Compatibility version of clutter-keysyms.h.
*
* Since Clutter 1.4, the key symbol defines have been changed to have
* a KEY_ prefix. This is a compatibility header that is included when
* deprecated symbols are enabled. Consider porting to the new names
* instead.
*/
#ifndef __CLUTTER_KEYSYMS_DEPRECATED_H__
#define __CLUTTER_KEYSYMS_DEPRECATED_H__
#ifndef CLUTTER_DISABLE_DEPRECATED
EOF
while (<IN_KEYSYMDEF>)
{
next if ( ! /^#define / );
@ -115,8 +137,13 @@ while (<IN_KEYSYMDEF>)
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XK_/CLUTTER_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XK_/CLUTTER_/g;
my $deprecation = "CLUTTER_DEPRECATED_MACRO_FOR(\"Deprecated key symbol. Use $binding instead.\")";
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x %s\n", $compat_binding, hex($keysymelements[2]), $deprecation;
}
close IN_KEYSYMDEF;
@ -160,8 +187,11 @@ while (<IN_XF86KEYSYM>)
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XF86XK_/CLUTTER_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XF86XK_/CLUTTER_/g;
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
}
close IN_XF86KEYSYM;
@ -172,6 +202,13 @@ print OUT_KEYSYMS<<EOF;
#endif /* __CLUTTER_KEYSYMS_H__ */
EOF
print OUT_KEYSYMS_COMPAT<<EOF;
#endif /* CLUTTER_DISABLE_DEPRECATED */
#endif /* __CLUTTER_KEYSYMS_DEPRECATED_H__ */
EOF
foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
unlink $f or die "Unable to delete $f: $!";
}

View File

@ -98,11 +98,11 @@
* |[
* {
* "type" : "ClutterBox",
* "layout-manager" : { "type" : "ClutterGridLayout" },
* "layout-manager" : { "type" : "ClutterTableLayout" },
* "children" : [
* {
* "type" : "ClutterText",
* "text" : "Some text",
* "type" : "ClutterTexture",
* "filename" : "image-00.png",
*
* "layout::row" : 0,
* "layout::column" : 0,
@ -112,8 +112,8 @@
* "layout::y-expand" : true
* },
* {
* "type" : "ClutterText",
* "text" : "Some more text",
* "type" : "ClutterTexture",
* "filename" : "image-01.png",
*
* "layout::row" : 0,
* "layout::column" : 1,
@ -329,6 +329,9 @@ 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);
@ -372,6 +375,9 @@ 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);

View File

@ -213,6 +213,15 @@ 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__ */

View File

@ -59,7 +59,6 @@
#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"
@ -2195,8 +2194,6 @@ clutter_base_init (void)
/* initialise the Big Clutter Lock™ if necessary */
clutter_threads_init_default ();
clutter_graphene_init ();
}
}
@ -2311,7 +2308,8 @@ clutter_threads_remove_repaint_func (guint handle_id)
* that it does not block, otherwise the frame time budget may be lost.
*
* A repaint function is useful to ensure that an update of the scenegraph
* is performed before the scenegraph is repainted. By default, a repaint
* is performed before the scenegraph is repainted; for instance, uploading
* a frame from a video into a #ClutterTexture. By default, a repaint
* function added using this function will be invoked prior to the frame
* being processed.
*
@ -2360,7 +2358,8 @@ clutter_threads_add_repaint_func (GSourceFunc func,
* that it does not block, otherwise the frame time budget may be lost.
*
* A repaint function is useful to ensure that an update of the scenegraph
* is performed before the scenegraph is repainted. The @flags passed to this
* is performed before the scenegraph is repainted; for instance, uploading
* a frame from a video into a #ClutterTexture. The @flags passed to this
* function will determine the section of the frame processing that will
* result in @func being called.
*
@ -2603,36 +2602,6 @@ 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)
{

View File

@ -34,45 +34,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;
/**
* CLUTTER_INIT_ERROR:
*
@ -197,15 +158,6 @@ 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

View File

@ -74,7 +74,6 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-actor-box-private.h"
@ -87,7 +86,7 @@ struct _ClutterOffscreenEffectPrivate
ClutterActor *actor;
ClutterActor *stage;
graphene_point3d_t position;
ClutterVertex position;
int fbo_offset_x;
int fbo_offset_y;
@ -118,7 +117,11 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
meta_class->set_actor (meta, actor);
/* clear out the previous state */
g_clear_pointer (&priv->offscreen, cogl_object_unref);
if (priv->offscreen != NULL)
{
cogl_handle_unref (priv->offscreen);
priv->offscreen = NULL;
}
/* we keep a back pointer here, to avoid going through the ActorMeta */
priv->actor = clutter_actor_meta_get_actor (meta);
@ -194,8 +197,17 @@ update_fbo (ClutterEffect *effect,
ensure_pipeline_filter_for_scale (self, resource_scale);
}
g_clear_pointer (&priv->texture, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
if (priv->texture != NULL)
{
cogl_handle_unref (priv->texture);
priv->texture = NULL;
}
if (priv->offscreen != NULL)
{
cogl_handle_unref (priv->offscreen);
priv->offscreen = NULL;
}
priv->texture =
clutter_offscreen_effect_create_texture (self, target_width, target_height);
@ -212,7 +224,7 @@ update_fbo (ClutterEffect *effect,
{
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
cogl_object_unref (priv->target);
cogl_handle_unref (priv->target);
priv->target = NULL;
priv->target_width = 0;
@ -225,8 +237,7 @@ update_fbo (ClutterEffect *effect,
}
static gboolean
clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
@ -237,14 +248,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
CoglColor transparent;
gfloat stage_width, stage_height;
gfloat target_width = -1, target_height = -1;
CoglFramebuffer *framebuffer;
gfloat resource_scale;
gfloat ceiled_resource_scale;
graphene_point3d_t local_offset;
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
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;
@ -302,10 +310,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
if (!update_fbo (effect, target_width, target_height, resource_scale))
return FALSE;
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
cogl_get_modelview_matrix (&old_modelview);
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen);
/* let's draw offscreen */
cogl_push_framebuffer (priv->offscreen);
/* We don't want the FBO contents to be transformed. That could waste memory
* (e.g. during zoom), or result in something that's not rectangular (clipped
@ -315,7 +323,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
* contents on screen...
*/
clutter_actor_get_transform (priv->stage, &modelview);
cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview);
cogl_set_modelview_matrix (&modelview);
/* Save the original viewport for calculating priv->position */
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
@ -327,11 +335,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
/* Set up the viewport so that it has the same size as the stage (avoid
* distortion), but translated to account for the FBO offset...
*/
cogl_framebuffer_set_viewport (priv->offscreen,
-priv->fbo_offset_x,
-priv->fbo_offset_y,
stage_width,
stage_height);
cogl_set_viewport (-priv->fbo_offset_x,
-priv->fbo_offset_y,
stage_width,
stage_height);
/* Copy the stage's projection matrix across to the framebuffer */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
@ -348,15 +355,14 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
&priv->position,
1);
cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection);
cogl_set_projection_matrix (&projection);
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
cogl_framebuffer_clear (priv->offscreen,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH,
&transparent);
cogl_clear (&transparent,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH);
cogl_framebuffer_push_matrix (priv->offscreen);
cogl_push_matrix ();
/* Override the actor's opacity to fully opaque - we paint the offscreen
* texture with the actor's paint opacity, so we need to do this to avoid
@ -370,12 +376,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
}
static void
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
guint8 paint_opacity;
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
@ -401,21 +405,18 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
}
static void
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglFramebuffer *framebuffer =
clutter_paint_context_get_framebuffer (paint_context);
CoglMatrix modelview;
float resource_scale;
cogl_framebuffer_push_matrix (framebuffer);
cogl_push_matrix ();
/* The current modelview matrix is *almost* perfect already. It's only
* missing a correction for the expanded FBO and offset rendering within...
*/
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
cogl_get_modelview_matrix (&modelview);
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
resource_scale != 1.0f)
@ -428,23 +429,21 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
priv->fbo_offset_x,
priv->fbo_offset_y,
0.0f);
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
cogl_set_modelview_matrix (&modelview);
/* paint the target material; this is virtualized for
* sub-classes that require special hand-holding
*/
clutter_offscreen_effect_paint_target (effect, paint_context);
clutter_offscreen_effect_paint_target (effect);
cogl_framebuffer_pop_matrix (framebuffer);
cogl_pop_matrix ();
}
static void
clutter_offscreen_effect_post_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context)
clutter_offscreen_effect_post_paint (ClutterEffect *effect)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
CoglFramebuffer *framebuffer;
if (priv->offscreen == NULL ||
priv->target == NULL ||
@ -454,16 +453,14 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect,
/* Restore the previous opacity override */
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (framebuffer);
clutter_paint_context_pop_framebuffer (paint_context);
cogl_pop_matrix ();
cogl_pop_framebuffer ();
clutter_offscreen_effect_paint_texture (self, paint_context);
clutter_offscreen_effect_paint_texture (self);
}
static void
clutter_offscreen_effect_paint (ClutterEffect *effect,
ClutterPaintContext *paint_context,
ClutterEffectPaintFlags flags)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
@ -474,33 +471,13 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
*/
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
{
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
gboolean pre_paint_succeeded;
pre_paint_succeeded = effect_class->pre_paint (effect, paint_context);
clutter_actor_continue_paint (priv->actor, paint_context);
if (pre_paint_succeeded)
effect_class->post_paint (effect, paint_context);
else
g_clear_pointer (&priv->offscreen, cogl_object_unref);
/* Chain up to the parent paint method which will call the pre and
post paint functions to update the image */
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
paint (effect, flags);
}
else
clutter_offscreen_effect_paint_texture (self, paint_context);
}
static void
clutter_offscreen_effect_notify (GObject *gobject,
GParamSpec *pspec)
{
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject);
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
if (strcmp (pspec->name, "enabled") == 0)
g_clear_pointer (&priv->offscreen, cogl_object_unref);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec);
clutter_offscreen_effect_paint_texture (self);
}
static void
@ -509,9 +486,14 @@ clutter_offscreen_effect_finalize (GObject *gobject)
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
ClutterOffscreenEffectPrivate *priv = self->priv;
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->texture, cogl_object_unref);
g_clear_pointer (&priv->target, cogl_object_unref);
if (priv->offscreen)
cogl_handle_unref (priv->offscreen);
if (priv->target)
cogl_handle_unref (priv->target);
if (priv->texture)
cogl_handle_unref (priv->texture);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
}
@ -533,7 +515,6 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
effect_class->paint = clutter_offscreen_effect_paint;
gobject_class->finalize = clutter_offscreen_effect_finalize;
gobject_class->notify = clutter_offscreen_effect_notify;
}
static void
@ -556,7 +537,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 %NULL. The
* Return value: (transfer none): a #CoglHandle or %COGL_INVALID_HANDLE. The
* returned texture is owned by Clutter and it should not be
* modified or freed
*
@ -599,20 +580,17 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
/**
* clutter_offscreen_effect_paint_target:
* @effect: a #ClutterOffscreenEffect
* @paint_context: a #ClutterPaintContext
*
* Calls the paint_target() virtual function of the @effect
*
* Since: 1.4
*/
void
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
{
g_return_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect));
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect,
paint_context);
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect);
}
/**
@ -624,7 +602,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
* %NULL. The returned handle has its reference
* %COGL_INVALID_HANDLE. The returned handle has its reference
* count increased.
*
* Since: 1.4
@ -704,7 +682,7 @@ clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
*/
gboolean
clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
graphene_rect_t *rect)
ClutterRect *rect)
{
ClutterOffscreenEffectPrivate *priv;
@ -716,11 +694,11 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
if (priv->texture == NULL)
return FALSE;
graphene_rect_init (rect,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture));
clutter_rect_init (rect,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture));
return TRUE;
}

View File

@ -79,8 +79,7 @@ struct _ClutterOffscreenEffectClass
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
gfloat width,
gfloat height);
void (* paint_target) (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context);
void (* paint_target) (ClutterOffscreenEffect *effect);
/*< private >*/
void (* _clutter_offscreen1) (void);
@ -102,8 +101,7 @@ CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
CLUTTER_EXPORT
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context);
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
CLUTTER_EXPORT
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
gfloat width,
@ -116,7 +114,7 @@ gboolean clutter_offscreen_effect_get_target_size (ClutterOffscree
CLUTTER_EXPORT
gboolean clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
graphene_rect_t *rect);
ClutterRect *rect);
G_END_DECLS

View File

@ -1,29 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_PAINT_CONTEXT_PRIVATE_H
#define CLUTTER_PAINT_CONTEXT_PRIVATE_H
#include "clutter-paint-context.h"
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view);
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */

View File

@ -1,161 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#include "clutter-paint-context-private.h"
struct _ClutterPaintContext
{
grefcount ref_count;
GList *framebuffers;
ClutterStageView *view;
};
G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
clutter_paint_context_ref,
clutter_paint_context_unref)
ClutterPaintContext *
clutter_paint_context_new_for_view (ClutterStageView *view)
{
ClutterPaintContext *paint_context;
CoglFramebuffer *framebuffer;
paint_context = g_new0 (ClutterPaintContext, 1);
g_ref_count_init (&paint_context->ref_count);
paint_context->view = view;
framebuffer = clutter_stage_view_get_framebuffer (view);
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
return paint_context;
}
/**
* clutter_paint_context_new_for_framebuffer: (skip)
*/
ClutterPaintContext *
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
{
ClutterPaintContext *paint_context;
paint_context = g_new0 (ClutterPaintContext, 1);
g_ref_count_init (&paint_context->ref_count);
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
return paint_context;
}
ClutterPaintContext *
clutter_paint_context_ref (ClutterPaintContext *paint_context)
{
g_ref_count_inc (&paint_context->ref_count);
return paint_context;
}
static void
clutter_paint_context_dispose (ClutterPaintContext *paint_context)
{
g_list_free_full (paint_context->framebuffers,
cogl_object_unref);
paint_context->framebuffers = NULL;
}
void
clutter_paint_context_unref (ClutterPaintContext *paint_context)
{
if (g_ref_count_dec (&paint_context->ref_count))
{
clutter_paint_context_dispose (paint_context);
g_free (paint_context);
}
}
void
clutter_paint_context_destroy (ClutterPaintContext *paint_context)
{
clutter_paint_context_dispose (paint_context);
clutter_paint_context_unref (paint_context);
}
void
clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
CoglFramebuffer *framebuffer)
{
paint_context->framebuffers = g_list_prepend (paint_context->framebuffers,
cogl_object_ref (framebuffer));
}
void
clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
{
g_return_if_fail (paint_context->framebuffers);
cogl_object_unref (paint_context->framebuffers->data);
paint_context->framebuffers =
g_list_delete_link (paint_context->framebuffers,
paint_context->framebuffers);
}
/**
* clutter_paint_context_get_framebuffer:
* @paint_context: The #ClutterPaintContext
*
* Returns: (transfer none): The #CoglFramebuffer used for drawing
*/
CoglFramebuffer *
clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context)
{
g_return_val_if_fail (paint_context->framebuffers, NULL);
return paint_context->framebuffers->data;
}
CoglFramebuffer *
clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context)
{
return g_list_last (paint_context->framebuffers)->data;
}
/**
* clutter_paint_context_get_stage_view: (skip)
*/
ClutterStageView *
clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
{
return paint_context->view;
}
/**
* clutter_paint_context_is_drawing_off_stage: (skip)
*
* Return %TRUE if the paint context is currently drawing off stage.
* This happens if there are any framebuffers pushed, and the base framebuffer
* comes from the stage view.
*/
gboolean
clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
{
if (g_list_length (paint_context->framebuffers) > 1)
return TRUE;
return !paint_context->view;
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_PAINT_CONTEXT_H
#define CLUTTER_PAINT_CONTEXT_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <glib-object.h>
#include "clutter-macros.h"
#include "clutter-stage-view.h"
typedef struct _ClutterPaintContext ClutterPaintContext;
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
CLUTTER_EXPORT
GType clutter_paint_context_get_type (void);
CLUTTER_EXPORT
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer);
CLUTTER_EXPORT
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_context_unref (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
CLUTTER_EXPORT
void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
CoglFramebuffer *framebuffer);
CLUTTER_EXPORT
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_H */

View File

@ -27,7 +27,6 @@
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-paint-node.h>
G_BEGIN_DECLS
@ -64,12 +63,9 @@ struct _ClutterPaintNodeClass
void (* finalize) (ClutterPaintNode *node);
gboolean (* pre_draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void (* draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void (* post_draw) (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
gboolean (* pre_draw) (ClutterPaintNode *node);
void (* draw) (ClutterPaintNode *node);
void (* post_draw) (ClutterPaintNode *node);
JsonNode*(* serialize) (ClutterPaintNode *node);
@ -115,8 +111,7 @@ void _clutter_paint_node_init_types (void);
gpointer _clutter_paint_node_create (GType gtype);
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor,
CoglFramebuffer *framebuffer);
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
@ -144,6 +139,30 @@ 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__ */

View File

@ -202,21 +202,18 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
}
static gboolean
clutter_paint_node_real_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_paint_node_real_pre_draw (ClutterPaintNode *node)
{
return FALSE;
}
static void
clutter_paint_node_real_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_paint_node_real_draw (ClutterPaintNode *node)
{
}
static void
clutter_paint_node_real_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_paint_node_real_post_draw (ClutterPaintNode *node)
{
}
@ -1000,30 +997,29 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
* its children, if any.
*/
void
clutter_paint_node_paint (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_paint_node_paint (ClutterPaintNode *node)
{
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
ClutterPaintNode *iter;
gboolean res;
res = klass->pre_draw (node, paint_context);
res = klass->pre_draw (node);
if (res)
{
klass->draw (node, paint_context);
klass->draw (node);
}
for (iter = node->first_child;
iter != NULL;
iter = iter->next_sibling)
{
clutter_paint_node_paint (iter, paint_context);
clutter_paint_node_paint (iter);
}
if (res)
{
klass->post_draw (node, paint_context);
klass->post_draw (node);
}
}
@ -1103,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, (intptr_t) op->op.path);
json_builder_add_int_value (builder, (gint64) op->op.path);
break;
case PAINT_OP_PRIMITIVE:
json_builder_set_member_name (builder, "primitive");
json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
json_builder_add_int_value (builder, (gint64) op->op.primitive);
break;
case PAINT_OP_INVALID:
@ -1203,10 +1199,9 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
* @node: a #ClutterPaintNode
*
* Retrieves the #CoglFramebuffer that @node will draw
* into, if it the root node has a custom framebuffer set.
* into.
*
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
* set.
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
@ -1214,9 +1209,12 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
ClutterPaintNode *root = clutter_paint_node_get_root (node);
ClutterPaintNodeClass *klass;
if (root == NULL)
return NULL;
klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
if (klass->get_framebuffer != NULL)
return klass->get_framebuffer (root);
else
return NULL;
return cogl_get_draw_framebuffer ();
}

View File

@ -50,8 +50,7 @@ CLUTTER_EXPORT
void clutter_paint_node_unref (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_paint (ClutterPaintNode *node,
ClutterPaintContext *paint_context);
void clutter_paint_node_paint (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_set_name (ClutterPaintNode *node,

View File

@ -44,7 +44,6 @@
#include "clutter-color.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h"
@ -104,12 +103,11 @@ struct _ClutterRootNode
G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_root_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_root_node_pre_draw (ClutterPaintNode *node)
{
ClutterRootNode *rnode = (ClutterRootNode *) node;
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
cogl_push_framebuffer (rnode->framebuffer);
cogl_framebuffer_clear (rnode->framebuffer,
rnode->clear_flags,
@ -119,10 +117,9 @@ clutter_root_node_pre_draw (ClutterPaintNode *node,
}
static void
clutter_root_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_root_node_post_draw (ClutterPaintNode *node)
{
clutter_paint_context_pop_framebuffer (paint_context);
cogl_pop_framebuffer ();
}
static void
@ -166,8 +163,6 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
{
ClutterRootNode *res;
g_return_val_if_fail (framebuffer, NULL);
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
cogl_color_init_from_4ub (&res->clear_color,
@ -177,52 +172,54 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
clear_color->alpha);
cogl_color_premultiply (&res->clear_color);
res->framebuffer = cogl_object_ref (framebuffer);
if (G_LIKELY (framebuffer != NULL))
res->framebuffer = cogl_object_ref (framebuffer);
else
res->framebuffer = cogl_object_ref (cogl_get_draw_framebuffer ());
res->clear_flags = clear_flags;
return (ClutterPaintNode *) res;
}
/*
* ClutterTransformNode
* Transform node
*
* A private PaintNode, that changes the modelview of its child
* nodes.
*/
struct _ClutterTransformNode
{
#define clutter_transform_node_get_type _clutter_transform_node_get_type
typedef struct _ClutterTransformNode {
ClutterPaintNode parent_instance;
CoglMatrix transform;
};
CoglMatrix modelview;
} ClutterTransformNode;
struct _ClutterTransformNodeClass
{
ClutterPaintNodeClass parent_class;
};
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_transform_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_transform_node_pre_draw (ClutterPaintNode *node)
{
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
ClutterTransformNode *tnode = (ClutterTransformNode *) node;
CoglMatrix matrix;
cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_transform (fb, &transform_node->transform);
cogl_push_matrix ();
cogl_get_modelview_matrix (&matrix);
cogl_matrix_multiply (&matrix, &matrix, &tnode->modelview);
cogl_set_modelview_matrix (&matrix);
return TRUE;
}
static void
clutter_transform_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_transform_node_post_draw (ClutterPaintNode *node)
{
CoglFramebuffer *fb =
clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_pop_matrix (fb);
cogl_pop_matrix ();
}
static void
@ -238,24 +235,18 @@ clutter_transform_node_class_init (ClutterTransformNodeClass *klass)
static void
clutter_transform_node_init (ClutterTransformNode *self)
{
cogl_matrix_init_identity (&self->transform);
cogl_matrix_init_identity (&self->modelview);
}
/*
* 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 *transform)
_clutter_transform_node_new (const CoglMatrix *modelview)
{
ClutterTransformNode *res;
res = _clutter_paint_node_create (CLUTTER_TYPE_TRANSFORM_NODE);
if (transform)
res->transform = *transform;
res = _clutter_paint_node_create (_clutter_transform_node_get_type ());
if (modelview != NULL)
res->modelview = *modelview;
return (ClutterPaintNode *) res;
}
@ -283,8 +274,7 @@ struct _ClutterDummyNode
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_dummy_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_dummy_node_pre_draw (ClutterPaintNode *node)
{
return TRUE;
}
@ -321,16 +311,6 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
return dnode->framebuffer;
}
static void
clutter_dummy_node_finalize (ClutterPaintNode *node)
{
ClutterDummyNode *dnode = (ClutterDummyNode *) node;
cogl_clear_object (&dnode->framebuffer);
CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
}
static void
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
{
@ -339,7 +319,6 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
node_class->pre_draw = clutter_dummy_node_pre_draw;
node_class->serialize = clutter_dummy_node_serialize;
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
node_class->finalize = clutter_dummy_node_finalize;
}
static void
@ -348,8 +327,7 @@ clutter_dummy_node_init (ClutterDummyNode *self)
}
ClutterPaintNode *
_clutter_dummy_node_new (ClutterActor *actor,
CoglFramebuffer *framebuffer)
_clutter_dummy_node_new (ClutterActor *actor)
{
ClutterPaintNode *res;
ClutterDummyNode *dnode;
@ -358,7 +336,7 @@ _clutter_dummy_node_new (ClutterActor *actor,
dnode = (ClutterDummyNode *) res;
dnode->actor = actor;
dnode->framebuffer = cogl_object_ref (framebuffer);
dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
return res;
}
@ -401,34 +379,22 @@ clutter_pipeline_node_finalize (ClutterPaintNode *node)
}
static gboolean
clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_pipeline_node_pre_draw (ClutterPaintNode *node)
{
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
if (node->operations != NULL &&
pnode->pipeline != NULL)
return TRUE;
{
cogl_push_source (pnode->pipeline);
return TRUE;
}
return FALSE;
}
static CoglFramebuffer *
get_target_framebuffer (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
CoglFramebuffer *framebuffer;
framebuffer = clutter_paint_node_get_framebuffer (node);
if (framebuffer)
return framebuffer;
return clutter_paint_context_get_framebuffer (paint_context);
}
static void
clutter_pipeline_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_pipeline_node_draw (ClutterPaintNode *node)
{
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
CoglFramebuffer *fb;
@ -440,7 +406,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
fb = clutter_paint_context_get_framebuffer (paint_context);
fb = clutter_paint_node_get_framebuffer (node);
for (i = 0; i < node->operations->len; i++)
{
@ -454,20 +420,18 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
break;
case PAINT_OP_TEX_RECT:
cogl_framebuffer_draw_textured_rectangle (fb,
pnode->pipeline,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
cogl_rectangle_with_texture_coords (op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (fb,
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
pnode->pipeline,
op->op.texrect[0],
op->op.texrect[1],
@ -478,7 +442,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
break;
case PAINT_OP_PATH:
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
cogl_path_fill (op->op.path);
break;
case PAINT_OP_PRIMITIVE:
@ -491,9 +455,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
}
static void
clutter_pipeline_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_pipeline_node_post_draw (ClutterPaintNode *node)
{
cogl_pop_source ();
}
static JsonNode *
@ -812,8 +776,7 @@ clutter_text_node_finalize (ClutterPaintNode *node)
}
static gboolean
clutter_text_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_text_node_pre_draw (ClutterPaintNode *node)
{
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
@ -821,8 +784,7 @@ clutter_text_node_pre_draw (ClutterPaintNode *node,
}
static void
clutter_text_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_text_node_draw (ClutterPaintNode *node)
{
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
PangoRectangle extents;
@ -832,7 +794,7 @@ clutter_text_node_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
fb = get_target_framebuffer (node, paint_context);
fb = clutter_paint_node_get_framebuffer (node);
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
@ -865,11 +827,11 @@ clutter_text_node_draw (ClutterPaintNode *node,
clipped = TRUE;
}
cogl_pango_show_layout (fb,
tnode->layout,
op->op.texrect[0],
op->op.texrect[1],
&tnode->color);
cogl_pango_render_layout (tnode->layout,
op->op.texrect[0],
op->op.texrect[1],
&tnode->color,
0);
if (clipped)
cogl_framebuffer_pop_clip (fb);
@ -1008,8 +970,7 @@ struct _ClutterClipNodeClass
G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_clip_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_clip_node_pre_draw (ClutterPaintNode *node)
{
gboolean retval = FALSE;
CoglFramebuffer *fb;
@ -1018,7 +979,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return FALSE;
fb = get_target_framebuffer (node, paint_context);
fb = clutter_paint_node_get_framebuffer (node);
for (i = 0; i < node->operations->len; i++)
{
@ -1053,8 +1014,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
}
static void
clutter_clip_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_clip_node_post_draw (ClutterPaintNode *node)
{
CoglFramebuffer *fb;
guint i;
@ -1062,7 +1022,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
if (node->operations == NULL)
return;
fb = get_target_framebuffer (node, paint_context);
fb = clutter_paint_node_get_framebuffer (node);
for (i = 0; i < node->operations->len; i++)
{
@ -1118,118 +1078,10 @@ clutter_clip_node_new (void)
}
/*
* ClutterActorNode
* ClutterLayerNode (private)
*/
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,
ClutterPaintContext *paint_context)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
return TRUE;
}
static void
clutter_actor_node_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
clutter_actor_continue_paint (actor_node->actor, paint_context);
}
static void
clutter_actor_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
}
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->post_draw = clutter_actor_node_post_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
*/
#define clutter_layer_node_get_type _clutter_layer_node_get_type
struct _ClutterLayerNode
{
@ -1257,11 +1109,9 @@ struct _ClutterLayerNodeClass
G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_layer_node_pre_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_layer_node_pre_draw (ClutterPaintNode *node)
{
ClutterLayerNode *lnode = (ClutterLayerNode *) node;
CoglFramebuffer *framebuffer;
CoglMatrix matrix;
/* if we were unable to create an offscreen buffer for this node, then
@ -1277,10 +1127,9 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
/* copy the same modelview from the current framebuffer to the one we
* are going to use
*/
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
cogl_get_modelview_matrix (&matrix);
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
cogl_push_framebuffer (lnode->offscreen);
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
@ -1298,7 +1147,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
0.f, 0.f, 0.f, 0.f);
cogl_framebuffer_push_matrix (lnode->offscreen);
cogl_push_matrix ();
/* every draw operation after this point will happen an offscreen
* framebuffer
@ -1308,18 +1157,17 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
}
static void
clutter_layer_node_post_draw (ClutterPaintNode *node,
ClutterPaintContext *paint_context)
clutter_layer_node_post_draw (ClutterPaintNode *node)
{
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
CoglFramebuffer *fb;
guint i;
/* switch to the previous framebuffer */
cogl_framebuffer_pop_matrix (lnode->offscreen);
clutter_paint_context_pop_framebuffer (paint_context);
cogl_pop_matrix ();
cogl_pop_framebuffer ();
fb = clutter_paint_context_get_framebuffer (paint_context);
fb = cogl_get_draw_framebuffer ();
for (i = 0; i < node->operations->len; i++)
{
@ -1333,20 +1181,20 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
case PAINT_OP_TEX_RECT:
/* now we need to paint the texture */
cogl_framebuffer_draw_textured_rectangle (fb,
lnode->state,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
cogl_push_source (lnode->state);
cogl_rectangle_with_texture_coords (op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
op->op.texrect[4],
op->op.texrect[5],
op->op.texrect[6],
op->op.texrect[7]);
cogl_pop_source ();
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (fb,
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
lnode->state,
op->op.texrect[0],
op->op.texrect[1],
@ -1357,7 +1205,9 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
break;
case PAINT_OP_PATH:
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
cogl_push_source (lnode->state);
cogl_path_fill (op->op.path);
cogl_pop_source ();
break;
case PAINT_OP_PRIMITIVE:
@ -1418,11 +1268,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;

View File

@ -143,25 +143,6 @@ 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))
@ -182,54 +163,6 @@ 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__ */

View File

@ -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.
*/
graphene_point3d_t vertices[8];
ClutterVertex vertices[8];
/* As an optimization for internally managed PaintVolumes we allow
* initializing ClutterPaintVolume variables allocated on the stack

View File

@ -63,7 +63,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
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 (graphene_point3d_t));
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
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 #graphene_point3d_t
* @origin: a #ClutterVertex
*
* 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 graphene_point3d_t *origin)
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const ClutterVertex *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 #graphene_point3d_t
* @vertex: (out): the return location for a #ClutterVertex
*
* 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,
graphene_point3d_t *vertex)
ClutterVertex *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;
graphene_point3d_t origin;
ClutterVertex 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;
graphene_point3d_t *vertices;
ClutterVertex *vertices;
int count;
gint i;
@ -878,9 +878,9 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
cogl_matrix_transform_points (matrix,
3,
sizeof (graphene_point3d_t),
sizeof (ClutterVertex),
pv->vertices,
sizeof (graphene_point3d_t),
sizeof (ClutterVertex),
pv->vertices,
transform_count);
@ -896,7 +896,7 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
{
int count;
int i;
graphene_point3d_t origin;
ClutterVertex 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;
graphene_point3d_t *vertices = pv->vertices;
ClutterVertex *vertices = pv->vertices;
gboolean partial = FALSE;
int i;
int j;
@ -1097,18 +1097,24 @@ _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++)
{
graphene_vec3_t v;
ClutterVertex p;
float distance;
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));
/* 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];
if (graphene_vec3_dot (&plane->n, &v) < 0)
distance = (planes[i].n[0] * p.x +
planes[i].n[1] * p.y +
planes[i].n[2] * p.z);
if (distance < 0)
out++;
}

View File

@ -27,7 +27,8 @@
* and bezier curves.
*
* A #ClutterPath contains a description of a path consisting of
* straight lines and bezier curves.
* straight lines and bezier curves. This can be used in a
* #ClutterBehaviourPath to animate an actor moving along the path.
*
* The path consists of a series of nodes. Each node is one of the
* following four types:
@ -243,6 +244,9 @@ 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
@ -263,6 +267,9 @@ 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

View File

@ -1,25 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_PICK_CONTEXT_PRIVATE_H
#define CLUTTER_PICK_CONTEXT_PRIVATE_H
#include "clutter-pick-context.h"
ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view);
#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */

View File

@ -1,83 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#include "clutter-pick-context-private.h"
struct _ClutterPickContext
{
grefcount ref_count;
CoglFramebuffer *framebuffer;
};
G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
clutter_pick_context_ref,
clutter_pick_context_unref)
ClutterPickContext *
clutter_pick_context_new_for_view (ClutterStageView *view)
{
ClutterPickContext *pick_context;
pick_context = g_new0 (ClutterPickContext, 1);
g_ref_count_init (&pick_context->ref_count);
pick_context->framebuffer =
cogl_object_ref (clutter_stage_view_get_framebuffer (view));
return pick_context;
}
ClutterPickContext *
clutter_pick_context_ref (ClutterPickContext *pick_context)
{
g_ref_count_inc (&pick_context->ref_count);
return pick_context;
}
static void
clutter_pick_context_dispose (ClutterPickContext *pick_context)
{
g_clear_pointer (&pick_context->framebuffer, cogl_object_unref);
}
void
clutter_pick_context_unref (ClutterPickContext *pick_context)
{
if (g_ref_count_dec (&pick_context->ref_count))
{
clutter_pick_context_dispose (pick_context);
g_free (pick_context);
}
}
void
clutter_pick_context_destroy (ClutterPickContext *pick_context)
{
clutter_pick_context_dispose (pick_context);
clutter_pick_context_unref (pick_context);
}
/**
* clutter_pick_context_get_framebuffer: (skip)
*/
CoglFramebuffer *
clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context)
{
return pick_context->framebuffer;
}

View File

@ -1,49 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_PICK_CONTEXT_H
#define CLUTTER_PICK_CONTEXT_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <glib-object.h>
#include "clutter-macros.h"
#include "clutter-stage-view.h"
typedef struct _ClutterPickContext ClutterPickContext;
#define CLUTTER_TYPE_PICK_CONTEXT (clutter_pick_context_get_type ())
CLUTTER_EXPORT
GType clutter_pick_context_get_type (void);
CLUTTER_EXPORT
ClutterPickContext * clutter_pick_context_ref (ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_pick_context_unref (ClutterPickContext *pick_context);
CLUTTER_EXPORT
void clutter_pick_context_destroy (ClutterPickContext *pick_context);
CLUTTER_EXPORT
CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context);
#endif /* CLUTTER_PICK_CONTEXT_H */

View File

@ -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,10 +105,12 @@ typedef enum
/* Used to avoid recursion */
CLUTTER_IN_PAINT = 1 << 5,
CLUTTER_IN_PICK = 1 << 6,
/* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 7,
CLUTTER_IN_RELAYOUT = 1 << 6,
/* a flag for internal children of Containers (DEPRECATED) */
CLUTTER_INTERNAL_CHILD = 1 << 7
} ClutterPrivateFlags;
/*
@ -222,17 +224,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 graphene_point3d_t *vertices_in,
graphene_point3d_t *vertices_out,
int n_vertices);
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_rect_from_rectangle (const cairo_rectangle_int_t *src,
graphene_rect_t *dest);
ClutterRect *dest);
void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
cairo_rectangle_int_t *dest);
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
@ -280,10 +282,10 @@ void _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
float factor);
gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
graphene_point3d_t *scale_p,
ClutterVertex *scale_p,
float shear_p[3],
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex *rotate_p,
ClutterVertex *translate_p,
ClutterVertex4 *perspective_p);
CLUTTER_EXPORT
@ -294,8 +296,8 @@ PangoDirection _clutter_pango_find_base_dir (const gchar *text,
typedef struct _ClutterPlane
{
graphene_vec3_t v0;
graphene_vec3_t n;
float v0[3];
float n[3];
} ClutterPlane;
typedef enum _ClutterCullResult
@ -313,8 +315,6 @@ 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__ */

View File

@ -352,64 +352,63 @@ _clutter_script_parse_knot (ClutterScript *script,
}
static gboolean
parse_rect_from_array (JsonArray *array,
graphene_rect_t *rect)
parse_geometry_from_array (JsonArray *array,
ClutterGeometry *geometry)
{
if (json_array_get_length (array) != 4)
return FALSE;
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));
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);
return TRUE;
}
static gboolean
parse_rect_from_object (JsonObject *object,
graphene_rect_t *rect)
parse_geometry_from_object (JsonObject *object,
ClutterGeometry *geometry)
{
if (json_object_has_member (object, "x"))
rect->origin.x = json_object_get_int_member (object, "x");
geometry->x = json_object_get_int_member (object, "x");
else
rect->origin.x = 0;
geometry->x = 0;
if (json_object_has_member (object, "y"))
rect->origin.y = json_object_get_int_member (object, "y");
geometry->y = json_object_get_int_member (object, "y");
else
rect->origin.y = 0;
geometry->y = 0;
if (json_object_has_member (object, "width"))
rect->size.width = json_object_get_int_member (object, "width");
geometry->width = json_object_get_int_member (object, "width");
else
rect->size.width = 0;
geometry->width = 0;
if (json_object_has_member (object, "height"))
rect->size.height = json_object_get_int_member (object, "height");
geometry->height = json_object_get_int_member (object, "height");
else
rect->size.height = 0;
geometry->height = 0;
return TRUE;
}
gboolean
_clutter_script_parse_rect (ClutterScript *script,
JsonNode *node,
graphene_rect_t *rect)
_clutter_script_parse_geometry (ClutterScript *script,
JsonNode *node,
ClutterGeometry *geometry)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
g_return_val_if_fail (rect != NULL, FALSE);
g_return_val_if_fail (geometry != NULL, FALSE);
switch (JSON_NODE_TYPE (node))
{
case JSON_NODE_ARRAY:
return parse_rect_from_array (json_node_get_array (node), rect);
return parse_geometry_from_array (json_node_get_array (node), geometry);
case JSON_NODE_OBJECT:
return parse_rect_from_object (json_node_get_object (node), rect);
return parse_geometry_from_object (json_node_get_object (node), geometry);
default:
break;
@ -493,8 +492,8 @@ _clutter_script_parse_color (ClutterScript *script,
}
static gboolean
parse_point_from_array (JsonArray *array,
graphene_point_t *point)
parse_point_from_array (JsonArray *array,
ClutterPoint *point)
{
if (json_array_get_length (array) != 2)
return FALSE;
@ -506,8 +505,8 @@ parse_point_from_array (JsonArray *array,
}
static gboolean
parse_point_from_object (JsonObject *object,
graphene_point_t *point)
parse_point_from_object (JsonObject *object,
ClutterPoint *point)
{
if (json_object_has_member (object, "x"))
point->x = json_object_get_double_member (object, "x");
@ -523,9 +522,9 @@ parse_point_from_object (JsonObject *object,
}
gboolean
_clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
graphene_point_t *point)
_clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
ClutterPoint *point)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
@ -547,8 +546,8 @@ _clutter_script_parse_point (ClutterScript *script,
}
static gboolean
parse_size_from_array (JsonArray *array,
graphene_size_t *size)
parse_size_from_array (JsonArray *array,
ClutterSize *size)
{
if (json_array_get_length (array) != 2)
return FALSE;
@ -560,8 +559,8 @@ parse_size_from_array (JsonArray *array,
}
static gboolean
parse_size_from_object (JsonObject *object,
graphene_size_t *size)
parse_size_from_object (JsonObject *object,
ClutterSize *size)
{
if (json_object_has_member (object, "width"))
size->width = json_object_get_double_member (object, "width");
@ -577,9 +576,9 @@ parse_size_from_object (JsonObject *object,
}
gboolean
_clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
graphene_size_t *size)
_clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
ClutterSize *size)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
@ -1329,11 +1328,11 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (p_type == GRAPHENE_TYPE_RECT)
else if (p_type == CLUTTER_TYPE_GEOMETRY)
{
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
ClutterGeometry geom = { 0, };
/* rect := {
/* geometry := {
* "x" : (int),
* "y" : (int),
* "width" : (int),
@ -1341,9 +1340,9 @@ _clutter_script_parse_node (ClutterScript *script,
* }
*/
if (_clutter_script_parse_rect (script, node, &rect))
if (_clutter_script_parse_geometry (script, node, &geom))
{
g_value_set_boxed (value, &rect);
g_value_set_boxed (value, &geom);
return TRUE;
}
}
@ -1365,9 +1364,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (p_type == GRAPHENE_TYPE_POINT)
else if (p_type == CLUTTER_TYPE_POINT)
{
graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
ClutterPoint point = CLUTTER_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point))
{
@ -1375,9 +1374,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (p_type == GRAPHENE_TYPE_SIZE)
else if (p_type == CLUTTER_TYPE_SIZE)
{
graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
ClutterSize size = CLUTTER_SIZE_INIT_ZERO;
if (_clutter_script_parse_size (script, node, &size))
{
@ -1418,15 +1417,15 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_RECT))
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_GEOMETRY))
{
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
ClutterGeometry geom = { 0, };
/* rect := [ (int), (int), (int), (int) ] */
/* geometry := [ (int), (int), (int), (int) ] */
if (_clutter_script_parse_rect (script, node, &rect))
if (_clutter_script_parse_geometry (script, node, &geom))
{
g_value_set_boxed (value, &rect);
g_value_set_boxed (value, &geom);
return TRUE;
}
}
@ -1442,9 +1441,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_POINT))
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_POINT))
{
graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
ClutterPoint point = CLUTTER_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point))
{
@ -1452,9 +1451,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_SIZE))
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_SIZE))
{
graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
ClutterSize size = CLUTTER_SIZE_INIT_ZERO;
if (_clutter_script_parse_size (script, node, &size))
{

View File

@ -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_rect (ClutterScript *script,
gboolean _clutter_script_parse_geometry (ClutterScript *script,
JsonNode *node,
graphene_rect_t *rect);
ClutterGeometry *geometry);
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,
graphene_point_t *point);
gboolean _clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
ClutterPoint *point);
gboolean _clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
graphene_size_t *size);
ClutterSize *size);
gboolean _clutter_script_parse_translatable_string (ClutterScript *script,
JsonNode *node,

View File

@ -75,6 +75,65 @@
* 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:
@ -151,6 +210,7 @@
* 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
@ -175,6 +235,7 @@
#include "clutter-actor.h"
#include "clutter-stage.h"
#include "clutter-texture.h"
#include "clutter-script.h"
#include "clutter-script-private.h"
@ -185,6 +246,7 @@
#include "clutter-debug.h"
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-state.h"
@ -462,10 +524,11 @@ 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 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 behaviours and 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.
@ -800,7 +863,9 @@ construct_each_objects (gpointer key,
if (oinfo->object == NULL)
_clutter_script_construct_object (script, oinfo);
/* this will take care of setting up properties and adding children */
/* this will take care of setting up properties,
* adding children and applying behaviours
*/
_clutter_script_apply_properties (script, oinfo);
}
}

View File

@ -56,7 +56,7 @@
struct _ClutterScrollActorPrivate
{
graphene_point_t scroll_to;
ClutterPoint 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 graphene_point_t *point)
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
const ClutterPoint *point)
{
ClutterScrollActorPrivate *priv = self->priv;
ClutterActor *actor = CLUTTER_ACTOR (self);
ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY;
float dx, dy;
if (graphene_point_equal (&priv->scroll_to, point))
if (clutter_point_equals (&priv->scroll_to, point))
return;
if (point == NULL)
graphene_point_init (&priv->scroll_to, 0.f, 0.f);
clutter_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 graphene_point_t *point = g_value_get_boxed (value);
const ClutterPoint *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",
GRAPHENE_TYPE_POINT,
CLUTTER_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 #graphene_point_t
* @point: a #ClutterPoint
*
* 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 graphene_point_t *point)
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *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,
GRAPHENE_TYPE_POINT,
CLUTTER_TYPE_POINT,
&priv->scroll_to);
clutter_transition_set_to (priv->transition,
GRAPHENE_TYPE_POINT,
CLUTTER_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 graphene_rect_t *rect)
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect)
{
graphene_rect_t n_rect;
ClutterRect 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 */
graphene_rect_normalize (&n_rect);
clutter_rect_normalize (&n_rect);
clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin);
}

View File

@ -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 graphene_point_t *point);
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point);
CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const graphene_rect_t *rect);
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect);
G_END_DECLS

View File

@ -177,18 +177,18 @@ clutter_shader_effect_clear (ClutterShaderEffect *self,
{
ClutterShaderEffectPrivate *priv = self->priv;
if (priv->shader != NULL)
if (priv->shader != COGL_INVALID_HANDLE)
{
cogl_object_unref (priv->shader);
cogl_handle_unref (priv->shader);
priv->shader = NULL;
priv->shader = COGL_INVALID_HANDLE;
}
if (priv->program != NULL)
if (priv->program != COGL_INVALID_HANDLE)
{
cogl_object_unref (priv->program);
cogl_handle_unref (priv->program);
priv->program = NULL;
priv->program = COGL_INVALID_HANDLE;
}
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 == NULL)
if (priv->program == COGL_INVALID_HANDLE)
return;
if (priv->uniforms == NULL)
@ -333,7 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
default:
g_assert_not_reached ();
return NULL;
return COGL_INVALID_HANDLE;
}
}
@ -353,7 +353,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
CLUTTER_TYPE_SHADER_EFFECT,
ClutterShaderEffectClassPrivate);
if (class_priv->shader == NULL)
if (class_priv->shader == COGL_INVALID_HANDLE)
{
gchar *source;
@ -387,16 +387,15 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
}
}
priv->shader = cogl_object_ref (class_priv->shader);
priv->shader = cogl_handle_ref (class_priv->shader);
if (class_priv->program != NULL)
priv->program = cogl_object_ref (class_priv->program);
if (class_priv->program != COGL_INVALID_HANDLE)
priv->program = cogl_handle_ref (class_priv->program);
}
}
static void
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
ClutterPaintContext *paint_context)
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
{
ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
ClutterShaderEffectPrivate *priv = self->priv;
@ -405,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 == NULL)
if (priv->shader == COGL_INVALID_HANDLE)
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 == NULL)
if (priv->program == COGL_INVALID_HANDLE)
goto out;
CLUTTER_NOTE (SHADER, "Applying the shader effect of type '%s'",
@ -426,7 +425,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
out:
/* paint the offscreen buffer */
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
parent->paint_target (effect, paint_context);
parent->paint_target (effect);
}
@ -501,7 +500,6 @@ static void
clutter_shader_effect_init (ClutterShaderEffect *effect)
{
effect->priv = clutter_shader_effect_get_instance_private (effect);
effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER;
}
/**
@ -535,7 +533,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 %NULL
* or %COGL_INVALID_HANDLE
*
* Since: 1.4
*/
@ -543,7 +541,7 @@ CoglHandle
clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
NULL);
COGL_INVALID_HANDLE);
return effect->priv->shader;
}
@ -555,7 +553,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 %NULL
* or %COGL_INVALID_HANDLE
*
* Since: 1.4
*/
@ -563,7 +561,7 @@ CoglHandle
clutter_shader_effect_get_program (ClutterShaderEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
NULL);
COGL_INVALID_HANDLE);
return effect->priv->program;
}
@ -893,7 +891,7 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
priv = effect->priv;
if (priv->shader != NULL)
if (priv->shader != COGL_INVALID_HANDLE)
return TRUE;
priv->shader = clutter_shader_effect_create_shader (effect);

View File

@ -44,6 +44,8 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "deprecated/clutter-stage-manager.h"
enum
{
PROP_0,
@ -181,6 +183,23 @@ clutter_stage_manager_get_default (void)
return context->stage_manager;
}
/**
* clutter_stage_manager_set_default_stage:
* @stage_manager: a #ClutterStageManager
* @stage: a #ClutterStage
*
* Sets @stage as the default stage.
*
* Since: 0.8
*
* Deprecated: 1.2: Calling this function has no effect
*/
void
clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
ClutterStage *stage)
{
}
/*< private >
* _clutter_stage_manager_set_default_stage:
* @stage_manager: a #ClutterStageManager

View File

@ -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 graphene_point_t *vertices,
ClutterActor *actor);
void clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices,
ClutterActor *actor);
void clutter_stage_push_pick_clip (ClutterStage *stage,
const graphene_point_t *vertices);
void clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices);
void clutter_stage_pop_pick_clip (ClutterStage *stage);
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
float x,
float y,
gint x,
gint y,
ClutterPickMode mode);
ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
@ -104,6 +104,8 @@ ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (Clut
const ClutterPaintVolume *clip);
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry);
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device,
ClutterActor *actor);
@ -131,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,
graphene_rect_t *rect,
float *view_scale);
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
ClutterRect *rect,
float *view_scale);
void _clutter_stage_presented (ClutterStage *stage,
CoglFrameEvent frame_event,

View File

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

View File

@ -30,7 +30,6 @@ enum
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
PROP_SHADOWFB,
PROP_SCALE,
PROP_LAST
@ -45,10 +44,7 @@ typedef struct _ClutterStageViewPrivate
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
CoglPipeline *offscreen_pipeline;
CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline;
CoglPipeline *pipeline;
guint dirty_viewport : 1;
guint dirty_projection : 1;
@ -82,8 +78,6 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen)
return priv->offscreen;
else if (priv->shadowfb)
return priv->shadowfb;
else
return priv->framebuffer;
}
@ -105,24 +99,6 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
return priv->framebuffer;
}
static CoglPipeline *
clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
{
CoglPipeline *pipeline;
pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (pipeline, 0,
cogl_offscreen_get_texture (framebuffer));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
return pipeline;
}
static void
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{
@ -133,27 +109,21 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
g_assert (priv->offscreen != NULL);
if (priv->offscreen_pipeline)
if (priv->pipeline)
return;
priv->offscreen_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
priv->pipeline =
cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen));
cogl_pipeline_set_layer_filters (priv->pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
cogl_offscreen_get_texture (priv->offscreen));
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
if (view_class->setup_offscreen_blit_pipeline)
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
}
static void
clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->shadowfb_pipeline)
return;
priv->shadowfb_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb);
view_class->setup_offscreen_blit_pipeline (view, priv->pipeline);
}
void
@ -162,93 +132,33 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
}
static void
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
const cairo_rectangle_int_t *rect,
CoglPipeline *pipeline,
CoglFramebuffer *src_framebuffer,
CoglFramebuffer *dst_framebuffer,
gboolean can_blit)
{
CoglMatrix matrix;
/* First, try with blit */
if (can_blit)
{
if (cogl_blit_framebuffer (src_framebuffer,
dst_framebuffer,
0, 0,
0, 0,
cogl_framebuffer_get_width (dst_framebuffer),
cogl_framebuffer_get_height (dst_framebuffer),
NULL))
return;
}
/* If blit fails, fallback to the slower painting method */
cogl_framebuffer_push_matrix (dst_framebuffer);
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (dst_framebuffer,
pipeline,
0, 0, 1, 1);
cogl_framebuffer_pop_matrix (dst_framebuffer);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
}
void
clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
if (priv->offscreen)
{
gboolean can_blit;
CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
can_blit = cogl_matrix_is_identity (&matrix);
/* Set transform so 0,0 is on the top left corner and 1,1 on
* the bottom right corner.
*/
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
if (priv->shadowfb)
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->shadowfb,
can_blit);
}
else
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->framebuffer,
can_blit);
}
}
cogl_framebuffer_draw_rectangle (priv->framebuffer,
priv->pipeline,
0, 0, 1, 1);
if (priv->shadowfb)
{
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->shadowfb_pipeline,
priv->shadowfb,
priv->framebuffer,
TRUE);
}
cogl_framebuffer_pop_matrix (priv->framebuffer);
}
float
@ -348,9 +258,6 @@ clutter_stage_view_get_property (GObject *object,
case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen);
break;
case PROP_SHADOWFB:
g_value_set_boxed (value, priv->shadowfb);
break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
break;
@ -396,9 +303,6 @@ clutter_stage_view_set_property (GObject *object,
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SHADOWFB:
priv->shadowfb = g_value_dup_boxed (value);
break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
break;
@ -415,10 +319,8 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadowfb, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
}
@ -473,15 +375,6 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SHADOWFB] =
g_param_spec_boxed ("shadowfb",
"Shadow framebuffer",
"Framebuffer used as intermediate shadow buffer",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] =
g_param_spec_float ("scale",
"View scale",

View File

@ -235,18 +235,19 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
return TRUE;
}
cairo_region_t *
_clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_redraw_clip != NULL)
return iface->get_redraw_clip (window);
if (iface->get_redraw_clip_bounds != NULL)
return iface->get_redraw_clip_bounds (window, stage_clip);
return NULL;
return FALSE;
}
void

View File

@ -55,7 +55,9 @@ struct _ClutterStageWindowInterface
cairo_rectangle_int_t *stage_rectangle);
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *clip);
void (* set_accept_focus) (ClutterStageWindow *stage_window,
gboolean accept_focus);
@ -98,7 +100,8 @@ void _clutter_stage_window_add_redraw_clip (ClutterStageWin
cairo_rectangle_int_t *stage_clip);
gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *clip);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus);

File diff suppressed because it is too large Load Diff

View File

@ -115,6 +115,26 @@ 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)
*/
@ -133,6 +153,8 @@ 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;
@ -164,6 +186,11 @@ void clutter_stage_get_minimum_size (ClutterStage
guint *width,
guint *height);
CLUTTER_EXPORT
void clutter_stage_set_no_clear_hint (ClutterStage *stage,
gboolean no_clear);
CLUTTER_EXPORT
gboolean clutter_stage_get_no_clear_hint (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_use_alpha (ClutterStage *stage,
gboolean use_alpha);
CLUTTER_EXPORT
@ -196,8 +223,8 @@ gboolean clutter_stage_event (ClutterStage
CLUTTER_EXPORT
ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage,
ClutterPickMode pick_mode,
float x,
float y);
gint x,
gint y);
CLUTTER_EXPORT
guchar * clutter_stage_read_pixels (ClutterStage *stage,
gint x,
@ -206,7 +233,8 @@ guchar * clutter_stage_read_pixels (ClutterStage
gint height);
CLUTTER_EXPORT
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip);
CLUTTER_EXPORT
void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_EXPORT

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