Commit Graph

1766 Commits

Author SHA1 Message Date
Robert Bragg
af0726480c [cogl-matrix] Documents that CoglMatrix members should be considered read only
In the future if we want to annotate matrices with internal flags, and add
caching of the inverse matrix then we need to ensure that all matrix
modifications are done by cogl_matrix API so we'd know when to dirty the
cache or update the flags.

This just adds documentation to that effect, and assuming the most likley
case where someone would try and directly write to matrix members would
probably be to load a constant matrix other than the identity matrix; I
renamed cogl_matrix_init_from_gl_matrix to cogl_matrix_init_from_array to
make it seem more general purpose.
2009-02-26 16:42:32 +00:00
Robert Bragg
0a218a64e2 [cogl-matrix] Adds padding to CoglMatrix
This adds enough padding to allow us to potentially add a cache of the inverse
matrix in the future and private flags to annotate matrices.
2009-02-26 16:42:32 +00:00
Emmanuele Bassi
b39223d8cb [backend] Constify font options
The font options accessors in ClutterBackend only deal with const
cairo_font_options_t values, since:

  - set_font_options() will copy the font options
  - get_font_options() will return a pointer to the internal
    font options

Not using const in these cases makes the API confusing and might lead
to erroneous calls to cairo_font_options_destroy().
2009-02-26 15:32:48 +00:00
Emmanuele Bassi
8354295986 Intern the ClutterScriptable type name
Like we do for other types, use the I_() macro to intern the
type name during the GType registration for ClutterScriptable.
2009-02-26 14:57:58 +00:00
Bastian Winkler
28a3cbf38e Remove redundant declaration in clutter-text.h
clutter-text.h declares clutter_text_get_layout twice.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-26 12:49:50 +00:00
Emmanuele Bassi
0fc9452b03 [build] Do not shave typelib generation
Bug 1478 - typelib creation shaved out of existence

Add a 'GEN' output rule for the typelib files created when
introspection is enabled.
2009-02-26 12:46:36 +00:00
Owen W. Taylor
402e2e0d82 Fix x/y confusion for GL_TEXTURE_RECTANGLE_ARB
When "denormalizing" for texture rectangles, multiple X coordinates
by the X size and Y coordinates by the Y size.

http://bugzilla.openedhand.com/show_bug.cgi?id=1479
2009-02-26 11:27:21 +00:00
Neil Roberts
ce83007c1d [cogl-pango-glyph-cache] Fix compiler warning on 64-bit
gcc warns about casting a pointer to a guint because it is a different
size on 64-bit machines. However the pointer is only used as a hash so
it doesn't matter if we lose the most significant bits. The patch
makes it use GPOINTER_TO_UINT instead which first casts it to a gulong
and avoids the warning.
2009-02-26 10:56:42 +00:00
Neil Roberts
1626d6132e [clutter-texture] Use a GThreadPool for loading async textures
Instead of creating a separate thread for each texture load, the loads
are now queued in a thread pool which will use at most 3 textures at a
time. This avoids the potentially large overhead of creating and
destroying a thread for every image while still avoiding throttling
the CPU if a large number of textures are loaded at the same time.

If the load is cancelled the old code needed to join the thread which
effectively meant it had to wait for the load to finish. With this
model the threads are owned by the thread pool so there is no need to
wait for them to finish. Instead, each thread is given its own thread
data which we can use to mark the thread as aborted. Once the load is
finished the thread will check whether it is aborted before setting
the texture data. That way the ClutterTexture can just disown threads
that it needs to cancel.
2009-02-25 17:52:14 +00:00
Emmanuele Bassi
bff6ce414a [media] Add sub-second resolution for the duration
The duration in ClutterMedia is currently expressed in integer multiples
of a second. This does not offer enough granularity for media playback
that has fractionary durations -- 2.3 seconds; 1 minute, 23.4 seconds;
1 hour, 23 minutes, 4.5 seconds; etc.

The duration value should be expressed in seconds with a sub-second
granularity; for this reason, a double should be used insted of an
unsigned integer.

The semantics haven't changed: the :duration property still exposes
seconds.
2009-02-24 16:22:02 +00:00
Bastian Winkler
dd3c760cc5 [media] Fix the interface cast macro
Bug 1474 - ClutterMedia interface

The GET_INTERFACE() macro is still using the old type name of
the ClutterMedia interface structure in the cast.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-24 16:00:18 +00:00
Jonathan Matthew
eaf202c886 Declare the EnumValues for PixelFormat static
Bug 1473 - CoglPixelFormat enum data must be declared static

When registering an enumeration GType, the GEnumValue or GFlagsValue
arrays must be declared static; otherwise, you get a segmentation
fault when calling the function again.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-24 09:29:08 +00:00
Emmanuele Bassi
3409a941a4 Use a dynamic array for the actors when delivering events
Instead of using a fixed size array for storing the scenegraph sub-node
during event delivery we should use a GPtrArray. The benefits are:

  - a smaller allocation
  - no undocumented yet binding constraint on the scenegraph size
2009-02-24 09:29:08 +00:00
Emmanuele Bassi
64db7896db Remove stray fixed point macro usage
The CoglPango renderer is using a CLUTTER_FIXED macro, but the
whole code has been Clutter-free for a while, now.
2009-02-24 09:29:07 +00:00
Emmanuele Bassi
7d181636ed Make fuzzy picking a command line switch
The CLUTTER_FUZZY_PICK environment variable is the last one used
by Clutter without a corresponding command line switch.
2009-02-23 13:17:06 +00:00
Emmanuele Bassi
42fa1e035b Make disable text mipmapping a command line switch
The environment variable to disable mipmapping should also be
a command line switch, and be handled like the rest of Clutter's
environment variables/command line switches.
2009-02-23 13:08:59 +00:00
Emmanuele Bassi
a1f0b25d14 [actor] Remove usage of ClutterFixed
The ClutterFixed type and symbols are now equivalent to the native
float type. In order to remove ambiguity and clean up the code, any
usage of ClutterFixed and relative macros has been removed.
2009-02-23 13:00:52 +00:00
Emmanuele Bassi
605dfb8fd0 Add runtime debug messages for COGL
Clutter is able to show debug messages written using the CLUTTER_NOTE()
macro at runtime, either by using an environment variable:

  CLUTTER_DEBUG=...

or by using a command line switch:

  --clutter-debug=...
  --clutter-no-debug=...

Both are parsed during the initialization process by using the
GOption API.

COGL would benefit from having the same support.

In order to do this, we need a cogl_get_option_group() function in
COGL that sets up a GOptionGroup for COGL and adds a pre-parse hook
that will check the COGL_DEBUG environment variable. The OptionGroup
will also install two command line switches:

  --cogl-debug
  --cogl-no-debug

With the same semantics of the Clutter ones.

During Clutter initialization, the COGL option group will be attached
to the GOptionContext used to parse the command line options passed
to a Clutter application.

Every debug message written using:

  COGL_NOTE (SECTION, "message format", arguments);

Will then be printed only if SECTION was enabled at runtime.

This whole machinery, like the equivalent one in Clutter, depends on
a compile time switch, COGL_ENABLE_DEBUG, which is enabled at the same
time as CLUTTER_ENABLE_DEBUG. Having two different symbols allows
greater granularity.
2009-02-23 13:00:52 +00:00
Neil Roberts
a4c8e78477 Add an environment variable to disable mipmapped text
Mipmapped text is enabled by default in Clutter but it can cause
problems on some drivers so it is convenient to have an environment
variable to disable it for all apps.
2009-02-23 11:36:03 +00:00
Robert Bragg
8d04fbb05e [Cogl] Remove a debugging assert that was triggering on false positives
An assert to verify there was no error when generating a buffer object
for the vertex buffer API was being hit when running the GLES1 conformance
tests.
2009-02-23 10:49:35 +00:00
Robert Bragg
5e956a88b8 [cogl-material] Always glBindTexture when flushing material state
Bug #1457 - Creating a new texture messes up the cogl material state
            cache; reported by Neil Roberts

We still don't have caching of bound texture state so we always have to
re-bind the texture when flushing the GL state of any material layers.
2009-02-23 10:49:35 +00:00
Robert Bragg
d13b9de2e2 [Cogl] Fixes automatic handling of the GL blend enable state.
Bug #1460 - Handling of flags in cogl_material_set_color

Cogl automatically enables/disables blending based on whether the source color
has an alhpa < 1.0, or if any textures with an alpha component are in use, but
it wasn't doing it quite right.

At the same time I removed some of the dirty flags which on second thought
are nothing more than micro-optimsations that only helped clutter the code.

thanks to Owen Taylor for reporting the bug
2009-02-23 10:49:35 +00:00
Robert Bragg
34e53736ed [Cogl] the cogl_get_*_matrix functions now work with CoglMatrix types
Since the CoglMatrix type was added for supporting texture matrices recently
it made sense to be consistent accross the Cogl API and use the Cogl type
over the GL style GLfloat m[16] arrays.
2009-02-23 10:49:35 +00:00
Emmanuele Bassi
82f83ffbfb [build] Move all the compiler flags to AM_CFLAGS
The INCLUDES directive should only contain pre-processor flags, since
we're passing it also to the introspection scanner.

Using AM_CFLAGS for compiler flags, like debug flags and maintainer
flags, is more indicated.
2009-02-21 13:44:14 +00:00
Emmanuele Bassi
f4df307ddd [backend] Update the viewport when updating the GL context
Bug 1442 - multistage, same-window resize events invalidate stage

When ensuring that the GL context is attached to the correct
ClutterStage we need to set the SYNC_MATRICES flag on the stage
itself. This is needed in case the size of the new stage does
not match the size of the old -- thus requiring a call to
glViewport() when the paint cycle starts.
2009-02-20 16:40:57 +00:00
Neil Roberts
fa996734cf [cogl-gles2-wrapper] Actually call glActiveTexture
cogl_wrap_glActiveTexture needs to call the GL version of
glActiveTexture otherwise the subsequent calls to glBindTexture will
all be using texture unit 0. This fixes test-cogl-multitexture.
2009-02-20 16:37:20 +00:00
Neil Roberts
b0df99fbad [cogl-gles2-wrapper] Convert texture unit settings to be a static sized array
Previously the texture unit settings were stored in growable GArrays
and every time a new texture unit was encountered it would expand the
arrays. However the array wasn't copied when stored in a
CoglGles2WrapperSettings struct so all settings had the same
array. This meant that it wouldn't detect that a different program is
needed if a texture unit is disabled or enabled.

The texture unit settings arrays are all now a fixed size and the
enabledness of each unit is stored in a bit mask. Therefore the
settings can just be copied around by assignment as before.

This puts a limit on the number of texture units accessible by Cogl
but I think it is worth it to make the code simpler and more
efficient. The material API already poses a limit on the number of
texture units it can use.
2009-02-20 15:59:13 +00:00
Emmanuele Bassi
21aa09748c Add build machinery for gobject-introspection data
configure.ac: Check for gobject-introspection

build/introspection.m4: Include the file that defines the
GOBJECT_CHECK_INTROSPECTION m4 macro in case we want to disable
the introspection data generation.

clutter/json/Makefile.am: Build the .gir for "ClutterJson"
  (json-glib as part of the Clutter library)

clutter/Makefile.am: Build the .gir for clutter, compile the
  Clutter and ClutterJson girs into typelibs, and install them.
  Also move GCC_FLAGS from $(INCLUDES) to $(AM_CFLAGS) since it includes
  non-preprocessor flag like -Wall.

See also:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1450

Based on a patch by: Owen W. Taylor <otaylor@fishsoup.net>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-20 14:39:51 +00:00
Owen W. Taylor
c5afd98416 Add gobject-introspection annotations
Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.

The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".

http://bugzilla.openedhand.com/show_bug.cgi?id=1452

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-20 12:09:07 +00:00
Emmanuele Bassi
3bfbcedec8 Do not use GL types in Clutter headers
Bug 1451 - clutter_value_get_shader_matrix() return value

The return value of the get_shader_matrix() function should be
gfloat, not GLfloat.
2009-02-20 11:47:14 +00:00
Emmanuele Bassi
1816106047 [timeline] Set the n_markers out paramater
Bug 1464 - clutter_timeline_list_markers should set n_markers=0 when
           there are no markers

If no markers are registered and we bail out we should also set the
n_markers out parameter to 0 so that code checking the number of
markers will still work.
2009-02-20 11:47:14 +00:00
Emmanuele Bassi
effbbe2e1e [path] Do not accept NULL descriptions
Bug 1465 - clutter_path_parse_description should check p==NULL

When accepting a stringified path description, ClutterPath methods
and the parser should not accept NULL or empty strings.
2009-02-20 11:47:14 +00:00
Emmanuele Bassi
96317854c8 [behaviour] Do not notify empty behaviours
If a behaviour does not have actors associated to it then it should
not invoke the ::alpha_notify() implementation.
2009-02-20 11:47:13 +00:00
Neil Roberts
97431b4670 Replaced ClutterFixed constants in color_{darken,lighten} with float
Bug 1463 - clutter_color_lighten(darken) unexpected because of
           ClutterFixed=>float

These two functions contained ClutterFixed constants represented as
integers which are no longer valid since the cogl-float branch
merge. They are now converted to ClutterFixed from float constants
using CLUTTER_FLOAT_TO_FIXED (which is now a no-op).

Thanks to Zhang Wei for reporting.
2009-02-20 11:07:23 +00:00
Emmanuele Bassi
5123608e22 [build] Reference the headers with their full path
Do not assume locality of the files, but use their whole path.
2009-02-19 17:22:21 +00:00
Øyvind Kolås
84ecb5081f Bail early in clutter_texture_paint if opacity == 0
This causes clutter to skip all the GL work of state changes and
texturing if the opacity was 0. This is done in ClutterTexture and not
ClutterActor to ensure that pre and post paint signals work correctly.
Other expensive actors should be doing the same thing.
2009-02-19 15:44:16 +00:00
Emmanuele Bassi
3009d029ba Remove type functions for removed types
The CoglHandle wrapper GTypes have been removed in commit a0800b44
so we can safely remove the declarations.
2009-02-19 15:00:23 +00:00
Emmanuele Bassi
cf48935cf5 [build] Pass the -s switch to cmp
The call to "cmp" to compare a built file with its current version
should use the -s (silent) command line switch. This avoids a ugly
message on the console when building Clutter the first time.
2009-02-19 14:57:43 +00:00
Emmanuele Bassi
4aecece48d [docs] Add a missing "return" annotation
The documentation for the get_anchor_point_gravity() method is
missing the "Return value:" section.
2009-02-19 14:56:07 +00:00
Emmanuele Bassi
9bdbe8a06a Merge branch 'build-enhancements'
* build-enhancements:
  [build] Fix dist for the newly introduced m4 macro directory
  [build] Fix interaction between shave, gtk-doc and libtool 1.x
  [build] Add dolt
  [build] Beautify autotools' output
  [gitignore] update gitignore files for tests/
2009-02-19 14:42:40 +00:00
Emmanuele Bassi
c18e756267 [docs] Clarify the set_cogl_texture() documentation
When setting the COGL texture handle for a ClutterTexture the
texture will be set as the first layer of the material used
by the ClutterTexture. The documentation should clarify this
point.
2009-02-19 13:44:29 +00:00
Emmanuele Bassi
a0800b44ad [texture] Use COGL_TYPE_HANDLE for the handle properties
The :texture and :material properties of ClutterTexture use a
Clutter-provided GType shielding from CoglHandle. Since CoglHandle
now has a GType we can use COGL_TYPE_HANDLE instead.

This commit also removes the conditional compilation of the
:material property, as it makes little sense now that the
Materials API has landed.
2009-02-19 12:05:20 +00:00
Emmanuele Bassi
3c073d82c7 [cogl] Provide GTypes for COGL types
COGL types should be registered inside the GType system, for
bindings and type checking inside properties and signals.

CoglHandle is a boxed type with a ref+unref semantics; slightly evil
from a bindings perspective (we cannot associate custom data to it),
but better than nothing.

The rest of the exposed types are enumerations or bitmasks.
2009-02-19 12:02:42 +00:00
Emmanuele Bassi
63ae25972e [cogl] Add cogl_is_material to cogl-material.h
The COGL_DEFINE_HANDLE macro generates a cogl_is_<type> function
as well, to check whether a CoglHandle opaque pointer is of type
<type>.

The handle for CoglMaterial does not export cogl_is_material() in
its installed header.
2009-02-19 11:55:54 +00:00
Emmanuele Bassi
5bdcfd288c Initialize a variable to avoid warnings
The gl_mode variable was not initialized, and the compiler complained
when using the anal-retentive compiler flags.
2009-02-18 18:45:58 +00:00
Neil Roberts
a86b9834d3 [ClutterBehaviourRotate] Fix up some breakage from the cogl-float branch merge
The rotation angle calculated in clutter_behaviour_rotate_alpha_notify
gets applied to each actor using clutter_behaviour_actors_foreach. The
angle is a ClutterFixed value. Before the cogl float branch merge it
was stuffed into a gpointer using GPOINTER_TO_UINT. The pointer was
then converted back to a uint and cast to a ClutterFixed which worked
out fine even for negative numbers.

After the cogl-float merge the angle is effectively a gfloat. This
gets cast to a uint and stored in a pointer and converted back to a
float via a uint at the other end. However this fails for negative
numbers because a uint -> float conversion can't take advantage of
overflow to preserve the sign so you end up with a large number.

It also had the side effect that it only rotated in whole degrees.

This commit fixes the problem by just passing the ClutterFixed value
inside a closure struct instead of trying to stuff it into a pointer.
2009-02-18 18:30:58 +00:00
Damien Lespiau
8eec75efde [build] Beautify autotools' output
Use shave (http://git.lespiau.name/cgit/shave) to make compilation more
human friendly.
2009-02-18 17:38:34 +00:00
Neil Roberts
deed85035f Allow rotation angle properties to be negative
Bug 1167 - clutter_effect_rotate improperly clamps negative angles

The rotation angle properties had a minimum value of 0.0 but the
rotation works fine with a negative value so the limitation is
unnecessary. This makes rotation using the ClutterAnimation API more
flexible because it was previously not possible to rotate
counter-clockwise from the 0.0 position.
2009-02-18 17:32:23 +00:00
Neil Roberts
99248fa90f Override the opacity when painting a clone instead of combining
When rendering a clone before this commit the clone's opacity was
combined with the opacity of the source but this is not usually the
desired effect. Instead the clone's opacity (combined with its
parents) should completely override the opacity of the source.
2009-02-18 17:01:12 +00:00
Tomas Frydrych
c0672b6683 [x11] Only update cached last event time if we have a real timestamp.
Ignore the timestamp if it is set to CurrentTime (e.g., when the last event
did not carry a timestamp).
2009-02-18 16:56:39 +00:00
Robert Bragg
d2fe1fda31 [cogl-color.c] #include fix for the cogl_set_source_color prototype
cogl.h wasn't being included so we got a compiler warning
2009-02-18 16:19:14 +00:00
Robert Bragg
03018f0c2a [Cogl] Renames cogl_paint_init to cogl_clear and adds a cogl_disable_fog function
cogl_paint_init was a bit too miscellaneous; it mainly cleared the color, depth
and stencil buffers but arbitrarily it also disabled fogging and lighting.

It no longer disables lighting, since we know Cogl never enables lighting and
disabling of fog is now handled with a seperate function.

Since I noticed cogl_set_fog was taking a density argument documented as
"Ignored" I've also added a mode argument to cogl_set_fog which exposes the
exponential fog modes which can make use of the density.
2009-02-18 16:00:52 +00:00
Robert Bragg
2b5a72dde5 [Cogl] cogl_clip_{set*,unset} renamed to cogl_clip_{push*,pop}
This is so they self document the stacking semantics of the cogl clip API
2009-02-18 16:00:51 +00:00
Øyvind Kolås
57ffcdf014 Added a mutex for clutter asynchronous textures threads.
Bug #1453 - Asynchronous texture loading can starve cpu.

Add a mutex that is held in the loader threads during the image
decoding. We were spawning and starting a thread for each asynchronously
loaded texture. This can cause cpu / memory starvation when many pixbuf
loaders allocate their temporary memory at the same time.

Also added -fno-strict-aliasing to MAINTAINER_CFLAGS in configure.ac
to avoid incorrect warnings caused by the static mutex code.
2009-02-18 10:35:45 +00:00
Emmanuele Bassi
2fe0228f92 [x11] Add backend-specific get_current_event_time()
The clutter_get_current_event_time() function will return the event
timestamp coming from a Clutter event. Clutter might synthesize or
throttle events, so the function cannot be used when dealing with
backend-specific use cases.

The X11 backend is the only backend supported by Clutter that makes
use of timestamps, so it's altogether fitting that it should come
with a specific function to deal with the timestamps of the X events.
2009-02-18 10:07:12 +00:00
Neil Roberts
747233a8ac [clutter-main] Fix the input device passed to set_motion_last_actor
In generate_enter_leave_events it passes the device pointer from the
event to set_motion_last_actor but it was reading it directly from
event->motion.device. However the function is also used to process
button events so it would read from the wrong location in this case.

The device location in the union happened to be in the same place as
the click_count field of ClutterButtonEvent so it only mattered if the
click_count is non-zero. The X11 backend doesn't set this but
Clutter-GTK does so it was causing a crash.
2009-02-16 16:36:46 +00:00
Neil Roberts
1fcddb3b10 [win32] Track mouse leave messages
Bug 1178 - No enter / leave events on actors when pointer leaves the
           stage window

This patch causes the Win32 backend to emit CLUTTER_LEAVE events when
a WM_MOUSELEAVE event is received in the same way that f505536 does
for the X11 backend.

Windows will only send WM_MOUSELEAVE events if they are previously
requested using TrackMouseEvent so this needs to be called whenever
the mouse enters the window. There is no WM_MOUSELEAVE event but we
can detect when the mouse enters because we get a WM_MOUSEMOVE event.
2009-02-16 12:46:37 +00:00
Neil Roberts
9e10dc402f Call glActiveTexture and glClientActiveTexture through cogl_get_proc_address
All GL functions that are defined in a version later than 1.1 need to
be called through cogl_get_proc_address because the Windows GL DLL
does not export them to directly link against.
2009-02-16 12:46:36 +00:00
Neil Roberts
5d6a11e1bf Emit CLUTTER_LEAVE events when the pointer leaves the stage
Bug 1178 - No enter / leave events on actors when pointer leaves the
           stage window

The patch is mostly thanks to Johan Bilien with small modifications
based on suggestions by Owen Taylor.

The X11 backend now listens for enter and leave notifications. Leave
notifications get translated directly to a CLUTTER_LEAVE
event. Clutter can detect these special events because the source
actor is NULL in which case it sets the source actor to the last known
actor and then sets the last known actor to NULL.

Enter notifications just get translated to CLUTTER_MOTION events which
will cause Clutter to generate an enter event through the usual code
path.
2009-02-16 12:46:36 +00:00
Emmanuele Bassi
0c7e4172ab [animation] Do not bind construct-only properties
ClutterAnimation should not try to bind construct-only properties,
since it only manipulates existing instances.
2009-02-16 11:02:20 +00:00
Emmanuele Bassi
8f59f25beb [actor] Revert part of commit 402e022c
An unintended chunk of commit 402e022c got committed before I looked
at the diff.
2009-02-14 13:11:13 +00:00
Christian Persch
839d1e00b1 Bug 1429 - Redundant declaration in clutter-x11.h
clutter-x11.h declares clutter_x11_set_display twice, which means code using
clutter doesn't compile cleanly with -Wredundant-decls.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-14 12:55:20 +00:00
Shane Bryan
46ce2ee737 Bug 1434 - _NET_WM_NAME not set before realize
Moved clutter_stage_set_title() before call to clutter_actor_realize()
to ensure _NET_WM_NAME is set early enough for use by interested WM's,

Signed-off-by: Shane Bryan <shane.bryan@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-14 12:49:25 +00:00
Emmanuele Bassi
9da564b391 Bug 1440 - Add clutter_get_current_event_time()
The clutter_get_current_event_time() is a global function for
retrieving the timestamp of the current event being propagated
by Clutter. Such function avoids the need to propagate the
timestamp from within user code.
2009-02-14 11:38:16 +00:00
Emmanuele Bassi
0ac6d6637e [list-model] Make ClutterListModel subclassable
ClutterListModel has been added as a terminal class in case we
decided to change API or implementation.

Apparently, it's a lot more resilient than we expected -- or far
too few are using it and reporting bugs. Once common issue, though,
is that it cannot be subclassed, hence it's fairly limited in its
usage.

In the hope that more developers will start using it, here's a
patch that makes ListModel a fully subclassable object.

May whatever god you believe in have mercy on your eventual soul.
2009-02-14 11:31:00 +00:00
Robert Staudinger
f17437124e [build] Add cogl.h to the built sources list
The main COGL header file is generated at configure time. If something
changes in the template, though, the file will not be regenerated.

Adding cogl.h to the BUILT_SOURCES list will allow the regeneration to
happen.
2009-02-12 12:42:58 +00:00
Emmanuele Bassi
402e022c36 [actor] Check out parameters before setting them
The clutter_actor_get_rotation() out parameters may be NULL, so
we need to check before dereferencing them.
2009-02-11 17:57:44 +00:00
Emmanuele Bassi
82db27874b [event] Extend KeyEvent for multi-input support
Key events can come from different input devices, so they need a
ClutterInputDevice member like the pointer-related events. This
field is reserved for future use.
2009-02-11 17:57:44 +00:00
Emmanuele Bassi
5590958102 [texture] Check if the material is valid
The CoglMaterial handle might be invalid when we are disposing
the ClutterTexture, so we need to check before calling any
cogl_material_* API on it.
2009-02-11 17:57:44 +00:00
Emmanuele Bassi
29bff6890a [texture] Consolidate the quality to filter conversions
To convert from a TextureQuality to a COGL filter enumeration
we need to perform two function calls. Since we need both filters
when calling cogl_texture_set_filters() we can safely consolidate
the two conversion functions into one. This also allows using a
shorter function name, thus reducing the lenght of the lines
involved and, more importantly preventing Emmanuele from crying.
2009-02-11 17:57:43 +00:00
Robert Bragg
b4f9c8204d [docs] Various gtk-doc updates for Cogl
This hides a number of internal structs and enums from the docs, and moves
some functions to more appropriate sections as well as misc description
updates (mostly for the vertex buffer api)
2009-02-09 14:33:14 +00:00
Robert Bragg
d01e3cd802 [cogl-vertex-buffer] Some fixes for texturing and color arrays
Fixes some blending issues when using color arrays since we were
conflicting with the cogl_enable state + fixes a texture layer
validation bug.

Adds a basic textured triangle to test-vertex-buffer-contiguous.
2009-02-09 14:15:06 +00:00
Robert Bragg
4a110afe08 [cogl-material] Fixes some dirty flag checks
Flushing material layers wasn't clearing the right dirty flag and
some of the tests used to avoid re-submitting GL state weren't
complete.
2009-02-09 14:15:06 +00:00
Robert Bragg
fa55c096d8 [Cogl] Renames cogl_fog_set to cogl_set_fog for consistency
More things follow the <object>_set_<property> convention.
2009-02-09 14:15:06 +00:00
Neil Roberts
0be6f42070 [cogl-texture] Fix uninitialised priv var in texture_finalize
Fix my failure to initialise the priv var which was some causing
crashes.
2009-02-05 23:02:38 +00:00
Neil Roberts
a2168686b9 [cogl-texture] Move the destruction of the material to _finalize
Otherwise if the dipose method is called twice the material will
already be destroyed when texture_free_gl_resources is called so it
will issue a warning about an invalid handle.
2009-02-05 20:29:25 +00:00
Neil Roberts
05c7e5a97c [cogl-texture] Fix offset to next quad when flushing the log
When the quad log contains multiple textures (such as when a sliced
texture is drawn) it dispatches the log with multiple calls to
flush_quad_batch and walks a pointer along the list of vertices.
However this pointer was being incremented by only one vertex so the
next quad would be drawn with three of the vertices from the last
quad.
2009-02-05 20:29:25 +00:00
Neil Roberts
a4de12dbe8 [clutter-texture] Fix the no_slice property
The 'no_slice' property means the texture should never be sliced. We
want cogl to create a texture with any amount of waste so we pass
max_waste as -1. However this got broken in commit 168d55 so that the
meaning got negated (no_slice enabled slicing).
2009-02-05 20:29:25 +00:00
Chris Lord
6bc7f4c723 [actor] Force a relayout on set_parent()
The current code that handles the invariant that the new parent
of an actor needing a layout should also be queued for relayout
is hitting the short-circuiting we do in the queue_relayout()
method.

In order to fix this we can forcibly set the actor to need a
width/height request and an allocation; then we queue a relayout
on the parent.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-05 19:54:48 +00:00
Emmanuele Bassi
9cf02bfdb9 [text] Rename :alignment to :line-alignment
The :alignment property is prone to generate confusion: developers
will set it thinking that the contents of a ClutterText will
automagically align themselves.

Instead of using the generic term :alignment, and following the
GTK+ convention, we should use a more specific term, conveying the
actual effect of the property: alignment of the lines with respect
to each other, and not to the overall allocated area.

See bug 1428:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1428
2009-02-05 19:54:48 +00:00
Neil Roberts
e349642937 [clutter-texture] Unref the Cogl material on dispose
The material is created in the _init function and is owned by the
ClutterTexture so it will be leaked if not freed.
2009-02-05 18:27:04 +00:00
Neil Roberts
ee0bf5e26d [clutter-texture] Release the temporary ref taken when setting a texture
When setting the cogl texture, the ClutterTexture takes a reference to
the Cogl handle but the material takes an additional reference when it
is set as the layer. Nothing was unrefing the temporary reference so
the textures were being leaked.
2009-02-05 18:26:08 +00:00
Neil Roberts
8feb99722c [clutter-clone] Override the parent opacity to self not self->parent
The opacity of the source actor when painted from the clone should be
combined with the opacity of the clone as well as the clone's parents,
instead of just the parents.
2009-02-04 00:14:16 +00:00
Neil Roberts
8e44874a93 [cogl-gles2-wrapper] Remove the FIXME to adjust the fragment color
Removed some debugging code which sets the r and g values to 1 in the
fragment shader.
2009-02-02 22:02:47 +00:00
Neil Roberts
49359407b0 [cogl-texture] Fix the count for the number of enabled arrays
The quad drawing code keeps track of the number of texture units that
have the tex coord array enabled so that in the next call it can
disabled any that are no longer enabled. However it was using 'i+1' as
the count but 'i' is already set to 'n_layers' from the previous for
loop.

Therefore it was disabling an extra texture unit. This doesn't
normally matter but it was causing GLES 2 to pointlessly realize an
extra unit.
2009-02-02 22:01:47 +00:00
Neil Roberts
e88de5f5fd Fix building GLES 2 after the material branch merge
- In cogl-material.h it directly sets the values of the
  CoglMaterialLayerCombineFunc to some GL_* constants. However these
  aren't defined in GLES 2 beacuse it has no fixed function texture
  combining. Instead the CGL_* versions are now used. cogl-defines.h
  now sets these to either the GL_* version if it is available,
  otherwise it directly uses the number.

- Under GLES 2 cogl-material.c needs to access the CoglTexture struct
  so it needs to include cogl-texture-private.h

- There are now #define's in cogl-gles2-wrapper.h to remap the GL
  function names to the wrapper names. These are disabled in
  cogl-gles2-wrapper.c by defining COGL_GLES2_WRAPPER_NO_REMAP.

- Added missing wrappers for glLoadMatrixf and glMaterialfv.

- Renamed the TexEnvf wrapper to TexEnvi because the latter is used
  instead from the material API.
2009-02-02 21:57:41 +00:00
Neil Roberts
edbe9a0377 [cogl-material] Always bind the new texture handle
Cogl previously tried to cache the currently bound texture when
drawing through the material API to avoid excessive GL calls. However,
a few other places in Cogl and Clutter rebind the texture as well so
this can cause problems.

This was causing shaped windows to fail in Mutter because
ClutterGLXTexturePixmap was binding a different texture to update it
while the second texture unit was still active which meant the mask
texture would not be selected when the shaped window was drawn
subsequent times.

Ideally we would fix this by providing a wrapper around glBindTexture
which would affect the cached value. The cache would also have to be
cleared if a selected texture was deleted.
2009-02-02 14:53:23 +00:00
Emmanuele Bassi
2747aa7be2 [text] Use create_pango_layout()
Since we added clutter_actor_get_pango_layout() it would be a
good idea to use it in the ClutterText actor to cut down the
PangoContext-related calls.
2009-02-02 12:07:29 +00:00
Emmanuele Bassi
6e12722a9b [clone] Allow cloning unparented actors
If the source of a ClutterClone does not have a parent actor the
clone will be unable to paint it because it's missing an allocation.

A simple way to fix it is to make the ClutterClone act like a
"foster parent": when it is allocated it will check if the source
actor has a parent and if not it will allocate the source with
its preferred size.
2009-02-02 12:07:29 +00:00
Emmanuele Bassi
801e535e94 Add Actor::create_pango_layout()
Final bit of integration between ClutterActor and Pango: a simple
method for creating a PangoLayout, pre-filled with text and ready
to be rendered using cogl_pango_render_layout().

This should make writing new Actors rendering custom text in their
paint() implementation easy and reliable.
2009-02-02 12:07:28 +00:00
Emmanuele Bassi
488de99fc6 [text] Merge the attributes with markup enabled
ClutterText should merge the PangoAttributes set by using
clutter_text_set_attributes() with the attributes generated by
parsing Pango markup.

For this to work we must parse the markup and merge the attributes
we get out of pango_parse_markup() with the attributes set by
the user.

Setting the markup or the attributes on an editable text should
not work for the time being.
2009-02-02 12:07:28 +00:00
Tomas Frydrych
e8ef5153b1 Fix clutter_x11_texture_pixmap_get/set_property() following change of PROP_WINDOW type.
PROP_WINDOW is now gulong, so we need to use appropriate GValue accessors.
2009-02-02 07:37:08 +00:00
Tomas Frydrych
c1de33fafe Fixed handling of enter and leave events in clutter_x11_handle_event()
When processing a motion event, we need to spin the event loop two extra
  times to ensure that any enter/leave events that might have been synthesized
  are pumped through (otherwise they end up being pushed down the queue and
  never processed).
2009-02-02 07:36:36 +00:00
Emmanuele Bassi
bb6202a1a1 Add cogl-material-private.h to the source files
The material-private.h file was not added to the dist files and
caused a build failure.
2009-01-29 16:00:15 +00:00
Emmanuele Bassi
86aba661bd Fix a variable masking warning
The usual issue with math.h defined symbols.
2009-01-29 13:31:51 +00:00
Neil Roberts
f1bae778ce [cogl] Add an NULL terminator to the call to material_flush_gl_state
This fixes a compiler warning and a potential crash.
2009-01-29 12:21:56 +00:00
Robert Bragg
6516dd3033 Another Cogl gl vs gles normalizaion pass
This tries to make a number of files more comparable with the intention of
moving some code into cogl/common/

Files normalized:
 cogl.c
 cogl-context.c
 cogl-context.h
 cogl-texture.c
2009-01-28 17:20:16 +00:00
Robert Bragg
081f2056bc Removes cogl_color_set_from_4d as it may mislead people.
Someone not sure which cogl_color_set_from_* version is "best" may use
set_from_4d because taking doubles implies higher precision. Currently
it doesn't have any advantage.
2009-01-28 17:20:15 +00:00
Robert Bragg
ef4052c18d Changes cogl_rectangle to take x1, y1, x2, y2 args not x1, y1, width, height
This makes it consistent with cogl_rectangle_with_{multi,}texture_coords.
Notably the reason cogl_rectangle_with_{multi,}texture_coords wasn't changed
instead is that the former approach lets you describe back facing rectangles.
(though technically you could pass negative width/height values to achieve
 this; it doesn't seem as neat.)
2009-01-28 17:20:15 +00:00
Robert Bragg
6048a0544a Adds some debug code to _cogl_journal_flush_quad_batch
The code is #if 0 guarded, but when uncommented it outlines all drawn
rectangles with an un-blended red, green or blue border. This may e.g. help
with debugging texture slicing issues or blending issues, plus it looks quite
cool.
2009-01-28 17:20:15 +00:00
Neil Roberts
e30c5b33b9 Undeprecate clutter_actor_set_scale_with_gravity
The scale center has returned so this function is available again but
it was still deprecated so you couldn't use it.
2009-01-28 16:24:02 +00:00
Neil Roberts
3e68b23ea8 Merge branch 'scale-center'
Bug 1349 - Using the anchor point to set the scale center is messy

The branch adds an extra center point for scaling which can be used
for example to set a scale about the center without affecting the
position of the actor.

The scale center can be specified as a unit offset from the origin or
as a gravity. If specified as a gravity it will be stored as a
fraction of the actor's size so that the position will track when the
actor changes size.

The anchor point and rotation centers have been modified so they can
be set with a gravity in the same way. However, only the Z rotation
exposes a property to set using a gravity because the other two
require a Z coordinate which doesn't make sense to interpret as a
fraction of the actor's width or height.

Conflicts:

	clutter/clutter-actor.c
2009-01-28 15:39:51 +00:00
Neil Roberts
1cd313477b [clutter-actor] Use G_STMT_START/END instead of do { } while (0)
In the TRANSFORM_ABOUT_ANCHOR_COORD macro it now uses G_STMT_START and
G_STMT_END instead of directly using do/while because it's more
readable.
2009-01-28 15:33:34 +00:00
Neil Roberts
d7c275f5e5 [cogl-texture] Fix order of tex coords when compensating for waste
When drawing a texture with waste in _cogl_multitexture_unsliced_quad
it scales the texture coordinates so that the waste is not
included. However the formula was the wrong way around so it was
calculating as if the texture coordinates are ordered x1,x2,y1,y2 but
it is actually x1,y1,x2,y2.
2009-01-28 12:57:06 +00:00
Neil Roberts
e72042648c [cogl-texture] Reset size of vertex log after drawing a polygon
Otherwise trying to render a rectangle after a polygon doesn't work
because it expects the array to be empty when it starts logging
vertices.
2009-01-28 12:24:11 +00:00
Neil Roberts
eda1d08f76 Fix rectangles_with_multitexture_coords for sliced without tex coords
When the texture is sliced it drops back to a fallback function and
passes it the texture coordinates from the rectangle. However if no
tex coords are given it would crash. Now it passes the default
0.0->1.0 tex coords instead.
2009-01-28 12:24:10 +00:00
Neil Roberts
7df1987652 Fix _cogl_texture_unsliced_quad when no texture coordinates are given
If no texture coordinates are given then texture_unsliced_quad tries
to generate its own coordinates. However it also tries to read the
texture coordinates to check if they are in [0.0,1.0] range so it will
crash before it reaches that.
2009-01-28 12:24:10 +00:00
Emmanuele Bassi
9b7fa2cb04 Reuse the layers list
Instead of getting the layers list twice from the Material, we
can reuse the list when we need to retrieve the first layer.
2009-01-28 11:57:49 +00:00
Emmanuele Bassi
b3e02869cd Remove gtk-doc annotation
The _cogl_material_flush_layers_gl_state() function is static,
so it should not have a gtk-doc annotation.
2009-01-28 11:57:49 +00:00
Emmanuele Bassi
b08a011512 Fix typo in the :clone getter method
The :clone property getter method, clutter_clone_get_source(), was
defined using the wrong name of clutter_clone_get_clone_source().
2009-01-28 11:57:49 +00:00
Neil Roberts
2722909b76 Fix building GLES after _cogl_texture_handle_from_pointer got removed
Commit a688b1db removed the function and replaced it with a direct
cast. This was also being used in the GL ES so the build broke.
2009-01-28 10:56:47 +00:00
Neil Roberts
6b9da72ab0 Directly set backend font options in clutter_set_font_flags
Instead of having a separate set of font options that override the
backend options when clutter_set_font_flags is called, it now just
directly sets the backend font options. So now the font flags are just
a convenience wrapper around the backend font options.

This also makes the ClutterText labels automatically update when the
font flags are changed because they will respond to the 'font-changed'
signal from the backend.
2009-01-27 17:11:02 +00:00
Neil Roberts
89b0b00dd1 Listen for the font-changed signal on the backend in ClutterText
Whenever a ClutterText is created it now connects to the font-changed
signal. When it is emitted the layout cache is dirtied and a relayout
is queued. That way changes to the font options or resolution will
cause an immediate update to the labels in the scene.
2009-01-27 17:07:02 +00:00
Emmanuele Bassi
1b578fb9c7 [docs] Documentation fixes
Update the COGL API reference to avoid a lot of warnings coming
from gtk-doc.
2009-01-27 16:53:01 +00:00
Emmanuele Bassi
865f04decd Removed unused conditional
USE_COGL_MATERIAL is a left-over from the development branch.
2009-01-27 16:40:51 +00:00
Emmanuele Bassi
3cfc7fb1ca Merge branch 'generic-actor-clone'
* generic-actor-clone:
  Remove CloneTexture from the API
  [tests] Clean up the Clone interactive test
  Rename ActorClone to Clone/2
  Rename ActorClone to Clone/1
  Improves the unit test to verify more awkward scaling and some corresponding fixes
  Implements a generic ClutterActorClone that doesn't need fbos.
2009-01-27 16:14:35 +00:00
Emmanuele Bassi
a688b1db01 Fallout from cogl-material merge
When enabling the maintainer CFLAGS the compiler got very angry
at the code that has been merged.
2009-01-27 16:02:04 +00:00
Robert Bragg
840941fdfe Adds padding to CoglColor to future proof it a bit
This adds enough padding to allow us to change to an internal float storage
for the color components if needs be in the future.
2009-01-27 15:20:16 +00:00
Robert Bragg
70d7d16f13 Support scaling on the z axis with cogl_scale
This simply adds a z argument to cogl_scale and updates clutter-actor.c
to pass 1.0 for the z scale.
2009-01-27 15:20:13 +00:00
Robert Bragg
e9a45c7744 Merge branch 'cogl-material'
Conflicts:

	clutter/cogl/gl/cogl-texture.c
	clutter/cogl/gles/cogl-primitives.c

* cogl-material:
 clutter-{clone-,}texture weren't updating their material opacity.
 Updates GLES1 support for CoglMaterial
 Normalizes gl vs gles code in preperation for synching material changes
 Removes cogl_blend_func and cogl_alpha_func
 Fully integrates CoglMaterial throughout the rest of Cogl
 [cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
 [cogl-material] Make the user_tex_coords parameter of _rectangle const
 [test-cogl-material] Remove return value from material_rectangle_paint
 Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
 [cogl-material] improvements for cogl_material_rectangle
 [cogl-material] Adds a cogl_material_set_color function
 [cogl-material] Some improvements for how we sync CoglMaterial state with OpenGL
 [cogl-material] Converts clutter-texture/clutter-clone-texture to the material API
 [doc] Hooks up cogl-material reference documentation
 Updates previous GLES multi-texturing code to use CoglMaterial
 Adds a CoglMaterial abstraction, which includes support for multi-texturing
 [doc] Hooks up cogl-matrix reference documentation
 Adds CoglMatrix utility code
 [tests] Adds an interactive unit test for multi-texturing
 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
2009-01-27 15:19:34 +00:00
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
Neil Roberts
418fb995c8 Replace clutter_set_use_mipmapped_text with clutter_set_font_flags
The hope is that this function makes it easier to extend the font
settings with more flags without having to add a function for every
setting.

A new flag for enabling hinting has been added. If set, this changes
the font options on the global PangoContext and any newly created
PangoContexts. The options are only set if the flag is changed from
the default so it won't override any detailed setting chosen by the
backend.
2009-01-27 14:43:44 +00:00
Robert Bragg
28f9749e8e clutter-{clone-,}texture weren't updating their material opacity.
cogl_set_source_color4ub was previously used to set a transparent
white source color according to the actors opacity, but since
cogl_set_source_color now always implies you want a solid fill we
we use cogl_material_set_color4ub to achieve the same result.
2009-01-27 14:26:50 +00:00
Robert Bragg
4a7fa6d0fa Updates GLES1 support for CoglMaterial
This updates cogl/gles in line with the integration of CoglMaterial throughout
Cogl that has been done for cogl/gl.

Note: This is still buggy, but at least it builds again and test-actors works.
Some GLES2 specific changes were made, but these haven't been tested yet.
2009-01-27 14:26:50 +00:00
Robert Bragg
60e81f0fda Normalizes gl vs gles code in preperation for synching material changes
This changes all GLES code to use the OpenGL function names instead of
the cogl_wrap_* names. For GLES2 we now define the OpenGL name to point
to the wrapper, as opposed to defining the wrapper to point to the
OpenGL name for GLES1.

I've also done a quick pass through gl/cogl.c and gles/cogl.c to make
them more easily comparable. (most of the code is now identical)
2009-01-27 14:26:50 +00:00
Robert Bragg
427fff032e Removes cogl_blend_func and cogl_alpha_func
The GL blend function and alpha function are now controlled by the material
code, and even internally Cogl should now be using the material API when
it needs control of these.
2009-01-27 14:26:49 +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
2138b1cbb2 Bug 1388 - Clarify signal emission for advance_to_marker()
Like clutter_timeline_advance(), calling advance_to_marker() will
not emit ::new-frame for the frame where the marker is set on; it
will also not emit ::marker-reached for the marker we are advancing
the timeline to.
2009-01-27 11:25:06 +00:00
Emmanuele Bassi
8608d103f8 Bug 1387 - Clarify new-frame signal emission with advance()
When calling clutter_timeline_advance(), a timeline will not emit
the ::new-frame signal for the frame we are advancing to, as this
would break the invariants of the timeline behaviour.

The documentation should make this clear.
2009-01-27 11:18:09 +00:00
Emmanuele Bassi
43bd4e5d3f [timeline] Check the fps property range in the ctor
The clutter_timeline_new() constructor is not checking the full
range of the passed :fps property. The ParamSpec of the property
and the setter method perform this check, so the ctor should as
well.
2009-01-27 10:35:50 +00:00
Emmanuele Bassi
f753847851 [timeline] Move a complex condition into its own function
The "is-timeline-complete" condition is pretty long, spanning
four lines and four logical sub-conditions. It is possible to
neatly move it into an is_complete() function and make the
code more readable.
2009-01-27 10:33:44 +00:00
Emmanuele Bassi
092db1098c [timeline] Intern signal names
The signal names are static string and thus should be interned
so that Glib can do a simple pointer comparison whenever needed,
instead of a strcmp().
2009-01-27 10:32:15 +00:00
Emmanuele Bassi
7863ca4a55 [timeline] Whitespace fixes 2009-01-27 10:31:53 +00:00
Emmanuele Bassi
2be9cdc267 [timeline] Documentation and comment fixes
The long description of the ClutterTimeline class is very C
developer-oriented. Since many language bindings will refer to
the C API reference we should probably be more verbose and
language agnostic -- at least in the class description.

The methods documentation also requires a little pass to increase
the consistency of the terminology, the grammar and the syntax.

Finally, comments never killed anyone.
2009-01-27 10:27:33 +00:00
Emmanuele Bassi
763de185e9 [timeline] Create markers hash tables on demand
Since not every timeline will have markers it's unfair to make
all of them crete two empty hash tables (with a preallocated
fixed size).

This commit moves the responsibility of creating the hash tables
to the marker API itself, and adds the relative checks.
2009-01-27 09:51:45 +00:00
Emmanuele Bassi
1e071ed859 [timeline] Limit timelines to 1000 frames per second
Since we are using milliseconds granularity to integrate timelines
with the GLib main loop, we cannot allow values of the :fps
property bigger than 1000. This means validating the fps value both
in the GParamSpec and the clutter_timeline_set_speed() accessor
function.

This should also fix floating point exceptions when trying to
perform "n_frames = milliseconds / (1000 / fps)".

See bug 1354:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1354
2009-01-27 09:51:45 +00:00
Havoc Pennington
81f642d4b7 Bug 1414 - avoid relayout of ClutterTexture if not syncing size
If a ClutterTexture does not sync size, it should be possible to
change the texture size without causing a relayout.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-26 16:25:53 +00:00
Havoc Pennington
9ccae46bc1 Bug 1415 - short-circuit setting same clip again
There is some GL work and a repaint anytime the clip is set
or unset, so avoid that if it isn't really changed.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-26 16:22:39 +00:00
Neil Roberts
54f4ed775c Set the SYNC_MATRICES flag when a stage is first realized
The stage will usually be painted before the first ConfigureNotify
arrives so we need to set the SYNC_MATRICES flag to ensure that the
viewport will be correct for that paint. Unfortunately this means that
the viewport will be set again once the ConfigureNotify is received
but compared to rendering an initial invalid scene I think it is the
lesser of two evils.
2009-01-26 10:58:40 +00:00
Emmanuele Bassi
9197646d25 Rename ActorClone to Clone/1
Step one of the ActorClone -> Clone renaming: rename the files.
2009-01-26 10:32:53 +00:00
Emmanuele Bassi
cdb360107b Whitespace fixes for BehaviourEllipse
Simple fallout from the automated conversion scripts that
switched from ClutterFixed to float.
2009-01-24 14:32:10 +00:00
Emmanuele Bassi
171a7647b9 Bug 1395 - apply and get_nth_actor are inconsistent
When calling clutter_behaviour_apply() the new actor is prepended
to the list of actors to which a behaviour is applied; this breaks
the rest of methods working on the actors list, e.g.:

  # adding actors
  apply(actor_0);
  apply(actor_1);
  apply(actor_2);

  # expected: [ actor_0, actor_1, actor_2 ]
  [ actor_2, actor_1, actor_0 ] = get_actors();

  # expected: actor_2
  actor_0 = get_nth_actor(2);

This commit fixes the inconsistency in the returned values.
2009-01-24 14:32:09 +00:00
Neil Roberts
ba068f6bc9 Fix the Cogl primitives for the GLES backend
The Cogl primitives broke for GLES 1.1 and 2 after the cogl-float
branch merge.

CoglPathNode was still being declared as GLfixed for the GLES backend
but it was being filled with float values so they were all ending up
as numbers < 1.

glDrawArrays was being called with GL_FIXED so this has been changed
to GL_FLOAT.

The scanline rasterizer had a leftover hardcoded ClutterFixed constant
to add a small amount to the height of each line.

struct _CoglFloatVec2 has been removed because it is no longer used
anywhere.
2009-01-24 00:26:51 +00:00
Neil Roberts
4d7caa4bd5 [clutter-timeline] Remove the code for backwards timelines in get_progress
The special check to invert the progress when the timeline direction
is backwards is not necessary because the actual frame number will be
decreasing in that case. Inverting just makes it progress forwards
again.

This is more apparent since the float-alpha-value branch merge because
the clutter_linear function directly returns the value from
get_progress. For example in test-depth, the animations loop instead
of oscillating back and forth.
2009-01-23 22:57:36 +00:00
Neil Roberts
9ea6ab76fb Fix gtk-doc reference since the anchor point changes
The documentation has been updated to reflect the fact that the anchor
point will move when the actor changes size if it was specified using
a gravity value. The new functions for setting the scale center and z
rotation gravity are also documented.
2009-01-23 18:41:41 +00:00
Neil Roberts
d5e5d35316 Convert the rotation centers to be AnchorCoords
Currently only the Z axis rotation center can be set using a gravity
but the other rotations also store their center as an AnchorCoord for
consistency. Specifying the center as a gravity makes less sense for
the other axes because the actors have no size along the Z axis.

The rotation angles are now stored as gdoubles and the fixed point *x
entry points have been removed.

The Z rotation can now be set with a gravity center using the
following new function:

void clutter_actor_set_z_rotation_from_gravity (ClutterActor   *self,
                                                gdouble         angle,
                                                ClutterGravity  gravity);
2009-01-23 18:41:41 +00:00
Neil Roberts
e10d255b83 Add a scale center property to ClutterActor
This sets the center point from which the scaling will occur. This can
be used insetad of the anchor point to avoid moving the actor. Like
the anchor point, it can be specified as either a coordinate in units
or a gravity enum.

To set the center you can use two new variants of set_scale:

clutter_actor_set_scale_full (ClutterActor *self,
                              gdouble       scale_x,
                              gdouble       scale_y,
                              int           center_x,
                              int           center_y);

or

clutter_actor_set_scale_with_gravity (ClutterActor   *self,
                                      gdouble         scale_x,
                                      gdouble         scale_y,
                                      ClutterGravity  gravity);

The ClutterFixed variants of the set_scale functions have been removed
and the scale value is now always stored as a double.
2009-01-23 18:41:40 +00:00
Neil Roberts
a24b9a32e5 Store when the anchor point is set from a gravity
This makes it so when the anchor point is set using a gravity enum
then the anchor point moves when the actor changes size. A new
property is added for the anchor point gravity. If the anchor point is
set from gravity then the position in units can also be retreived with
the regular API.

A new union type is used to store the anchor point with helper
accessor functions. The hope is these can be reused for the scale and
rotation center points.
2009-01-23 18:41:40 +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