Commit Graph

374 Commits

Author SHA1 Message Date
Emmanuele Bassi
86e95a779a Remove CloneTexture from the API
ClutterClone supercedes ClutterCloneTexture, since it can clone
every kind of actor -- including composite ones.

This is another "brain surgery with a shotgun" kind of commit: it
removes CloneTexture and updates every test case using CloneTexture
to ClutterClone. The API fallout is minimal, luckily for us.
2009-01-27 15:18:45 +00:00
Robert Bragg
9266e110de Removes test-simple from tests/interactive/Makefile.am
The addition was accidental
2009-01-27 15:17:16 +00:00
Emmanuele Bassi
cd5c1bd98b [tests] Clean up the Clone interactive test
Do not assume the default stage, and store more data inside the
"application" structure that gets passed around instead of relying
on macros.
2009-01-27 14:36:12 +00:00
Robert Bragg
5985eef44c Fully integrates CoglMaterial throughout the rest of Cogl
This glues CoglMaterial in as the fundamental way that Cogl describes how to
fill in geometry.

It adds cogl_set_source (), which is used to set the material which will be
used by all subsequent drawing functions

It adds cogl_set_source_texture as a convenience for setting up a default
material with a single texture layer, and cogl_set_source_color is now also
a convenience for setting up a material with a solid fill.

"drawing functions" include, cogl_rectangle, cogl_texture_rectangle,
cogl_texture_multiple_rectangles, cogl_texture_polygon (though the
cogl_texture_* funcs have been renamed; see below for details),
cogl_path_fill/stroke and cogl_vertex_buffer_draw*.

cogl_texture_rectangle, cogl_texture_multiple_rectangles and
cogl_texture_polygon no longer take a texture handle; instead the current
source material is referenced. The functions have also been renamed to:
cogl_rectangle_with_texture_coords, cogl_rectangles_with_texture_coords
and cogl_polygon respectivly.

Most code that previously did:
  cogl_texture_rectangle (tex_handle, x, y,...);
needs to be changed to now do:
  cogl_set_source_texture (tex_handle);
  cogl_rectangle_with_texture_coords (x, y,....);

In the less likely case where you were blending your source texture with a color
like:
  cogl_set_source_color4ub (r,g,b,a); /* where r,g,b,a isn't just white */
  cogl_texture_rectangle (tex_handle, x, y,...);
you will need your own material to do that:
  mat = cogl_material_new ();
  cogl_material_set_color4ub (r,g,b,a);
  cogl_material_set_layer (mat, 0, tex_handle));
  cogl_set_source_material (mat);

Code that uses the texture coordinates, 0, 0, 1, 1 don't need to use
cog_rectangle_with_texure_coords since these are the coordinates that
cogl_rectangle will use.

For cogl_texture_polygon; as well as dropping the texture handle, the
n_vertices and vertices arguments were transposed for consistency. So
code previously written as:
  cogl_texture_polygon (tex_handle, 3, verts, TRUE);
need to be written as:
  cogl_set_source_texture (tex_handle);
  cogl_polygon (verts, 3, TRUE);

All of the unit tests have been updated to now use the material API and
test-cogl-material has been renamed to test-cogl-multitexture since any
textured quad is now technically a test of CoglMaterial but this test
specifically creates a material with multiple texture layers.

Note: The GLES backend has not been updated yet; that will be done in a
following commit.
2009-01-27 14:26:39 +00:00
Emmanuele Bassi
86e4e89bf1 Rename ActorClone to Clone/2
Step two: rename the object and its methods.

While we're at it, adhere more strictly to the coding style
practises; rename :clone-source to :source; add a setter method
for the :source property; take a reference on the source actor
to avoid it disappearing while we're still accessing it.
2009-01-27 14:24:31 +00:00
Emmanuele Bassi
00a4549eb1 [tests] Remove an unused variable
This fixes a compiler warning.
2009-01-27 13:22:47 +00:00
Emmanuele Bassi
0616237064 [tests] Assert as soon as possible
In order to give a usable location of the errors in the test
suite, we need to assert() as soon as possible.
2009-01-27 09:51:45 +00:00
Neil Roberts
8e437e838f Simplify test-cogl-primitives
This removes a lot of code from test-cogl-primitives to make it easier
to follow. The TestCoglBox custom actor has gone and instead a blank
ClutterGroup is created with a paint signal handler.

Instead of rendering constantly and updating when a GTimer elapses a
second, a ClutterTimeline is used with 1 fps and a new redraw is
queued every frame.

The custom main loop is replaced with a regular call to clutter_main.
This fixes the close button of the stage window so you can quit
without having to press Ctrl+C.
2009-01-23 23:55:44 +00:00
Neil Roberts
343b0ed67e [test-cogl-primitives] Remove trailing whitespace 2009-01-23 23:41:26 +00:00
Neil Roberts
5acff562b4 [test-anchors] Add tests for the rotation centers
The rotation centers are now tested in a similar way to the anchor
point and scale centers.

The notification handling code has been simplified a bit to handle the
increased amount of properties.
2009-01-23 18:41:41 +00:00
Neil Roberts
a8a986a1a2 [test-anchors] Add tests for the scale center
A separate set of tests for the scale center have been added that work
in a similar way to the anchor point tests.
2009-01-23 18:41:41 +00:00
Neil Roberts
7818eb704d Add a conformance test for the anchor point
This verifies that the anchor point can be set from a gravity and then
it moves when the anchor point changes size.
2009-01-23 18:41:40 +00:00
Neil Roberts
d64ff5c9f0 [test-text] Use g_setenv instead of setenv
setenv doesn't appear to be available on Windows so it fails to
compile.
2009-01-23 18:20:46 +00:00
Robert Bragg
3d07e34cc5 Merge commit 'origin/master' into cogl-material
Conflicts:

	clutter/clutter-texture.c
	clutter/cogl/cogl-texture.h
	clutter/cogl/cogl.h.in
	clutter/cogl/common/Makefile.am
	clutter/cogl/gl/Makefile.am
	clutter/cogl/gles/Makefile.am
	clutter/cogl/gles/cogl-gles2-wrapper.c
	clutter/cogl/gles/cogl-gles2-wrapper.h
2009-01-23 15:23:49 +00:00
Emmanuele Bassi
ae40bd37c7 Clean up the test reports
Since we override the clean-generic target in order to remove
the shell scripts we create for each conformance test unit, we
cannot use CLEANFILES to remove the test reports.
2009-01-23 13:29:55 +00:00
Emmanuele Bassi
915d9ec7ca Split maintainer-flags from the compiler flags
The maintainer compiler flags we use trigger warnings and errors
in the autogenerated code that gtk-doc creates to scan the header
and source files. Since we cannot control that, and we must run
a distcheck with both --enable-gtk-doc and --enable-maintainer-flags
turned on, we need to use less-strict compiler flags when inside
the doc/reference subdirectories.

The way to do this is to split the maintainer compiler flags into
their own Makefile variable, called MAINTAINER_CFLAGS. The we
can use $(MAINTAINER_CFLAGS) in the INCLUDES or _CFLAGS sections
of each part of the source directories we wish to check with the
anal retentiveness suited for maintainers.
2009-01-23 13:09:51 +00:00
Emmanuele Bassi
20973bd29f Fix compiler warnings
The maintainer-flags option discovered the usual amount of
collisions and compiler warnings we have to fix in order to
get distcheck to pass.
2009-01-23 13:08:46 +00:00
Emmanuele Bassi
792ffa1538 Merge branch 'float-alpha-value'
* float-alpha-value:
  [script] Parse easing modes by name
  [docs] Update the easing modes documentation
  [animation] Implement new easing functions
  [animation] Move the alpha value to floating point
2009-01-23 12:10:50 +00:00
Emmanuele Bassi
1b242e3550 [tests] Use the right value in cogl_texture_new*
The correct symbol for disabling the flags when creating a new
COGL texture is COGL_TEXTURE_NONE.
2009-01-22 16:54:49 +00:00
Emmanuele Bassi
07689865fe [tests] Update the tests calling cogl_texture_new_*
The tests calling any of the cogl_texture_new_* family of functions
must be updated to the new constructor syntax.
2009-01-21 10:14:29 +00:00
Robert Bragg
e338245827 Renames the mesh api to the "vertex buffer api".
This better reflects the fact that the api manages sets of vertex attributes,
and the attributes really have no implied form. It is only when you use the
attributes to draw that they become mesh like; when you specify how they should
be interpreted, e.g. as triangle lists or fans etc. This rename frees up the
term "mesh", which can later be applied to a concept slightly more fitting.
E.g. at some point it would be nice to have a higher level abstraction that
sits on top of cogl vertex buffers that adds the concept of faces. (Somthing
like Blender's mesh objects.) There have also been some discussions over
particle engines, and these can be defined in terms of emitter faces; so some
other kind of mesh abstraction might be usefull here.
2009-01-20 22:29:35 +00:00
Robert Bragg
3014d4ff8a Merge branch 'cogl-float'
Okey; to summarise the changes...

We have converted Clutter and Cogl over to using floating point internally
instead of 16.16 fixed, but we have maintained the cogl-fixed API as a
utility to applications in case they want to implement their own optimizations.

The Clutter API has not changed (though ClutterFixed and ClutterUnit are now
internally floats) but all Cogl entry points have been changed to accept floats
now instead of CoglFixed.

To summarise the rationale...

There have been a number of issues with using fixed point though out Clutter
and Cogl including: lack of precision, lack of range, excessive format
conversion (GPUs tend to work nativly with IEEE floats) and maintainability.
One of the main arguments for fixed point - performance - hasn't shown
itself to be serious in practice so far since we seem to be more limited
by GPU performance and making improvements regarding how we submit data to
OpenGL[ES]/the GPU has had a more significant impact.

Ref: The recent multiple rectangle queuing changes + the
cogl-texture-agressive-batching branch which show significant performance
gains, and that recent tests on the ipodtouch (ARM + MBX) also showed no
loss of performance running with floats.

So finally; please forgive the inevitable fallout, this is a far reaching
change. There are still a few known issues with the fixed to float
conversion but enough works for all our conformance tests to pass, and the
remaining issues hopefully wont be too tricky to solve. For reference two
tags will be available either side of this change: "cogl-fixed-end" and
"cogl-float-start"
2009-01-20 18:47:50 +00:00
Emmanuele Bassi
ac1a0d568e [script] Parse easing modes by name
The easing modes for a ClutterAlpha can either be parsed by using
the enumeration "nickname" (the shorthand form of the enumeration
value) or by using the common naming policy used in other
animation frameworks, like:

        easeInCubic
        easeOutElastic
        easeInOutBounce
2009-01-20 18:24:58 +00:00
Emmanuele Bassi
ec3b1a7b90 [animation] Implement new easing functions
Instead of using our own homegrown alpha functions, we should
use the easing functions also shared by other animation frameworks,
like jQuery and Tween, in the interests of code portability.

The easing functions have been defined by Robert Penner and
are divided into three categories:

        In    Out     InOut

Each category has a particular curve:

        Quadratic
        Cubic
        Quartic
        Quintic
        Sinusoidal
        Exponential
        Circular

In addition, there are "physical" curves:

        Elastic
        Back (overshooting cubic)
        Bounce (exponentially decaying parabolic)

Finally, the Linear curve is also provided as a reference.

The functions are private, and are meant to be used only
through their logical id as provided by the AnimationMode
enumeration.

The tests should be updated as well to match the new
easing functions.
2009-01-20 17:57:30 +00:00
Emmanuele Bassi
7d7372af43 [animation] Move the alpha value to floating point
The current Alpha value is an unsigned integer that can be used
implicitly as a fixed point value. This makes writing an alpha
function overshooting below and above the current range basically
impossible without complicating an already complex code, and
creating weird corner cases.

For this reason, the Alpha value should be defined as a floating
point normalized value, spanning a range between 0.0 and 1.0; in
order to allow overshooting, the valid range is extended one unit
below and one unit above, thus making it -1.0 .. 2.0.

This commit updates the various users of the ClutterAlpha API
and the tests cases.

This commit also removes all the current alpha functions exposed
in the public API.
2009-01-20 16:42:49 +00:00
Robert Bragg
a2cf7e4a19 [Automatic fixed-to-float.sh change] Applies a number fixed to float patches
To deal with all the corner cases that couldn't be scripted a number of patches
were written for the remaining 10% of the effort.

Note: again no API changes were made in Clutter, only in Cogl.
2009-01-20 16:20:54 +00:00
Robert Bragg
e82f656590 [Automatic fixed-to-float.sh change] Applies all scripted changes
This is the result of running a number of sed and perl scripts over the code to
do 90% of the work in converting from 16.16 fixed to single precision floating
point.

Note: A pristine cogl-fixed.c has been maintained as a standalone utility API
      so that applications may still take advantage of fixed point if they
      desire for certain optimisations where lower precision may be acceptable.

Note: no API changes were made in Clutter, only in Cogl.

Overview of changes:
- Within clutter/* all usage of the COGL_FIXED_ macros have been changed to use
the CLUTTER_FIXED_ macros.

- Within cogl/* all usage of the COGL_FIXED_ macros have been completly stripped
and expanded into code that works with single precision floats instead.

- Uses of cogl_fixed_* have been replaced with single precision math.h
alternatives.

- Uses of COGL_ANGLE_* and cogl_angle_* have been replaced so we use a float for
angles and math.h replacements.
2009-01-20 16:20:54 +00:00
Robert Bragg
8b39bfec7f Improves the unit test to verify more awkward scaling and some corresponding fixes
This simplifies the mucking about with the model-view matrix that was previously
done which improves its efficiency when scaling is necessary.

Notably: There should now be no performance advantage to using
ClutterCloneTexture as a special case clone actor since this method is just as
efficient.

The unit test was renamed to test-actor-clone.
2009-01-20 11:03:50 +00:00
Robert Bragg
df7480090d Implements a generic ClutterActorClone that doesn't need fbos.
Many use cases for clonning an actor don't require running a shader on the
resulting clone image and so requiring FBOs in these cases is overkill and
in-efficient as it requires kicking and synchronizing a render for each clone.

This approach basically just uses the paint function of another actor to
implement the painting for the clone actor with some fiddling of the model-
view matrix to scale according to the different allocation box sizes of
each of the actors.

A simple unit test called test-actors2 was added for testing.
2009-01-19 16:23:49 +00:00
Emmanuele Bassi
74213e0ee3 [alpha] Allow registering alpha functions
In order to unify alpha functions and animation modes in ClutterAlpha
we should be able to register alpha functions and get a logical id
for them; the logical id will then be available to be used by
clutter_alpha_set_mode().

The registration requires API changes in ClutterAlpha constructors
and methods. It also provides the chance to shift ClutterAlpha
towards the use of animations modes only, and to alpha functions
as a convenience API for language bindings alone.
2009-01-16 14:37:35 +00:00
Robert Bragg
642617b7a0 [test-text] queue redraws instead of calling clutter_actor_paint directly
Directly calling clutter_actor_paint skips out quite a bit code such as the
backend swap buffer call.

Since we are interested in the highest fps possible, and it now goes through
to the backend swap buffer call we now do a setenv (CLUTTER_VBLANK, none, 0)
before calling clutter_init.
2009-01-15 14:25:22 +00:00
Emmanuele Bassi
41386a5f72 Remove the Effects API
The Effects API and all related symbols have been superceded by
the newly added Animation API and clutter_actor_animate().

This commit removes the Effects implementation, the documentation
and the interactive test/example code.
2009-01-14 16:56:21 +00:00
Robert Bragg
3e9e5a11da [test-depth] cast width to gint when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
2009-01-14 15:25:27 +00:00
Robert Bragg
f1b15efcdc [tests] Adds a flowery clutter_cairo_texture unit test
This is simply a copy of flowers.c from the old clutter-cairo repo
2009-01-14 15:25:27 +00:00
Emmanuele Bassi
a074106ded Merge branch 'animation-improvements'
* animation-improvements:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [docs] Update the ClutterAnimation section
  [animation] Extend ClutterAnimation support to all objects
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
  [animation] Allow registering custom progress function
  [animation] Interval::compute_value should return a boolean
  Animate ClutterColor properties
2009-01-14 15:00:44 +00:00
Emmanuele Bassi
c83d955af3 Fix compilation warning
Declare the width and height variables as unsigned ints, in order
to match the required arguments for clutter_actor_get_size().
2009-01-14 14:34:35 +00:00
Robert Bragg
616c082a7c Merge commit 'origin/master' into cogl-material
Conflicts:

	clutter/clutter-texture.c
	clutter/cogl/cogl-texture.h
	clutter/cogl/gles/cogl-context.c
	clutter/cogl/gles/cogl-context.h
2009-01-13 13:37:38 +00:00
Emmanuele Bassi
e9ee7f049d Fix last improper usage of ClutterUnits
ClutterUnits should not be used interchangeably as, or with
ClutterFixed values. ClutterUnits should also not be assumed
to be integers.

This commit fixes the last few improper usages of ClutterUnit
values, and adds a CLUTTER_UNITS_FORMAT macro for safely printing
ClutterUnit values with printf().
2009-01-08 16:00:47 +00:00
Robert Bragg
e4b1859077 [test-clip] Use gint for hand_{width,height} when calulating -hand_* /2
It was a fluke that this worked out due to how the incorrect integer
result gets converted by CLUTTER_INT_TO_FIXED.
2009-01-08 11:38:31 +00:00
Robert Bragg
cc8cd8392f [test-depth] Use a gint for width, not guint, when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
2009-01-08 11:03:23 +00:00
Emmanuele Bassi
5913bcf7e3 [tests] Update the ClutterText interactive test
Remove the unused functions and if the test fails to load the
text from a file, show the error inside the text actor itself.
2009-01-07 15:54:08 +00:00
Emmanuele Bassi
c297d1ccf1 [tests] Make test-scale use ClutterText
The ClutterLabel actor has been superceded by ClutterText.

This is merge fall-out from the text-actor branch.
2009-01-07 12:17:09 +00:00
Emmanuele Bassi
796294fd4e [tests] Remove test-opacity interactive test
Merge fall-out from the text-actor branch. The test-opacity test
was moved to the conformance test suite.
2009-01-07 12:17:02 +00:00
Emmanuele Bassi
c54bd99097 Merge the ClutterText actor
Merge branch 'text-actor'

* text-actor: (108 commits)
  Re-align ClutterText header file
  [text] Fix cursor sizing
  Comments and whitespace fixes to ClutterText
  [docs] Add newly added :single-line-mode accessors
  Update the ignore file
  [tests] Add text field interactive test
  [text] Add single-line-mode to ClutterText
  [text] Fix the deletion actions
  [text] Use cached length when possible
  [tests] Add unit for the ClutterText:password-char property
  [docs] Update the Text section
  [text] Coalesce text visibility and password character
  Allow localizations to change the text direction
  Clean up the update_pango_context() function
  Pass the PangoContext, not the MainContext
  Revert the logic of the PangoContext check
  Remove the binding pool entry from the list
  Remove BindingPool::list_actions()
  Add ClutterActor::create_pango_context()
  Rename the PangoContext creation functions
  ...
2009-01-07 12:06:33 +00:00
Emmanuele Bassi
71c03df967 [tests] Add text field interactive test
The test-text-field is a test/example that shows how to use the
ClutterText as a text input field in single line mode.
2009-01-07 00:27:50 +00:00
Neil Roberts
b3b7312f33 [test-cogl-material] Remove return value from material_rectangle_paint
The paint signal has no return value so it isn't needed. This fixes
a compiler warning.
2009-01-06 16:01:23 +00:00
Emmanuele Bassi
87ab64d291 [tests] Add unit for the ClutterText:password-char property
Check that the contents of the Text actor are unaffected by the
:password-char property; that the accessors are correct; and finally
that the initial value for a newly constructed Text actor is valid.
2009-01-06 15:30:31 +00:00
Emmanuele Bassi
854cf5d499 Animate ClutterColor properties
We can animate a ClutterColor-based property between an interval
of two colors by simply applying the factor to each color component.
2009-01-06 12:53:30 +00:00
Neil Roberts
e5543a658f Make libdisable-npots a bit more portable
Instead of including GL/gl.h directly it now includes cogl/cogl.h
instead which should include the right GL header.

Instead of using dlopen to specifically open libGL it now tries to use
dlsym with RTLD_NEXT. This requires defining _GNU_SOURCE on GNU
systems. If RTLD_NEXT is not available it will try passing NULL which
is unlikely to work but it will at least catch the case where it
returns the wrapper version of glGetString to prevent infinite
recursion.

This should hopefully make it work on OS X where the name of the
header and library are different (although this is currently
untested).
2009-01-05 17:11:44 +00:00
Emmanuele Bassi
fd2d78918b Merge branch 'units-rework'
* units-rework:
  [texture] Do not mix fixed point and units values
  [tests] Fix the actor detection
  [units] Do not use fixed point and units interchangeably
2009-01-05 11:11:10 +00:00
Robert Bragg
377f114046 [cogl-material] improvements for cogl_material_rectangle
The API has been changed to take an explicit length for the number of
texture coordinates passed, and it's now documented that if there are
more layers to the current material than the number of texture coords
passed, then default coordinates will be generated for the other
layers.

cogl_material_rectangle should now handle the case where a single
sliced texture is supplied as a material layer by falling back to
cogl_texture_rectangle. We are nearly at the point that
cogl_texture_rectangle could be deprecated. A few issues remain
though, such as not considering waste in cogl_material_rectangle.
2008-12-24 01:35:33 +00:00
Robert Bragg
bb938ac4ff Merge branch 'master' into cogl-material
Conflicts:

	clutter/cogl/gl/cogl-context.c
	clutter/cogl/gl/cogl-context.h
2008-12-24 00:59:13 +00:00
Emmanuele Bassi
7649e9de07 Remove a masking with index()
The binding-pool test unit had a variable masking the index() function
declared inside string.h.
2008-12-23 21:06:05 +00:00
Robert Bragg
40b0bb4e95 Adds a CoglMaterial abstraction, which includes support for multi-texturing
My previous work to provide muti-texturing support has been extended into
a CoglMaterial abstraction that adds control over the texture combine
functions (controlling how multiple texture layers are blended together),
the gl blend function (used for blending the final primitive with the
framebuffer), the alpha function (used to discard fragments based on
their alpha channel), describing attributes such as a diffuse, ambient and
specular color (for use with the standard OpenGL lighting model), and
per layer rotations. (utilizing the new CoglMatrix utility API)

For now the only way this abstraction is exposed is via a new
cogl_material_rectangle function, that is similar to cogl_texture_rectangle
but doesn't take a texture handle (the source material is pulled from
the context), and the array of texture coordinates is extended to be able
to supply coordinates for each layer.

Note: this function doesn't support sliced textures; supporting sliced
textures is a non trivial problem, considering the ability to rotate layers.
Note: cogl_material_rectangle, has quite a few workarounds, for a number of
other limitations within Cogl a.t.m.
Note: The GLES1/2 multi-texturing support has yet to be updated to use
the material abstraction.
2008-12-22 16:35:52 +00:00
Robert Bragg
fc7a86fd0d [tests] Adds an interactive unit test for multi-texturing
This simply gives an example of blending a red o-hand logo with an alpha mask
and a changing light map.
2008-12-22 16:35:51 +00:00
Emmanuele Bassi
b021f518c1 Use "" as the default value for the :text property
This follows the convention of GtkLabel/GtkEntry in GTK+ and the old
ClutterEntry.

It makes it easier to use strlen/strcmp etc on the output, since we can
assume that it is always a string.

This commit also updates the test unit for ClutterText to verify that
the clutter_text_get_text() function also returns an empty string when
a ClutterText actor has been created.
2008-12-22 13:43:41 +00:00
Robert Bragg
c700d4c9a1 [tests] Ensures that test-viewport.c is built
test-viewport.c wasn't listed correctly in the UNIT_TESTS variable
(it was missing the .c extension, and so it wasn't being built.)
2008-12-21 14:07:35 +00:00
Robert Bragg
a40666469d [tests] Ensure that test-launcher.sh is found for out of tree builds
When building out of tree the generated scripts for the unit tests
need to explicitly reference the original src dir to be able to find
test-launcher.sh, like this:
 $(top_srcdir)/tests/conform/test-launcher.sh

Also test-launcher.sh now passes -m slow --verbose to gtester. Without
-m slow then the wrappers dont work for some of the timeline tests.
2008-12-21 14:07:22 +00:00
Emmanuele Bassi
8d98c28dfa Merge branch 'cairo-texture'
* cairo-texture:
  [cairo-texture] Remove the construct only restriction on surface size
  [cairo-texture] Silently discard 0x0 surfaces
  Re-indent ClutterPath header
  Add a test case for the new cairo path functions
  Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
  Warn instead of returning in the IN_PAINT check
  Small documentation fixes
  Print a warning when creating a cairo_t while painting
  Do not set the IN_PAINT flag inside the Stage paint
  Set the IN_PAINT private flag
  [docs] Add ClutterCairoTexture to the API reference
  Add ClutterCairoTexture
  Require Cairo as a Clutter dependency

Conflicts:

  Fix merge conflict in clutter/clutter-path.h
2008-12-19 16:44:40 +00:00
Emmanuele Bassi
f6e9a701e4 [tests] Fix the actor detection
The test-unproject interactive test assumed that only the rectangle was
on the stage. As it turns out, labels can be picked as well.
2008-12-19 13:03:53 +00:00
Neil Roberts
9cd92fc540 [test-scale] Add a label showing the gravity
A label is now displayed under the rectangle showing the current
gravity. The text for the gravity is taken from the GEnumClass. This
makes it easier to verify that the test is working correctly.
2008-12-18 17:40:36 +00:00
Emmanuele Bassi
335b650d0b [tests] Create a real file for each test unit
Currently, the conformance test suite creates symbolic links pointing
to a wrapper script that just parses the name used to invoke it and
calls the gtester with the correct path.

Unfortunately, this presents two issues:

        - it does not really work on file systems that do not
          support symbolic links
        - it leaves behind the symbolic links, which cannot
          be automatically cleaning by 'make clean'

Both can be solved by creating a small script that invokes the wrapper
one with the test unit path.

The Makefile will use test-conform to extract the unit test paths
and generate a list that will be iterated over to create the
executable name (using the "test-name" convention also used by the
interactive tests, instead of "test_name"); the executable is then
just a simple shell script that invokes the wrapper script passing
the unit test path on the command line. The wrapper script will
use the first argument to work correctly, so it could be simply
executed like:

        ./test-wrapper.sh /path/to/unit_test

Which is another improvement over the current implementation, where
the wrapper script does not work when invoked directly.
2008-12-17 14:08:08 +00:00
Neil Roberts
ff92cc9766 Convert clutter_path_get_position to take a gdouble instead of an alpha value
The gdouble value represents an interval along the path from 0.0 to
1.0. This makes more sense than using an alpha value because paths are
not directly related to ClutterAlphas and the rest of the Clutter API
tends to expose gdouble arguments.
2008-12-16 15:39:53 +00:00
Emmanuele Bassi
ba586b46b3 [tests] Make the layout cache fail at the right place
The GTest report output allows the developer to know where exactly
a test unit failure happened. The test-text-cache unit makes it
very hard to pinpoint the exact failure location because it relies
on the output to be printed out - which is not the case when the
tests are run as part of a make check.

This commit makes each sub-test inside the unit fail exactly where
the check function fails, which makes it easier to know which sub-test
did actually fail.
2008-12-16 13:58:54 +00:00
Neil Roberts
c68cf3564e [test-paint-wrapper] Use a separate paint guard for each actor
Since commit c7c5cf9b ClutterCloneTexture causes an extra paint of the
source actor during the paint run of the cloned texture if the source
is not yet visible. When the stage is first shown it is redrawn
immediatly before it is mapped which means get_paint_visibility will
fail on the source actor so the inner paint will be run. The paint
guards were a global variable so they didn't cope with a second actor
being painted.

The breakage didn't occur until commit d510a4b0 because
get_paint_visibility was also broken.
2008-12-15 16:33:45 +00:00
Neil Roberts
965ec27620 Add a test case for the new cairo path functions
The nodes of the test path have been reordered because Cairo coalesces
multiple move operations into a single move so the comparison would
fail if the two move nodes are consecutive.
2008-12-12 14:32:07 +00:00
Emmanuele Bassi
ffa37dec20 Update the micro-bench tests to ClutterText
Test the ClutterText rendering speed instead of ClutterLabel's.
2008-12-11 13:48:45 +00:00
Emmanuele Bassi
5c14044e52 Update the interactive tests to ClutterText
Instead of using ClutterLabel, use ClutterText to display some
text where needed.
2008-12-11 13:48:01 +00:00
Emmanuele Bassi
24a6163688 Do not compile the opacity and entry interactive tests
The test-opacity interactive test is superceded by the equivalent
units inside the conformance test suite.

The test-entry interactive test is superceded by the test-text one.
2008-12-11 13:45:22 +00:00
Emmanuele Bassi
edd6b65743 Update the paint opacity unit test
ClutterText behaviour with regards to the paint opacity has been
changed by commit 07e19fff5ffa9617413fa6c3715914513fec3793.

We need to update the test suite for the paint opacity to reflect
that change as well.
2008-12-11 12:26:47 +00:00
Emmanuele Bassi
06b00f9dfc Remove units for Entry and Label
ClutterText should supercede all unit tests for ClutterLabel and
ClutterEntry.
2008-12-11 12:13:26 +00:00
Emmanuele Bassi
ec4c15f8e7 Comment out the mapping API
The test-text interactive test for ClutterText should not use
the mapping API, since ClutterText does not have it anymore.
2008-12-11 12:07:20 +00:00
Emmanuele Bassi
b1c366a143 Add Text::get_chars() implementation and tests
The clutter_text_get_chars() function returns a section of the
contents of the Text actor, delimited by a start and an end position.

This commit adds the implementation for that function and a test
unit that guarantees the offset-to-bytes computations are correct.
2008-12-11 11:59:50 +00:00
Emmanuele Bassi
e93a7e243c Add comments in the test suite
Comment why we need to enable the editability of the Text actor
inside the test suite.

This should clarify commit ea508ea528d61ae478d8bc4c88f54a89304f18e8
2008-12-11 11:56:44 +00:00
Emmanuele Bassi
191d1aebff Update the ClutterText test unit
Whenever we are sending specially crafted KeyEvents to a ClutterText
we also need to set it editable, since the event handling code depends
on the editability setting.
2008-12-11 11:51:28 +00:00
Emmanuele Bassi
94789e3cc3 Add a separate test unit for ClutterText
Instead of changing the unit for ClutterEntry, we add a new
test unit specifically for ClutterText so that we can later tweak
it specifically for the behaviour changes needed to make ClutterText
work better.
2008-12-11 11:45:37 +00:00
Emmanuele Bassi
64af7bafe3 Move test-threads to ClutterText
The test-threads interactive test is a good candidate for the
switch from ClutterLabel to ClutterText to verify that the
behaviour of the two classes is the same.
2008-12-11 11:37:46 +00:00
Emmanuele Bassi
5ac16652df Update the ClutterText interactive test
Use ClutterText's own API instead of relying on the Label's API.

ClutterText is not meant to be a subclass of ClutterLabel.
2008-12-11 11:18:05 +00:00
Emmanuele Bassi
a98720ae19 Initial import of the Text actor from Tidy
The TidyText actor is meant as a replacement for both ClutterLabel
and ClutterText.

Any text-displaying and editing actor should derive from ClutterText
and implement the various visual cues to differentiate the editable
from the non-editable state. Those visual cues usually belong to
a high-level toolkit, especially if themeing is involved.
2008-12-11 11:12:48 +00:00
Emmanuele Bassi
8a537b6299 2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/Makefile.am:
	* clutter/clutter.h: Add ClutterBindingPool to the build.

	* clutter/clutter-binding-pool.c:
	* clutter/clutter-binding-pool.h: Add ClutterBindingPool, a data
	structure meant to hold (key symbol, modifiers) pairs and associate
	them to a closure. The ClutterBindingPool can be used to install
	key bindings for actors and then execute closures inside the
	key-press-event signal handlers, removing the need for big
	switch() or if() blocks for each key.

	* clutter/clutter-event.c: Consistently use "key symbol" instead
	of "key value".

	* clutter/clutter-event.h: Add more modifier masks.

	* clutter/clutter-marshal.list:

	* tests/conform/Makefile.am:
	* tests/conform/test-binding-pool.c:
	* tests/conform/test-conform-main.c: Add ClutterBindingPool
	conformance test.

	* tests/interactive/Makefile.am:
	* tests/interactive/test-binding-pool.c: Add interactive test (and
	example code) for the ClutterBindingPool usage.
2008-12-08 13:57:10 +00:00
Neil Roberts
1a63414966 Bug 1252 - Merge ClutterBehaviourPath and ClutterBehaviourBspline
* clutter/clutter-path.h:
	* clutter/clutter-path.c: Implementation of new ClutterPath object
	to represent a path combining straight line and bezier curve
	elements.

	* clutter/clutter.h: Include clutter-path.h and remove
	clutter-behaviour-bspline.h

	* tests/interactive/test-threads.c (test_threads_main):
	* tests/interactive/test-script.c:
	* tests/interactive/test-behave.c (test_behave_main): Use new path
	API

	* clutter/clutter-effect.c: Use the new ClutterBehaviourPath API.

	* clutter/clutter-bezier.h:
	* clutter/clutter-bezier.c: Moved bezier curve handling code out
	from clutter-behaviour-bspline.c to a separate file.

	* clutter/clutter-behaviour-path.h:
	* clutter/clutter-behaviour-path.c: Reimplemented to work with a
	ClutterPath

	* clutter/clutter-behaviour-bspline.h:
	* clutter/clutter-behaviour-bspline.c: Removed

	* clutter/Makefile.am: Add clutter-path and clutter-bezier, remove
	clutter-behaviour-bspline.

	* tests/conform/test-path.c: New automatic test for ClutterPath
	consistency

	* tests/conform/test-conform-main.c (main): Add test_path

	* tests/conform/Makefile.am (test_conformance_SOURCES): Add
	test-path.c

	* clutter/clutter-sections.txt: Add ClutterPath docs

	* clutter/clutter.types:
	* clutter/clutter-docs.xml:
	* doc/reference/clutter/clutter-animation-tutorial.xml: Remove
	mention of ClutterBehaviourBspline

	* clutter/clutter-marshal.list: Add VOID:UINT
2008-12-05 13:13:37 +00:00
Neil Roberts
89e7552ca3 Bug 1172 - Disjoint paths and clip to path
* clutter/cogl/cogl-path.h:
	* clutter/cogl/common/cogl-primitives.c:
	* clutter/cogl/common/cogl-primitives.h:
	* clutter/cogl/gl/cogl-primitives.c:
	* clutter/cogl/gles/cogl-primitives.c: Changed the semantics of
	cogl_path_move_to. Previously this always started a new path but
	now it instead starts a new disjoint sub path. The path isn't
	cleared until you call either cogl_path_stroke, cogl_path_fill or
	cogl_path_new. There are also cogl_path_stroke_preserve and
	cogl_path_fill_preserve functions.

	* clutter/cogl/gl/cogl-context.c:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gles/cogl-context.c:
	* clutter/cogl/gles/cogl-context.h: Convert the path nodes array
	to a GArray.

	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure

	* clutter/cogl/common/cogl-clip-stack.c:
	* clutter/cogl/common/cogl-clip-stack.h: Simplified the clip
	stack code quite a bit to make it more maintainable.  Previously
	whenever you added a new clip it would go through a separate route
	to immediately intersect with the current clip and when you
	removed it again it would immediately rebuild the entire clip. Now
	when you add or remove a clip it doesn't do anything immediately
	but just sets a dirty flag instead.

	* clutter/cogl/gl/cogl.c:
	* clutter/cogl/gles/cogl.c: Taken away the code to intersect
	stencil clips when there is exactly one stencil bit. It won't work
	with path clips and I don't know of any platform that doesn't have
	eight or zero stencil bits. It needs at least three bits to
	intersect a path with an existing clip. cogl_features_init now
	just decides you don't have a stencil buffer at all if you have
	less than three bits.

	* clutter/cogl/cogl.h.in: New functions and documentation.

	* tests/interactive/test-clip.c: Replaced with a different test
	that lets you add and remove clips. The three different mouse
	buttons add clips in different shapes. This makes it easier to
	test multiple levels of clipping.

	* tests/interactive/test-cogl-primitives.c: Use
	cogl_path_stroke_preserve when using the same path again.

	* doc/reference/cogl/cogl-sections.txt: Document the new
	functions.
2008-12-04 13:45:09 +00:00
Neil Roberts
f052335bb4 * tests/conform/test-backface-culling.c (TEXTURE_SIZE): Don't set
to a funny size on GLES because it will break cogl_texture_polygon
2008-11-28 17:45:54 +00:00
Neil Roberts
72f2fc22ad * tests/conform/test-backface-culling.c: New test for backface
culling

	* tests/conform/test-conform-main.c (main): Add
	/texture/test_backface_culing

	* tests/conform/Makefile.am (test_conformance_SOURCES): Add
	test-backface-culling.c
2008-11-28 17:36:37 +00:00
Neil Roberts
1cbafc99d6 * tests/conform/test-mesh-mutability.c:
* tests/conform/test-mesh-interleved.c:
	* tests/conform/test-mesh-contiguous.c: Remove the idle source
	after the test is complete so that it won't interfere with other
	tests.
2008-11-28 16:25:20 +00:00
Neil Roberts
596d4628e6 Add a wrapper library to help testing without NPOTs.
* tests/tools/Makefile.am: Optionally build the
	libdisable-npots.la library depending on whether libdl was
	detected in the configure script. A helper script is also
	generated to setup the LD_PRELOAD.

	* tests/conform/Makefile.am: There are now two versions of the
	test-report and full-report rules. test-report-normal is the same
	as before and test-report-disable-npots runs the tests with the
	disable-npots wrapper script. The full-report rule runs both of
	them and displays two separate HTML files. The test-report rule
	just runs the normal version as before.

	* configure.ac: Add a test for libdl

	* tests/tools/disable-npots.sh.in: New file. Template for the
	helper script

	* tests/tools/disable-npots.c: New file
2008-11-24 15:44:16 +00:00
Neil Roberts
fccc087959 * tests/interactive/Makefile.am:
* tests/conform/Makefile.am: Use $(EXEEXT) when specifying a
	dependency on an executable otherwise there won't be a rule to
	build it on Windows.
2008-11-21 16:18:47 +00:00
Emmanuele Bassi
47150304cd 2008-11-20 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-actor.c:
	(clutter_actor_set_property): Add sanity checks for NULL
	boxed values when setting the rotation center.

	* tests/interactive/test-animation.c:
	(on_button_press): Add an example on how to use the rotation
	properties to animate an actor.
2008-11-20 10:52:09 +00:00
Neil Roberts
eeab42b765 Fixed some trivial compiler warnings
* tests/interactive/test-pixmap.c (create_pixmap): Use a format
	string instead of passing the error message directly to g_error.

	* tests/interactive/test-easing.c (test_easing_main)
	(on_button_press):
	* tests/interactive/test-animation.c (on_button_press): Use
	unsigned variables for the results from clutter_actor_get_size
	otherwise it complains about the pointer signedness being
	different.

	* clutter/clutter-script.c (clutter_script_add_search_paths): Use
	G_GSIZE_FORMAT instead of %d for a gsize parameter otherwise it
	gets upset on 64-bit.
2008-11-18 18:53:10 +00:00
Neil Roberts
7324db4a0c * tests/conform/test-timeline.c (test_timeline): Remove the delay
idle handler after the test is finished, otherwise it will
	continue running during subsequent tests. This was breaking
	test_timeline_interpolate.
2008-11-18 18:30:55 +00:00
Emmanuele Bassi
af0cb47570 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1049 - Clutter doesn't support most GLSL uniforms (patch
	by Chris Lord and Neil Roberts)

	* README: Update release notes.

	* clutter/Makefile.am:
	* clutter/clutter-shader-types.[ch]: Add GValue types for
	shader values.

	* clutter/clutter-actor.[ch]: Update the shader API to use
	the newly added GValue support for GLSL shader uniform
	setters.

	* clutter/clutter-shader.[ch]: Add float and integer convenience
	API for single value GLSL uniform setters.

	* clutter/cogl/cogl-shader.h: Add new uniform setters.

	* clutter/cogl/gl/cogl-context.c:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gl/cogl-defines.h.in:
	* clutter/cogl/gl/cogl-program.c:
	* clutter/cogl/gl/cogl.c: Update the GL implementation of COGL
	to handle the GLSL uniform setters.

	* clutter/cogl/gles/cogl-gles2-wrapper.c:
	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	* clutter/cogl/gles/cogl-internal.h:
	* clutter/cogl/gles/cogl-program.c: Update the GLES 2.0 implementation
	of COGL to handle the GLSL uniform setters.

	* doc/reference/clutter/clutter-sections.txt:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/interactive/test-fbo.c:
	* tests/interactive/test-shader.c: Update the shader tests.
2008-11-18 15:08:40 +00:00
Emmanuele Bassi
ab9464b33d 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
* tests/conform/test-conform-main.c (main): Do not run the
	conformance test suite if we are on X11 but we do not have
	a DISPLAY available. Some of the tests require a DISPLAY,
	and everything passes through a clutter_init() call which will
	fail anyway. If we are running make distcheck on an headless
	box we might as well just skip the conformance test suite
	without a meaningless error.
2008-11-18 13:06:02 +00:00
Emmanuele Bassi
7a6353b971 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
* tests/conform/test-mesh-contiguous.c:
	* tests/conform/test-mesh-interleved.c:
	* tests/conform/test-mesh-mutability.c: Remove the last bare
	g_print() from the conformance test suite.
2008-11-18 12:54:34 +00:00
Emmanuele Bassi
34cc7fe21c 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-alpha.h:
	* clutter/clutter-alpha.c:
	(clutter_alpha_set_mode): Use a lookup table to find the alpha
	function given the animation mode.

	(clutter_exp_in_func),
	(clutter_exp_out_func),
	(clutter_exp_in_out_func): Add new exponential functions.

	* clutter/clutter-script.c: Update the lookup table with the
	new animation modes; match "linear" to the ramp-inc alpha
	function.

	* clutter/clutter-types.h: Add new AnimationMode values.

	* tests/interactive/test-easing.c: Update the easing functions
	test.
2008-11-18 12:42:05 +00:00
Neil Roberts
33a67bc299 * tests/conform/test-pick.c (test_pick): The final result message
when --verbose is used was the wrong way around
2008-11-18 12:36:27 +00:00
Neil Roberts
56fa77a5db * tests/conform/test-conform-main.c (main): Fixed a typo in the
name of the path for test_realized.
2008-11-18 12:16:00 +00:00
Emmanuele Bassi
62844d5f04 2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements

	* clutter/Makefile.am:
	* clutter/clutter.h: Update the build

	* clutter/clutter-types.h: Add AnimationMode, an enumeration
	for easing functions.

	* clutter/clutter-alpha.[ch]: Add the :mode property to
	control the function bound to an Alpha instance using an
	enumeration value. Also add six new alpha functions:

		- ease-in, ease-out, ease-in-out
		- sine-in, sine-out, sine-in-out

	* clutter/clutter-deprecated.h: Deprecate the #defines for
	the alpha functions. They will be replaced by entries in the
	ClutterAnimationMode.

	* clutter/clutter-interval.[ch]: Add ClutterInterval, an
	object for defining, validating and computing an interval
	between two values.

	* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
	object responsible for animation the properties of a single
	actor along an interval of values. ClutterAnimation memory
	management is automatic. A simple wrapper method for
	ClutterActor is provided:

		clutter_actor_animate()

	which will create, or update, an animation for the passed
	actor.

	* clutter/clutter-debug.h:
	* clutter/clutter-main.c: Add a new 'animation' debug note.

	* clutter/clutter-script.c: Clean up the alpha functions
	whitelist, and add the new functions.

	* doc/reference/clutter/Makefile.am:
	* doc/reference/clutter/clutter-sections.txt: Update the
	API reference.

	* doc/reference/clutter/clutter-animation.xml: Renamed to
	doc/reference/clutter/clutter-animation-tutorial.xml to
	avoid clashes with the ClutterAnimation section.

	* doc/reference/clutter/clutter-docs.sgml: Renamed to
	doc/reference/clutter/clutter-docs.xml, as it was an XML
	file and not a SGML file.

	* tests/Makefile.am:
	* tests/interactive/Makefile.am:
	* tests/interactive/test-animation.c:
	* tests/interactive/test-easing.c: Add two tests for the
	new simple animation API and the easing functions.

	* tests/interactive/test-actors.c:
	* tests/interactive/test-behave.c:
	* tests/interactive/test-depth.c:
	* tests/interactive/test-effects.c:
	* tests/interactive/test-layout.c:
	* tests/interactive/test-multistage.c:
	* tests/interactive/test-paint-wrapper.c:
	* tests/interactive/test-rotate.c:
	* tests/interactive/test-scale.c:
	* tests/interactive/test-texture-quality.c:
	* tests/interactive/test-threads.c:
	* tests/interactive/test-viewport.c: Update interactive tests
	to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
Robert Bragg
3e6993ad43 * tests/interactive/Makefile.am
* tests/interactive/test-pixmap.c:
	test-pixmap + test-devices accidentally got dropped from the makefiles
	when changing the unit test layout; this puts them back.
2008-11-15 15:03:09 +00:00
Emmanuele Bassi
99b173eee7 2008-11-14 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1265 - ClutterScore doesn't emit 'started' signal (Bastian
	Winkler)

	* clutter/clutter-score.c: Emit the ::started signal.

	* tests/interactive/test-score.c: Check the emission of the
	Score signals.
2008-11-14 14:52:35 +00:00
Robert Bragg
3d2a1e2d81 Gets the mesh API working with GLES2
* clutter/cogl/common/cogl-mesh.c:
	Make sure we use the appropriate cogl_wrap_gl* funcs as appropriate

	* clutter/cogl/gles/cogl-gles2-wrapper.c
	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	In our glColorPointer wrapper we needed to mark our color attribute
	as normalized.

	* tests/conform/Makefile.am:
	When creating unit test symlinks we use the -l gtester option to
	list tests, but when using the PVR SDK the test binary also spews
	out some extra info that caused lots of random symlinks to be
	created. We now grep for lines starting with a '/'

	* tests/conform/test-mesh-contiguous.c
	* tests/conform/test-mesh-mutability.c:
	Use cogl_set_source_color instead of directly calling glColor4ub
2008-11-13 14:28:16 +00:00