Compare commits

...

46 Commits

Author SHA1 Message Date
dd39d7a060 shaped-texture: Implement ClutterContent
MetaWindowActor is the compositor-side representative of a
MetaWindow. Specifically it represents the geometry of the
window under Clutter scene graph. MetaWindowActors are backed
by MetaSurfaceActors, that represent the windowing system's
surfaces themselves. Naturally, these surfaces have textures
with the pixel content of the clients associated with them.
These textures are represented by MetaShapedTexture.

MetaShapedTextures are currently implemented as ClutterActor
subclasses that override the paint function to paint the
textures it holds.

Conceptually, however, Clutter has an abstraction layer for
contents of actors: ClutterContent. Which MetaShapedTexture
fits nicely, in fact.

Make MetaShapedTexture a ClutterContent implementation. This
forces a few changes in the stack:

 * MetaShapedTexture now manually tracks the content scale.

 * We now paint into ClutterPaintNode instead of the direct
   framebuffer.

 * Various pieces of Wayland code now use MetaSurfaceActor
   instead of MetaShapedTexture.

 * MetaSurfaceActorWayland doesn't override size negotiation
   vfuncs anymore
2019-01-27 16:22:42 -02:00
e1c272e3d7 clutter/image: Also invalidate size
ClutterImage is a ClutterContent implementation that
has an internally managed CoglTexture. This texture
is recreated when new image data is set.

ClutterContent implementations may have control over
the allocation of the widgets they're attached to,
through CLUTTER_REQUEST_CONTENT_SIZE. On those cases,
if the new image data differs in size from the previous
data, it is important to notify those actors about the
size change. However, currently ClutterImage does not
notify them.

With the introduction of clutter_content_invalidate_size(),
it is possible to report the size changes to attached
actors.

Adapt ClutterImage to invalidate_size() when image data
has different sizes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-01-27 15:20:58 -02:00
41ece851d6 clutter/paint-nodes: Expose ClutterLayerNode
ClutterLayerNode is a private paint node that paints the
contents of its subnodes into an offscreen buffer, then
paints this entire offscreen buffer at the previous draw
framebuffer with the given opacity.

It is specially interesting to the future ClutterContent
implementation of MetaShapedTexture, for the NVidia and
rotation cases where the contents are painted on an
offscreen.

Expose ClutterLayerNode as public API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-01-27 15:20:58 -02:00
d5262f0f4d clutter/paint-node: Add multitexture API
The multitexture API is not a shortcut for multiple calls
to the single texture API. It is meant to wrap calls to
cogl_framebuffer_draw_multitexture_rectangle(), which
uses the passed texture coordinates at different layers of
the pipeline.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-01-27 15:20:58 -02:00
fd99a56fd6 clutter/content: Add clutter_content_invalidate_size()
ClutterContent has the ability to dictate the layout of any
given actor, through the CLUTTER_REQUEST_CONTENT_SIZE request
mode.

However, there is no way for ClutterContent implementations
to notify their attached actors that the content size changed.

Add a new optional ClutterContent.invalidate_size() vfunc and
clutter_content_invalidate_size().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-01-27 15:15:01 -02:00
3fa6a92cc5 screen-cast: Fix monitor recording on HiDPI
It scaled the logical monitor rect with scale to get the stream
dimensions, but that is only valid when having
'scale-monitor-framebuffers' enabled. Even when it was, it didn't work
properly, as clutter_stage_capture_into() doesn't work properly with
scaled monitor framebuffers yet.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/415
2019-01-26 16:18:45 +00:00
d5a7bbd094 Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
de41f3ea28 clutter: Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
5c3ec27b4b cogl: Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 00:48:12 +01:00
8655bc5d8d clutter: Fix offscreen-effect painting of clones
`ClutterOffscreenEffect` had been getting the wrong bounding box in the
case of clones and descendents of clones, causing visibly incorrect
clipping. This was due to `clutter_actor_get_paint_box` only ever being
given the source actor during a paint (which is correct) and not the clone.
Even if we weren't painting a clone but an offscreened descendent of a
clone (like in gnome-shell's desktop zoom), we would get the wrong result.

Fortunately we don't need to know the actual clone/actor being painted so
don't need to call the problematic `clutter_actor_get_paint_box` at all.
The solution is to only keep untransformed rendering in the FBO and leave
the correct transformation for later. The correct clone/actor's
transformation is already set for us as the current cogl modelview matrix
by `clutter_actor_paint`.

Bonus optimization: This all means we don't need to keep `last_matrix_drawn`
or force a full repaint every time some part of the transformation changes.
Because the FBO contents are no longer affected by transformations. As it
should be. In other words, offscreen-effected actors can now move around
on screen without themselves being repainted.

Special thanks to Mai Lavelle for identifying the cause of the problem.

Fixes:
https://bugzilla.gnome.org/show_bug.cgi?id=789050,
https://bugzilla.gnome.org/show_bug.cgi?id=659523#c9,
https://gitlab.gnome.org/GNOME/mutter/issues/196,
https://gitlab.gnome.org/GNOME/mutter/issues/282,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/387,
https://launchpad.net/bugs/1767648,
https://launchpad.net/bugs/1779615
2019-01-24 17:00:25 +00:00
2e53ce8e75 meta, startup-notification: Make type declarations public
Shell is using these, which was revealed by
1bbb5c8107 breaking its build when
generating its introspection due to meta_startup_notification_get_type()
not being found.

We keep the class structs private, so in practice MetaStartupSequence
and MetaBackend can't be derived from (the are semi-private).
2019-01-24 16:38:09 +00:00
2528a39781 gitlab-ci.yml: Change build step build type to debugoptimized
We will catch -Wmaybe-uninitialized errors this way.
2019-01-23 21:05:51 +00:00
e02fef8e2f meta: Hide libmutter symbols by default and selectively export them
Make meson link libmutter using -fvisibility=hidden, and introduce META_EXPORT
and META_EXPORT_TEST defines to mark a symbols as visible.
The TEST version is meant to be used to flag symbols that are only used
internally by mutter tests, but that should not be considered public API.

This allows us to be more precise in selecting what is exported and what is
not, without the need of a version-script file that would be more complicated
to maintain.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 14:18:13 +01:00
e352011830 MonitorManager: Use composition instead of inheriting from dbus skeleton
MonitorManager was inheriting from MetaDBusDisplayConfigSkeleton, this was
causing introspection to see this like a GDBus skeleton object exposing to
clients methods that were not required.

Also, this required us to export meta_dbus_* symbols to the library, while
these should be actually private.

So, make MetaMonitorManager to be just a simple GObject holding a skeleton
instance, and connect to its signals reusing most of the code with just few
minor changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 14:12:07 +01:00
7f551ba776 meson: Don't list libraries private dependencies in pc files
pkg-config files for mutter are generated using *_pkg_deps as requires, but
programs linked with libmutter doesn't need most of these private dependencies
which are only needed for building and linking mutter and its subprojects.

So list packages needed only by mutter itself inside *_pkg_private_deps and
don't expose such packages to pkg-config, but only use them at build time.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
3838341d83 meson: Set cogl as dependency of libmutter-cogl dependency
Since a libmutter-cogl dependency is declared as libmutter_cogl_dep, it can be
used to avoid repeating cogl dependency everywhere.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
adc5670ea9 meson: Hide symbols by default in clutter
Clutter exports symbols explicitly using `CLUTTER_EXPORT`, so everything should
be hidden by default, unless exposed.

Usage of `gnu_symbol_visibility` needs a version bump to meson 0.48.0

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
08130912f0 meson: Set proper soversion and version to libraries
Soname of the libraries should be the major version number, while the version
triplet is currently used:
  objdump -p libmutter-4.so.0.0.0 | grep SONAME
    SONAME               libmutter-4.so.0.0.0

While is expected to be only libmutter-4.so.0

Fix all shared libraries by setting valid version and soversion.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
371b97af27 meson: Fix map files and load them to hide private symbols
Map files were using wrong syntax (missing final `;` or invalid chars).

Also, the map files were only monitored for rebuilding, but not really used by
ld, so pass the ldflags with version-script so that private symbols are really
hidden.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 13:03:40 +00:00
562cf14258 core: Fix compiler warning
Fix compiler warning: ‘startup_id’ may be used uninitialized in
`meta_launch_context_get_startup_notify_id()`.

Also change `gchar` to plain `char` while at it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/406
2019-01-23 10:06:30 +01:00
c57ae7fc9c cogl/path: Don't depend on GL/glu.h
It's not needed for anything, and we can get rid of the dependency we
just added.

Also remove the installation step from Dockerfile.
2019-01-22 19:06:14 +01:00
6c91683380 gitlab-ci.yml: Treat warnings as errors
This'll allow us to catch them before they land.
2019-01-22 18:32:28 +01:00
25f416c13d meson.build: Add more compilation warnings
So that we can catch more issues. The warning list is copied from GTK+,
with two switch related ones removed.
2019-01-22 18:32:28 +01:00
8d91135926 wayland/xdg-shell: Fix buffer attach coordinate comparison
Only x was checked, but twice. Should check both x and y.
2019-01-22 18:32:28 +01:00
1bbb5c8107 meta: Only declare types when generating gir files
Some types were declared in the public headers so that g-ir-scanner
could resolve the types. This caused warnings when using
-Wredundant-decls, so only redeclare them for the gir scanner.
2019-01-22 18:32:28 +01:00
12a42a9295 wayland: Move DND surface role into its own file
This avoids a -Wredundand-decls warning about the get_type() function.
2019-01-22 18:32:28 +01:00
01cea0d9ef Fix const qualifier usage
As with the commits earlier, this also adds const qualifiers where
expected. However, the const variables are casted to non-const variants
so they can be passed to glib functions that take non-const variants but
expect const-like input.
2019-01-22 18:31:53 +01:00
f615eea7ee backend: Remove redundant function declarations 2019-01-22 18:31:52 +01:00
cbbd3e366a clutter/build: Don't pass --prototypes to glib-genmarshal
This causes compilation warnings and the prototypes are declared in the
header file already.
2019-01-22 18:31:52 +01:00
ede10dded0 clutter: Add missing void to function declaration 2019-01-22 18:31:52 +01:00
982d135ace cogl: Add missing function declarations
In plenty of places a non-static function was defined but didn't have
the corresponding declaration. Fix this by adding them, or alternatively
making them static.
2019-01-22 18:31:52 +01:00
548c0f16f4 cogl: Remove redundant function declarations 2019-01-22 18:31:52 +01:00
bbd295ae09 cogl: Fix const qualifier usage 2019-01-22 18:31:52 +01:00
c55004864d cogl: Add missing void to functions with no arguments
I.e. foo () -> foo (void).
2019-01-22 18:31:52 +01:00
54685091f1 cogl-path: Remove own glu.h version
cogl-path uses types from glu.h, but to avoid a build dependency on glu,
it kept a minified copy of glu.h in tree. Drop this file and just use
the actual glu.h. To avoid linking to libGLU.so, just use the
includepath, instead of actually adding glu as a real dependency.

This means we can remove an includepath meant to make it possible to
include <GL/glu.h>.
2019-01-22 18:31:52 +01:00
d4a9535f04 cogl-path: Cast function pointer explicitly
gluTessCallback() expects an equivalent to a GFunc, but we pass
functions with arguments without casting. To get rid of warnings, cast
the callback function pointer to the expected type.
2019-01-22 18:31:52 +01:00
44477390a9 clutter: Fix const qualifier usage
The const qualifiers were implicitly discarded here and there. Avoid that
either by adding the constness, or casting it away when a const variable
is passed to a function that is defined as non-const but effectively
expect a const.
2019-01-22 18:31:19 +01:00
caf27c4c16 clutter/tests: Remove dead code
Defined, but not used anywhere.
2019-01-22 18:31:19 +01:00
576e7a43df clutter/tests: Fix missing declaration warnings 2019-01-22 18:31:19 +01:00
c242558398 clutter/debug: Add printf annotations to log helpers 2019-01-22 18:31:19 +01:00
8c9e827aab clutter/stage: Fix debug logging
We expected %d but passed %f in a couple of places.
2019-01-22 18:31:19 +01:00
2bcc9e2b86 clutter/tests/interactive: Remove dead code
It was hidden behind a macro that was never defined anywhere.
2019-01-22 18:31:19 +01:00
5c66afbf63 Dockerfile: Update gsettings-desktop-schemas copr URL
The old rpms had been cleaned out.
2019-01-22 18:31:19 +01:00
84aeb8f715 Dockerfile: Remove manual pipewire-0.2.5 upgrade
It's already in F29 stable.
2019-01-22 18:31:14 +01:00
3738579dd3 window-actor: Use actual image size for capture
Previously, the clipping rectangle passed to
`meta_surface_actor_get_image()` was updated with the actual texture
size, but recent changes in `meta_shaped_texture_get_image()` now keep
the caller's clipping rectangle unchanged.

The implementation of `meta_window_actor_capture_into()` was relying on
the old behavior of updating the passed clipping rectangle, but now that
it's kept unchanged, the actual clipping rectangle used to copy the data
is wrong, which causes either a distorded image or worse, a crash of
mutter.

Use the resulting cairo image size to copy the data instead of the
clipping rectangle to avoid the issue and get the expected size.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/442
2019-01-22 10:30:04 +01:00
1ca60f424a input-settings/x11: Only warn once about missing udev support
Otherwise we end up logging the same message everytime we enter this function,
flooding the logs and making it annoying to spot other entries.
2019-01-22 02:21:13 +01:00
264 changed files with 2627 additions and 963 deletions

View File

@ -7,7 +7,7 @@ stages:
build-mutter:
stage: build
script:
- meson . build -Degl_device=true -Dwayland_eglstream=true
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror
- ninja -C build
- ninja -C build install

View File

@ -11,10 +11,7 @@ RUN dnf -y update && dnf -y upgrade && \
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 && \
# Unpackaged versions
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00836095-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00836095-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
# Packages not yet in stable
dnf install -y https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-0.2.5-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-devel-0.2.5-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-libs-0.2.5-1.fc29.x86_64.rpm && \
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
dnf install -y intltool redhat-rpm-config make && \
dnf clean all

View File

@ -0,0 +1,12 @@
#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__
#define __CLUTTER_ACTOR_BOX_PRIVATE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */

View File

@ -5,6 +5,7 @@
#include "clutter-types.h"
#include "clutter-interval.h"
#include "clutter-private.h"
#include "clutter-actor-box-private.h"
/**
* clutter_actor_box_new:
@ -542,6 +543,57 @@ clutter_actor_box_set_size (ClutterActorBox *box,
box->y2 = box->y1 + height;
}
void
_clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
{
float width, height;
/* The aim here is that for a given rectangle defined with floating point
* coordinates we want to determine a stable quantized size in pixels
* that doesn't vary due to the original box's sub-pixel position.
*
* The reason this is important is because effects will use this
* API to determine the size of offscreen framebuffers and so for
* a fixed-size object that may be animated accross the screen we
* want to make sure that the stage paint-box has an equally stable
* size so that effects aren't made to continuously re-allocate
* a corresponding fbo.
*
* The other thing we consider is that the calculation of this box is
* subject to floating point precision issues that might be slightly
* different to the precision issues involved with actually painting the
* actor, which might result in painting slightly leaking outside the
* user's calculated paint-volume. For this we simply aim to pad out the
* paint-volume by at least half a pixel all the way around.
*/
width = box->x2 - box->x1;
height = box->y2 - box->y1;
width = CLUTTER_NEARBYINT (width);
height = CLUTTER_NEARBYINT (height);
/* XXX: NB the width/height may now be up to 0.5px too small so we
* must also pad by 0.25px all around to account for this. In total we
* must padd by at least 0.75px around all sides. */
/* XXX: The furthest that we can overshoot the bottom right corner by
* here is 1.75px in total if you consider that the 0.75 padding could
* just cross an integer boundary and so ceil will effectively add 1.
*/
box->x2 = ceilf (box->x2 + 0.75);
box->y2 = ceilf (box->y2 + 0.75);
/* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall
* size of the box will be stable and not dependant on the box's
* position.
*
* Adding 3px to the width/height will ensure we cover the maximum of
* 1.75px padding on the bottom/right and still ensure we have > 0.75px
* padding on the top/left.
*/
box->x1 = box->x2 - width - 3;
box->y1 = box->y2 - height - 3;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
clutter_actor_box_copy,
clutter_actor_box_free,

View File

@ -36,7 +36,7 @@ G_BEGIN_DECLS
typedef struct _ClutterBezier ClutterBezier;
ClutterBezier *_clutter_bezier_new ();
ClutterBezier *_clutter_bezier_new (void);
void _clutter_bezier_free (ClutterBezier * b);

View File

@ -38,6 +38,7 @@
#include "clutter-build-config.h"
#include "clutter-actor-private.h"
#include "clutter-content-private.h"
#include "clutter-debug.h"
@ -91,6 +92,11 @@ clutter_content_real_invalidate (ClutterContent *content)
{
}
static void
clutter_content_real_invalidate_size (ClutterContent *content)
{
}
static void
clutter_content_real_paint_content (ClutterContent *content,
ClutterActor *actor,
@ -108,6 +114,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
iface->attached = clutter_content_real_attached;
iface->detached = clutter_content_real_detached;
iface->invalidate = clutter_content_real_invalidate;
iface->invalidate_size = clutter_content_real_invalidate_size;
/**
* ClutterContent::attached:
@ -188,6 +195,45 @@ clutter_content_invalidate (ClutterContent *content)
}
}
/**
* clutter_content_invalidate_size:
* @content: a #ClutterContent
*
* Signals that @content's size changed. Attached actors with request mode
* set to %CLUTTER_REQUEST_CONTENT_SIZE will have a relayout queued.
*
* Attached actors with other request modes are not redrawn. To redraw them
* too, use clutter_content_invalidate().
*/
void
clutter_content_invalidate_size (ClutterContent *content)
{
ClutterActor *actor;
GHashTable *actors;
GHashTableIter iter;
g_return_if_fail (CLUTTER_IS_CONTENT (content));
CLUTTER_CONTENT_GET_IFACE (content)->invalidate_size (content);
actors = g_object_get_qdata (G_OBJECT (content), quark_content_actors);
if (actors == NULL)
return;
g_hash_table_iter_init (&iter, actors);
while (g_hash_table_iter_next (&iter, (gpointer *) &actor, NULL))
{
ClutterRequestMode request_mode;
g_assert (actor != NULL);
request_mode = clutter_actor_get_request_mode (actor);
if (request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
_clutter_actor_queue_only_relayout (actor);
}
}
/*< private >
* _clutter_content_attached:
* @content: a #ClutterContent

View File

@ -86,6 +86,8 @@ struct _ClutterContentIface
ClutterActor *actor);
void (* invalidate) (ClutterContent *content);
void (* invalidate_size) (ClutterContent *content);
};
CLUTTER_EXPORT
@ -98,6 +100,9 @@ gboolean clutter_content_get_preferred_size (ClutterContent *content
CLUTTER_EXPORT
void clutter_content_invalidate (ClutterContent *content);
CLUTTER_EXPORT
void clutter_content_invalidate_size (ClutterContent *content);
G_END_DECLS
#endif /* __CLUTTER_CONTENT_H__ */

View File

@ -80,9 +80,9 @@ extern guint clutter_pick_debug_flags;
extern guint clutter_paint_debug_flags;
void _clutter_debug_messagev (const char *format,
va_list var_args);
va_list var_args) G_GNUC_PRINTF (1, 0);
void _clutter_debug_message (const char *format,
...);
...) G_GNUC_PRINTF (1, 2);
G_END_DECLS

View File

@ -53,6 +53,8 @@
struct _ClutterImagePrivate
{
CoglTexture *texture;
gint width;
gint height;
};
static void clutter_content_iface_init (ClutterContentIface *iface);
@ -68,6 +70,27 @@ clutter_image_error_quark (void)
return g_quark_from_static_string ("clutter-image-error-quark");
}
static void
update_image_size (ClutterImage *self)
{
gint width, height;
if (self->priv->texture == NULL)
return;
width = cogl_texture_get_width (self->priv->texture);
height = cogl_texture_get_height (self->priv->texture);
if (self->priv->width == width &&
self->priv->height == height)
return;
self->priv->width = width;
self->priv->height = height;
clutter_content_invalidate_size (CLUTTER_CONTENT (self));
}
static void
clutter_image_finalize (GObject *gobject)
{
@ -238,6 +261,7 @@ clutter_image_set_data (ClutterImage *image,
}
clutter_content_invalidate (CLUTTER_CONTENT (image));
update_image_size (image);
return TRUE;
}
@ -306,6 +330,7 @@ clutter_image_set_bytes (ClutterImage *image,
}
clutter_content_invalidate (CLUTTER_CONTENT (image));
update_image_size (image);
return TRUE;
}
@ -399,6 +424,7 @@ clutter_image_set_area (ClutterImage *image,
}
clutter_content_invalidate (CLUTTER_CONTENT (image));
update_image_size (image);
return TRUE;
}

View File

@ -72,6 +72,8 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-actor-box-private.h"
struct _ClutterOffscreenEffectPrivate
{
@ -82,8 +84,10 @@ struct _ClutterOffscreenEffectPrivate
ClutterActor *actor;
ClutterActor *stage;
gfloat x_offset;
gfloat y_offset;
ClutterVertex position;
int fbo_offset_x;
int fbo_offset_y;
/* This is the calculated size of the fbo before being passed
through create_texture(). This needs to be tracked separately so
@ -93,16 +97,6 @@ struct _ClutterOffscreenEffectPrivate
int fbo_height;
gint old_opacity_override;
/* The matrix that was current the last time the fbo was updated. We
need to keep track of this to detect when we can reuse the
contents of the fbo without redrawing the actor. We need the
actual matrix rather than just detecting queued redraws on the
actor because any change in the parent hierarchy (even just a
translation) could cause the actor to look completely different
and it won't cause a redraw to be queued on the parent's
children. */
CoglMatrix last_matrix_drawn;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
@ -222,15 +216,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
ClutterActorBox box;
ClutterActorBox raw_box, box;
ClutterActor *stage;
CoglMatrix projection;
CoglMatrix projection, old_modelview, modelview;
const ClutterPaintVolume *volume;
CoglColor transparent;
gfloat stage_width, stage_height;
gfloat fbo_width = -1, fbo_height = -1;
gfloat width, height;
gfloat xexpand, yexpand;
int texture_width, texture_height;
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
gfloat old_viewport[4];
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
@ -241,92 +235,82 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
stage = _clutter_actor_get_stage_internal (priv->actor);
clutter_actor_get_size (stage, &stage_width, &stage_height);
/* The paint box is the bounding box of the actor's paint volume in
* stage coordinates. This will give us the size for the framebuffer
* we need to redirect its rendering offscreen and its position will
* be used to setup an offset viewport */
if (clutter_actor_get_paint_box (priv->actor, &box))
/* Get the minimal bounding box for what we want to paint, relative to the
* parent of priv->actor. Note that we may actually be painting a clone of
* priv->actor so we need to be careful to avoid querying the transformation
* of priv->actor (like clutter_actor_get_paint_box would). Just stay in
* local coordinates for now...
*/
volume = clutter_actor_get_paint_volume (priv->actor);
if (volume)
{
clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
clutter_actor_box_get_origin (&box, &priv->x_offset, &priv->y_offset);
ClutterPaintVolume mutable_volume;
fbo_width = MIN (fbo_width, stage_width);
fbo_height = MIN (fbo_height, stage_height);
_clutter_paint_volume_copy_static (volume, &mutable_volume);
_clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
clutter_paint_volume_free (&mutable_volume);
}
else
{
fbo_width = stage_width;
fbo_height = stage_height;
clutter_actor_get_allocation_box (priv->actor, &raw_box);
}
if (fbo_width == stage_width)
priv->x_offset = 0.0f;
if (fbo_height == stage_height)
priv->y_offset = 0.0f;
box = raw_box;
_clutter_actor_box_enlarge_for_effects (&box);
priv->fbo_offset_x = box.x1 - raw_box.x1;
priv->fbo_offset_y = box.y1 - raw_box.y1;
clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
/* First assert that the framebuffer is the right size... */
if (!update_fbo (effect, fbo_width, fbo_height))
return FALSE;
texture_width = cogl_texture_get_width (priv->texture);
texture_height = cogl_texture_get_height (priv->texture);
/* get the current modelview matrix so that we can copy it to the
* framebuffer. We also store the matrix that was last used when we
* updated the FBO so that we can detect when we don't need to
* update the FBO to paint a second time */
cogl_get_modelview_matrix (&priv->last_matrix_drawn);
cogl_get_modelview_matrix (&old_modelview);
/* let's draw offscreen */
cogl_push_framebuffer (priv->offscreen);
/* Copy the modelview that would have been used if rendering onscreen */
cogl_set_modelview_matrix (&priv->last_matrix_drawn);
/* Set up the viewport so that it has the same size as the stage,
* but offset it so that the actor of interest lands on our
* framebuffer. */
clutter_actor_get_size (priv->stage, &width, &height);
/* Expand the viewport if the actor is partially off-stage,
* otherwise the actor will end up clipped to the stage viewport
/* 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
* incorrectly). So drop the modelview matrix of the current paint chain.
* This is fine since paint_texture runs with the same modelview matrix,
* so it will come out correctly whenever that is used to put the FBO
* contents on screen...
*/
xexpand = 0.f;
if (priv->x_offset < 0.f)
xexpand = -priv->x_offset;
if (priv->x_offset + texture_width > width)
xexpand = MAX (xexpand, (priv->x_offset + texture_width) - width);
clutter_actor_get_transform (priv->stage, &modelview);
cogl_set_modelview_matrix (&modelview);
yexpand = 0.f;
if (priv->y_offset < 0.f)
yexpand = -priv->y_offset;
if (priv->y_offset + texture_height > height)
yexpand = MAX (yexpand, (priv->y_offset + texture_height) - height);
/* Save the original viewport for calculating priv->position */
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
&old_viewport[0],
&old_viewport[1],
&old_viewport[2],
&old_viewport[3]);
/* Set the viewport */
cogl_set_viewport (-(priv->x_offset + xexpand), -(priv->y_offset + yexpand),
width + (2 * xexpand), height + (2 * yexpand));
/* Set up the viewport so that it has the same size as the stage (avoid
* distortion), but translated to account for the FBO offset...
*/
cogl_set_viewport (-priv->fbo_offset_x,
-priv->fbo_offset_y,
stage_width,
stage_height);
/* Copy the stage's projection matrix across to the framebuffer */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
&projection);
/* If we've expanded the viewport, make sure to scale the projection
* matrix accordingly (as it's been initialised to work with the
* original viewport and not our expanded one).
/* Now save the global position of the effect (not just of the actor).
* It doesn't appear anyone actually uses this yet, but get_target_rect is
* documented as returning it. So we should...
*/
if (xexpand > 0.f || yexpand > 0.f)
{
gfloat new_width, new_height;
new_width = width + (2 * xexpand);
new_height = height + (2 * yexpand);
cogl_matrix_scale (&projection,
width / new_width,
height / new_height,
1);
}
_clutter_util_fully_transform_vertices (&old_modelview,
&projection,
old_viewport,
&local_offset,
&priv->position,
1);
cogl_set_projection_matrix (&projection);
@ -385,13 +369,14 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
cogl_push_matrix ();
/* Now reset the modelview to put us in stage coordinates so
* we can drawn the result of our offscreen render as a textured
* quad... */
cogl_matrix_init_identity (&modelview);
_clutter_actor_apply_modelview_transform (priv->stage, &modelview);
cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.0f);
/* The current modelview matrix is *almost* perfect already. It's only
* missing a correction for the expanded FBO and offset rendering within...
*/
cogl_get_modelview_matrix (&modelview);
cogl_matrix_translate (&modelview,
priv->fbo_offset_x,
priv->fbo_offset_y,
0.0f);
cogl_set_modelview_matrix (&modelview);
/* paint the target material; this is virtualized for
@ -428,16 +413,11 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
CoglMatrix matrix;
cogl_get_modelview_matrix (&matrix);
/* If we've already got a cached image for the same matrix and the
actor hasn't been redrawn then we can just use the cached image
in the fbo */
if (priv->offscreen == NULL ||
(flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) ||
!cogl_matrix_equal (&matrix, &priv->last_matrix_drawn))
/* If we've already got a cached image and the actor hasn't been redrawn
* then we can just use the cached image in the FBO.
*/
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
{
/* Chain up to the parent paint method which will call the pre and
post paint functions to update the image */
@ -663,8 +643,8 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
return FALSE;
clutter_rect_init (rect,
priv->x_offset,
priv->y_offset,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture));

View File

@ -77,6 +77,7 @@ struct _ClutterPaintNodeClass
typedef enum {
PAINT_OP_INVALID = 0,
PAINT_OP_TEX_RECT,
PAINT_OP_MULTITEX_RECT,
PAINT_OP_PATH,
PAINT_OP_PRIMITIVE
} PaintOpCode;
@ -85,6 +86,8 @@ struct _ClutterPaintOperation
{
PaintOpCode opcode;
GArray *multitex_coords;
union {
float texrect[8];
@ -142,30 +145,6 @@ ClutterPaintNode * clutter_paint_node_get_parent (Clutter
G_GNUC_INTERNAL
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);
#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ())
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
/*
* ClutterLayerNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterLayerNode ClutterLayerNode;
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
GType _clutter_layer_node_get_type (void) G_GNUC_CONST;
ClutterPaintNode * _clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity);
G_END_DECLS
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */

View File

@ -761,6 +761,11 @@ clutter_paint_operation_clear (ClutterPaintOperation *op)
case PAINT_OP_TEX_RECT:
break;
case PAINT_OP_MULTITEX_RECT:
if (op->multitex_coords != NULL)
g_array_unref (op->multitex_coords);
break;
case PAINT_OP_PATH:
if (op->op.path != NULL)
cogl_object_unref (op->op.path);
@ -794,6 +799,27 @@ clutter_paint_op_init_tex_rect (ClutterPaintOperation *op,
op->op.texrect[7] = y_2;
}
static inline void
clutter_paint_op_init_multitex_rect (ClutterPaintOperation *op,
const ClutterActorBox *rect,
const float *tex_coords,
unsigned int tex_coords_len)
{
clutter_paint_operation_clear (op);
op->opcode = PAINT_OP_MULTITEX_RECT;
op->multitex_coords = g_array_sized_new (FALSE, FALSE,
sizeof (float),
tex_coords_len);
g_array_append_vals (op->multitex_coords, tex_coords, tex_coords_len);
op->op.texrect[0] = rect->x1;
op->op.texrect[1] = rect->y1;
op->op.texrect[2] = rect->x2;
op->op.texrect[3] = rect->y2;
}
static inline void
clutter_paint_op_init_path (ClutterPaintOperation *op,
CoglPath *path)
@ -881,6 +907,33 @@ clutter_paint_node_add_texture_rectangle (ClutterPaintNode *node,
g_array_append_val (node->operations, operation);
}
/**
* clutter_paint_node_add_multitexture_rectangle:
* @node: a #ClutterPaintNode
* @rect: a #ClutterActorBox
* @text_coords: array of multitexture values
* @text_coords_len: number of items of @text_coords
*
* Adds a rectangle region to the @node, with multitexture coordinates.
*/
void
clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
const ClutterActorBox *rect,
const float *text_coords,
unsigned int text_coords_len)
{
ClutterPaintOperation operation = PAINT_OP_INIT;
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
g_return_if_fail (rect != NULL);
clutter_paint_node_maybe_init_operations (node);
clutter_paint_op_init_multitex_rect (&operation, rect, text_coords, text_coords_len);
g_array_append_val (node->operations, operation);
}
/**
* clutter_paint_node_add_path: (skip)
* @node: a #ClutterPaintNode
@ -1006,7 +1059,7 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
if (node->operations != NULL)
{
guint i;
guint i, j;
for (i = 0; i < node->operations->len; i++)
{
@ -1031,6 +1084,19 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
json_builder_end_array (builder);
break;
case PAINT_OP_MULTITEX_RECT:
json_builder_set_member_name (builder, "texrect");
json_builder_begin_array (builder);
for (j = 0; i < op->multitex_coords->len; j++)
{
float coord = g_array_index (op->multitex_coords, float, j);
json_builder_add_double_value (builder, coord);
}
json_builder_end_array (builder);
break;
case PAINT_OP_PATH:
json_builder_set_member_name (builder, "path");
json_builder_add_int_value (builder, (gint64) op->op.path);

View File

@ -67,6 +67,12 @@ void clutter_paint_node_add_texture_rectangle (Clutter
float x_2,
float y_2);
CLUTTER_EXPORT
void clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
const ClutterActorBox *rect,
const float *text_coords,
unsigned int text_coords_len);
CLUTTER_EXPORT
void clutter_paint_node_add_path (ClutterPaintNode *node,
CoglPath *path);

View File

@ -431,6 +431,17 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
op->op.texrect[7]);
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
pnode->pipeline,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
(float*) op->multitex_coords->data,
op->multitex_coords->len);
break;
case PAINT_OP_PATH:
cogl_path_fill (op->op.path);
break;
@ -827,6 +838,7 @@ clutter_text_node_draw (ClutterPaintNode *node)
cogl_framebuffer_pop_clip (fb);
break;
case PAINT_OP_MULTITEX_RECT:
case PAINT_OP_PATH:
case PAINT_OP_PRIMITIVE:
case PAINT_OP_INVALID:
@ -992,6 +1004,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
retval = TRUE;
break;
case PAINT_OP_MULTITEX_RECT:
case PAINT_OP_PRIMITIVE:
case PAINT_OP_INVALID:
break;
@ -1025,6 +1038,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node)
cogl_framebuffer_pop_clip (fb);
break;
case PAINT_OP_MULTITEX_RECT:
case PAINT_OP_PRIMITIVE:
case PAINT_OP_INVALID:
break;
@ -1065,11 +1079,9 @@ clutter_clip_node_new (void)
}
/*
* ClutterLayerNode (private)
* ClutterLayerNode
*/
#define clutter_layer_node_get_type _clutter_layer_node_get_type
struct _ClutterLayerNode
{
ClutterPaintNode parent_instance;
@ -1180,6 +1192,17 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
cogl_pop_source ();
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
lnode->state,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
(float*) op->multitex_coords->data,
op->multitex_coords->len);
break;
case PAINT_OP_PATH:
cogl_push_source (lnode->state);
cogl_path_fill (op->op.path);
@ -1244,11 +1267,11 @@ clutter_layer_node_init (ClutterLayerNode *self)
* Since: 1.10
*/
ClutterPaintNode *
_clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity)
clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity)
{
ClutterLayerNode *res;
CoglColor color;

View File

@ -143,6 +143,29 @@ CLUTTER_EXPORT
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
const ClutterColor *color);
#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.
*/
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);
G_END_DECLS
#endif /* __CLUTTER_PAINT_NODES_H__ */

View File

@ -35,6 +35,7 @@
#include "clutter-paint-volume-private.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-actor-box-private.h"
G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume,
clutter_paint_volume_copy,
@ -1138,8 +1139,6 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
CoglMatrix modelview;
CoglMatrix projection;
float viewport[4];
float width;
float height;
_clutter_paint_volume_copy_static (pv, &projected_pv);
@ -1179,50 +1178,7 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
return;
}
/* The aim here is that for a given rectangle defined with floating point
* coordinates we want to determine a stable quantized size in pixels
* that doesn't vary due to the original box's sub-pixel position.
*
* The reason this is important is because effects will use this
* API to determine the size of offscreen framebuffers and so for
* a fixed-size object that may be animated accross the screen we
* want to make sure that the stage paint-box has an equally stable
* size so that effects aren't made to continuously re-allocate
* a corresponding fbo.
*
* The other thing we consider is that the calculation of this box is
* subject to floating point precision issues that might be slightly
* different to the precision issues involved with actually painting the
* actor, which might result in painting slightly leaking outside the
* user's calculated paint-volume. For this we simply aim to pad out the
* paint-volume by at least half a pixel all the way around.
*/
width = box->x2 - box->x1;
height = box->y2 - box->y1;
width = CLUTTER_NEARBYINT (width);
height = CLUTTER_NEARBYINT (height);
/* XXX: NB the width/height may now be up to 0.5px too small so we
* must also pad by 0.25px all around to account for this. In total we
* must padd by at least 0.75px around all sides. */
/* XXX: The furthest that we can overshoot the bottom right corner by
* here is 1.75px in total if you consider that the 0.75 padding could
* just cross an integer boundary and so ceil will effectively add 1.
*/
box->x2 = ceilf (box->x2 + 0.75);
box->y2 = ceilf (box->y2 + 0.75);
/* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall
* size of the box will be stable and not dependant on the box's
* position.
*
* Adding 3px to the width/height will ensure we cover the maximum of
* 1.75px padding on the bottom/right and still ensure we have > 0.75px
* padding on the top/left.
*/
box->x1 = box->x2 - width - 3;
box->y1 = box->y2 - height - 3;
_clutter_actor_box_enlarge_for_effects (box);
clutter_paint_volume_free (&projected_pv);
}

View File

@ -961,6 +961,7 @@ clutter_pan_action_get_motion_delta (ClutterPanAction *self,
return clutter_pan_action_get_interpolated_delta (self, delta_x, delta_y);
default:
g_assert_not_reached ();
return 0.0f;
}
}

View File

@ -202,7 +202,7 @@ gboolean _clutter_feature_init (GError **error);
/* Diagnostic mode */
gboolean _clutter_diagnostic_enabled (void);
void _clutter_diagnostic_message (const char *fmt, ...);
void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
/* Picking code */
guint _clutter_pixel_to_id (guchar pixel[4]);

View File

@ -333,6 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
default:
g_assert_not_reached ();
return COGL_INVALID_HANDLE;
}
}

View File

@ -1474,8 +1474,8 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)))
{
CLUTTER_NOTE (PICK, "Pushing pick scissor clip x: %d, y: %d, 1x1",
(int) dirty_x * fb_scale,
(int) dirty_y * fb_scale);
(int) (dirty_x * fb_scale),
(int) (dirty_y * fb_scale));
cogl_framebuffer_push_scissor_clip (fb, dirty_x * fb_scale, dirty_y * fb_scale, 1, 1);
}
@ -1495,7 +1495,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
read_x = dirty_x * fb_scale;
read_y = dirty_y * fb_scale;
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %d",
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %f",
x, y,
view_layout.width, view_layout.height,
view_layout.x, view_layout.y, fb_scale);

View File

@ -766,6 +766,7 @@ discrete_to_direction (double discrete_dx,
return CLUTTER_SCROLL_UP;
else
g_assert_not_reached ();
return 0;
}
void

View File

@ -491,7 +491,7 @@ clutter_marshal = gnome.genmarshal('clutter-marshal',
prefix: '_clutter_marshal',
sources: 'clutter-marshal.list',
valist_marshallers: true,
extra_args: ['--prototypes', '--quiet'],
extra_args: ['--quiet'],
install_dir: clutter_clutter_includedir,
install_header: true,
)
@ -519,10 +519,12 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
cally_headers,
cally_private_headers,
],
soversion: '0.0.0',
version: '0.0.0',
soversion: 0,
c_args: clutter_c_args,
include_directories: clutter_includes,
dependencies: [clutter_deps],
gnu_symbol_visibility: 'hidden',
link_with: [
libmutter_cogl,
libmutter_cogl_pango,

View File

@ -480,7 +480,7 @@ xsettings_client_new_with_grab_funcs (Display *display,
{
XSettingsClient *client;
char buffer[256];
char *atom_names[3];
const char *atom_names[3];
Atom atoms[3];
client = malloc (sizeof *client);

View File

@ -29,26 +29,30 @@ endif
clutter_c_args += clutter_debug_c_args
clutter_pkg_deps = [
gdk_pixbuf_dep,
atk_dep,
cairo_gobject_dep,
glib_dep,
gobject_dep,
gio_dep,
json_glib_dep,
pango_dep,
]
clutter_pkg_private_deps = [
gdk_pixbuf_dep,
gthread_dep,
gmodule_no_export_dep,
atk_dep,
pangocairo_dep,
json_glib_dep,
]
if have_pango_ft2
clutter_pkg_deps += [
clutter_pkg_private_deps += [
pangoft2_dep,
]
endif
if have_wayland
clutter_pkg_deps += [
clutter_pkg_private_deps += [
wayland_egl_dep,
wayland_server_dep,
]
@ -57,6 +61,8 @@ endif
if have_x11
clutter_pkg_deps += [
x11_dep,
]
clutter_pkg_private_deps += [
xext_dep,
xdamage_dep,
xcomposite_dep,
@ -66,7 +72,7 @@ if have_x11
endif
if have_native_backend
clutter_pkg_deps += [
clutter_pkg_private_deps += [
libudev_dep,
libinput_dep,
xkbcommon_dep,
@ -74,13 +80,14 @@ if have_native_backend
endif
if have_libwacom
clutter_pkg_deps += [
clutter_pkg_private_deps += [
libwacom_dep,
]
endif
clutter_deps = [
clutter_pkg_deps,
clutter_pkg_private_deps,
libmutter_cogl_dep,
m_dep
]

View File

@ -1,119 +0,0 @@
#define CLUTTER_ENABLE_EXPERIMENTAL_API
#include <clutter/clutter.h>
#define STAGE_WIDTH (300)
#define STAGE_HEIGHT (300)
typedef struct
{
ClutterActor *stage;
ClutterActor *actor_group1;
ClutterEffect *blur_effect1;
ClutterActor *actor_group2;
ClutterEffect *blur_effect2;
} Data;
static void
check_results (ClutterStage *stage, gpointer user_data)
{
Data *data = user_data;
gfloat width, height;
ClutterRect rect;
clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect1),
&rect);
width = clutter_rect_get_width (&rect);
height = clutter_rect_get_height (&rect);
if (g_test_verbose ())
g_print ("Checking effect1 size: %.2f x %.2f\n",
clutter_rect_get_width (&rect),
clutter_rect_get_height (&rect));
g_assert_cmpint (width, <, STAGE_WIDTH);
g_assert_cmpint (height, <, STAGE_HEIGHT);
clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect2),
&rect);
width = clutter_rect_get_width (&rect);
height = clutter_rect_get_height (&rect);
if (g_test_verbose ())
g_print ("Checking effect2 size: %.2f x %.2f\n", width, height);
g_assert_cmpint (width, ==, STAGE_WIDTH);
g_assert_cmpint (height, ==, STAGE_HEIGHT);
clutter_main_quit ();
}
static ClutterActor *
create_actor (gfloat x, gfloat y,
gfloat width, gfloat height,
const ClutterColor *color)
{
return g_object_new (CLUTTER_TYPE_ACTOR,
"x", x,
"y", y,
"width", width,
"height", height,
"background-color", color,
NULL);
}
static void
actor_offscreen_limit_max_size (void)
{
Data data;
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
return;
data.stage = clutter_test_get_stage ();
g_signal_connect (data.stage, "after-paint",
G_CALLBACK (check_results), &data);
clutter_actor_set_size (data.stage, STAGE_WIDTH, STAGE_HEIGHT);
data.actor_group1 = clutter_actor_new ();
clutter_actor_add_child (data.stage, data.actor_group1);
data.blur_effect1 = clutter_blur_effect_new ();
clutter_actor_add_effect (data.actor_group1, data.blur_effect1);
clutter_actor_add_child (data.actor_group1,
create_actor (10, 10,
100, 100,
CLUTTER_COLOR_Blue));
clutter_actor_add_child (data.actor_group1,
create_actor (100, 100,
100, 100,
CLUTTER_COLOR_Gray));
data.actor_group2 = clutter_actor_new ();
clutter_actor_add_child (data.stage, data.actor_group2);
data.blur_effect2 = clutter_blur_effect_new ();
clutter_actor_add_effect (data.actor_group2, data.blur_effect2);
clutter_actor_add_child (data.actor_group2,
create_actor (-10, -10,
100, 100,
CLUTTER_COLOR_Yellow));
clutter_actor_add_child (data.actor_group2,
create_actor (250, 10,
100, 100,
CLUTTER_COLOR_ScarletRed));
clutter_actor_add_child (data.actor_group2,
create_actor (10, 250,
100, 100,
CLUTTER_COLOR_Yellow));
clutter_actor_show (data.stage);
clutter_main ();
}
CLUTTER_TEST_SUITE (
CLUTTER_TEST_UNIT ("/actor/offscreen/limit-max-size", actor_offscreen_limit_max_size)
)

View File

@ -189,10 +189,11 @@ verify_redraws (gpointer user_data)
clutter_actor_queue_redraw (data->child);
verify_redraw (data, 1);
/* Modifying the transformation on the parent should cause a
redraw */
/* Modifying the transformation on the parent should not cause a redraw,
since the FBO stores pre-transformed rendering that can be reused with
any transformation. */
clutter_actor_set_anchor_point (data->parent_container, 0, 1);
verify_redraw (data, 1);
verify_redraw (data, 0);
/* Redrawing an unrelated actor shouldn't cause a redraw */
clutter_actor_set_position (data->unrelated_actor, 0, 1);

View File

@ -19,7 +19,6 @@ clutter_conform_tests_actor_tests = [
'actor-iter',
'actor-layout',
'actor-meta',
'actor-offscreen-limit-max-size',
'actor-offscreen-redirect',
'actor-paint-opacity',
'actor-pick',

View File

@ -27,6 +27,9 @@ typedef struct SuperOH
static gint n_hands = NHANDS;
int
test_actors_main (int argc, char *argv[]);
static GOptionEntry super_oh_entries[] = {
{
"num-hands", 'n',

View File

@ -4,6 +4,12 @@
static gboolean is_expanded = FALSE;
int
test_animation_main (int argc, char *argv[]);
const char *
test_animation_describe (void);
static void
on_rect_transitions_completed (ClutterActor *actor)
{

View File

@ -5,6 +5,10 @@
static ClutterAnimator *animator;
gint
test_animator_main (gint argc,
gchar **argv);
static ClutterActor *new_rect (gint r,
gint g,
gint b,

View File

@ -47,6 +47,12 @@ static const gchar *desaturare_glsl_shader =
static gboolean is_expanded = FALSE;
const char *
test_bind_constraint_describe (void);
int
test_bind_constraint_main (int argc, char *argv[]);
static gboolean
on_button_release (ClutterActor *actor,
ClutterEvent *event,

View File

@ -31,6 +31,14 @@ struct _KeyGroupClass
ClutterActor *child);
};
GType key_group_get_type (void);
int
test_binding_pool_main (int argc, char *argv[]);
const char *
test_binding_pool_describe (void);
G_DEFINE_TYPE (KeyGroup, key_group, CLUTTER_TYPE_ACTOR)
enum

View File

@ -3,6 +3,12 @@
#include <cairo.h>
#include <clutter/clutter.h>
int
test_cairo_clock_main (int argc, char *argv[]);
const char *
test_cairo_clock_describe (void);
static gboolean
draw_clock (ClutterCanvas *canvas,
cairo_t *cr,

View File

@ -25,6 +25,12 @@ Flower;
static ClutterActor *stage = NULL;
int
test_cairo_flowers_main (int argc, char **argv);
const char *
test_cairo_flowers_describe (void);
static gboolean
draw_flower (ClutterCanvas *canvas,
cairo_t *cr,

View File

@ -30,6 +30,11 @@ typedef struct _TestMultiLayerMaterialState
} TestMultiLayerMaterialState;
int
test_cogl_multitexture_main (int argc, char *argv[]);
const char *
test_cogl_multitexture_describe (void);
static void
frame_cb (ClutterTimeline *timeline,

View File

@ -56,6 +56,12 @@ struct _TestCoglboxClass
static GType test_coglbox_get_type (void) G_GNUC_CONST;
int
test_cogl_offscreen_main (int argc, char *argv[]);
const char *
test_cogl_offscreen_describe (void);
G_END_DECLS
/* Coglbox private declaration
@ -153,7 +159,7 @@ test_coglbox_dispose (GObject *object)
* This sets up a Clutter like coordinate system for a Cogl
* framebuffer
*/
void
static void
setup_viewport (unsigned int width,
unsigned int height,
float fovy,

View File

@ -51,6 +51,12 @@ struct _Data
CoglMaterial *material;
};
int
test_cogl_point_sprites_main (int argc, char *argv[]);
const char *
test_cogl_point_sprites_describe (void);
static CoglHandle
generate_round_texture (void)
{

View File

@ -7,10 +7,13 @@
typedef struct
{
char *name;
char *source;
const char *name;
const char *source;
} ShaderSource;
int
test_cogl_shader_glsl_main (int argc, char *argv[]);
/* a couple of boilerplate defines that are common amongst all the
* sample shaders
*/
@ -51,22 +54,6 @@ static ShaderSource shaders[]=
{"box-blur",
FRAGMENT_SHADER_VARS
#if GPU_SUPPORTS_DYNAMIC_BRANCHING
"uniform float radius;"
FRAGMENT_SHADER_BEGIN
"float u, v;"
"int count = 1;"
"for (u=-radius;u<radius;u++)"
" for (v=-radius;v<radius;v++)"
" {"
" color += texture2D(tex, "
" vec2(cogl_tex_coord_in[0].s + u * 2.0 * x_step, "
" cogl_tex_coord_in[0].t + v * 2.0 * y_step));"
" count ++;"
" }"
"color = color / float(count);"
FRAGMENT_SHADER_END
#else
"vec4 get_rgba_rel(sampler2D tex, float dx, float dy)"
"{"
" return texture2D (tex, cogl_tex_coord_in[0].st "
@ -86,7 +73,6 @@ static ShaderSource shaders[]=
" color += get_rgba_rel (tex, x_step, y_step); count++;"
" color = color / count;"
FRAGMENT_SHADER_END
#endif
},
{"invert",

View File

@ -56,6 +56,12 @@ struct _TestCoglboxClass
static GType test_coglbox_get_type (void) G_GNUC_CONST;
int
test_cogl_tex_convert_main (int argc, char *argv[]);
const char *
test_cogl_tex_convert_describe (void);
G_END_DECLS
/* Coglbox private declaration

View File

@ -60,6 +60,9 @@ typedef struct _TestCoglbox TestCoglbox;
typedef struct _TestCoglboxClass TestCoglboxClass;
typedef struct _TestCoglboxPrivate TestCoglboxPrivate;
const char *
test_cogl_tex_foreign_describe (void);
struct _TestCoglbox
{
ClutterActor parent;
@ -116,6 +119,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
#define TEST_COGLBOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
int
test_cogl_tex_foreign_main (int argc, char *argv[]);
/* Coglbox implementation
*--------------------------------------------------*/

View File

@ -56,6 +56,12 @@ struct _TestCoglboxClass
static GType test_coglbox_get_type (void) G_GNUC_CONST;
int
test_cogl_tex_polygon_main (int argc, char *argv[]);
const char *
test_cogl_tex_polygon_describe (void);
G_END_DECLS
/* Coglbox private declaration

View File

@ -57,6 +57,12 @@ struct _TestCoglboxClass
static GType test_coglbox_get_type (void) G_GNUC_CONST;
int
test_cogl_tex_tile_main (int argc, char *argv[]);
const char *
test_cogl_tex_tile_describe (void);
G_END_DECLS
/* Coglbox private declaration

View File

@ -53,6 +53,12 @@ typedef struct _TestState
guint frame_id;
} TestState;
int
test_cogl_vertex_buffer_main (int argc, char *argv[]);
const char *
test_cogl_vertex_buffer_describe (void);
static void
frame_cb (ClutterTimeline *timeline,
gint elapsed_msecs,

View File

@ -19,6 +19,14 @@ typedef struct _ColorContentClass {
static void clutter_content_iface_init (ClutterContentIface *iface);
GType color_content_get_type (void);
int
test_content_main (int argc, char *argv[]);
const char *
test_content_describe (void);
G_DEFINE_TYPE_WITH_CODE (ColorContent, color_content, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
clutter_content_iface_init))

View File

@ -12,6 +12,9 @@ typedef struct {
GHashTable *devices;
} TestDevicesApp;
int
test_devices_main (int argc, char **argv);
static const gchar *
device_type_name (ClutterInputDevice *device)
{

View File

@ -55,6 +55,12 @@ static ClutterActor *easing_mode_label = NULL;
static ClutterAnimation *last_animation = NULL;
int
test_easing_main (int argc, char *argv[]);
const char *
test_easing_describe (void);
/* recenter_bouncer:
*
* repositions (through an animation) the bouncer at the center of the stage

View File

@ -4,6 +4,12 @@
gboolean IsFullScreen = FALSE, IsMotion = TRUE;
int
test_events_main (int argc, char *argv[]);
const char *
test_events_describe (void);
static const gchar *
get_event_type_name (const ClutterEvent *event)
{
@ -53,7 +59,7 @@ get_event_type_name (const ClutterEvent *event)
static gchar *
get_event_state_string (const ClutterEvent *event)
{
gchar *mods[18];
const char *mods[18];
int i = 0;
ClutterModifierType state = clutter_event_get_state (event);
@ -96,7 +102,7 @@ get_event_state_string (const ClutterEvent *event)
mods[i++] = "-";
mods[i] = NULL;
return g_strjoinv (",", mods);
return g_strjoinv (",", (char **) mods);
}
static void
@ -422,15 +428,15 @@ test_events_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (stage), "Events");
clutter_actor_set_name (stage, "Stage");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect (stage, "event", G_CALLBACK (input_cb), "stage");
g_signal_connect (stage, "event", G_CALLBACK (input_cb), (char *) "stage");
g_signal_connect (stage, "fullscreen",
G_CALLBACK (stage_state_cb), "fullscreen");
G_CALLBACK (stage_state_cb), (char *) "fullscreen");
g_signal_connect (stage, "unfullscreen",
G_CALLBACK (stage_state_cb), "unfullscreen");
G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
g_signal_connect (stage, "activate",
G_CALLBACK (stage_state_cb), "activate");
G_CALLBACK (stage_state_cb), (char *) "activate");
g_signal_connect (stage, "deactivate",
G_CALLBACK (stage_state_cb), "deactivate");
G_CALLBACK (stage_state_cb), (char *) "deactivate");
focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
clutter_actor_set_name (focus_box, "Focus Box");
@ -442,7 +448,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "red box");
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "red box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
/* Toggle motion - enter/leave capture */
@ -457,7 +463,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 250, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "green box");
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "green box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
@ -468,7 +474,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 400, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box");
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
/* Fullscreen */
@ -481,7 +487,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 400, 50);
clutter_actor_set_position (actor, 100, 250);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box");
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
g_signal_connect (stage, "key-focus-in", G_CALLBACK (key_focus_in_cb),
@ -493,7 +499,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "yellow box");
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "yellow box");
/* note group not reactive */
group = clutter_group_new ();

View File

@ -8,7 +8,13 @@
#define STAGE_WIDTH 800
#define STAGE_HEIGHT 600
ClutterActor *
int
test_fbo_main (int argc, char *argv[]);
const char *
test_fbo_describe (void);
static ClutterActor *
make_source (void)
{
ClutterActor *source, *actor;

View File

@ -1,6 +1,12 @@
#include <gmodule.h>
#include <clutter/clutter.h>
int
test_grab_main (int argc, char *argv[]);
const char *
test_grab_describe (void);
static void
stage_state_cb (ClutterStage *stage,
gpointer data)
@ -211,22 +217,22 @@ test_grab_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect (stage, "event",
G_CALLBACK (debug_event_cb), "stage");
G_CALLBACK (debug_event_cb), (char *) "stage");
g_signal_connect (stage, "fullscreen",
G_CALLBACK (stage_state_cb), "fullscreen");
G_CALLBACK (stage_state_cb), (char *) "fullscreen");
g_signal_connect (stage, "unfullscreen",
G_CALLBACK (stage_state_cb), "unfullscreen");
G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
g_signal_connect (stage, "activate",
G_CALLBACK (stage_state_cb), "activate");
G_CALLBACK (stage_state_cb), (char *) "activate");
g_signal_connect (stage, "deactivate",
G_CALLBACK (stage_state_cb), "deactivate");
G_CALLBACK (stage_state_cb), (char *) "deactivate");
actor = clutter_rectangle_new_with_color (&rcol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "red box");
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "red box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL);
g_signal_connect (actor, "button-release-event",
@ -237,7 +243,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_position (actor, 100, 300);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "yellow box");
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "yellow box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (toggle_grab_pointer_cb), NULL);
@ -247,7 +253,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), "blue box");
G_CALLBACK (debug_event_cb), (char *) "blue box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL);
g_signal_connect (actor, "button-release-event",
@ -259,7 +265,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), "green box");
G_CALLBACK (debug_event_cb), (char *) "green box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (green_press_cb), NULL);
@ -270,7 +276,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event",
G_CALLBACK (debug_event_cb), "cyan box");
G_CALLBACK (debug_event_cb), (char *) "cyan box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (cyan_press_cb), NULL);

View File

@ -20,6 +20,14 @@ typedef struct _SolidContentClass {
static void clutter_content_iface_init (ClutterContentIface *iface);
GType solid_content_get_type (void);
const char *
test_image_describe (void);
int
test_image_main (int argc, char *argv[]);
G_DEFINE_TYPE_WITH_CODE (SolidContent, solid_content, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
clutter_content_iface_init))

View File

@ -11,6 +11,12 @@ static const ClutterColor colors[] = {
#define PADDING (64.0f)
#define SIZE (64.0f)
const char *
test_keyframe_transition_describe (void);
int
test_keyframe_transition_main (int argc, char *argv[]);
static void
on_transition_stopped (ClutterActor *actor,
const gchar *transition_name,

View File

@ -48,6 +48,14 @@ struct _MyThingPrivate
guint use_transformed_box : 1;
};
GType my_thing_get_type (void);
int
test_layout_main (int argc, char *argv[]);
const char *
test_layout_describe (void);
G_DEFINE_TYPE_WITH_PRIVATE (MyThing, my_thing, CLUTTER_TYPE_ACTOR)
#define MY_THING_GET_PRIVATE(obj) \
@ -417,7 +425,7 @@ my_thing_init (MyThing *thing)
thing->priv = MY_THING_GET_PRIVATE (thing);
}
ClutterActor *
static ClutterActor *
my_thing_new (gfloat padding,
gfloat spacing)
{

View File

@ -4,6 +4,9 @@
static GList *stages = NULL;
static gint n_stages = 1;
int
test_multistage_main (int argc, char *argv[]);
static gboolean
tex_button_cb (ClutterActor *actor,
ClutterEvent *event,

View File

@ -56,6 +56,12 @@ static GOptionEntry super_oh_entries[] = {
{ NULL }
};
int
test_paint_wrapper_main (int argc, char *argv[]);
const char *
test_paint_wrapper_describe (void);
static gboolean
on_button_press_event (ClutterActor *actor,
ClutterEvent *event,

View File

@ -11,6 +11,10 @@
static gboolean toggled = FALSE;
int
test_path_constraint_main (int argc,
char *argv[]);
static gboolean
on_button_press (ClutterActor *actor,
const ClutterEvent *event,

View File

@ -23,6 +23,12 @@
static gboolean disable_x11 = FALSE;
static gboolean disable_animation = FALSE;
int
test_pixmap_main (int argc, char **argv);
const char *
test_pixmap_describe (void);
static GOptionEntry g_options[] =
{
{ "disable-x11",
@ -131,7 +137,7 @@ stage_button_press_cb (ClutterActor *actor,
return CLUTTER_EVENT_STOP;
}
Pixmap
static Pixmap
create_pixmap (guint *width, guint *height, guint *depth)
{
Display *dpy = clutter_x11_get_default_display ();

View File

@ -26,6 +26,12 @@
#define STAGE_WIDTH 800
#define STAGE_HEIGHT 550
int
test_rotate_zoom_main (int argc, char *argv[]);
const char *
test_rotate_zoom_describe (void);
static ClutterActor *
create_hand (void)
{

View File

@ -18,6 +18,12 @@ static const ClutterGravity gravities[] = {
static gint gindex = 0;
static ClutterActor *label;
int
test_scale_main (int argc, char *argv[]);
const char *
test_scale_describe (void);
static void
set_next_gravity (ClutterActor *actor)
{

View File

@ -10,6 +10,9 @@
static ClutterScript *script = NULL;
static guint merge_id = 0;
int
test_script_main (int argc, char *argv[]);
static const gchar *test_unmerge =
"["
" {"
@ -75,28 +78,6 @@ static const gchar *test_behaviour =
" }"
"]";
gdouble
sine_alpha (ClutterAlpha *alpha,
gpointer dummy G_GNUC_UNUSED)
{
ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
return sin (clutter_timeline_get_progress (timeline) * G_PI);
}
gdouble
double_ramp_alpha (ClutterAlpha *alpha,
gpointer dummy G_GNUC_UNUSED)
{
ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
gdouble progress = clutter_timeline_get_progress (timeline);
if (progress >= 0.5)
return 1.0 - progress;
return progress;
}
static gboolean
blue_button_press (ClutterActor *actor,
ClutterButtonEvent *event,

View File

@ -20,6 +20,9 @@ static const gchar *rect_color[N_RECTS] = {
static ClutterActor *rectangle[N_RECTS];
static ClutterActor *viewport = NULL;
int
test_scrolling_main (int argc, char *argv[]);
static void
on_drag_end (ClutterDragAction *action,
ClutterActor *actor,

View File

@ -7,6 +7,9 @@
#include <clutter/clutter.h>
int
test_shader_effects_main (int argc, char *argv[]);
G_MODULE_EXPORT int
test_shader_effects_main (int argc, char *argv[])
{

View File

@ -16,17 +16,23 @@ struct _CallbackData
guint idle_source;
};
int
test_stage_read_pixels_main (int argc, char **argv);
const char *
test_stage_read_pixels_describe (void);
static ClutterActor *
make_label (void)
{
ClutterActor *label;
gchar *text;
gchar *argv[] = { "ls", "--help", NULL };
const char *argv[] = { "ls", "--help", NULL };
label = clutter_text_new ();
clutter_text_set_font_name (CLUTTER_TEXT (label), "Sans 10");
if (g_spawn_sync (NULL, argv, NULL,
if (g_spawn_sync (NULL, (char **) argv, NULL,
G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
NULL, NULL, &text, NULL, NULL, NULL))
{

View File

@ -2,6 +2,12 @@
#include <gmodule.h>
#include <clutter/clutter.h>
int
test_stage_sizing_main (int argc, char *argv[]);
const char *
test_stage_sizing_describe (void);
static gboolean
fullscreen_clicked_cb (ClutterStage *stage)
{

View File

@ -6,6 +6,13 @@
static ClutterState *state;
static ClutterAnimator *animator;
gint
test_state_animator_main (gint argc,
gchar **argv);
const char *
test_state_animator_describe (void);
static gboolean press_event (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)

View File

@ -6,15 +6,8 @@
#define TEST_STATE_SCRIPT_FILE "test-script-signals.json"
gboolean
on_button_press (ClutterActor *actor,
ClutterEvent *event,
gpointer dummy G_GNUC_UNUSED)
{
g_print ("Button pressed!\n");
return FALSE;
}
int
test_state_script_main (int argc, char *argv[]);
G_MODULE_EXPORT int
test_state_script_main (int argc, char *argv[])

View File

@ -13,6 +13,12 @@
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
#define TOTAL (ROWS*COLS)
gint
test_state_main (gint argc,
gchar **argv);
const char *
test_state_describe (void);
static gboolean press_event (ClutterActor *actor,
ClutterEvent *event,

View File

@ -7,6 +7,12 @@ enum {
BOTH = 2
};
int
test_swipe_action_main (int argc, char *argv[]);
const char *
test_swipe_action_describe (void);
static void
swept_cb (ClutterSwipeAction *action,
ClutterActor *actor,

View File

@ -9,6 +9,12 @@
#define FONT "Sans 12"
int
test_table_layout_main (int argc, char *argv[]);
const char *
test_table_layout_describe (void);
static void
set_text (ClutterActor *actor, const gchar *text)
{

View File

@ -2,6 +2,13 @@
#include <gmodule.h>
#include <clutter/clutter.h>
gint
test_text_field_main (gint argc,
gchar **argv);
const char *
test_text_field_describe (void);
static void
on_entry_activate (ClutterText *text,
gpointer data)

View File

@ -10,6 +10,13 @@ static const gchar *runes =
"ᛋᚳᛖᚪᛚ᛫ᚦᛖᚪᚻ᛫ᛗᚪᚾᚾᚪ᛫ᚷᛖᚻᚹᛦᛚᚳ᛫ᛗᛁᚳᛚᚢᚾ᛫ᚻᛦᛏ᛫ᛞᚫᛚᚪᚾ\n"
"ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ᛬\n";
gint
test_text_main (gint argc,
gchar **argv);
const char *
test_text_describe (void);
G_MODULE_EXPORT gint
test_text_main (gint argc,
gchar **argv)

View File

@ -11,6 +11,12 @@ enum
static ClutterActor *stage = NULL;
const char *
test_texture_async_describe (void);
gint
test_texture_async_main (int argc, char *argv[]);
static void
on_load_finished (ClutterTexture *texture,
const GError *error,

View File

@ -3,6 +3,9 @@
#include <gmodule.h>
#include <clutter/clutter.h>
int
test_texture_material_main (int argc, char *argv[]);
G_MODULE_EXPORT int
test_texture_material_main (int argc, char *argv[])
{

View File

@ -2,6 +2,12 @@
#include <gmodule.h>
#include <clutter/clutter.h>
gint
test_texture_quality_main (int argc, char *argv[]);
const char *
test_texture_quality_describe (void);
/* each time the timeline animating the label completes, swap the direction */
static void
timeline_completed (ClutterTimeline *timeline,

View File

@ -3,7 +3,13 @@
#include <clutter/clutter.h>
guchar*
int
test_textures_main (int argc, char *argv[]);
const char *
test_texture_slicing_describe (void);
static guchar *
make_rgba_data (int width, int height, int bpp, int has_alpha, int *rowstride_p)
{
#define CHECK_SIZE 20

View File

@ -45,6 +45,12 @@ static const ClutterColor static_colors[] = {
};
static GHashTable *sequence_to_color = NULL;
int
test_touch_events_main (int argc, char *argv[]);
const char *
test_touch_events_describe (void);
static void
canvas_paint (ClutterCairoTexture *canvas)
{

View File

@ -7,7 +7,8 @@ static gint testframes = 0;
static float testmaxtime = 1.0;
/* initialize environment to be suitable for fps testing */
void clutter_perf_fps_init (void)
static inline void
clutter_perf_fps_init (void)
{
/* Force not syncing to vblank, we want free-running maximum FPS */
g_setenv ("vblank_mode", "0", FALSE);
@ -27,17 +28,20 @@ void clutter_perf_fps_init (void)
static void perf_stage_paint_cb (ClutterStage *stage, gpointer *data);
static gboolean perf_fake_mouse_cb (gpointer stage);
void clutter_perf_fps_start (ClutterStage *stage)
static inline void
clutter_perf_fps_start (ClutterStage *stage)
{
g_signal_connect (stage, "paint", G_CALLBACK (perf_stage_paint_cb), NULL);
}
void clutter_perf_fake_mouse (ClutterStage *stage)
static inline void
clutter_perf_fake_mouse (ClutterStage *stage)
{
clutter_threads_add_timeout (1000/60, perf_fake_mouse_cb, stage);
}
void clutter_perf_fps_report (const gchar *id)
static inline void
clutter_perf_fps_report (const gchar *id)
{
g_print ("\n@ %s: %.2f fps \n",
id, testframes / g_timer_elapsed (testtimer, NULL));

View File

@ -1,6 +1,4 @@
{
global:
gl*;
local:
*;
}
};

View File

@ -8,16 +8,20 @@ cogl_gles2_sources = [
'cogl-gles2-api.c',
]
libmutter_cogl_gles2_map = 'libmutter-cogl-gles2.map'
libmutter_cogl_gles2_link_args = [
'-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
libmutter_cogl_gles2_map),
]
libmutter_cogl_gles2 = shared_library('mutter-cogl-gles2-' + libmutter_api_version,
sources: [cogl_gles2_sources, cogl_gles2_public_headers],
soversion: '0.0.0',
version: '0.0.0',
soversion: 0,
c_args: cogl_c_args,
include_directories: [cogl_includepath, cogl_path_includepath],
link_depends: 'libmutter-cogl-gles2.map',
dependencies: [
cogl_deps,
libmutter_cogl_dep
],
link_depends: libmutter_cogl_gles2_map,
link_args: libmutter_cogl_gles2_link_args,
dependencies: libmutter_cogl_dep,
install_rpath: pkglibdir,
install_dir: pkglibdir,
install: true,

View File

@ -3,4 +3,4 @@ global:
cogl_pango_*;
local:
*;
}
};

View File

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

View File

@ -1358,13 +1358,13 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
gluTessNormal (tess.glu_tess, 0.0, 0.0, 1.0);
gluTessCallback (tess.glu_tess, GLU_TESS_BEGIN_DATA,
_cogl_path_tesselator_begin);
(GCallback) _cogl_path_tesselator_begin);
gluTessCallback (tess.glu_tess, GLU_TESS_VERTEX_DATA,
_cogl_path_tesselator_vertex);
(GCallback) _cogl_path_tesselator_vertex);
gluTessCallback (tess.glu_tess, GLU_TESS_END_DATA,
_cogl_path_tesselator_end);
(GCallback) _cogl_path_tesselator_end);
gluTessCallback (tess.glu_tess, GLU_TESS_COMBINE_DATA,
_cogl_path_tesselator_combine);
(GCallback) _cogl_path_tesselator_combine);
gluTessBeginPolygon (tess.glu_tess, &tess);

View File

@ -14,4 +14,4 @@ global:
cogl2_set_*;
local:
*;
}
};

View File

@ -33,10 +33,9 @@ cogl_path_sources = [
'tesselator/tesselator.h',
'tesselator/tessmono.c',
'tesselator/tessmono.h',
'tesselator/GL/glu.h',
]
cogl_path_includepath = include_directories('.', 'tesselator')
cogl_path_includepath = include_directories('.')
libmutter_cogl_path_enum_types = gnome.mkenums('cogl-path-enum-types',
sources: 'cogl-path-types.h',
@ -49,13 +48,24 @@ libmutter_cogl_path_enum_types_h = libmutter_cogl_path_enum_types[1]
cogl_path_sources += libmutter_cogl_path_enum_types
cogl_path_c_args = [
cogl_c_args,
]
libmutter_cogl_path_map = 'libmutter-cogl-path.map'
libmutter_cogl_path_link_args = [
'-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
libmutter_cogl_path_map),
]
libmutter_cogl_path = shared_library('mutter-cogl-path-' + libmutter_api_version,
sources: [cogl_path_sources, cogl_path_public_headers],
soversion: '0.0.0',
c_args: cogl_c_args,
version: '0.0.0',
soversion: 0,
c_args: cogl_path_c_args,
include_directories: [cogl_includepath, cogl_path_includepath],
link_depends: 'libmutter-cogl-path.map',
dependencies: [libmutter_cogl_dep, cogl_deps],
link_depends: libmutter_cogl_path_map,
link_args: libmutter_cogl_path_link_args,
dependencies: libmutter_cogl_dep,
install_rpath: pkglibdir,
install_dir: pkglibdir,
install: true,

View File

@ -1,47 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2010 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/* This is just a wrapper to use our simplified version of glu.h so
that the tesselator code can still #include <GL/glu.h> */
#include "../tesselator.h"
/* These aren't defined on GLES and we don't really want the
tesselator code to use them but we're also trying to avoid
modifying the C files so we just force them to be empty here */
#undef GLAPI
#define GLAPI
#undef GLAPIENTRY
#define GLAPIENTRY
/* GLES doesn't define a GLdouble type so lets just force it to a
regular double */
#define GLdouble double

View File

@ -45,12 +45,12 @@
#define FALSE 0
#endif
static GLUvertex *allocVertex()
static GLUvertex *allocVertex(void)
{
return (GLUvertex *)memAlloc( sizeof( GLUvertex ));
}
static GLUface *allocFace()
static GLUface *allocFace(void)
{
return (GLUface *)memAlloc( sizeof( GLUface ));
}

View File

@ -35,7 +35,7 @@
#ifndef __mesh_h_
#define __mesh_h_
#include <GL/glu.h>
#include <GL/gl.h>
typedef struct GLUmesh GLUmesh;

View File

@ -36,6 +36,7 @@
#define __normal_h_
#include "tess.h"
#include "tesselator.h"
/* __gl_projectPolygon( tess ) determines the polygon normal
* and project vertices onto the plane of the polygon.

View File

@ -36,6 +36,7 @@
#define __render_h_
#include "mesh.h"
#include "tesselator.h"
/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle
* fans, strips, and separate triangles. A substantial effort is made

View File

@ -36,6 +36,7 @@
#define __sweep_h_
#include "mesh.h"
#include "tesselator.h"
/* __gl_computeInterior( tess ) computes the planar arrangement specified
* by the given contours, and further subdivides this arrangement

View File

@ -35,7 +35,6 @@
#ifndef __tess_h_
#define __tess_h_
#include <GL/glu.h>
#include <setjmp.h>
#include "mesh.h"
#include "dict.h"

View File

@ -45,7 +45,7 @@ void gluBeginPolygon (GLUtesselator* tess);
void gluDeleteTess (GLUtesselator* tess);
void gluEndPolygon (GLUtesselator* tess);
typedef void (_GLUfuncptr)();
typedef void (_GLUfuncptr)(void);
void gluGetTessProperty (GLUtesselator* tess, GLenum which, double* data);

View File

@ -52,7 +52,7 @@ typedef enum
typedef struct _CoglAttributeNameState
{
char *name;
const char *name;
CoglAttributeNameID name_id;
int name_index;
CoglBool normalized_default;

View File

@ -67,7 +67,7 @@ COGL_GTYPE_DEFINE_CLASS (Attribute, attribute);
static CoglBool
validate_cogl_attribute_name (const char *name,
char **real_attribute_name,
const char **real_attribute_name,
CoglAttributeNameID *name_id,
CoglBool *normalized,
int *layer_number)

View File

@ -355,6 +355,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
}
g_assert_not_reached ();
return FALSE;
}
CoglBool

View File

@ -360,7 +360,7 @@ struct _CoglContext
};
CoglContext *
_cogl_context_get_default ();
_cogl_context_get_default (void);
const CoglWinsysVtable *
_cogl_context_get_winsys (CoglContext *context);

View File

@ -377,9 +377,6 @@ CoglPipelineLayer *
_cogl_pipeline_layer_get_authority (CoglPipelineLayer *layer,
unsigned long difference);
CoglTexture *
_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer);
int
_cogl_pipeline_layer_get_unit_index (CoglPipelineLayer *layer);

View File

@ -805,9 +805,6 @@ _cogl_pipeline_weak_copy (CoglPipeline *pipeline,
void
_cogl_pipeline_set_progend (CoglPipeline *pipeline, int progend);
CoglPipeline *
_cogl_pipeline_get_parent (CoglPipeline *pipeline);
void
_cogl_pipeline_get_colorubv (CoglPipeline *pipeline,
uint8_t *color);
@ -883,10 +880,6 @@ _cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
unsigned long
_cogl_pipeline_get_age (CoglPipeline *pipeline);
CoglPipeline *
_cogl_pipeline_get_authority (CoglPipeline *pipeline,
unsigned long difference);
void
_cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
CoglPipelineLayer *layer,

View File

@ -53,8 +53,8 @@ _cogl_profile_trace_message (const char *format, ...);
#else
#define COGL_STATIC_TIMER(A,B,C,D,E) extern void _cogl_dummy_decl (void)
#define COGL_STATIC_COUNTER(A,B,C,D) extern void _cogl_dummy_decl (void)
#define COGL_STATIC_TIMER(A,B,C,D,E) G_STMT_START{ (void)0; }G_STMT_END
#define COGL_STATIC_COUNTER(A,B,C,D) G_STMT_START{ (void)0; }G_STMT_END
#define COGL_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define COGL_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END
#define COGL_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END

View File

@ -57,9 +57,6 @@ void
_cogl_shader_compile_real (CoglHandle handle,
CoglPipeline *pipeline);
CoglShaderLanguage
_cogl_program_get_language (CoglHandle handle);
void
_cogl_shader_set_source_with_boilerplate (GLuint shader_gl_handle,
GLenum shader_gl_type,

View File

@ -389,7 +389,7 @@ strideof (CoglAttributeType type, int n_components)
static char *
canonize_attribute_name (const char *attribute_name)
{
char *detail_seperator = NULL;
const char *detail_seperator = NULL;
int name_len;
if (strncmp (attribute_name, "gl_", 3) != 0)

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