Compare commits
3 Commits
benzea/use
...
wip/nielsd
Author | SHA1 | Date | |
---|---|---|---|
4233ecd539 | |||
355d486502 | |||
84415f936c |
@ -1,4 +1,4 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
|
||||
stages:
|
||||
- review
|
||||
|
@ -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 graphene-devel && \
|
||||
|
||||
# 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 && \
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
65
NEWS
65
NEWS
@ -1,68 +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]
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
98
clutter/clutter/cally/cally-texture.c
Normal file
98
clutter/clutter/cally/cally-texture.c
Normal 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;
|
||||
}
|
84
clutter/clutter/cally/cally-texture.h
Normal file
84
clutter/clutter/cally/cally-texture.h
Normal 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__ */
|
@ -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);
|
||||
|
||||
|
@ -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__
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
@ -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,12 @@ 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);
|
||||
void (* pick) (ClutterActor *actor);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
@ -353,17 +349,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
|
||||
@ -915,7 +903,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
|
||||
|
@ -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
|
||||
|
@ -90,7 +90,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (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)
|
||||
|
@ -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
|
||||
|
@ -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 == NULL)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
|
||||
|
||||
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
|
||||
&internal_error))
|
||||
{
|
||||
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_set_allowed_drivers (const char *drivers)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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().
|
||||
|
@ -384,6 +384,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 +474,33 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_get_children:
|
||||
* @container: a #ClutterContainer
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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,16 +166,14 @@ 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)
|
||||
{
|
||||
|
@ -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__
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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: $!";
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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__ */
|
||||
|
@ -2311,7 +2311,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 +2361,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 +2605,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)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
||||
@ -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_object_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_object_unref (priv->texture);
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
|
||||
priv->texture =
|
||||
clutter_offscreen_effect_create_texture (self, target_width, target_height);
|
||||
@ -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,7 +248,6 @@ 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;
|
||||
@ -302,10 +312,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 +325,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 +337,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 +357,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 +378,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 +407,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 +431,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 +455,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 +473,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 +488,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_object_unref (priv->offscreen);
|
||||
|
||||
if (priv->target)
|
||||
cogl_object_unref (priv->target);
|
||||
|
||||
if (priv->texture)
|
||||
cogl_object_unref (priv->texture);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||
}
|
||||
@ -533,7 +517,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
|
||||
@ -599,20 +582,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
@ -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;
|
||||
}
|
@ -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 */
|
@ -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__ */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 ();
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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__ */
|
||||
|
@ -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
|
||||
|
@ -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 */
|
@ -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;
|
||||
}
|
@ -67,7 +67,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
|
||||
#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 +104,9 @@ 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,
|
||||
} ClutterPrivateFlags;
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -395,8 +395,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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__ */
|
||||
|
@ -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,48 @@ 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);
|
||||
g_clear_pointer (&priv->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)
|
||||
void
|
||||
clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
CoglMatrix matrix;
|
||||
|
||||
/* First, try with blit */
|
||||
if (can_blit)
|
||||
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
|
||||
if (cogl_matrix_is_identity (&matrix))
|
||||
{
|
||||
if (cogl_blit_framebuffer (src_framebuffer,
|
||||
dst_framebuffer,
|
||||
int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
|
||||
int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
|
||||
|
||||
if (cogl_blit_framebuffer (priv->offscreen,
|
||||
priv->framebuffer,
|
||||
0, 0,
|
||||
0, 0,
|
||||
cogl_framebuffer_get_width (dst_framebuffer),
|
||||
cogl_framebuffer_get_height (dst_framebuffer),
|
||||
fb_width, fb_height,
|
||||
NULL))
|
||||
return;
|
||||
}
|
||||
|
||||
/* If blit fails, fallback to the slower painting method */
|
||||
cogl_framebuffer_push_matrix (dst_framebuffer);
|
||||
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
|
||||
cogl_framebuffer_push_matrix (priv->framebuffer);
|
||||
|
||||
/* 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 (dst_framebuffer, &matrix);
|
||||
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (dst_framebuffer,
|
||||
pipeline,
|
||||
cogl_framebuffer_draw_rectangle (priv->framebuffer,
|
||||
priv->pipeline,
|
||||
0, 0, 1, 1);
|
||||
|
||||
cogl_framebuffer_pop_matrix (dst_framebuffer);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_after_paint (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
if (priv->offscreen)
|
||||
{
|
||||
gboolean can_blit;
|
||||
CoglMatrix matrix;
|
||||
|
||||
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
|
||||
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
|
||||
can_blit = cogl_matrix_is_identity (&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);
|
||||
}
|
||||
}
|
||||
|
||||
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 +273,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 +318,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 +334,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 +390,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",
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -68,9 +68,7 @@
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-pick-context-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
@ -80,6 +78,26 @@
|
||||
#include "cogl/cogl.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
/* <private>
|
||||
* ClutterStageHint:
|
||||
* @CLUTTER_STAGE_NONE: No hint set
|
||||
* @CLUTTER_STAGE_NO_CLEAR_ON_PAINT: When this hint is set, the stage
|
||||
* should not clear the viewport; this flag is useful when painting
|
||||
* fully opaque actors covering the whole visible area of the stage,
|
||||
* i.e. when no blending with the stage color happens over the whole
|
||||
* stage viewport
|
||||
*
|
||||
* A series of hints that enable or disable behaviours on the stage
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_STAGE >*/
|
||||
{
|
||||
CLUTTER_STAGE_HINT_NONE = 0,
|
||||
|
||||
CLUTTER_STAGE_NO_CLEAR_ON_PAINT = 1 << 0
|
||||
} ClutterStageHint;
|
||||
|
||||
#define STAGE_NO_CLEAR_ON_PAINT(s) ((((ClutterStage *) (s))->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0)
|
||||
|
||||
struct _ClutterStageQueueRedrawEntry
|
||||
{
|
||||
ClutterActor *actor;
|
||||
@ -116,12 +134,16 @@ struct _ClutterStagePrivate
|
||||
|
||||
GQueue *event_queue;
|
||||
|
||||
ClutterStageHint stage_hints;
|
||||
|
||||
GArray *paint_volume_stack;
|
||||
|
||||
ClutterPlane current_clip_planes[4];
|
||||
|
||||
GList *pending_queue_redraws;
|
||||
|
||||
CoglFramebuffer *active_framebuffer;
|
||||
|
||||
gint sync_delay;
|
||||
|
||||
GTimer *fps_timer;
|
||||
@ -168,6 +190,7 @@ enum
|
||||
PROP_TITLE,
|
||||
PROP_USE_ALPHA,
|
||||
PROP_KEY_FOCUS,
|
||||
PROP_NO_CLEAR_HINT,
|
||||
PROP_ACCEPT_FOCUS,
|
||||
PROP_LAST
|
||||
};
|
||||
@ -443,9 +466,9 @@ is_inside_axis_aligned_rectangle (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
float min_x = FLT_MAX;
|
||||
float max_x = -FLT_MAX;
|
||||
float max_x = FLT_MIN;
|
||||
float min_y = FLT_MAX;
|
||||
float max_y = -FLT_MAX;
|
||||
float max_y = FLT_MIN;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
@ -696,6 +719,17 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
flags | CLUTTER_DELEGATE_LAYOUT);
|
||||
}
|
||||
|
||||
/* XXX: Until Cogl becomes fully responsible for backend windows
|
||||
* Clutter need to manually keep it informed of the current window
|
||||
* size. We do this after the allocation above so that the stage
|
||||
* window has a chance to update the window size based on the
|
||||
* allocation.
|
||||
*/
|
||||
_clutter_stage_window_get_geometry (priv->impl, &window_size);
|
||||
|
||||
cogl_onscreen_clutter_backend_set_size (window_size.width,
|
||||
window_size.height);
|
||||
|
||||
/* reset the viewport if the allocation effectively changed */
|
||||
clutter_actor_get_allocation_box (self, &alloc);
|
||||
clutter_actor_box_get_size (&alloc, &new_width, &new_height);
|
||||
@ -838,17 +872,32 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
|
||||
graphene_vec3_normalize (&plane->n, &plane->n);
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_stage_update_active_framebuffer (ClutterStage *stage,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
/* We track the CoglFramebuffer that corresponds to the stage itself
|
||||
* so, for example, we can disable culling when rendering to an
|
||||
* offscreen framebuffer.
|
||||
*/
|
||||
|
||||
priv->active_framebuffer = framebuffer;
|
||||
}
|
||||
|
||||
/* XXX: Instead of having a toplevel 2D clip region, it might be
|
||||
* better to have a clip volume within the view frustum. This could
|
||||
* allow us to avoid projecting actors into window coordinates to
|
||||
* be able to cull them.
|
||||
*/
|
||||
static void
|
||||
setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cairo_rectangle_int_t view_layout;
|
||||
float clip_poly[8];
|
||||
float viewport[4];
|
||||
@ -899,20 +948,8 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
priv->current_clip_planes);
|
||||
|
||||
_clutter_stage_paint_volume_stack_free_all (stage);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = clutter_paint_context_new_for_view (view);
|
||||
|
||||
setup_view_for_pick_or_paint (stage, view, clip);
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
|
||||
clutter_paint_context_destroy (paint_context);
|
||||
_clutter_stage_update_active_framebuffer (stage, framebuffer);
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage));
|
||||
}
|
||||
|
||||
/* This provides a common point of entry for painting the scenegraph
|
||||
@ -952,20 +989,18 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
|
||||
* respect the Z order as it uses our empty sort_depth_order.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_stage_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_paint (child, paint_context);
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_stage_pick (ClutterActor *self)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
@ -976,7 +1011,7 @@ clutter_stage_pick (ClutterActor *self,
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_pick (child, pick_context);
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1385,10 +1420,11 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
|
||||
ClutterDeviceManager *device_manager;
|
||||
GSList *updating = NULL;
|
||||
const GSList *devices;
|
||||
cairo_region_t *clip;
|
||||
cairo_rectangle_int_t clip;
|
||||
graphene_point_t point;
|
||||
gboolean has_clip;
|
||||
|
||||
clip = _clutter_stage_window_get_redraw_clip (priv->impl);
|
||||
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
|
||||
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
devices = clutter_device_manager_peek_devices (device_manager);
|
||||
@ -1411,7 +1447,9 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
|
||||
if (!clutter_input_device_get_coords (dev, NULL, &point))
|
||||
continue;
|
||||
|
||||
if (!clip || cairo_region_contains_point (clip, point.x, point.y))
|
||||
if (!has_clip ||
|
||||
(point.x >= clip.x && point.x < clip.x + clip.width &&
|
||||
point.y >= clip.y && point.y < clip.y + clip.height))
|
||||
updating = g_slist_prepend (updating, dev);
|
||||
break;
|
||||
default:
|
||||
@ -1600,24 +1638,39 @@ _clutter_stage_has_full_redraw_queued (ClutterStage *stage)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
clutter_stage_get_redraw_clip (ClutterStage *stage)
|
||||
/**
|
||||
* clutter_stage_get_redraw_clip_bounds:
|
||||
* @stage: A #ClutterStage
|
||||
* @clip: (out caller-allocates): Return location for the clip bounds
|
||||
*
|
||||
* Gets the bounds of the current redraw for @stage in stage pixel
|
||||
* coordinates. E.g., if only a single actor has queued a redraw then
|
||||
* Clutter may redraw the stage with a clip so that it doesn't have to
|
||||
* paint every pixel in the stage. This function would then return the
|
||||
* bounds of that clip. An application can use this information to
|
||||
* avoid some extra work if it knows that some regions of the stage
|
||||
* aren't going to be painted. This should only be called while the
|
||||
* stage is being painted. If there is no current redraw clip then
|
||||
* this function will set @clip to the full extents of the stage.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
void
|
||||
clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
cairo_rectangle_int_t clip;
|
||||
cairo_region_t *region;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail (clip != NULL);
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
region = _clutter_stage_window_get_redraw_clip (priv->impl);
|
||||
if (region)
|
||||
return region;
|
||||
|
||||
/* Set clip to the full extents of the stage */
|
||||
_clutter_stage_window_get_geometry (priv->impl, &clip);
|
||||
return cairo_region_create_rectangle (&clip);
|
||||
if (!_clutter_stage_window_get_redraw_clip_bounds (priv->impl, clip))
|
||||
{
|
||||
/* Set clip to the full extents of the stage */
|
||||
_clutter_stage_window_get_geometry (priv->impl, clip);
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
@ -1629,25 +1682,23 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
int i;
|
||||
|
||||
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
|
||||
|
||||
if (mode != priv->cached_pick_mode)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
_clutter_stage_clear_pick_stack (stage);
|
||||
|
||||
pick_context = clutter_pick_context_new_for_view (view);
|
||||
cogl_push_framebuffer (fb);
|
||||
|
||||
context->pick_mode = mode;
|
||||
setup_view_for_pick_or_paint (stage, view, NULL);
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
|
||||
clutter_stage_do_paint_view (stage, view, NULL);
|
||||
context->pick_mode = CLUTTER_PICK_NONE;
|
||||
priv->cached_pick_mode = mode;
|
||||
|
||||
clutter_pick_context_destroy (pick_context);
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
add_pick_stack_weak_refs (stage);
|
||||
}
|
||||
@ -1822,6 +1873,10 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_key_focus (stage, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_NO_CLEAR_HINT:
|
||||
clutter_stage_set_no_clear_hint (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_ACCEPT_FOCUS:
|
||||
clutter_stage_set_accept_focus (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -1872,6 +1927,15 @@ clutter_stage_get_property (GObject *gobject,
|
||||
g_value_set_object (value, priv->key_focused_actor);
|
||||
break;
|
||||
|
||||
case PROP_NO_CLEAR_HINT:
|
||||
{
|
||||
gboolean hint =
|
||||
(priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
|
||||
|
||||
g_value_set_boolean (value, hint);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ACCEPT_FOCUS:
|
||||
g_value_set_boolean (value, priv->accept_focus);
|
||||
break;
|
||||
@ -2074,6 +2138,23 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterStage:no-clear-hint:
|
||||
*
|
||||
* Whether or not the #ClutterStage should clear its contents
|
||||
* before each paint cycle.
|
||||
*
|
||||
* See clutter_stage_set_no_clear_hint() for further information.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_NO_CLEAR_HINT] =
|
||||
g_param_spec_boolean ("no-clear-hint",
|
||||
P_("No Clear Hint"),
|
||||
P_("Whether the stage should clear its contents"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterStage:accept-focus:
|
||||
*
|
||||
@ -2157,7 +2238,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
/**
|
||||
* ClutterStage::after-paint:
|
||||
* @stage: the stage that received the event
|
||||
* @paint_Context: the paint context
|
||||
*
|
||||
* The ::after-paint signal is emitted after the stage is painted,
|
||||
* but before the results are displayed on the screen.
|
||||
@ -2769,6 +2849,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
return NULL;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
clutter_stage_do_paint_view (stage, view, &clip_rect);
|
||||
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
@ -2783,6 +2864,8 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
pixels);
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
@ -3689,6 +3772,72 @@ _clutter_stage_clear_update_time (ClutterStage *stage)
|
||||
_clutter_stage_window_clear_update_time (stage_window);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_set_no_clear_hint:
|
||||
* @stage: a #ClutterStage
|
||||
* @no_clear: %TRUE if the @stage should not clear itself on every
|
||||
* repaint cycle
|
||||
*
|
||||
* Sets whether the @stage should clear itself at the beginning
|
||||
* of each paint cycle or not.
|
||||
*
|
||||
* Clearing the #ClutterStage can be a costly operation, especially
|
||||
* if the stage is always covered - for instance, in a full-screen
|
||||
* video player or in a game with a background texture.
|
||||
*
|
||||
* This setting is a hint; Clutter might discard this hint
|
||||
* depending on its internal state.
|
||||
*
|
||||
* If parts of the stage are visible and you disable clearing you
|
||||
* might end up with visual artifacts while painting the contents of
|
||||
* the stage.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_no_clear_hint (ClutterStage *stage,
|
||||
gboolean no_clear)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
ClutterStageHint new_hints;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
priv = stage->priv;
|
||||
new_hints = priv->stage_hints;
|
||||
|
||||
if (no_clear)
|
||||
new_hints |= CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
|
||||
else
|
||||
new_hints &= ~CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
|
||||
|
||||
if (priv->stage_hints == new_hints)
|
||||
return;
|
||||
|
||||
priv->stage_hints = new_hints;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_NO_CLEAR_HINT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_no_clear_hint:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Retrieves the hint set with clutter_stage_set_no_clear_hint()
|
||||
*
|
||||
* Return value: %TRUE if the stage should not clear itself on every paint
|
||||
* cycle, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_stage_get_no_clear_hint (ClutterStage *stage)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
|
||||
return (stage->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
|
||||
}
|
||||
|
||||
ClutterPaintVolume *
|
||||
_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage)
|
||||
{
|
||||
@ -4002,6 +4151,18 @@ clutter_stage_get_motion_events_enabled (ClutterStage *stage)
|
||||
return stage->priv->motion_events_enabled;
|
||||
}
|
||||
|
||||
/* NB: The presumption shouldn't be that a stage can't be comprised
|
||||
* of multiple internal framebuffers, so instead of simply naming
|
||||
* this function _clutter_stage_get_framebuffer(), the "active"
|
||||
* infix is intended to clarify that it gets the framebuffer that
|
||||
* is currently in use/being painted.
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
_clutter_stage_get_active_framebuffer (ClutterStage *stage)
|
||||
{
|
||||
return stage->priv->active_framebuffer;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
@ -4411,6 +4572,7 @@ capture_view_into (ClutterStage *stage,
|
||||
|
||||
if (paint)
|
||||
{
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||
clutter_stage_do_paint_view (stage, view, rect);
|
||||
}
|
||||
@ -4435,6 +4597,9 @@ capture_view_into (ClutterStage *stage,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
bitmap);
|
||||
|
||||
if (paint)
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cogl_object_unref (bitmap);
|
||||
}
|
||||
|
||||
|
@ -164,6 +164,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
|
||||
@ -206,7 +211,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
|
||||
|
@ -178,17 +178,17 @@ struct _ClutterTextPrivate
|
||||
guint password_hint_timeout;
|
||||
|
||||
/* Signal handler for when the backend changes its font settings */
|
||||
gulong settings_changed_id;
|
||||
guint settings_changed_id;
|
||||
|
||||
/* Signal handler for when the :text-direction changes */
|
||||
gulong direction_changed_id;
|
||||
guint direction_changed_id;
|
||||
|
||||
ClutterInputFocus *input_focus;
|
||||
ClutterInputContentHintFlags input_hints;
|
||||
ClutterInputContentPurpose input_purpose;
|
||||
|
||||
/* Signal handler for when the :resource-scale changes */
|
||||
gulong resource_scale_changed_id;
|
||||
guint resource_scale_changed_id;
|
||||
|
||||
/* bitfields */
|
||||
guint alignment : 2;
|
||||
@ -1758,12 +1758,30 @@ clutter_text_dispose (GObject *gobject)
|
||||
/* get rid of the entire cache */
|
||||
clutter_text_dirty_cache (self);
|
||||
|
||||
g_clear_signal_handler (&priv->direction_changed_id, self);
|
||||
g_clear_signal_handler (&priv->resource_scale_changed_id, self);
|
||||
g_clear_signal_handler (&priv->settings_changed_id,
|
||||
clutter_get_default_backend ());
|
||||
if (priv->direction_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (self, priv->direction_changed_id);
|
||||
priv->direction_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_handle_id (&priv->password_hint_id, g_source_remove);
|
||||
if (priv->resource_scale_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (self, priv->resource_scale_changed_id);
|
||||
priv->resource_scale_changed_id = 0;
|
||||
}
|
||||
|
||||
if (priv->settings_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (clutter_get_default_backend (),
|
||||
priv->settings_changed_id);
|
||||
priv->settings_changed_id = 0;
|
||||
}
|
||||
|
||||
if (priv->password_hint_id)
|
||||
{
|
||||
g_source_remove (priv->password_hint_id);
|
||||
priv->password_hint_id = 0;
|
||||
}
|
||||
|
||||
clutter_text_set_buffer (self, NULL);
|
||||
|
||||
@ -1991,7 +2009,7 @@ selection_paint (ClutterText *self,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
||||
cogl_pango_render_layout (layout, priv->text_x, 0, &cogl_color, 0);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
@ -2446,7 +2464,8 @@ clutter_text_key_press (ClutterActor *actor,
|
||||
|
||||
if (priv->show_password_hint)
|
||||
{
|
||||
g_clear_handle_id (&priv->password_hint_id, g_source_remove);
|
||||
if (priv->password_hint_id != 0)
|
||||
g_source_remove (priv->password_hint_id);
|
||||
|
||||
priv->password_hint_visible = TRUE;
|
||||
priv->password_hint_id =
|
||||
@ -2548,8 +2567,7 @@ clutter_text_compute_layout_offsets (ClutterText *self,
|
||||
#define TEXT_PADDING 2
|
||||
|
||||
static void
|
||||
clutter_text_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_text_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (self);
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
@ -2567,7 +2585,7 @@ clutter_text_paint (ClutterActor *self,
|
||||
float alloc_height;
|
||||
float resource_scale;
|
||||
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
/* Note that if anything in this paint method changes it needs to be
|
||||
reflected in the get_paint_volume implementation which is tightly
|
||||
@ -2755,7 +2773,7 @@ clutter_text_paint (ClutterActor *self,
|
||||
priv->text_color.green,
|
||||
priv->text_color.blue,
|
||||
real_opacity);
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
|
||||
cogl_pango_render_layout (layout, priv->text_x, priv->text_y, &color, 0);
|
||||
|
||||
selection_paint (text, fb);
|
||||
|
||||
|
131
clutter/clutter/clutter-texture.h
Normal file
131
clutter/clutter/clutter-texture.h
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_TEXTURE_H__
|
||||
#define __CLUTTER_TEXTURE_H__
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <clutter/clutter-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_TEXTURE (clutter_texture_get_type ())
|
||||
#define CLUTTER_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXTURE, ClutterTexture))
|
||||
#define CLUTTER_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXTURE, ClutterTextureClass))
|
||||
#define CLUTTER_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXTURE))
|
||||
#define CLUTTER_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXTURE))
|
||||
#define CLUTTER_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXTURE, ClutterTextureClass))
|
||||
|
||||
/**
|
||||
* ClutterTextureError:
|
||||
* @CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY: OOM condition
|
||||
* @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support
|
||||
* found
|
||||
* @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for
|
||||
* clutter_texture_set_from_rgb_data or
|
||||
* clutter_texture_set_from_yuv_data is unsupported.
|
||||
*
|
||||
* Error enumeration for #ClutterTexture
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY,
|
||||
CLUTTER_TEXTURE_ERROR_NO_YUV,
|
||||
CLUTTER_TEXTURE_ERROR_BAD_FORMAT
|
||||
} ClutterTextureError;
|
||||
|
||||
/**
|
||||
* CLUTTER_TEXTURE_ERROR:
|
||||
*
|
||||
* Error domain for #ClutterTexture errors
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
#define CLUTTER_TEXTURE_ERROR (clutter_texture_error_quark ())
|
||||
CLUTTER_EXPORT
|
||||
GQuark clutter_texture_error_quark (void);
|
||||
|
||||
typedef struct _ClutterTexture ClutterTexture;
|
||||
typedef struct _ClutterTextureClass ClutterTextureClass;
|
||||
typedef struct _ClutterTexturePrivate ClutterTexturePrivate;
|
||||
|
||||
/**
|
||||
* ClutterTexture:
|
||||
*
|
||||
* The #ClutterTexture structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
struct _ClutterTexture
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActor parent;
|
||||
|
||||
ClutterTexturePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterTextureClass:
|
||||
* @size_change: handler for the #ClutterTexture::size-change signal
|
||||
* @pixbuf_change: handler for the #ClutterTexture::pixbuf-change signal
|
||||
* @load_finished: handler for the #ClutterTexture::load-finished signal
|
||||
*
|
||||
* The #ClutterTextureClass structure contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
struct _ClutterTextureClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* size_change) (ClutterTexture *texture,
|
||||
gint width,
|
||||
gint height);
|
||||
void (* pixbuf_change) (ClutterTexture *texture);
|
||||
void (* load_finished) (ClutterTexture *texture,
|
||||
const GError *error);
|
||||
|
||||
/*< private >*/
|
||||
/* padding, for future expansion */
|
||||
void (*_clutter_texture1) (void);
|
||||
void (*_clutter_texture2) (void);
|
||||
void (*_clutter_texture3) (void);
|
||||
void (*_clutter_texture4) (void);
|
||||
void (*_clutter_texture5) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_texture_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TEXTURE_H__ */
|
@ -1038,15 +1038,15 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
|
||||
* to correpondingly reduce elapsed_time_delta to reflect the correct
|
||||
* range of times */
|
||||
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
|
||||
end_msecs = priv->elapsed_time;
|
||||
|
||||
@ -1756,12 +1756,12 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
if (msecs != 0)
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
priv->last_frame_time += msecs;
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ typedef union _ClutterEvent ClutterEvent;
|
||||
*/
|
||||
typedef struct _ClutterEventSequence ClutterEventSequence;
|
||||
|
||||
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
|
||||
typedef struct _ClutterShader ClutterShader; /* deprecated */
|
||||
|
||||
/**
|
||||
|
@ -103,6 +103,7 @@
|
||||
#include "clutter-stage-manager.h"
|
||||
#include "clutter-stage-view.h"
|
||||
#include "clutter-tap-action.h"
|
||||
#include "clutter-texture.h"
|
||||
#include "clutter-text.h"
|
||||
#include "clutter-timeline.h"
|
||||
#include "clutter-transition-group.h"
|
||||
|
@ -56,7 +56,7 @@ typedef struct _ClutterStageViewCoglPrivate
|
||||
*/
|
||||
#define DAMAGE_HISTORY_MAX 16
|
||||
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
|
||||
cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
|
||||
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
|
||||
unsigned int damage_index;
|
||||
} ClutterStageViewCoglPrivate;
|
||||
|
||||
@ -296,10 +296,13 @@ clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
|
||||
/* NB: at the start of each new frame there is an implied clip that
|
||||
* clips everything (i.e. nothing would be drawn) so we need to make
|
||||
* sure we return True in the un-initialized case here.
|
||||
*
|
||||
* NB: a clip width of 0 means a full stage redraw has been queued
|
||||
* so we effectively don't have any redraw clips in that case.
|
||||
*/
|
||||
if (!stage_cogl->initialized_redraw_clip ||
|
||||
(stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->redraw_clip))
|
||||
stage_cogl->bounding_redraw_clip.width != 0))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -310,9 +313,9 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
/* NB: a NULL clip means a full stage redraw is required */
|
||||
/* NB: a clip width of 0 means a full stage redraw is required */
|
||||
if (stage_cogl->initialized_redraw_clip &&
|
||||
!stage_cogl->redraw_clip)
|
||||
stage_cogl->bounding_redraw_clip.width == 0)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -343,11 +346,11 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||
return;
|
||||
|
||||
/* A NULL stage clip means a full stage redraw has been queued and
|
||||
* we keep track of this by setting a NULL redraw_clip.
|
||||
*/
|
||||
* we keep track of this by setting a zero width
|
||||
* stage_cogl->bounding_redraw_clip */
|
||||
if (stage_clip == NULL)
|
||||
{
|
||||
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
|
||||
stage_cogl->bounding_redraw_clip.width = 0;
|
||||
stage_cogl->initialized_redraw_clip = TRUE;
|
||||
return;
|
||||
}
|
||||
@ -356,27 +359,34 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||
if (stage_clip->width == 0 || stage_clip->height == 0)
|
||||
return;
|
||||
|
||||
if (!stage_cogl->redraw_clip)
|
||||
if (!stage_cogl->initialized_redraw_clip)
|
||||
{
|
||||
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
|
||||
stage_cogl->bounding_redraw_clip = *stage_clip;
|
||||
}
|
||||
else
|
||||
else if (stage_cogl->bounding_redraw_clip.width > 0)
|
||||
{
|
||||
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
|
||||
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
|
||||
stage_clip,
|
||||
&stage_cogl->bounding_redraw_clip);
|
||||
}
|
||||
|
||||
stage_cogl->initialized_redraw_clip = TRUE;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
|
||||
static gboolean
|
||||
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
|
||||
return cairo_region_copy (stage_cogl->redraw_clip);
|
||||
if (stage_cogl->using_clipped_redraw)
|
||||
{
|
||||
*stage_clip = stage_cogl->bounding_redraw_clip;
|
||||
|
||||
return NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
@ -393,47 +403,37 @@ valid_buffer_age (ClutterStageViewCogl *view_cogl,
|
||||
}
|
||||
|
||||
static void
|
||||
paint_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *swap_region)
|
||||
paint_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_rectangle_int_t *swap_region)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||
static CoglPipeline *overlay_blue = NULL;
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (stage_cogl->wrapper);
|
||||
CoglMatrix transform;
|
||||
int n_rects, i;
|
||||
float x_1 = swap_region->x;
|
||||
float x_2 = swap_region->x + swap_region->width;
|
||||
float y_1 = swap_region->y;
|
||||
float y_2 = swap_region->y + swap_region->height;
|
||||
CoglMatrix modelview;
|
||||
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
clutter_actor_get_transform (actor, &transform);
|
||||
cogl_framebuffer_transform (framebuffer, &transform);
|
||||
|
||||
/* Blue for the swap region */
|
||||
if (G_UNLIKELY (overlay_blue == NULL))
|
||||
{
|
||||
overlay_blue = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
|
||||
}
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
cogl_matrix_init_identity (&modelview);
|
||||
_clutter_actor_apply_modelview_transform (actor, &modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
|
||||
|
||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
y_2 = rect.y + rect.height;
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
|
||||
}
|
||||
/* Blue for the swap region */
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
|
||||
|
||||
/* Red for the clip */
|
||||
if (stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->redraw_clip)
|
||||
if (stage_cogl->initialized_redraw_clip)
|
||||
{
|
||||
static CoglPipeline *overlay_red = NULL;
|
||||
|
||||
@ -443,63 +443,55 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
|
||||
}
|
||||
|
||||
n_rects = cairo_region_num_rectangles (stage_cogl->redraw_clip);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
x_1 = stage_cogl->bounding_redraw_clip.x;
|
||||
x_2 = stage_cogl->bounding_redraw_clip.x + stage_cogl->bounding_redraw_clip.width;
|
||||
y_1 = stage_cogl->bounding_redraw_clip.y;
|
||||
y_2 = stage_cogl->bounding_redraw_clip.y + stage_cogl->bounding_redraw_clip.height;
|
||||
|
||||
cairo_region_get_rectangle (stage_cogl->redraw_clip, i, &rect);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
y_2 = rect.y + rect.height;
|
||||
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
|
||||
}
|
||||
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
|
||||
}
|
||||
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *swap_region,
|
||||
gboolean swap_with_damage)
|
||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_rectangle_int_t *swap_region,
|
||||
gboolean swap_with_damage)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
int *damage, n_rects, i;
|
||||
int damage[4], ndamage;
|
||||
|
||||
damage[0] = swap_region->x;
|
||||
damage[1] = swap_region->y;
|
||||
damage[2] = swap_region->width;
|
||||
damage[3] = swap_region->height;
|
||||
|
||||
if (swap_region->width != 0)
|
||||
ndamage = 1;
|
||||
else
|
||||
ndamage = 0;
|
||||
|
||||
if (G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)))
|
||||
paint_damage_region (stage_window, view, swap_region);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
damage = g_newa (int, n_rects * 4);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||
damage[i * 4] = rect.x;
|
||||
damage[i * 4 + 1] = rect.y;
|
||||
damage[i * 4 + 2] = rect.width;
|
||||
damage[i * 4 + 3] = rect.height;
|
||||
}
|
||||
|
||||
if (cogl_is_onscreen (framebuffer))
|
||||
{
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||
|
||||
/* push on the screen */
|
||||
if (n_rects > 0 && !swap_with_damage)
|
||||
if (ndamage == 1 && !swap_with_damage)
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"cogl_onscreen_swap_region (onscreen: %p)",
|
||||
onscreen);
|
||||
"cogl_onscreen_swap_region (onscreen: %p, "
|
||||
"x: %d, y: %d, "
|
||||
"width: %d, height: %d)",
|
||||
onscreen,
|
||||
damage[0], damage[1], damage[2], damage[3]);
|
||||
|
||||
cogl_onscreen_swap_region (onscreen,
|
||||
damage, n_rects);
|
||||
damage, ndamage);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -509,7 +501,7 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
onscreen);
|
||||
|
||||
cogl_onscreen_swap_buffers_with_damage (onscreen,
|
||||
damage, n_rects);
|
||||
damage, ndamage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -524,122 +516,81 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
scale_and_clamp_rect (const graphene_rect_t *rect,
|
||||
float scale,
|
||||
cairo_rectangle_int_t *dest)
|
||||
|
||||
{
|
||||
graphene_rect_t tmp = *rect;
|
||||
|
||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||
}
|
||||
|
||||
static void
|
||||
paint_stage (ClutterStageCogl *stage_cogl,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *clip)
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStage *stage = stage_cogl->wrapper;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_int_t paint_rect;
|
||||
cairo_rectangle_int_t view_rect;
|
||||
graphene_rect_t rect;
|
||||
float fb_scale;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_rect);
|
||||
fb_scale = clutter_stage_view_get_scale (view);
|
||||
|
||||
cairo_region_get_extents (clip, &clip_rect);
|
||||
|
||||
_clutter_util_rect_from_rectangle (&clip_rect, &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
|
||||
_clutter_util_rectangle_offset (&paint_rect,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&paint_rect);
|
||||
|
||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||
_clutter_stage_paint_view (stage, view, &paint_rect);
|
||||
_clutter_stage_paint_view (stage, view, clip);
|
||||
|
||||
clutter_stage_view_after_paint (view, &paint_rect);
|
||||
if (clutter_stage_view_get_onscreen (view) !=
|
||||
clutter_stage_view_get_framebuffer (view))
|
||||
{
|
||||
clutter_stage_view_blit_offscreen (view, clip);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fill_current_damage_history (ClutterStageView *view,
|
||||
cairo_region_t *damage)
|
||||
fill_current_damage_history_and_step (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
|
||||
ClutterStageViewCoglPrivate *view_priv =
|
||||
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
||||
cairo_region_t **current_fb_damage;
|
||||
cairo_rectangle_int_t view_rect;
|
||||
float fb_scale;
|
||||
cairo_rectangle_int_t *current_fb_damage;
|
||||
|
||||
current_fb_damage =
|
||||
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
|
||||
clutter_stage_view_get_layout (view, &view_rect);
|
||||
fb_scale = clutter_stage_view_get_scale (view);
|
||||
|
||||
g_clear_pointer (current_fb_damage, cairo_region_destroy);
|
||||
*current_fb_damage = cairo_region_copy (damage);
|
||||
*current_fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
view_priv->damage_index++;
|
||||
}
|
||||
|
||||
static void
|
||||
fill_current_damage_history_rectangle (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect)
|
||||
{
|
||||
cairo_region_t *damage;
|
||||
|
||||
damage = cairo_region_create_rectangle (rect);
|
||||
fill_current_damage_history (view, damage);
|
||||
cairo_region_destroy (damage);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
transform_swap_region_to_onscreen (ClutterStageView *view,
|
||||
cairo_region_t *swap_region)
|
||||
transform_swap_region_to_onscreen (ClutterStageView *view,
|
||||
cairo_rectangle_int_t *swap_region)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
cairo_rectangle_int_t layout;
|
||||
gfloat x1, y1, x2, y2;
|
||||
gint width, height;
|
||||
int n_rects, i;
|
||||
cairo_rectangle_int_t *rects;
|
||||
cairo_region_t *transformed_region;
|
||||
|
||||
framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
clutter_stage_view_get_layout (view, &layout);
|
||||
|
||||
x1 = (float) swap_region->x / layout.width;
|
||||
y1 = (float) swap_region->y / layout.height;
|
||||
x2 = (float) (swap_region->x + swap_region->width) / layout.width;
|
||||
y2 = (float) (swap_region->y + swap_region->height) / layout.height;
|
||||
|
||||
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
|
||||
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
|
||||
|
||||
width = cogl_framebuffer_get_width (framebuffer);
|
||||
height = cogl_framebuffer_get_height (framebuffer);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
gfloat x1, y1, x2, y2;
|
||||
x1 = floor (x1 * width);
|
||||
y1 = floor (height - (y1 * height));
|
||||
x2 = ceil (x2 * width);
|
||||
y2 = ceil (height - (y2 * height));
|
||||
|
||||
cairo_region_get_rectangle (swap_region, i, &rects[i]);
|
||||
|
||||
x1 = (float) rects[i].x / layout.width;
|
||||
y1 = (float) rects[i].y / layout.height;
|
||||
x2 = (float) (rects[i].x + rects[i].width) / layout.width;
|
||||
y2 = (float) (rects[i].y + rects[i].height) / layout.height;
|
||||
|
||||
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
|
||||
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
|
||||
|
||||
x1 = floor (x1 * width);
|
||||
y1 = floor (height - (y1 * height));
|
||||
x2 = ceil (x2 * width);
|
||||
y2 = ceil (height - (y2 * height));
|
||||
|
||||
rects[i].x = x1;
|
||||
rects[i].y = y1;
|
||||
rects[i].width = x2 - x1;
|
||||
rects[i].height = y2 - y1;
|
||||
}
|
||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
||||
|
||||
return transformed_region;
|
||||
*swap_region = (cairo_rectangle_int_t) {
|
||||
.x = x1,
|
||||
.y = y1,
|
||||
.width = x2 - x1,
|
||||
.height = y2 - y1
|
||||
};
|
||||
}
|
||||
|
||||
static void
|
||||
@ -673,6 +624,18 @@ is_buffer_age_enabled (void)
|
||||
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_and_clamp_rect (const graphene_rect_t *rect,
|
||||
float scale,
|
||||
cairo_rectangle_int_t *dest)
|
||||
|
||||
{
|
||||
graphene_rect_t tmp = *rect;
|
||||
|
||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view)
|
||||
@ -691,10 +654,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
gboolean do_swap_buffer;
|
||||
gboolean swap_with_damage;
|
||||
ClutterActor *wrapper;
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_region_t *fb_clip_region;
|
||||
cairo_region_t *swap_region;
|
||||
cairo_rectangle_int_t redraw_rect;
|
||||
cairo_rectangle_int_t redraw_clip;
|
||||
cairo_rectangle_int_t swap_region;
|
||||
cairo_rectangle_int_t fb_clip_region;
|
||||
gboolean clip_region_empty;
|
||||
float fb_scale;
|
||||
int subpixel_compensation = 0;
|
||||
@ -713,19 +675,20 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
|
||||
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
|
||||
|
||||
/* NB: a NULL redraw clip == full stage redraw */
|
||||
if (!stage_cogl->redraw_clip)
|
||||
/* NB: a zero width redraw clip == full stage redraw */
|
||||
if (stage_cogl->bounding_redraw_clip.width == 0)
|
||||
have_clip = FALSE;
|
||||
else
|
||||
{
|
||||
cairo_region_t *view_region;
|
||||
redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
|
||||
redraw_clip = stage_cogl->bounding_redraw_clip;
|
||||
_clutter_util_rectangle_intersection (&redraw_clip,
|
||||
&view_rect,
|
||||
&redraw_clip);
|
||||
|
||||
view_region = cairo_region_create_rectangle (&view_rect);
|
||||
cairo_region_intersect (redraw_clip, view_region);
|
||||
|
||||
have_clip = !cairo_region_equal (redraw_clip, view_region);
|
||||
cairo_region_destroy (view_region);
|
||||
have_clip = !(redraw_clip.x == view_rect.x &&
|
||||
redraw_clip.y == view_rect.y &&
|
||||
redraw_clip.width == view_rect.width &&
|
||||
redraw_clip.height == view_rect.height);
|
||||
}
|
||||
|
||||
may_use_clipped_redraw = FALSE;
|
||||
@ -737,52 +700,25 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
|
||||
{
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t *rects;
|
||||
int n_rects, i;
|
||||
|
||||
may_use_clipped_redraw = TRUE;
|
||||
|
||||
fb_clip_region = cairo_region_create ();
|
||||
|
||||
n_rects = cairo_region_num_rectangles (redraw_clip);
|
||||
rects = g_new (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t new_fb_clip_rect;
|
||||
|
||||
cairo_region_get_rectangle (redraw_clip, i, &rects[i]);
|
||||
|
||||
_clutter_util_rect_from_rectangle (&rects[i], &rect);
|
||||
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
|
||||
scale_and_clamp_rect (&rect, fb_scale, &new_fb_clip_rect);
|
||||
|
||||
cairo_region_union_rectangle (fb_clip_region, &new_fb_clip_rect);
|
||||
}
|
||||
g_free (rects);
|
||||
_clutter_util_rect_from_rectangle (&redraw_clip, &rect);
|
||||
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
|
||||
scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region);
|
||||
|
||||
if (fb_scale != floorf (fb_scale))
|
||||
{
|
||||
subpixel_compensation = ceilf (fb_scale);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (fb_clip_region);
|
||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
|
||||
rects[i].x -= subpixel_compensation;
|
||||
rects[i].y -= subpixel_compensation;
|
||||
rects[i].width += 2 * subpixel_compensation;
|
||||
rects[i].height += 2 * subpixel_compensation;
|
||||
}
|
||||
cairo_region_destroy (fb_clip_region);
|
||||
fb_clip_region = cairo_region_create_rectangles (rects, n_rects);
|
||||
fb_clip_region.x -= subpixel_compensation;
|
||||
fb_clip_region.y -= subpixel_compensation;
|
||||
fb_clip_region.width += 2 * subpixel_compensation;
|
||||
fb_clip_region.height += 2 * subpixel_compensation;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
|
||||
fb_clip_region = cairo_region_create_rectangle (&rect);
|
||||
redraw_clip = cairo_region_copy (fb_clip_region);
|
||||
fb_clip_region = (cairo_rectangle_int_t) { 0 };
|
||||
}
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
@ -791,14 +727,16 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
else
|
||||
use_clipped_redraw = FALSE;
|
||||
|
||||
clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (fb_clip_region);
|
||||
clip_region_empty = may_use_clipped_redraw && fb_clip_region.width == 0;
|
||||
|
||||
swap_with_damage = FALSE;
|
||||
if (has_buffer_age)
|
||||
{
|
||||
if (use_clipped_redraw && !clip_region_empty)
|
||||
{
|
||||
int age;
|
||||
int age, i;
|
||||
cairo_rectangle_int_t *current_fb_damage =
|
||||
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
|
||||
|
||||
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
|
||||
|
||||
@ -806,109 +744,96 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
{
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t damage_region;
|
||||
cairo_rectangle_int_t *rects;
|
||||
int n_rects, i;
|
||||
|
||||
fill_current_damage_history (view, fb_clip_region);
|
||||
*current_fb_damage = fb_clip_region;
|
||||
|
||||
for (i = 1; i <= age; i++)
|
||||
{
|
||||
cairo_region_t *fb_damage =
|
||||
view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
|
||||
cairo_region_union (fb_clip_region, fb_damage);
|
||||
cairo_rectangle_int_t *fb_damage =
|
||||
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
|
||||
|
||||
_clutter_util_rectangle_union (&fb_clip_region,
|
||||
fb_damage,
|
||||
&fb_clip_region);
|
||||
}
|
||||
|
||||
/* Update the redraw clip state with the extra damage. */
|
||||
n_rects = cairo_region_num_rectangles (fb_clip_region);
|
||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
|
||||
_clutter_util_rect_from_rectangle (&rects[i], &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
|
||||
_clutter_util_rectangle_offset (&damage_region,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&damage_region);
|
||||
cairo_region_union_rectangle (stage_cogl->redraw_clip,
|
||||
&damage_region);
|
||||
}
|
||||
/* Update the bounding redraw clip state with the extra damage. */
|
||||
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
|
||||
_clutter_util_rectangle_offset (&damage_region,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&damage_region);
|
||||
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
|
||||
&damage_region,
|
||||
&stage_cogl->bounding_redraw_clip);
|
||||
|
||||
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
|
||||
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: x=%d, y=%d, width=%d, height=%d\n",
|
||||
age,
|
||||
cairo_region_num_rectangles (fb_clip_region));
|
||||
fb_clip_region.x,
|
||||
fb_clip_region.y,
|
||||
fb_clip_region.width,
|
||||
fb_clip_region.height);
|
||||
|
||||
swap_with_damage = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t fb_damage;
|
||||
|
||||
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
|
||||
use_clipped_redraw = FALSE;
|
||||
fb_damage = (cairo_rectangle_int_t) {
|
||||
*current_fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
.width = view_rect.width * fb_scale,
|
||||
.height = view_rect.height * fb_scale
|
||||
};
|
||||
fill_current_damage_history_rectangle (view, &fb_damage);
|
||||
}
|
||||
}
|
||||
else if (!use_clipped_redraw)
|
||||
{
|
||||
cairo_rectangle_int_t fb_damage;
|
||||
|
||||
fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
fill_current_damage_history_rectangle (view, &fb_damage);
|
||||
fill_current_damage_history_and_step (view);
|
||||
}
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (fb);
|
||||
if (use_clipped_redraw && clip_region_empty)
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
||||
}
|
||||
else if (use_clipped_redraw)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t scissor_rect;
|
||||
cairo_rectangle_int_t paint_rect;
|
||||
|
||||
calculate_scissor_region (&fb_clip_region,
|
||||
subpixel_compensation,
|
||||
fb_width, fb_height,
|
||||
&scissor_rect);
|
||||
|
||||
CLUTTER_NOTE (CLIPPING,
|
||||
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
|
||||
scissor_rect.x,
|
||||
scissor_rect.y,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
stage_cogl->using_clipped_redraw = TRUE;
|
||||
|
||||
if (cairo_region_num_rectangles (fb_clip_region) == 1)
|
||||
{
|
||||
cairo_region_get_extents (fb_clip_region, &clip_rect);
|
||||
cogl_framebuffer_push_scissor_clip (fb,
|
||||
scissor_rect.x,
|
||||
scissor_rect.y,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
calculate_scissor_region (&clip_rect,
|
||||
subpixel_compensation,
|
||||
fb_width, fb_height,
|
||||
&scissor_rect);
|
||||
|
||||
CLUTTER_NOTE (CLIPPING,
|
||||
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
|
||||
scissor_rect.x,
|
||||
scissor_rect.y,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
cogl_framebuffer_push_scissor_clip (fb,
|
||||
scissor_rect.x,
|
||||
scissor_rect.y,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
|
||||
}
|
||||
|
||||
paint_stage (stage_cogl, view, fb_clip_region);
|
||||
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
|
||||
_clutter_util_rectangle_offset (&paint_rect,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&paint_rect);
|
||||
|
||||
paint_stage (stage_cogl, view, &paint_rect);
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
|
||||
stage_cogl->using_clipped_redraw = FALSE;
|
||||
@ -918,17 +843,16 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
|
||||
|
||||
/* If we are trying to debug redraw issues then we want to pass
|
||||
* the redraw_clip so it can be visualized */
|
||||
* the bounding_redraw_clip so it can be visualized */
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
|
||||
may_use_clipped_redraw &&
|
||||
!clip_region_empty)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t scissor_rect;
|
||||
cairo_rectangle_int_t paint_rect;
|
||||
|
||||
cairo_region_get_extents (fb_clip_region, &clip_rect);
|
||||
|
||||
calculate_scissor_region (&clip_rect,
|
||||
calculate_scissor_region (&fb_clip_region,
|
||||
subpixel_compensation,
|
||||
fb_width, fb_height,
|
||||
&scissor_rect);
|
||||
@ -939,28 +863,20 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
paint_stage (stage_cogl, view, fb_clip_region);
|
||||
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
|
||||
_clutter_util_rectangle_offset (&paint_rect,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&paint_rect);
|
||||
|
||||
paint_stage (stage_cogl, view, &paint_rect);
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t clip;
|
||||
cairo_region_t *view_region;
|
||||
|
||||
clip = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
view_region = cairo_region_create_rectangle (&clip);
|
||||
paint_stage (stage_cogl, view, view_region);
|
||||
cairo_region_destroy (view_region);
|
||||
}
|
||||
paint_stage (stage_cogl, view, &view_rect);
|
||||
}
|
||||
|
||||
cairo_region_get_extents (redraw_clip, &redraw_rect);
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
|
||||
@ -968,10 +884,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
CoglContext *ctx = cogl_framebuffer_get_context (fb);
|
||||
static CoglPipeline *outline = NULL;
|
||||
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
|
||||
float x_1 = redraw_rect.x;
|
||||
float x_2 = redraw_rect.x + redraw_rect.width;
|
||||
float y_1 = redraw_rect.y;
|
||||
float y_2 = redraw_rect.y + redraw_rect.height;
|
||||
float x_1 = redraw_clip.x;
|
||||
float x_2 = redraw_clip.x + redraw_clip.width;
|
||||
float y_1 = redraw_clip.y;
|
||||
float y_2 = redraw_clip.y + redraw_clip.height;
|
||||
CoglVertexP2 quad[4] = {
|
||||
{ x_1, y_1 },
|
||||
{ x_2, y_1 },
|
||||
@ -1017,47 +933,32 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_region = cairo_region_copy (fb_clip_region);
|
||||
swap_region = fb_clip_region;
|
||||
g_assert (swap_region.width > 0);
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_region = cairo_region_create ();
|
||||
swap_region = (cairo_rectangle_int_t) { 0 };
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
|
||||
if (redraw_clip)
|
||||
cairo_region_destroy (redraw_clip);
|
||||
if (fb_clip_region)
|
||||
cairo_region_destroy (fb_clip_region);
|
||||
|
||||
if (do_swap_buffer)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||
"Paint (swap framebuffer)");
|
||||
|
||||
if (clutter_stage_view_get_onscreen (view) !=
|
||||
clutter_stage_view_get_framebuffer (view))
|
||||
{
|
||||
cairo_region_t *transformed_swap_region;
|
||||
|
||||
transformed_swap_region =
|
||||
transform_swap_region_to_onscreen (view, swap_region);
|
||||
cairo_region_destroy (swap_region);
|
||||
swap_region = transformed_swap_region;
|
||||
transform_swap_region_to_onscreen (view, &swap_region);
|
||||
}
|
||||
|
||||
res = swap_framebuffer (stage_window,
|
||||
view,
|
||||
swap_region,
|
||||
swap_with_damage);
|
||||
|
||||
cairo_region_destroy (swap_region);
|
||||
|
||||
return res;
|
||||
return swap_framebuffer (stage_window,
|
||||
view,
|
||||
&swap_region,
|
||||
swap_with_damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1097,7 +998,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
|
||||
/* reset the redraw clipping for the next paint... */
|
||||
stage_cogl->initialized_redraw_clip = FALSE;
|
||||
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
|
||||
|
||||
stage_cogl->frame_count++;
|
||||
|
||||
@ -1119,7 +1019,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
|
||||
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
|
||||
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
|
||||
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
|
||||
iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
|
||||
iface->redraw = clutter_stage_cogl_redraw;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,12 @@
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-stage-window.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -56,7 +62,7 @@ struct _ClutterStageCogl
|
||||
|
||||
gint last_sync_delay;
|
||||
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_rectangle_int_t bounding_redraw_clip;
|
||||
|
||||
guint initialized_redraw_clip : 1;
|
||||
|
||||
|
@ -33,9 +33,16 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint32 clutter_actor_get_gid (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterActor * clutter_get_actor_by_gid (guint32 id_);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child() and clutter_actor_add_child())
|
||||
void clutter_actor_reparent (ClutterActor *self,
|
||||
ClutterActor *new_parent);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
|
||||
void clutter_actor_set_parent (ClutterActor *self,
|
||||
ClutterActor *parent);
|
||||
@ -43,6 +50,20 @@ void clutter_actor_set_parent (ClutterActor
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
|
||||
void clutter_actor_unparent (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
|
||||
void clutter_actor_raise (ClutterActor *self,
|
||||
ClutterActor *below);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_below_sibling)
|
||||
void clutter_actor_lower (ClutterActor *self,
|
||||
ClutterActor *above);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling() with NULL sibling)
|
||||
void clutter_actor_raise_top (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_below_sibling() with NULL sibling)
|
||||
void clutter_actor_lower_bottom (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_push_internal (ClutterActor *self);
|
||||
|
||||
@ -52,6 +73,9 @@ void clutter_actor_pop_internal (ClutterActor
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_show_all (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_hide_all (ClutterActor *self);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_z_position)
|
||||
void clutter_actor_set_depth (ClutterActor *self,
|
||||
gfloat depth);
|
||||
@ -85,6 +109,11 @@ void clutter_actor_set_scale_full (ClutterActor
|
||||
gdouble scale_y,
|
||||
gfloat center_x,
|
||||
gfloat center_y);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_set_scale and clutter_actor_set_pivot_point)
|
||||
void clutter_actor_set_scale_with_gravity (ClutterActor *self,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
ClutterGravity gravity);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_get_pivot_point)
|
||||
void clutter_actor_get_scale_center (ClutterActor *self,
|
||||
gfloat *center_x,
|
||||
@ -101,6 +130,10 @@ void clutter_actor_move_anchor_point (ClutterActor
|
||||
gfloat anchor_x,
|
||||
gfloat anchor_y);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_get_anchor_point (ClutterActor *self,
|
||||
gfloat *anchor_x,
|
||||
gfloat *anchor_y);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterGravity clutter_actor_get_anchor_point_gravity (ClutterActor *self);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self,
|
||||
@ -108,6 +141,9 @@ void clutter_actor_set_anchor_point_from_gravity (ClutterActor
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
|
||||
ClutterGravity gravity);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_get_transformation_matrix (ClutterActor *self,
|
||||
ClutterMatrix *matrix);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -39,12 +39,15 @@
|
||||
* be available any more in the next major version of Clutter.
|
||||
*
|
||||
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which
|
||||
* translates the time T into an adimensional factor alpha.
|
||||
* translates the time T into an adimensional factor alpha. The factor can
|
||||
* then be used to drive a #ClutterBehaviour, which will translate the
|
||||
* alpha value into something meaningful for a #ClutterActor.
|
||||
*
|
||||
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
|
||||
* instance using clutter_alpha_set_timeline(). You should also set an
|
||||
* "animation mode", by using the #ClutterAnimationMode values that
|
||||
* Clutter provides.
|
||||
* "animation mode", either by using the #ClutterAnimationMode values that
|
||||
* Clutter itself provides or by registering custom functions using
|
||||
* clutter_alpha_register_func().
|
||||
*
|
||||
* Instead of a #ClutterAnimationMode you may provide a function returning
|
||||
* the alpha value depending on the progress of the timeline, using
|
||||
@ -56,6 +59,9 @@
|
||||
* pause, stop or resume the #ClutterAlpha from calling the alpha function by
|
||||
* using the appropriate functions of the #ClutterTimeline object.
|
||||
*
|
||||
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it
|
||||
* is internally used by the #ClutterAnimation API.
|
||||
*
|
||||
* #ClutterAlpha is available since Clutter 0.2.
|
||||
*
|
||||
* #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and
|
||||
@ -72,7 +78,9 @@
|
||||
*
|
||||
* The following JSON fragment defines a #ClutterAlpha
|
||||
* using a #ClutterTimeline with id "sine-timeline" and an alpha
|
||||
* function called `my_sine_alpha`.
|
||||
* function called `my_sine_alpha`. The defined #ClutterAlpha
|
||||
* instance can be reused in multiple #ClutterBehaviour
|
||||
* definitions or for #ClutterAnimation definitions.
|
||||
*
|
||||
* |[
|
||||
* {
|
||||
@ -361,8 +369,9 @@ clutter_alpha_class_init (ClutterAlphaClass *klass)
|
||||
/**
|
||||
* ClutterAlpha:mode:
|
||||
*
|
||||
* The progress function logical id - a value from the
|
||||
* #ClutterAnimationMode enumeration.
|
||||
* The progress function logical id - either a value from the
|
||||
* #ClutterAnimationMode enumeration or a value returned by
|
||||
* clutter_alpha_register_func().
|
||||
*
|
||||
* If %CLUTTER_CUSTOM_MODE is used then the function set using
|
||||
* clutter_alpha_set_closure() or clutter_alpha_set_func()
|
||||
@ -636,6 +645,9 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha)
|
||||
* bind a #ClutterTimeline object to the #ClutterAlpha instance
|
||||
* using clutter_alpha_set_timeline().
|
||||
*
|
||||
* You should use the newly created #ClutterAlpha instance inside
|
||||
* a #ClutterBehaviour object.
|
||||
*
|
||||
* Return value: the newly created empty #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 0.2
|
||||
@ -677,6 +689,44 @@ clutter_alpha_new_full (ClutterTimeline *timeline,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_alpha_new_with_func:
|
||||
* @timeline: a #ClutterTimeline
|
||||
* @func: a #ClutterAlphaFunc
|
||||
* @data: data to pass to the function, or %NULL
|
||||
* @destroy: function to call when removing the alpha function, or %NULL
|
||||
*
|
||||
* Creates a new #ClutterAlpha instances and sets the timeline
|
||||
* and the alpha function.
|
||||
*
|
||||
* This function will not register @func as a global alpha function.
|
||||
*
|
||||
* See also clutter_alpha_set_timeline() and clutter_alpha_set_func().
|
||||
*
|
||||
* Return value: the newly created #ClutterAlpha
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12: Use #ClutterTimeline instead
|
||||
*/
|
||||
ClutterAlpha *
|
||||
clutter_alpha_new_with_func (ClutterTimeline *timeline,
|
||||
ClutterAlphaFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy)
|
||||
{
|
||||
ClutterAlpha *retval;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||
g_return_val_if_fail (func != NULL, NULL);
|
||||
|
||||
retval = clutter_alpha_new ();
|
||||
clutter_alpha_set_timeline (retval, timeline);
|
||||
clutter_alpha_set_func (retval, func, data, destroy);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_alpha_get_mode:
|
||||
* @alpha: a #ClutterAlpha
|
||||
@ -731,7 +781,8 @@ clutter_alpha_easing_func (ClutterAlpha *alpha,
|
||||
* @mode: a #ClutterAnimationMode
|
||||
*
|
||||
* Sets the progress function of @alpha using the symbolic value
|
||||
* of @mode, as taken by the #ClutterAnimationMode enumeration.
|
||||
* of @mode, as taken by the #ClutterAnimationMode enumeration or
|
||||
* using the value returned by clutter_alpha_register_func().
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
@ -785,7 +836,9 @@ clutter_alpha_set_mode (ClutterAlpha *alpha,
|
||||
|
||||
if (G_UNLIKELY (clutter_alphas == NULL))
|
||||
{
|
||||
g_warning ("No alpha functions defined for ClutterAlpha to use. ");
|
||||
g_warning ("No alpha functions defined for ClutterAlpha to use. "
|
||||
"Use clutter_alpha_register_func() to register an "
|
||||
"alpha function.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -817,3 +870,81 @@ clutter_alpha_set_mode (ClutterAlpha *alpha,
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
||||
}
|
||||
|
||||
static gulong
|
||||
register_alpha_internal (AlphaData *alpha_data)
|
||||
{
|
||||
if (G_UNLIKELY (clutter_alphas == NULL))
|
||||
clutter_alphas = g_ptr_array_new ();
|
||||
|
||||
g_ptr_array_add (clutter_alphas, alpha_data);
|
||||
|
||||
return clutter_alphas->len + CLUTTER_ANIMATION_LAST;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_alpha_register_func: (skip)
|
||||
* @func: a #ClutterAlphaFunc
|
||||
* @data: user data to pass to @func, or %NULL
|
||||
*
|
||||
* Registers a global alpha function and returns its logical id
|
||||
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
|
||||
*
|
||||
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
|
||||
*
|
||||
* Return value: the logical id of the alpha function
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12: There is no direct replacement for this
|
||||
* function. Use clutter_timeline_set_progress_func() on each
|
||||
* specific #ClutterTimeline instance
|
||||
*/
|
||||
gulong
|
||||
clutter_alpha_register_func (ClutterAlphaFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
AlphaData *alpha_data;
|
||||
|
||||
g_return_val_if_fail (func != NULL, 0);
|
||||
|
||||
alpha_data = g_slice_new (AlphaData);
|
||||
alpha_data->closure_set = FALSE;
|
||||
alpha_data->func = func;
|
||||
alpha_data->data = data;
|
||||
|
||||
return register_alpha_internal (alpha_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_alpha_register_closure: (rename-to clutter_alpha_register_func)
|
||||
* @closure: a #GClosure
|
||||
*
|
||||
* #GClosure variant of clutter_alpha_register_func().
|
||||
*
|
||||
* Registers a global alpha function and returns its logical id
|
||||
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
|
||||
*
|
||||
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
|
||||
*
|
||||
* Return value: the logical id of the alpha function
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.12: There is no direct replacement for this
|
||||
* function. Use clutter_timeline_set_progress_func() on each
|
||||
* specific #ClutterTimeline instance
|
||||
*/
|
||||
gulong
|
||||
clutter_alpha_register_closure (GClosure *closure)
|
||||
{
|
||||
AlphaData *alpha_data;
|
||||
|
||||
g_return_val_if_fail (closure != NULL, 0);
|
||||
|
||||
alpha_data = g_slice_new (AlphaData);
|
||||
alpha_data->closure_set = TRUE;
|
||||
alpha_data->closure = closure;
|
||||
|
||||
return register_alpha_internal (alpha_data);
|
||||
}
|
||||
|
@ -113,6 +113,12 @@ CLUTTER_DEPRECATED
|
||||
ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline,
|
||||
gulong mode);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAlpha * clutter_alpha_new_with_func (ClutterTimeline *timeline,
|
||||
ClutterAlphaFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_alpha_set_func (ClutterAlpha *alpha,
|
||||
@ -133,6 +139,12 @@ void clutter_alpha_set_mode (ClutterAlpha *alpha,
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_alpha_get_mode (ClutterAlpha *alpha);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_alpha_register_func (ClutterAlphaFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_alpha_register_closure (GClosure *closure);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ALPHA_H__ */
|
||||
|
47
clutter/clutter/deprecated/clutter-animatable.h
Normal file
47
clutter/clutter/deprecated/clutter-animatable.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corporation.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Author:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_ANIMATABLE_DEPRECATED_H__
|
||||
#define __CLUTTER_ANIMATABLE_DEPRECATED_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-animatable.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_animatable_interpolate_value)
|
||||
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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ANIMATABLE_DEPRECATED_H__ */
|
@ -50,10 +50,20 @@
|
||||
* emitted if #ClutterAnimation:loop is set to %TRUE - that is, a looping
|
||||
* animation never completes.
|
||||
*
|
||||
* If your animation depends on user control you can force its completion
|
||||
* using clutter_animation_completed().
|
||||
*
|
||||
* If the #GObject instance bound to a #ClutterAnimation implements the
|
||||
* #ClutterAnimatable interface it is possible for that instance to
|
||||
* control the way the initial and final states are interpolated.
|
||||
*
|
||||
* #ClutterAnimations are distinguished from #ClutterBehaviours
|
||||
* because the former can only control #GObject properties of a single
|
||||
* #GObject instance, while the latter can control multiple properties
|
||||
* using accessor functions inside the #ClutterBehaviour
|
||||
* `alpha_notify` virtual function, and can control multiple #ClutterActors
|
||||
* as well.
|
||||
*
|
||||
* For convenience, it is possible to use the clutter_actor_animate()
|
||||
* function call which will take care of setting up and tearing down
|
||||
* a #ClutterAnimation instance and animate an actor between its current
|
||||
@ -635,6 +645,231 @@ clutter_animation_update_property_internal (ClutterAnimation *animation,
|
||||
g_object_ref_sink (interval));
|
||||
}
|
||||
|
||||
static GParamSpec *
|
||||
clutter_animation_validate_bind (ClutterAnimation *animation,
|
||||
const char *property_name,
|
||||
GType argtype)
|
||||
{
|
||||
ClutterAnimationPrivate *priv;
|
||||
GParamSpec *pspec;
|
||||
GType pspec_type;
|
||||
|
||||
priv = animation->priv;
|
||||
|
||||
if (G_UNLIKELY (!priv->object))
|
||||
{
|
||||
g_warning ("Cannot bind property '%s': the animation has no "
|
||||
"object set. You need to call clutter_animation_set_object() "
|
||||
"first to be able to bind a property",
|
||||
property_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (clutter_animation_has_property (animation, property_name)))
|
||||
{
|
||||
g_warning ("Cannot bind property '%s': the animation already has "
|
||||
"a bound property with the same name",
|
||||
property_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (CLUTTER_IS_ANIMATABLE (priv->object))
|
||||
{
|
||||
ClutterAnimatable *animatable = CLUTTER_ANIMATABLE (priv->object);
|
||||
|
||||
pspec = clutter_animatable_find_property (animatable, property_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
GObjectClass *klass = G_OBJECT_GET_CLASS (priv->object);
|
||||
|
||||
pspec = g_object_class_find_property (klass, property_name);
|
||||
}
|
||||
|
||||
if (pspec == NULL)
|
||||
{
|
||||
g_warning ("Cannot bind property '%s': objects of type '%s' have "
|
||||
"no such property",
|
||||
property_name,
|
||||
g_type_name (G_OBJECT_TYPE (priv->object)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(pspec->flags & G_PARAM_WRITABLE))
|
||||
{
|
||||
g_warning ("Cannot bind property '%s': the property is not writable",
|
||||
property_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pspec_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||
|
||||
if (g_value_type_transformable (argtype, pspec_type))
|
||||
return pspec;
|
||||
else
|
||||
{
|
||||
g_warning ("Cannot bind property '%s': the interval value of "
|
||||
"type '%s' is not compatible with the property value "
|
||||
"of type '%s'",
|
||||
property_name,
|
||||
g_type_name (argtype),
|
||||
g_type_name (pspec_type));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_bind_interval:
|
||||
* @animation: a #ClutterAnimation
|
||||
* @property_name: the property to control
|
||||
* @interval: (transfer full): a #ClutterInterval
|
||||
*
|
||||
* Binds @interval to the @property_name of the #GObject
|
||||
* attached to @animation. The #ClutterAnimation will take
|
||||
* ownership of the passed #ClutterInterval. For more information
|
||||
* about animations, see clutter_actor_animate().
|
||||
*
|
||||
* If you need to update the interval instance use
|
||||
* clutter_animation_update_interval() instead.
|
||||
*
|
||||
* Return value: (transfer none): The animation itself.
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_animation_bind_interval (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
ClutterInterval *interval)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
|
||||
g_return_val_if_fail (property_name != NULL, NULL);
|
||||
g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), NULL);
|
||||
|
||||
pspec = clutter_animation_validate_bind (animation, property_name,
|
||||
clutter_interval_get_value_type (interval));
|
||||
if (pspec == NULL)
|
||||
return NULL;
|
||||
|
||||
clutter_animation_bind_property_internal (animation, property_name,
|
||||
pspec,
|
||||
interval);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_animation_bind:
|
||||
* @animation: a #ClutterAnimation
|
||||
* @property_name: the property to control
|
||||
* @final: The final value of the property
|
||||
*
|
||||
* Adds a single property with name @property_name to the
|
||||
* animation @animation. For more information about animations,
|
||||
* see clutter_actor_animate().
|
||||
*
|
||||
* This method returns the animation primarily to make chained
|
||||
* calls convenient in language bindings.
|
||||
*
|
||||
* Return value: (transfer none): The animation itself.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_animation_bind (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
const GValue *final)
|
||||
{
|
||||
ClutterAnimationPrivate *priv;
|
||||
GParamSpec *pspec;
|
||||
ClutterInterval *interval;
|
||||
GType type;
|
||||
GValue initial = G_VALUE_INIT;
|
||||
GValue real_final = G_VALUE_INIT;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
|
||||
g_return_val_if_fail (property_name != NULL, NULL);
|
||||
|
||||
priv = animation->priv;
|
||||
|
||||
type = G_VALUE_TYPE (final);
|
||||
pspec = clutter_animation_validate_bind (animation, property_name, type);
|
||||
if (pspec == NULL)
|
||||
return NULL;
|
||||
|
||||
g_value_init (&real_final, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||
if (!g_value_transform (final, &real_final))
|
||||
{
|
||||
g_value_unset (&real_final);
|
||||
g_warning ("Unable to transform the value of type '%s' to a value "
|
||||
"of '%s' compatible with the property '%s'of the object "
|
||||
"of type '%s'",
|
||||
g_type_name (type),
|
||||
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
|
||||
property_name,
|
||||
G_OBJECT_TYPE_NAME (priv->object));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_value_init (&initial, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||
|
||||
if (CLUTTER_IS_ANIMATABLE (priv->object))
|
||||
clutter_animatable_get_initial_state (CLUTTER_ANIMATABLE (priv->object),
|
||||
property_name,
|
||||
&initial);
|
||||
else
|
||||
g_object_get_property (priv->object, property_name, &initial);
|
||||
|
||||
interval = clutter_interval_new_with_values (G_PARAM_SPEC_VALUE_TYPE (pspec),
|
||||
&initial,
|
||||
&real_final);
|
||||
|
||||
g_value_unset (&initial);
|
||||
g_value_unset (&real_final);
|
||||
|
||||
clutter_animation_bind_property_internal (animation, property_name,
|
||||
pspec,
|
||||
interval);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_animation_unbind_property:
|
||||
* @animation: a #ClutterAnimation
|
||||
* @property_name: name of the property
|
||||
*
|
||||
* Removes @property_name from the list of animated properties.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
void
|
||||
clutter_animation_unbind_property (ClutterAnimation *animation,
|
||||
const gchar *property_name)
|
||||
{
|
||||
ClutterAnimationPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
|
||||
g_return_if_fail (property_name != NULL);
|
||||
|
||||
priv = animation->priv;
|
||||
|
||||
if (!clutter_animation_has_property (animation, property_name))
|
||||
{
|
||||
g_warning ("Cannot unbind property '%s': the animation has "
|
||||
"no bound property with that name",
|
||||
property_name);
|
||||
return;
|
||||
}
|
||||
|
||||
g_hash_table_remove (priv->properties, property_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_has_property:
|
||||
* @animation: a #ClutterAnimation
|
||||
@ -662,6 +897,137 @@ clutter_animation_has_property (ClutterAnimation *animation,
|
||||
return g_hash_table_lookup (priv->properties, property_name) != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_update_interval:
|
||||
* @animation: a #ClutterAnimation
|
||||
* @property_name: name of the property
|
||||
* @interval: a #ClutterInterval
|
||||
*
|
||||
* Changes the @interval for @property_name. The #ClutterAnimation
|
||||
* will take ownership of the passed #ClutterInterval.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
void
|
||||
clutter_animation_update_interval (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
ClutterInterval *interval)
|
||||
{
|
||||
ClutterAnimationPrivate *priv;
|
||||
GParamSpec *pspec;
|
||||
GType pspec_type, int_type;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
|
||||
g_return_if_fail (property_name != NULL);
|
||||
g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
|
||||
|
||||
priv = animation->priv;
|
||||
|
||||
if (!clutter_animation_has_property (animation, property_name))
|
||||
{
|
||||
g_warning ("Cannot update property '%s': the animation has "
|
||||
"no bound property with that name",
|
||||
property_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CLUTTER_IS_ANIMATABLE (priv->object))
|
||||
{
|
||||
ClutterAnimatable *animatable = CLUTTER_ANIMATABLE (priv->object);
|
||||
|
||||
pspec = clutter_animatable_find_property (animatable, property_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
GObjectClass *klass = G_OBJECT_GET_CLASS (priv->object);
|
||||
|
||||
pspec = g_object_class_find_property (klass, property_name);
|
||||
}
|
||||
|
||||
if (pspec == NULL)
|
||||
{
|
||||
g_warning ("Cannot update property '%s': objects of type '%s' have "
|
||||
"no such property",
|
||||
property_name,
|
||||
g_type_name (G_OBJECT_TYPE (priv->object)));
|
||||
return;
|
||||
}
|
||||
|
||||
pspec_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||
int_type = clutter_interval_get_value_type (interval);
|
||||
|
||||
if (!g_value_type_compatible (int_type, pspec_type) ||
|
||||
!g_value_type_transformable (int_type, pspec_type))
|
||||
{
|
||||
g_warning ("Cannot update property '%s': the interval value of "
|
||||
"type '%s' is not compatible with the property value "
|
||||
"of type '%s'",
|
||||
property_name,
|
||||
g_type_name (int_type),
|
||||
g_type_name (pspec_type));
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_animation_update_property_internal (animation, property_name,
|
||||
pspec,
|
||||
interval);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_update:
|
||||
* @animation: a #ClutterAnimation
|
||||
* @property_name: name of the property
|
||||
* @final: The final value of the property
|
||||
*
|
||||
* Updates the @final value of the interval for @property_name
|
||||
*
|
||||
* Return value: (transfer none): The animation itself.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_animation_update (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
const GValue *final)
|
||||
{
|
||||
ClutterInterval *interval;
|
||||
GType int_type;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
|
||||
g_return_val_if_fail (property_name != NULL, NULL);
|
||||
g_return_val_if_fail (final != NULL, NULL);
|
||||
g_return_val_if_fail (G_VALUE_TYPE (final) != G_TYPE_INVALID, NULL);
|
||||
|
||||
interval = clutter_animation_get_interval (animation, property_name);
|
||||
if (interval == NULL)
|
||||
{
|
||||
g_warning ("Cannot update property '%s': the animation has "
|
||||
"no bound property with that name",
|
||||
property_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int_type = clutter_interval_get_value_type (interval);
|
||||
|
||||
if (!g_value_type_compatible (G_VALUE_TYPE (final), int_type) ||
|
||||
!g_value_type_transformable (G_VALUE_TYPE (final), int_type))
|
||||
{
|
||||
g_warning ("Cannot update property '%s': the interval value of "
|
||||
"type '%s' is not compatible with the property value "
|
||||
"of type '%s'",
|
||||
property_name,
|
||||
g_type_name (int_type),
|
||||
g_type_name (G_VALUE_TYPE (final)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
clutter_interval_set_final_value (interval, final);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_get_interval:
|
||||
* @animation: a #ClutterAnimation
|
||||
@ -925,6 +1291,10 @@ out:
|
||||
* set the duration with clutter_animation_set_duration() and the
|
||||
* easing mode using clutter_animation_set_mode().
|
||||
*
|
||||
* Use clutter_animation_bind() or clutter_animation_bind_interval()
|
||||
* to define the properties to be animated. The interval and the
|
||||
* animated properties can be updated at runtime.
|
||||
*
|
||||
* The clutter_actor_animate() and relative family of functions provide
|
||||
* an easy way to animate a #ClutterActor and automatically manage the
|
||||
* lifetime of a #ClutterAnimation instance, so you should consider using
|
||||
@ -978,6 +1348,25 @@ clutter_animation_set_object (ClutterAnimation *animation,
|
||||
g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_OBJECT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_get_object:
|
||||
* @animation: a #ClutterAnimation
|
||||
*
|
||||
* Retrieves the #GObject attached to @animation.
|
||||
*
|
||||
* Return value: (transfer none): a #GObject
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
GObject *
|
||||
clutter_animation_get_object (ClutterAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
|
||||
|
||||
return animation->priv->object;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_set_mode:
|
||||
* @animation: a #ClutterAnimation
|
||||
@ -1268,6 +1657,76 @@ clutter_animation_get_timeline (ClutterAnimation *animation)
|
||||
return clutter_animation_get_timeline_internal (animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_set_alpha:
|
||||
* @animation: a #ClutterAnimation
|
||||
* @alpha: a #ClutterAlpha, or %NULL to unset the current #ClutterAlpha
|
||||
*
|
||||
* Sets @alpha as the #ClutterAlpha used by @animation.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterAnimation will take ownership
|
||||
* of the #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_animation_get_timeline() and
|
||||
* clutter_timeline_set_progress_mode() instead.
|
||||
*/
|
||||
void
|
||||
clutter_animation_set_alpha (ClutterAnimation *animation,
|
||||
ClutterAlpha *alpha)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
|
||||
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
|
||||
|
||||
clutter_animation_set_alpha_internal (animation, alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_get_alpha:
|
||||
* @animation: a #ClutterAnimation
|
||||
*
|
||||
* Retrieves the #ClutterAlpha used by @animation.
|
||||
*
|
||||
* Return value: (transfer none): the alpha object used by the animation
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_animation_get_timeline() and
|
||||
* clutter_timeline_get_progress_mode() instead.
|
||||
*/
|
||||
ClutterAlpha *
|
||||
clutter_animation_get_alpha (ClutterAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
|
||||
|
||||
return clutter_animation_get_alpha_internal (animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animation_completed:
|
||||
* @animation: a #ClutterAnimation
|
||||
*
|
||||
* Emits the ::completed signal on @animation
|
||||
*
|
||||
* When using this function with a #ClutterAnimation created
|
||||
* by the clutter_actor_animate() family of functions, @animation
|
||||
* will be unreferenced and it will not be valid anymore,
|
||||
* unless g_object_ref() was called before calling this function
|
||||
* or unless a reference was taken inside a handler for the
|
||||
* #ClutterAnimation::completed signal
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
|
||||
*/
|
||||
void
|
||||
clutter_animation_completed (ClutterAnimation *animation)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
|
||||
|
||||
g_signal_emit (animation, animation_signals[COMPLETED], 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* starts the timeline
|
||||
*/
|
||||
@ -1401,6 +1860,55 @@ done:
|
||||
g_value_unset (&real_value);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_animation_setupv (ClutterAnimation *animation,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values)
|
||||
{
|
||||
ClutterAnimationPrivate *priv = animation->priv;
|
||||
ClutterAnimatable *animatable = NULL;
|
||||
GObjectClass *klass = NULL;
|
||||
gint i;
|
||||
|
||||
if (CLUTTER_IS_ANIMATABLE (priv->object))
|
||||
animatable = CLUTTER_ANIMATABLE (priv->object);
|
||||
else
|
||||
klass = G_OBJECT_GET_CLASS (priv->object);
|
||||
|
||||
for (i = 0; i < n_properties; i++)
|
||||
{
|
||||
const gchar *property_name = properties[i];
|
||||
GParamSpec *pspec;
|
||||
gboolean is_fixed = FALSE;
|
||||
|
||||
if (g_str_has_prefix (property_name, "fixed::"))
|
||||
{
|
||||
property_name += 7; /* strlen("fixed::") */
|
||||
is_fixed = TRUE;
|
||||
}
|
||||
|
||||
if (animatable != NULL)
|
||||
pspec = clutter_animatable_find_property (animatable, property_name);
|
||||
else
|
||||
pspec = g_object_class_find_property (klass, property_name);
|
||||
|
||||
if (pspec == NULL)
|
||||
{
|
||||
g_warning ("Cannot bind property '%s': objects of type '%s' do "
|
||||
"not have this property",
|
||||
property_name,
|
||||
g_type_name (G_OBJECT_TYPE (priv->object)));
|
||||
break;
|
||||
}
|
||||
|
||||
clutter_animation_setup_property (animation, property_name,
|
||||
&values[i],
|
||||
pspec,
|
||||
is_fixed);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
const gchar *name;
|
||||
@ -1554,6 +2062,67 @@ animation_create_for_actor (ClutterActor *actor)
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_animate_with_alpha:
|
||||
* @actor: a #ClutterActor
|
||||
* @alpha: a #ClutterAlpha
|
||||
* @first_property_name: the name of a property
|
||||
* @...: a %NULL terminated list of property names and
|
||||
* property values
|
||||
*
|
||||
* Animates the given list of properties of @actor between the current
|
||||
* value for each property and a new final value. The animation has a
|
||||
* definite behaviour given by the passed @alpha.
|
||||
*
|
||||
* See clutter_actor_animate() for further details.
|
||||
*
|
||||
* This function is useful if you want to use an existing #ClutterAlpha
|
||||
* to animate @actor.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAnimation object. The object is owned by the
|
||||
* #ClutterActor and should not be unreferenced with g_object_unref()
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: Use the implicit transition for animatable properties
|
||||
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
|
||||
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
|
||||
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_actor_animate_with_alpha (ClutterActor *actor,
|
||||
ClutterAlpha *alpha,
|
||||
const gchar *first_property_name,
|
||||
...)
|
||||
{
|
||||
ClutterAnimation *animation;
|
||||
ClutterTimeline *timeline;
|
||||
va_list args;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
|
||||
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
g_return_val_if_fail (first_property_name != NULL, NULL);
|
||||
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
if (timeline == NULL)
|
||||
{
|
||||
g_warning ("The passed ClutterAlpha does not have an "
|
||||
"associated ClutterTimeline.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
animation = animation_create_for_actor (actor);
|
||||
clutter_animation_set_alpha_internal (animation, alpha);
|
||||
|
||||
va_start (args, first_property_name);
|
||||
clutter_animation_setup_valist (animation, first_property_name, args);
|
||||
va_end (args);
|
||||
|
||||
clutter_animation_start (animation);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_animate_with_timeline:
|
||||
* @actor: a #ClutterActor
|
||||
@ -1797,3 +2366,263 @@ clutter_actor_animate (ClutterActor *actor,
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_animatev:
|
||||
* @actor: a #ClutterActor
|
||||
* @mode: an animation mode logical id
|
||||
* @duration: duration of the animation, in milliseconds
|
||||
* @n_properties: number of property names and values
|
||||
* @properties: (array length=n_properties) (element-type utf8): a vector
|
||||
* containing the property names to set
|
||||
* @values: (array length=n_properties): a vector containing the
|
||||
* property values to set
|
||||
*
|
||||
* Animates the given list of properties of @actor between the current
|
||||
* value for each property and a new final value. The animation has a
|
||||
* definite duration and a speed given by the @mode.
|
||||
*
|
||||
* This is the vector-based variant of clutter_actor_animate(), useful
|
||||
* for language bindings.
|
||||
*
|
||||
* Unlike clutter_actor_animate(), this function will not
|
||||
* allow you to specify "signal::" names and callbacks.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAnimation object. The object is
|
||||
* owned by the #ClutterActor and should not be unreferenced with
|
||||
* g_object_unref()
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use the implicit transition for animatable properties
|
||||
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
|
||||
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
|
||||
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_actor_animatev (ClutterActor *actor,
|
||||
gulong mode,
|
||||
guint duration,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values)
|
||||
{
|
||||
ClutterAnimation *animation;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
|
||||
g_return_val_if_fail (mode != CLUTTER_CUSTOM_MODE, NULL);
|
||||
g_return_val_if_fail (duration > 0, NULL);
|
||||
g_return_val_if_fail (properties != NULL, NULL);
|
||||
g_return_val_if_fail (values != NULL, NULL);
|
||||
|
||||
animation = animation_create_for_actor (actor);
|
||||
clutter_animation_set_mode (animation, mode);
|
||||
clutter_animation_set_duration (animation, duration);
|
||||
clutter_animation_setupv (animation, n_properties, properties, values);
|
||||
clutter_animation_start (animation);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_animate_with_timelinev:
|
||||
* @actor: a #ClutterActor
|
||||
* @mode: an animation mode logical id
|
||||
* @timeline: a #ClutterTimeline
|
||||
* @n_properties: number of property names and values
|
||||
* @properties: (array length=n_properties) (element-type utf8): a vector
|
||||
* containing the property names to set
|
||||
* @values: (array length=n_properties): a vector containing the
|
||||
* property values to set
|
||||
*
|
||||
* Animates the given list of properties of @actor between the current
|
||||
* value for each property and a new final value. The animation has a
|
||||
* definite duration given by @timeline and a speed given by the @mode.
|
||||
*
|
||||
* See clutter_actor_animate() for further details.
|
||||
*
|
||||
* This function is useful if you want to use an existing timeline
|
||||
* to animate @actor.
|
||||
*
|
||||
* This is the vector-based variant of clutter_actor_animate_with_timeline(),
|
||||
* useful for language bindings.
|
||||
*
|
||||
* Unlike clutter_actor_animate_with_timeline(), this function
|
||||
* will not allow you to specify "signal::" names and callbacks.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAnimation object. The object is
|
||||
* owned by the #ClutterActor and should not be unreferenced with
|
||||
* g_object_unref()
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use the implicit transition for animatable properties
|
||||
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
|
||||
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
|
||||
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_actor_animate_with_timelinev (ClutterActor *actor,
|
||||
gulong mode,
|
||||
ClutterTimeline *timeline,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values)
|
||||
{
|
||||
ClutterAnimation *animation;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
|
||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||
g_return_val_if_fail (properties != NULL, NULL);
|
||||
g_return_val_if_fail (values != NULL, NULL);
|
||||
|
||||
animation = animation_create_for_actor (actor);
|
||||
clutter_animation_set_mode (animation, mode);
|
||||
clutter_animation_set_timeline (animation, timeline);
|
||||
clutter_animation_setupv (animation, n_properties, properties, values);
|
||||
clutter_animation_start (animation);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_animate_with_alphav:
|
||||
* @actor: a #ClutterActor
|
||||
* @alpha: a #ClutterAlpha
|
||||
* @n_properties: number of property names and values
|
||||
* @properties: (array length=n_properties) (element-type utf8): a vector
|
||||
* containing the property names to set
|
||||
* @values: (array length=n_properties): a vector containing the
|
||||
* property values to set
|
||||
*
|
||||
* Animates the given list of properties of @actor between the current
|
||||
* value for each property and a new final value. The animation has a
|
||||
* definite behaviour given by the passed @alpha.
|
||||
*
|
||||
* See clutter_actor_animate() for further details.
|
||||
*
|
||||
* This function is useful if you want to use an existing #ClutterAlpha
|
||||
* to animate @actor.
|
||||
*
|
||||
* This is the vector-based variant of clutter_actor_animate_with_alpha(),
|
||||
* useful for language bindings.
|
||||
*
|
||||
* Unlike clutter_actor_animate_with_alpha(), this function will
|
||||
* not allow you to specify "signal::" names and callbacks.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAnimation object. The object is owned by the
|
||||
* #ClutterActor and should not be unreferenced with g_object_unref()
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: Use the implicit transition for animatable properties
|
||||
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
|
||||
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
|
||||
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_actor_animate_with_alphav (ClutterActor *actor,
|
||||
ClutterAlpha *alpha,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values)
|
||||
{
|
||||
ClutterAnimation *animation;
|
||||
ClutterTimeline *timeline;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
|
||||
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
g_return_val_if_fail (properties != NULL, NULL);
|
||||
g_return_val_if_fail (values != NULL, NULL);
|
||||
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
if (timeline == NULL)
|
||||
{
|
||||
g_warning ("The passed ClutterAlpha does not have an "
|
||||
"associated ClutterTimeline.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
animation = animation_create_for_actor (actor);
|
||||
clutter_animation_set_alpha_internal (animation, alpha);
|
||||
clutter_animation_setupv (animation, n_properties, properties, values);
|
||||
clutter_animation_start (animation);
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_animation:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Retrieves the #ClutterAnimation used by @actor, if clutter_actor_animate()
|
||||
* has been called on @actor.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAnimation, or %NULL
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.12: Use the implicit transition for animatable properties
|
||||
* in #ClutterActor instead, and clutter_actor_get_transition() to retrieve
|
||||
* the transition.
|
||||
*/
|
||||
ClutterAnimation *
|
||||
clutter_actor_get_animation (ClutterActor *actor)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
|
||||
|
||||
return g_object_get_qdata (G_OBJECT (actor), quark_object_animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_detach_animation:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Detaches the #ClutterAnimation used by @actor, if clutter_actor_animate()
|
||||
* has been called on @actor.
|
||||
*
|
||||
* Once the animation has been detached, it loses a reference. If it was
|
||||
* the only reference then the #ClutterAnimation becomes invalid.
|
||||
*
|
||||
* The #ClutterAnimation::completed signal will not be emitted.
|
||||
*
|
||||
* Since: 1.4
|
||||
* Deprecated: 1.12: Use the implicit transition for animatable properties
|
||||
* in #ClutterActor instead, and clutter_actor_remove_transition() to
|
||||
* remove the transition.
|
||||
*/
|
||||
void
|
||||
clutter_actor_detach_animation (ClutterActor *actor)
|
||||
{
|
||||
ClutterAnimation *animation;
|
||||
ClutterAnimationPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
animation = g_object_get_qdata (G_OBJECT (actor), quark_object_animation);
|
||||
if (animation == NULL)
|
||||
return;
|
||||
|
||||
priv = animation->priv;
|
||||
|
||||
g_assert (priv->object == G_OBJECT (actor));
|
||||
|
||||
/* we can't call get_timeline_internal() here because it would be
|
||||
* pointless to create a timeline on an animation we want to detach
|
||||
*/
|
||||
if (priv->alpha != NULL)
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
|
||||
timeline = clutter_alpha_get_timeline (priv->alpha);
|
||||
if (timeline != NULL)
|
||||
clutter_timeline_stop (timeline);
|
||||
}
|
||||
|
||||
/* disconnect the ::destroy handler added by animation_create_for_actor() */
|
||||
g_signal_handlers_disconnect_by_func (actor,
|
||||
G_CALLBACK (on_actor_destroy),
|
||||
animation);
|
||||
|
||||
clutter_animation_set_object (animation, NULL);
|
||||
|
||||
/* drop the reference on the animation */
|
||||
g_object_unref (animation);
|
||||
}
|
||||
|
@ -103,6 +103,8 @@ ClutterAnimation * clutter_animation_new (void);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_transition_set_animatable)
|
||||
void clutter_animation_set_object (ClutterAnimation *animation,
|
||||
GObject *object);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_transition_get_animatable)
|
||||
GObject * clutter_animation_get_object (ClutterAnimation *animation);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_timeline_set_progress_mode)
|
||||
void clutter_animation_set_mode (ClutterAnimation *animation,
|
||||
gulong mode);
|
||||
@ -123,12 +125,38 @@ void clutter_animation_set_timeline (ClutterAnimatio
|
||||
ClutterTimeline *timeline);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_animation_get_timeline (ClutterAnimation *animation);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_animation_set_timeline)
|
||||
void clutter_animation_set_alpha (ClutterAnimation *animation,
|
||||
ClutterAlpha *alpha);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_animation_get_timeline)
|
||||
ClutterAlpha * clutter_animation_get_alpha (ClutterAnimation *animation);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimation * clutter_animation_bind (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
const GValue *final);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_transition_set_interval)
|
||||
ClutterAnimation * clutter_animation_bind_interval (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
ClutterInterval *interval);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animation_has_property (ClutterAnimation *animation,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimation * clutter_animation_update (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
const GValue *final);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animation_update_interval (ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
ClutterInterval *interval);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animation_unbind_property (ClutterAnimation *animation,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterInterval * clutter_animation_get_interval (ClutterAnimation *animation,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animation_completed (ClutterAnimation *animation);
|
||||
|
||||
/*
|
||||
* ClutterActor API
|
||||
@ -146,6 +174,36 @@ ClutterAnimation * clutter_actor_animate_with_timeline (ClutterActor
|
||||
ClutterTimeline *timeline,
|
||||
const gchar *first_property_name,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimation * clutter_actor_animatev (ClutterActor *actor,
|
||||
gulong mode,
|
||||
guint duration,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimation * clutter_actor_animate_with_timelinev (ClutterActor *actor,
|
||||
gulong mode,
|
||||
ClutterTimeline *timeline,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate_with_timeline)
|
||||
ClutterAnimation * clutter_actor_animate_with_alpha (ClutterActor *actor,
|
||||
ClutterAlpha *alpha,
|
||||
const gchar *first_property_name,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate_with_timelinev)
|
||||
ClutterAnimation * clutter_actor_animate_with_alphav (ClutterActor *actor,
|
||||
ClutterAlpha *alpha,
|
||||
gint n_properties,
|
||||
const gchar * const properties[],
|
||||
const GValue *values);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimation * clutter_actor_get_animation (ClutterActor *actor);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_actor_detach_animation (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
303
clutter/clutter/deprecated/clutter-behaviour-depth.c
Normal file
303
clutter/clutter/deprecated/clutter-behaviour-depth.c
Normal file
@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "deprecated/clutter-actor.h"
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-behaviour-depth.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour-depth
|
||||
* @Title: ClutterBehaviourDepth
|
||||
* @short_description: A behaviour controlling the Z position
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() instead
|
||||
*
|
||||
* #ClutterBehaviourDepth is a simple #ClutterBehaviour controlling the
|
||||
* depth of a set of actors between a start and end depth.
|
||||
*
|
||||
* #ClutterBehaviourDepth is available since Clutter 0.4.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:depth property and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
*/
|
||||
|
||||
struct _ClutterBehaviourDepthPrivate
|
||||
{
|
||||
gint depth_start;
|
||||
gint depth_end;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_DEPTH_START,
|
||||
PROP_DEPTH_END
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourDepth,
|
||||
clutter_behaviour_depth,
|
||||
CLUTTER_TYPE_BEHAVIOUR)
|
||||
|
||||
static void
|
||||
alpha_notify_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
clutter_actor_set_depth (actor, GPOINTER_TO_INT (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
ClutterBehaviourDepthPrivate *priv;
|
||||
gint depth;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_DEPTH (behaviour)->priv;
|
||||
|
||||
/* Need to create factor as to avoid borking signedness */
|
||||
depth = (alpha_value * (priv->depth_end - priv->depth_start))
|
||||
+ priv->depth_start;
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, depth: %d", alpha_value, depth);
|
||||
|
||||
clutter_behaviour_actors_foreach (behaviour,
|
||||
alpha_notify_foreach,
|
||||
GINT_TO_POINTER (depth));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_applied (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (behaviour);
|
||||
|
||||
clutter_actor_set_depth (actor, depth->priv->depth_start);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEPTH_START:
|
||||
depth->priv->depth_start = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_DEPTH_END:
|
||||
depth->priv->depth_end = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEPTH_START:
|
||||
g_value_set_int (value, depth->priv->depth_start);
|
||||
break;
|
||||
case PROP_DEPTH_END:
|
||||
g_value_set_int (value, depth->priv->depth_end);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = clutter_behaviour_depth_set_property;
|
||||
gobject_class->get_property = clutter_behaviour_depth_get_property;
|
||||
|
||||
behaviour_class->alpha_notify = clutter_behaviour_depth_alpha_notify;
|
||||
behaviour_class->applied = clutter_behaviour_depth_applied;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourDepth:depth-start:
|
||||
*
|
||||
* Start depth level to apply to the actors.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DEPTH_START,
|
||||
g_param_spec_int ("depth-start",
|
||||
P_("Start Depth"),
|
||||
P_("Initial depth to apply"),
|
||||
G_MININT, G_MAXINT, 0,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
/**
|
||||
* ClutterBehaviourDepth:depth-end:
|
||||
*
|
||||
* End depth level to apply to the actors.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DEPTH_END,
|
||||
g_param_spec_int ("depth-end",
|
||||
P_("End Depth"),
|
||||
P_("Final depth to apply"),
|
||||
G_MININT, G_MAXINT, 0,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_depth_init (ClutterBehaviourDepth *depth)
|
||||
{
|
||||
depth->priv = clutter_behaviour_depth_get_instance_private (depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_depth_new:
|
||||
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
|
||||
* @depth_start: initial value of the depth
|
||||
* @depth_end: final value of the depth
|
||||
*
|
||||
* Creates a new #ClutterBehaviourDepth which can be used to control
|
||||
* the ClutterActor:depth property of a set of #ClutterActor<!-- -->s.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
|
||||
* it can be set later with clutter_behaviour_set_alpha().
|
||||
*
|
||||
* Return value: (transfer full): the newly created behaviour
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterBehaviour *
|
||||
clutter_behaviour_depth_new (ClutterAlpha *alpha,
|
||||
gint depth_start,
|
||||
gint depth_end)
|
||||
{
|
||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_DEPTH,
|
||||
"alpha", alpha,
|
||||
"depth-start", depth_start,
|
||||
"depth-end", depth_end,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_depth_set_bounds:
|
||||
* @behaviour: a #ClutterBehaviourDepth
|
||||
* @depth_start: initial value of the depth
|
||||
* @depth_end: final value of the depth
|
||||
*
|
||||
* Sets the boundaries of the @behaviour.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint depth_start,
|
||||
gint depth_end)
|
||||
{
|
||||
ClutterBehaviourDepthPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
|
||||
|
||||
priv = behaviour->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (behaviour));
|
||||
|
||||
if (priv->depth_start != depth_start)
|
||||
{
|
||||
priv->depth_start = depth_start;
|
||||
g_object_notify (G_OBJECT (behaviour), "depth-start");
|
||||
}
|
||||
|
||||
if (priv->depth_end != depth_end)
|
||||
{
|
||||
priv->depth_end = depth_end;
|
||||
g_object_notify (G_OBJECT (behaviour), "depth-end");
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (behaviour));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_depth_get_bounds:
|
||||
* @behaviour: a #ClutterBehaviourDepth
|
||||
* @depth_start: (out): return location for the initial depth value, or %NULL
|
||||
* @depth_end: (out): return location for the final depth value, or %NULL
|
||||
*
|
||||
* Gets the boundaries of the @behaviour
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint *depth_start,
|
||||
gint *depth_end)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
|
||||
|
||||
if (depth_start)
|
||||
*depth_start = behaviour->priv->depth_start;
|
||||
|
||||
if (depth_end)
|
||||
*depth_end = behaviour->priv->depth_end;
|
||||
}
|
101
clutter/clutter/deprecated/clutter-behaviour-depth.h
Normal file
101
clutter/clutter/deprecated/clutter-behaviour-depth.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_DEPTH__
|
||||
#define __CLUTTER_BEHAVIOUR_DEPTH__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR_DEPTH (clutter_behaviour_depth_get_type ())
|
||||
#define CLUTTER_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepth))
|
||||
#define CLUTTER_IS_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
|
||||
#define CLUTTER_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
|
||||
#define CLUTTER_IS_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
|
||||
#define CLUTTER_BEHAVIOUR_DEPTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
|
||||
|
||||
typedef struct _ClutterBehaviourDepth ClutterBehaviourDepth;
|
||||
typedef struct _ClutterBehaviourDepthPrivate ClutterBehaviourDepthPrivate;
|
||||
typedef struct _ClutterBehaviourDepthClass ClutterBehaviourDepthClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourDepth:
|
||||
*
|
||||
* The #ClutterBehaviourDepth structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:depth
|
||||
* instead.
|
||||
*/
|
||||
struct _ClutterBehaviourDepth
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviour parent_instance;
|
||||
|
||||
ClutterBehaviourDepthPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourDepthClass:
|
||||
*
|
||||
* The #ClutterBehaviourDepthClass structure contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourDepthClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviourClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_depth_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:depth)
|
||||
ClutterBehaviour *clutter_behaviour_depth_new (ClutterAlpha *alpha,
|
||||
gint depth_start,
|
||||
gint depth_end);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint depth_start,
|
||||
gint depth_end);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
|
||||
gint *depth_start,
|
||||
gint *depth_end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_DEPTH__ */
|
310
clutter/clutter/deprecated/clutter-behaviour-opacity.c
Normal file
310
clutter/clutter/deprecated/clutter-behaviour-opacity.c
Normal file
@ -0,0 +1,310 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour-opacity
|
||||
* @Title: ClutterBehaviourOpacity
|
||||
* @short_description: A behaviour controlling opacity
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() instead.
|
||||
*
|
||||
* #ClutterBehaviourOpacity controls the opacity of a set of actors.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-behaviour-opacity.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-debug.h"
|
||||
|
||||
struct _ClutterBehaviourOpacityPrivate
|
||||
{
|
||||
guint8 opacity_start;
|
||||
guint8 opacity_end;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_OPACITY_START,
|
||||
PROP_OPACITY_END,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourOpacity,
|
||||
clutter_behaviour_opacity,
|
||||
CLUTTER_TYPE_BEHAVIOUR)
|
||||
|
||||
static void
|
||||
alpha_notify_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
clutter_actor_set_opacity (actor, GPOINTER_TO_UINT(data));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_alpha_notify (ClutterBehaviour *behave,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
ClutterBehaviourOpacityPrivate *priv;
|
||||
guint8 opacity;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv;
|
||||
|
||||
opacity = alpha_value
|
||||
* (priv->opacity_end - priv->opacity_start)
|
||||
+ priv->opacity_start;
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, opacity: %u",
|
||||
alpha_value,
|
||||
opacity);
|
||||
|
||||
clutter_behaviour_actors_foreach (behave,
|
||||
alpha_notify_foreach,
|
||||
GUINT_TO_POINTER ((guint) opacity));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_OPACITY_START:
|
||||
clutter_behaviour_opacity_set_bounds (self,
|
||||
g_value_get_uint (value),
|
||||
self->priv->opacity_end);
|
||||
break;
|
||||
|
||||
case PROP_OPACITY_END:
|
||||
clutter_behaviour_opacity_set_bounds (self,
|
||||
self->priv->opacity_start,
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_OPACITY_START:
|
||||
g_value_set_uint (value, self->priv->opacity_start);
|
||||
break;
|
||||
|
||||
case PROP_OPACITY_END:
|
||||
g_value_set_uint (value, self->priv->opacity_end);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
gobject_class->set_property = clutter_behaviour_opacity_set_property;
|
||||
gobject_class->get_property = clutter_behaviour_opacity_get_property;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacity:opacity-start:
|
||||
*
|
||||
* Initial opacity level of the behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_uint ("opacity-start",
|
||||
P_("Opacity Start"),
|
||||
P_("Initial opacity level"),
|
||||
0, 255,
|
||||
0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_OPACITY_START] = pspec;
|
||||
g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec);
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacity:opacity-end:
|
||||
*
|
||||
* Final opacity level of the behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_uint ("opacity-end",
|
||||
P_("Opacity End"),
|
||||
P_("Final opacity level"),
|
||||
0, 255,
|
||||
0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_OPACITY_END] = pspec;
|
||||
g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec);
|
||||
|
||||
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
|
||||
{
|
||||
self->priv = clutter_behaviour_opacity_get_instance_private (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_opacity_new:
|
||||
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
|
||||
* @opacity_start: minimum level of opacity
|
||||
* @opacity_end: maximum level of opacity
|
||||
*
|
||||
* Creates a new #ClutterBehaviourOpacity object, driven by @alpha
|
||||
* which controls the opacity property of every actor, making it
|
||||
* change in the interval between @opacity_start and @opacity_end.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
|
||||
* it can be set later with clutter_behaviour_set_alpha().
|
||||
*
|
||||
* Return value: the newly created #ClutterBehaviourOpacity
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterBehaviour *
|
||||
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
|
||||
"alpha", alpha,
|
||||
"opacity-start", opacity_start,
|
||||
"opacity-end", opacity_end,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_opacity_set_bounds:
|
||||
* @behaviour: a #ClutterBehaviourOpacity
|
||||
* @opacity_start: minimum level of opacity
|
||||
* @opacity_end: maximum level of opacity
|
||||
*
|
||||
* Sets the initial and final levels of the opacity applied by @behaviour
|
||||
* on each actor it controls.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end)
|
||||
{
|
||||
ClutterBehaviourOpacityPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
|
||||
|
||||
priv = behaviour->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (behaviour));
|
||||
|
||||
if (priv->opacity_start != opacity_start)
|
||||
{
|
||||
priv->opacity_start = opacity_start;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_START]);
|
||||
}
|
||||
|
||||
if (priv->opacity_end != opacity_end)
|
||||
{
|
||||
priv->opacity_end = opacity_end;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_END]);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (behaviour));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_opacity_get_bounds:
|
||||
* @behaviour: a #ClutterBehaviourOpacity
|
||||
* @opacity_start: (out): return location for the minimum level of opacity, or %NULL
|
||||
* @opacity_end: (out): return location for the maximum level of opacity, or %NULL
|
||||
*
|
||||
* Gets the initial and final levels of the opacity applied by @behaviour
|
||||
* on each actor it controls.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 *opacity_start,
|
||||
guint8 *opacity_end)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
|
||||
|
||||
if (opacity_start)
|
||||
*opacity_start = behaviour->priv->opacity_start;
|
||||
|
||||
if (opacity_end)
|
||||
*opacity_end = behaviour->priv->opacity_end;
|
||||
}
|
115
clutter/clutter/deprecated/clutter-behaviour-opacity.h
Normal file
115
clutter/clutter/deprecated/clutter-behaviour-opacity.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_OPACITY_H__
|
||||
#define __CLUTTER_BEHAVIOUR_OPACITY_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ())
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
|
||||
|
||||
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
|
||||
typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
|
||||
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacity:
|
||||
*
|
||||
* The #ClutterBehaviourOpacity structure contains only private data and
|
||||
* should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_actor_animate() and #ClutterActor:opacity
|
||||
* instead.
|
||||
*/
|
||||
struct _ClutterBehaviourOpacity
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviour parent;
|
||||
ClutterBehaviourOpacityPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourOpacityClass:
|
||||
*
|
||||
* The #ClutterBehaviourOpacityClass structure contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourOpacityClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviourClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:opacity)
|
||||
ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 opacity_start,
|
||||
guint8 opacity_end);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
|
||||
guint8 *opacity_start,
|
||||
guint8 *opacity_end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */
|
437
clutter/clutter/deprecated/clutter-behaviour-scale.c
Normal file
437
clutter/clutter/deprecated/clutter-behaviour-scale.c
Normal file
@ -0,0 +1,437 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour-scale
|
||||
* @Title: ClutterBehaviourScale
|
||||
* @short_description: A behaviour controlling scale
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
|
||||
* and #ClutterActor:scale-y instead.
|
||||
*
|
||||
* A #ClutterBehaviourScale interpolates actors size between two values.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
|
||||
* properties, and clutter_actor_animate(), or #ClutterAnimator or
|
||||
* #ClutterState instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-actor.h"
|
||||
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-behaviour-scale.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
struct _ClutterBehaviourScalePrivate
|
||||
{
|
||||
gdouble x_scale_start;
|
||||
gdouble y_scale_start;
|
||||
|
||||
gdouble x_scale_end;
|
||||
gdouble y_scale_end;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_X_SCALE_START,
|
||||
PROP_Y_SCALE_START,
|
||||
PROP_X_SCALE_END,
|
||||
PROP_Y_SCALE_END,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourScale,
|
||||
clutter_behaviour_scale,
|
||||
CLUTTER_TYPE_BEHAVIOUR)
|
||||
|
||||
typedef struct {
|
||||
gdouble scale_x;
|
||||
gdouble scale_y;
|
||||
} ScaleFrameClosure;
|
||||
|
||||
static void
|
||||
scale_frame_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
ScaleFrameClosure *closure = data;
|
||||
|
||||
clutter_actor_set_scale (actor, closure->scale_x, closure->scale_y);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
ScaleFrameClosure closure = { 0, };
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
|
||||
|
||||
/* Fix the start/end values, avoids potential rounding errors on large
|
||||
* values.
|
||||
*/
|
||||
if (alpha_value == 1.0)
|
||||
{
|
||||
closure.scale_x = priv->x_scale_end;
|
||||
closure.scale_y = priv->y_scale_end;
|
||||
}
|
||||
else if (alpha_value == 0)
|
||||
{
|
||||
closure.scale_x = priv->x_scale_start;
|
||||
closure.scale_y = priv->y_scale_start;
|
||||
}
|
||||
else
|
||||
{
|
||||
closure.scale_x = (priv->x_scale_end - priv->x_scale_start)
|
||||
* alpha_value
|
||||
+ priv->x_scale_start;
|
||||
|
||||
closure.scale_y = (priv->y_scale_end - priv->y_scale_start)
|
||||
* alpha_value
|
||||
+ priv->y_scale_start;
|
||||
}
|
||||
|
||||
clutter_behaviour_actors_foreach (behave,
|
||||
scale_frame_foreach,
|
||||
&closure);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_SCALE_START:
|
||||
priv->x_scale_start = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_X_SCALE_END:
|
||||
priv->x_scale_end = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_START:
|
||||
priv->y_scale_start = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_END:
|
||||
priv->y_scale_end = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_SCALE_START:
|
||||
g_value_set_double (value, priv->x_scale_start);
|
||||
break;
|
||||
|
||||
case PROP_X_SCALE_END:
|
||||
g_value_set_double (value, priv->x_scale_end);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_START:
|
||||
g_value_set_double (value, priv->y_scale_start);
|
||||
break;
|
||||
|
||||
case PROP_Y_SCALE_END:
|
||||
g_value_set_double (value, priv->y_scale_end);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
|
||||
GParamSpec *pspec = NULL;
|
||||
|
||||
gobject_class->set_property = clutter_behaviour_scale_set_property;
|
||||
gobject_class->get_property = clutter_behaviour_scale_get_property;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourScale:x-scale-start:
|
||||
*
|
||||
* The initial scaling factor on the X axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("x-scale-start",
|
||||
P_("X Start Scale"),
|
||||
P_("Initial scale on the X axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_X_SCALE_START] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_X_SCALE_START,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterBehaviourScale:x-scale-end:
|
||||
*
|
||||
* The final scaling factor on the X axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("x-scale-end",
|
||||
P_("X End Scale"),
|
||||
P_("Final scale on the X axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_X_SCALE_END] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_X_SCALE_END,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterBehaviourScale:y-scale-start:
|
||||
*
|
||||
* The initial scaling factor on the Y axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("y-scale-start",
|
||||
P_("Y Start Scale"),
|
||||
P_("Initial scale on the Y axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_Y_SCALE_START] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_Y_SCALE_START,
|
||||
pspec);
|
||||
/**
|
||||
* ClutterBehaviourScale:y-scale-end:
|
||||
*
|
||||
* The final scaling factor on the Y axis for the actors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
pspec = g_param_spec_double ("y-scale-end",
|
||||
P_("Y End Scale"),
|
||||
P_("Final scale on the Y axis"),
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
obj_props[PROP_Y_SCALE_END] = pspec;
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_Y_SCALE_END,
|
||||
pspec);
|
||||
|
||||
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
self->priv = priv = clutter_behaviour_scale_get_instance_private (self);
|
||||
|
||||
priv->x_scale_start = priv->x_scale_end = 1.0;
|
||||
priv->y_scale_start = priv->y_scale_end = 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_new:
|
||||
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
|
||||
* @x_scale_start: initial scale factor on the X axis
|
||||
* @y_scale_start: initial scale factor on the Y axis
|
||||
* @x_scale_end: final scale factor on the X axis
|
||||
* @y_scale_end: final scale factor on the Y axis
|
||||
*
|
||||
* Creates a new #ClutterBehaviourScale instance.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
|
||||
* it can be set later with clutter_behaviour_set_alpha().
|
||||
*
|
||||
* Return value: (transfer full): the newly created #ClutterBehaviourScale
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterBehaviour *
|
||||
clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end)
|
||||
{
|
||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
|
||||
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
|
||||
"alpha", alpha,
|
||||
"x-scale-start", x_scale_start,
|
||||
"y-scale-start", y_scale_start,
|
||||
"x-scale-end", x_scale_end,
|
||||
"y-scale-end", y_scale_end,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_set_bounds:
|
||||
* @scale: a #ClutterBehaviourScale
|
||||
* @x_scale_start: initial scale factor on the X axis
|
||||
* @y_scale_start: initial scale factor on the Y axis
|
||||
* @x_scale_end: final scale factor on the X axis
|
||||
* @y_scale_end: final scale factor on the Y axis
|
||||
*
|
||||
* Sets the bounds used by scale behaviour.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||
|
||||
priv = scale->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (scale));
|
||||
|
||||
if (priv->x_scale_start != x_scale_start)
|
||||
{
|
||||
priv->x_scale_start = x_scale_start;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_START]);
|
||||
}
|
||||
|
||||
if (priv->y_scale_start != y_scale_start)
|
||||
{
|
||||
priv->y_scale_start = y_scale_start;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_START]);
|
||||
}
|
||||
|
||||
if (priv->x_scale_end != x_scale_end)
|
||||
{
|
||||
priv->x_scale_end = x_scale_end;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_END]);
|
||||
}
|
||||
|
||||
if (priv->y_scale_end != y_scale_end)
|
||||
{
|
||||
priv->y_scale_end = y_scale_end;
|
||||
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_END]);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (scale));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_get_bounds:
|
||||
* @scale: a #ClutterBehaviourScale
|
||||
* @x_scale_start: (out): return location for the initial scale factor on the X
|
||||
* axis, or %NULL
|
||||
* @y_scale_start: (out): return location for the initial scale factor on the Y
|
||||
* axis, or %NULL
|
||||
* @x_scale_end: (out): return location for the final scale factor on the X axis,
|
||||
* or %NULL
|
||||
* @y_scale_end: (out): return location for the final scale factor on the Y axis,
|
||||
* or %NULL
|
||||
*
|
||||
* Retrieves the bounds used by scale behaviour.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble *x_scale_start,
|
||||
gdouble *y_scale_start,
|
||||
gdouble *x_scale_end,
|
||||
gdouble *y_scale_end)
|
||||
{
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||
|
||||
priv = scale->priv;
|
||||
|
||||
if (x_scale_start)
|
||||
*x_scale_start = priv->x_scale_start;
|
||||
|
||||
if (x_scale_end)
|
||||
*x_scale_end = priv->x_scale_end;
|
||||
|
||||
if (y_scale_start)
|
||||
*y_scale_start = priv->y_scale_start;
|
||||
|
||||
if (y_scale_end)
|
||||
*y_scale_end = priv->y_scale_end;
|
||||
}
|
107
clutter/clutter/deprecated/clutter-behaviour-scale.h
Normal file
107
clutter/clutter/deprecated/clutter-behaviour-scale.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
|
||||
#define __CLUTTER_BEHAVIOUR_SCALE_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR_SCALE (clutter_behaviour_scale_get_type ())
|
||||
#define CLUTTER_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
|
||||
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
|
||||
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE))
|
||||
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE))
|
||||
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
|
||||
|
||||
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
|
||||
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
|
||||
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourScale:
|
||||
*
|
||||
* The #ClutterBehaviourScale struct contains only private data and
|
||||
* should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
|
||||
* and #ClutterActor:scale-y instead.
|
||||
*/
|
||||
struct _ClutterBehaviourScale
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviour parent_instance;
|
||||
|
||||
ClutterBehaviourScalePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourScaleClass:
|
||||
*
|
||||
* The #ClutterBehaviourScaleClass struct contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourScaleClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterBehaviourClass parent_class;
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_actor_animate with ClutterActor:scale-x and ClutterActor:scale-y)
|
||||
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble *x_scale_start,
|
||||
gdouble *y_scale_start,
|
||||
gdouble *x_scale_end,
|
||||
gdouble *y_scale_end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */
|
657
clutter/clutter/deprecated/clutter-behaviour.c
Normal file
657
clutter/clutter/deprecated/clutter-behaviour.c
Normal file
@ -0,0 +1,657 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-behaviour
|
||||
* @Title: ClutterBehaviour
|
||||
* @short_description: Class for providing behaviours to actors
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
|
||||
* #ClutterState instead
|
||||
*
|
||||
* #ClutterBehaviour is the base class for implementing behaviours. A
|
||||
* behaviour is a controller object for #ClutterActor<!-- -->s; you can
|
||||
* use a behaviour to control one or more properties of an actor (such
|
||||
* as its opacity, or its position). A #ClutterBehaviour is driven by
|
||||
* an "alpha function" stored inside a #ClutterAlpha object; an alpha
|
||||
* function is a function depending solely on time. The alpha function
|
||||
* computes a value which is then applied to the properties of the
|
||||
* actors driven by a behaviour.
|
||||
*
|
||||
* Clutter provides some pre-defined behaviours, like #ClutterBehaviourPath,
|
||||
* which controls the position of a set of actors making them "walk" along
|
||||
* a set of nodes; #ClutterBehaviourOpacity, which controls the opacity
|
||||
* of a set of actors; #ClutterBehaviourScale, which controls the width
|
||||
* and height of a set of actors.
|
||||
*
|
||||
* To visualize the effects of different alpha functions on a
|
||||
* #ClutterBehaviour implementation it is possible to take the
|
||||
* #ClutterBehaviourPath as an example:
|
||||
*
|
||||
* 
|
||||
*
|
||||
* The actors position between the path's end points directly correlates
|
||||
* to the #ClutterAlpha's current alpha value driving the behaviour. With
|
||||
* the #ClutterAlpha's function set to a linear ramp the actor
|
||||
* will follow the path at a constant velocity, but when changing to
|
||||
* a sine wave the actor initially accelerates before quickly
|
||||
* decelerating.
|
||||
*
|
||||
* In order to implement a new behaviour you should subclass #ClutterBehaviour
|
||||
* and override the "alpha_notify" virtual function; inside the overridden
|
||||
* function you should obtain the alpha value from the #ClutterAlpha
|
||||
* instance bound to the behaviour and apply it to the desiderd property
|
||||
* (or properties) of every actor controlled by the behaviour.
|
||||
*
|
||||
* #ClutterBehaviour is available since Clutter 0.2.
|
||||
*
|
||||
* #ClutterBehaviour and its sub-classes have been discouraged sing Clutter
|
||||
* 1.0, and formally deprecated since Clutter 1.6. You should use the
|
||||
* [implicit animation][clutter-actor-animation] support inside #ClutterActor
|
||||
* if you still have code using #ClutterBehaviour.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "clutter-behaviour.h"
|
||||
#include "clutter-alpha.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-scriptable.h"
|
||||
#include "clutter-script-private.h"
|
||||
|
||||
struct _ClutterBehaviourPrivate
|
||||
{
|
||||
ClutterAlpha *alpha;
|
||||
|
||||
guint notify_id;
|
||||
GSList *actors;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ALPHA,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
enum
|
||||
{
|
||||
APPLIED,
|
||||
REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint behave_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour,
|
||||
clutter_behaviour,
|
||||
G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (ClutterBehaviour)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
||||
clutter_scriptable_iface_init))
|
||||
|
||||
static gboolean
|
||||
clutter_behaviour_parse_custom_node (ClutterScriptable *scriptable,
|
||||
ClutterScript *script,
|
||||
GValue *value,
|
||||
const gchar *name,
|
||||
JsonNode *node)
|
||||
{
|
||||
if (strncmp (name, "alpha", 5) == 0)
|
||||
{
|
||||
GObject *alpha;
|
||||
|
||||
alpha = _clutter_script_parse_alpha (script, node);
|
||||
if (alpha != NULL)
|
||||
{
|
||||
g_value_init (value, CLUTTER_TYPE_ALPHA);
|
||||
g_value_set_object (value, alpha);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||
{
|
||||
iface->parse_custom_node = clutter_behaviour_parse_custom_node;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBehaviour *self = CLUTTER_BEHAVIOUR (gobject);
|
||||
|
||||
clutter_behaviour_set_alpha (self, NULL);
|
||||
clutter_behaviour_remove_all (self);
|
||||
|
||||
G_OBJECT_CLASS (clutter_behaviour_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ALPHA:
|
||||
clutter_behaviour_set_alpha (behaviour, g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
|
||||
ClutterBehaviourPrivate *priv = behaviour->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ALPHA:
|
||||
g_value_set_object (value, priv->alpha);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_alpha_notify_unimplemented (ClutterBehaviour *behaviour,
|
||||
gdouble alpha_value)
|
||||
{
|
||||
g_warning ("ClutterBehaviourClass::alpha_notify not implemented for '%s'",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (behaviour)));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_class_init (ClutterBehaviourClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = clutter_behaviour_dispose;
|
||||
object_class->set_property = clutter_behaviour_set_property;
|
||||
object_class->get_property = clutter_behaviour_get_property;
|
||||
|
||||
/**
|
||||
* ClutterBehaviour:alpha:
|
||||
*
|
||||
* The #ClutterAlpha object used to drive this behaviour. A #ClutterAlpha
|
||||
* object binds a #ClutterTimeline and a function which computes a value
|
||||
* (the "alpha") depending on the time. Each time the alpha value changes
|
||||
* the alpha-notify virtual function is called.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
obj_props[PROP_ALPHA] =
|
||||
g_param_spec_object ("alpha",
|
||||
P_("Alpha"),
|
||||
P_("Alpha Object to drive the behaviour"),
|
||||
CLUTTER_TYPE_ALPHA,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class,
|
||||
PROP_LAST,
|
||||
obj_props);
|
||||
|
||||
klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented;
|
||||
|
||||
/**
|
||||
* ClutterBehaviour::applied:
|
||||
* @behaviour: the #ClutterBehaviour that received the signal
|
||||
* @actor: the actor the behaviour was applied to.
|
||||
*
|
||||
* The ::apply signal is emitted each time the behaviour is applied
|
||||
* to an actor.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
behave_signals[APPLIED] =
|
||||
g_signal_new ("applied",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterBehaviourClass, applied),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
/**
|
||||
* ClutterBehaviour::removed:
|
||||
* @behaviour: the #ClutterBehaviour that received the signal
|
||||
* @actor: the removed actor
|
||||
*
|
||||
* The ::removed signal is emitted each time a behaviour is not applied
|
||||
* to an actor anymore.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
behave_signals[REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (ClutterBehaviourClass, removed),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_behaviour_init (ClutterBehaviour *self)
|
||||
{
|
||||
self->priv = clutter_behaviour_get_instance_private (self);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_actor_on_destroy (ClutterActor *actor,
|
||||
ClutterBehaviour *behaviour)
|
||||
{
|
||||
clutter_behaviour_remove (behaviour, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_apply:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Applies @behave to @actor. This function adds a reference on
|
||||
* the actor.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_apply (ClutterBehaviour *behave,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = behave->priv;
|
||||
|
||||
if (g_slist_find (priv->actors, actor))
|
||||
{
|
||||
g_warning ("The behaviour of type %s already applies "
|
||||
"to the actor of type %s",
|
||||
g_type_name (G_OBJECT_TYPE (behave)),
|
||||
g_type_name (G_OBJECT_TYPE (actor)));
|
||||
return;
|
||||
}
|
||||
|
||||
priv->actors = g_slist_append (priv->actors, g_object_ref (actor));
|
||||
g_signal_connect (actor, "destroy",
|
||||
G_CALLBACK (remove_actor_on_destroy),
|
||||
behave);
|
||||
|
||||
g_signal_emit (behave, behave_signals[APPLIED], 0, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_is_applied:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Check if @behave applied to @actor.
|
||||
*
|
||||
* Return value: TRUE if actor has behaviour. FALSE otherwise.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
gboolean
|
||||
clutter_behaviour_is_applied (ClutterBehaviour *behave,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), FALSE);
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
||||
|
||||
return (g_slist_find (behave->priv->actors, actor) != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_remove:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Removes @actor from the list of #ClutterActor<!-- -->s to which
|
||||
* @behave applies. This function removes a reference on the actor.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_remove (ClutterBehaviour *behave,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = behave->priv;
|
||||
|
||||
if (!g_slist_find (priv->actors, actor))
|
||||
{
|
||||
g_warning ("The behaviour of type %s is not applied "
|
||||
"to the actor of type %s",
|
||||
g_type_name (G_OBJECT_TYPE (behave)),
|
||||
g_type_name (G_OBJECT_TYPE (actor)));
|
||||
return;
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (actor,
|
||||
G_CALLBACK (remove_actor_on_destroy),
|
||||
behave);
|
||||
|
||||
priv->actors = g_slist_remove (priv->actors, actor);
|
||||
|
||||
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
|
||||
|
||||
g_object_unref (actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_n_actors:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Gets the number of actors this behaviour is applied too.
|
||||
*
|
||||
* Return value: The number of applied actors
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
gint
|
||||
clutter_behaviour_get_n_actors (ClutterBehaviour *behave)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), 0);
|
||||
|
||||
return g_slist_length (behave->priv->actors);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_nth_actor:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @index_: the index of an actor this behaviour is applied too.
|
||||
*
|
||||
* Gets an actor the behaviour was applied to referenced by index num.
|
||||
*
|
||||
* Return value: (transfer none): A Clutter actor or NULL if @index_ is invalid.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
|
||||
gint index_)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
|
||||
|
||||
return g_slist_nth_data (behave->priv->actors, index_);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_behaviour_actors_foreach:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @func: (scope call): a function called for each actor
|
||||
* @data: optional data to be passed to the function, or %NULL
|
||||
*
|
||||
* Calls @func for every actor driven by @behave.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
|
||||
ClutterBehaviourForeachFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
for (l = behave->priv->actors; l != NULL; l = l->next)
|
||||
{
|
||||
ClutterActor *actor = l->data;
|
||||
|
||||
g_assert (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
func (behave, actor, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_alpha:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Retrieves the #ClutterAlpha object bound to @behave.
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAlpha object, or %NULL if no alpha
|
||||
* object has been bound to this behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
ClutterAlpha *
|
||||
clutter_behaviour_get_alpha (ClutterBehaviour *behave)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
|
||||
|
||||
return behave->priv->alpha;
|
||||
}
|
||||
|
||||
static void
|
||||
notify_cb (GObject *object,
|
||||
GParamSpec *param_spec,
|
||||
ClutterBehaviour *behave)
|
||||
{
|
||||
ClutterBehaviourClass *klass;
|
||||
|
||||
klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "notify::alpha");
|
||||
|
||||
/* no actors, we can stop right here */
|
||||
if (behave->priv->actors == NULL)
|
||||
return;
|
||||
|
||||
if (klass->alpha_notify != NULL)
|
||||
{
|
||||
gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "calling %s::alpha_notify (%p, %.4f)",
|
||||
g_type_name (G_TYPE_FROM_CLASS (klass)),
|
||||
behave, alpha_value);
|
||||
|
||||
klass->alpha_notify (behave, alpha_value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_set_alpha:
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
|
||||
*
|
||||
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
|
||||
* is what makes a behaviour work: for each tick of the timeline
|
||||
* used by #ClutterAlpha a new value of the alpha parameter is
|
||||
* computed by the alpha function; the value should be used by
|
||||
* the #ClutterBehaviour to update one or more properties of the
|
||||
* actors to which the behaviour applies.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_set_alpha (ClutterBehaviour *behave,
|
||||
ClutterAlpha *alpha)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
|
||||
|
||||
priv = behave->priv;
|
||||
|
||||
if (priv->alpha == alpha)
|
||||
return;
|
||||
|
||||
if (priv->notify_id)
|
||||
{
|
||||
CLUTTER_NOTE (ANIMATION, "removing previous notify-id (%d)",
|
||||
priv->notify_id);
|
||||
|
||||
g_signal_handler_disconnect (priv->alpha, priv->notify_id);
|
||||
priv->notify_id = 0;
|
||||
}
|
||||
|
||||
if (priv->alpha != NULL)
|
||||
{
|
||||
CLUTTER_NOTE (ANIMATION, "removing previous alpha object");
|
||||
|
||||
g_object_unref (priv->alpha);
|
||||
priv->alpha = NULL;
|
||||
}
|
||||
|
||||
if (alpha != NULL)
|
||||
{
|
||||
priv->alpha = g_object_ref_sink (alpha);
|
||||
|
||||
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
|
||||
G_CALLBACK(notify_cb),
|
||||
behave);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "setting new alpha object (%p, notify:%d)",
|
||||
priv->alpha, priv->notify_id);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_get_actors:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Retrieves all the actors to which @behave applies. It is not recommended
|
||||
* for derived classes to use this in there alpha notify method but use
|
||||
* #clutter_behaviour_actors_foreach as it avoids alot of needless allocations.
|
||||
*
|
||||
* Return value: (transfer container) (element-type Clutter.Actor): a list of
|
||||
* actors. You should free the returned list with g_slist_free() when
|
||||
* finished using it.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
GSList *
|
||||
clutter_behaviour_get_actors (ClutterBehaviour *behave)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
GSList *retval, *l;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
|
||||
|
||||
priv = behave->priv;
|
||||
retval = NULL;
|
||||
for (l = priv->actors; l != NULL; l = l->next)
|
||||
retval = g_slist_prepend (retval, l->data);
|
||||
|
||||
return g_slist_reverse (retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_remove_all:
|
||||
* @behave: a #ClutterBehaviour
|
||||
*
|
||||
* Removes every actor from the list that @behave holds.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_remove_all (ClutterBehaviour *behave)
|
||||
{
|
||||
ClutterBehaviourPrivate *priv;
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
|
||||
|
||||
priv = behave->priv;
|
||||
for (l = priv->actors; l != NULL; l = l->next)
|
||||
{
|
||||
ClutterActor *actor = l->data;
|
||||
|
||||
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
|
||||
g_signal_handlers_disconnect_by_func (actor,
|
||||
G_CALLBACK (remove_actor_on_destroy),
|
||||
behave);
|
||||
g_object_unref (actor);
|
||||
}
|
||||
|
||||
g_slist_free (priv->actors);
|
||||
priv->actors = NULL;
|
||||
}
|
170
clutter/clutter/deprecated/clutter-behaviour.h
Normal file
170
clutter/clutter/deprecated/clutter-behaviour.h
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Jorn Baayen <jorn@openedhand.com>
|
||||
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BEHAVIOUR_H__
|
||||
#define __CLUTTER_BEHAVIOUR_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
|
||||
|
||||
#define CLUTTER_BEHAVIOUR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR))
|
||||
|
||||
#define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CLUTTER_TYPE_BEHAVIOUR))
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
|
||||
|
||||
typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
|
||||
typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
|
||||
|
||||
/**
|
||||
* ClutterBehaviourForeachFunc:
|
||||
* @behaviour: the #ClutterBehaviour
|
||||
* @actor: an actor driven by @behaviour
|
||||
* @data: (closure): optional data passed to the function
|
||||
*
|
||||
* This function is passed to clutter_behaviour_actors_foreach() and
|
||||
* will be called for each actor driven by @behaviour.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
typedef void (*ClutterBehaviourForeachFunc) (ClutterBehaviour *behaviour,
|
||||
ClutterActor *actor,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* ClutterBehaviour:
|
||||
*
|
||||
* #ClutterBehaviour-struct contains only private data and should
|
||||
* be accessed with the functions below.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviour
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent;
|
||||
ClutterBehaviourPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterBehaviourClass:
|
||||
* @alpha_notify: virtual function, called each time the #ClutterAlpha
|
||||
* computes a new alpha value; the actors to which the behaviour applies
|
||||
* should be changed in this function. Every subclass of #ClutterBehaviour
|
||||
* must implement this virtual function
|
||||
* @applied: signal class handler for the ClutterBehaviour::applied signal
|
||||
* @removed: signal class handler for the ClutterBehaviour::removed signal
|
||||
*
|
||||
* Base class for behaviours.
|
||||
*
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
struct _ClutterBehaviourClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
/* vfunc, not signal */
|
||||
void (*alpha_notify) (ClutterBehaviour *behave,
|
||||
gdouble alpha_value);
|
||||
|
||||
/* signals */
|
||||
void (*applied) (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
void (*removed) (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
|
||||
/*< private >*/
|
||||
/* padding, for future expansion */
|
||||
void (*_clutter_behaviour1) (void);
|
||||
void (*_clutter_behaviour2) (void);
|
||||
void (*_clutter_behaviour3) (void);
|
||||
void (*_clutter_behaviour4) (void);
|
||||
void (*_clutter_behaviour5) (void);
|
||||
void (*_clutter_behaviour6) (void);
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_behaviour_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_apply (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_remove (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_remove_all (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
|
||||
ClutterBehaviourForeachFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_DEPRECATED
|
||||
gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
|
||||
gint index_);
|
||||
CLUTTER_DEPRECATED
|
||||
GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
|
||||
ClutterAlpha *alpha);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_H__ */
|
56
clutter/clutter/deprecated/clutter-bin-layout.h
Normal file
56
clutter/clutter/deprecated/clutter-bin-layout.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corporation.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Author:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BIN_LAYOUT_DEPRECATED_H__
|
||||
#define __CLUTTER_BIN_LAYOUT_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-bin-layout.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_bin_layout_set_alignment (ClutterBinLayout *self,
|
||||
ClutterActor *child,
|
||||
ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_bin_layout_get_alignment (ClutterBinLayout *self,
|
||||
ClutterActor *child,
|
||||
ClutterBinAlignment *x_align,
|
||||
ClutterBinAlignment *y_align);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_bin_layout_add (ClutterBinLayout *self,
|
||||
ClutterActor *child,
|
||||
ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BIN_LAYOUT_DEPRECATED_H__ */
|
1163
clutter/clutter/deprecated/clutter-cairo-texture.c
Normal file
1163
clutter/clutter/deprecated/clutter-cairo-texture.c
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user