Commit Graph

2416 Commits

Author SHA1 Message Date
Robert Bragg
e464acff7a [cogl] cogl_is_*(): Don't dereference an invalid handle; just return FALSE
An invalid handle is implicitly not of any type.
2009-04-06 11:35:10 +01:00
Neil Roberts
fff5585b5f [cogl-pango-render] Fix returning to default color after a color attribute
Since the Cogl material branch merge when changing the color of a part
using pango attributes (such as using <span color="red" /> markup)
then it wouldn't return to the default color for the rest of the
layout. pango_renderer_get_color returns NULL if there is no color
override in which case it needs to revert to the color specified as
the argument to cogl_pango_render_layout. The 'color' member of
CoglPangoRenderer has been reinstated to store that default color and
now cogl_pango_render_set_color_for_part is the only place that sets
the material color.
2009-04-06 11:14:43 +01:00
Emmanuele Bassi
a1cc1f57ac [animation] Do not connect to ::completed multiple times
The clutter_actor_animate*() family of functions should only connect
to the Animation::completed signal once, during the construction of
the Animation object attached to the Actor. Otherwise, the completed
signal handler will be run multiple times, and will try to unref()
the Animation for each call -- leading to a segmentation fault.
2009-04-05 20:32:15 +01:00
Emmanuele Bassi
6bf883da6c [animation] Add the ::started signal
The Animation class is missing a ::started signal matching the
::completed one. A ::started signal is useful for debugging,
initial state set up, and checks.
2009-04-03 14:19:20 +01:00
Emmanuele Bassi
1762795990 [group] Fix compilation
A case of rebase FAIL. The sorting of the children was still
done using the now removed group function call instead of the
Container one.
2009-04-03 13:36:30 +01:00
Emmanuele Bassi
df738d0a8c [animation] Do not unref on ::complete by default
Bug 1535 - Complete animation always unrefs ClutterAnimation (even
           after g_object_ref_sink)

Animations created through clutter_animation_new() should not
automagically unref themselves by default on ::complete. We
only want that behaviour for Animations created by the
clutter_actor_animate* family of functions, since those provide
the automagic memory management.
2009-04-03 12:47:21 +01:00
Emmanuele Bassi
bd8d3f6bd8 [group] Remove long deprecated API
ClutterGroup still ships with API deprecated since 0.4. We did
promise to keep it around for a minor release cycle -- not for 3.

Since we plan on shipping 1.0 without the extra baggage of the
deprecated entry points, here's the chance to remove the accumulated
cruft.

All the removed methods and signals have a ClutterContainer
counterpart.
2009-04-03 12:47:21 +01:00
Emmanuele Bassi
9d0ce68c2f [shader] Remove deprecated set_uniform_1f()
Since we're planning to release 1.0 without any of the deprecated
API baggage, we can simply remove the set_uniform_1f() method from
ClutterShader public API and add it to the deprecated header.
2009-04-03 12:47:21 +01:00
Robert Bragg
c3d9f0bed4 [cogl-handle] Optimize how we define cogl handles
The cogl_is_* functions were showing up quite high on profiles due to
iterating through arrays of cogl handles.

This does away with all the handle arrays and implements a simple struct
inheritance scheme. All cogl objects now add a CoglHandleObject _parent;
member to their main structures. The base object includes 2 members a.t.m; a
ref_count, and a klass pointer. The klass in turn gives you a type and
virtual function for freeing objects of that type.

Each handle type has a _cogl_##handle_type##_get_type () function
automatically defined which returns a GQuark of the handle type, so now
implementing the cogl_is_* funcs is just a case of comparing with
obj->klass->type.

Another outcome of the re-work is that cogl_handle_{ref,unref} are also much
more efficient, and no longer need extending for each handle type added to
cogl. The cogl_##handle_type##_{ref,unref} functions are now deprecated and
are no longer used internally to Clutter or Cogl. Potentially we can remove
them completely before 1.0.
2009-04-02 11:58:43 +01:00
Robert Bragg
04ebd6be44 [cogl] handle_automatic_blend_enable(): consider layers with invalid textures
A layer object may be instantiated when setting a combine mode, but before a
texture is associated. (e.g. this is done by the pango renderer) if this is the
case we shouldn't call cogl_texture_get_format() with an invalid cogl handle.

This patch skips over layers without a texture handle when determining if any
textures have an alpha channel.
2009-04-02 11:50:44 +01:00
Robert Bragg
8a1b4f8326 Unifies 90% of the code in {gl,gles}/cogl.c in common/cogl.c
This code keeps on diverging and we get bugs and fixes in one version but
not the other. This should make things a bit more maintainable.
2009-04-01 13:19:35 +01:00
Robert Bragg
50c1fc6291 Removes cogl_blend_func prototype from cogl-internal.h
cogl_blend_func was removed a while ago so this was just a left over from then
2009-03-30 18:02:03 +01:00
Bastian Winkler
34467e5c6a [docs] Fix some inconsistency in Animation
For some examples of clutter_actor_animate the parameters of @mode and
@duration are swapped.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-03-30 17:34:07 +01:00
Havoc Pennington
077e3192fd [texture] Queue a relayout when changing :keep-aspect-ratio
Bug 1528 - queue relayout when setting ClutterTexture:keep-aspect-ratio

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-03-30 17:32:54 +01:00
Raymond Liu
a362a4a889 [text] Use the base class binding pool
Bug 1518 - [Patch] Widget derivied from ClutterText will crash on
           key_press_event

In clutter_text_key_press() we are using G_OBJECT_TYPE_NAME to find
out the actor's type name. However, if some widget is derived from
ClutterText, when the key press handler is called, G_OBJECT_TYPE_NAME
will return the name of the derived widget.

The default implementation should get the binding pool for the base
class.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-03-30 16:57:11 +01:00
Emmanuele Bassi
02ea81ce02 [text] Different selection modes with multiple clicks
ClutterText should offer multiple selection modes depending on the
number of pointer clicks.

Following the GTK+ conventions:

  - double click selects the current word
  - triple click selects the current line
2009-03-30 16:50:26 +01:00
Øyvind Kolås
f6d938a0db [animation] add varargs support for signal::completed
Added support for registering a handler for the completed signal
directly amongst the varargs making it easier to attach code
to be executed when animations complete.
2009-03-30 12:10:41 +01:00
Emmanuele Bassi
a1a8193179 [text] Check text length in ::button-press-event
Bug 1529 - Selection bound out of sync with an empty Text actor

When the user clicks on a Text actor the cursor position and the
selection bound are set using bytes_to_offset(); if the Text is
empty, this means placing them both to 0. Setting the selection
bound to 0 means that when the user inserts a character by typing
it into the Text, the selection will be [0,1]; this will select
the first character, which will then be overwritten when typing
a new character.

The Text actor should, instead, check if there are no contents
and set the cursor position and the selection bound to -1.

The clutter_text_set_selection_bound() method should also validate
the value passed, in case it's bigger than the text lenght, or
smaller than -1.
2009-03-30 07:54:42 +01:00
Emmanuele Bassi
0de0e869a9 [docs] Fix typo in the AnimationMode name 2009-03-27 14:28:08 +00:00
Chris Lord
cc21a4aa5f [ClutterTimeline] Fix clutter_timeline_set_delay
When setting a delay, timeout_add was being used with msecs. timeout_add
takes fps since the fix to bug #1495. Delay now uses g_timeout_add
instead.
2009-03-26 20:29:23 +00:00
Damien Lespiau
231343f151 [gitignore] Ignore two newly introduced tests 2009-03-25 20:58:22 +00:00
Neil Roberts
68ab2c6024 [doc] Fix two small typos in cogl-vertex-buffer
The symbol name for cogl_vertex_buffer_draw_elements was wrong so it
ended up with no documentation. The name for the vertex attribute was
incorrect in cogl_vertex_buffer_add.
2009-03-25 14:53:58 +00:00
Robert Bragg
3d81f0c08e [build] Fixes a cogl-vertex-buffer.c warning when building for GLES
GLES 1 doesn't support GLSL so it never needs to use the generic_index
variable for generic attributes which was flagging a warning.
2009-03-23 16:32:17 +00:00
Robert Bragg
891ed53564 [cogl] Move rect and poly drawing code from cogl-texture.c to cogl-primitives.c
None of this code directly related to implementing CoglTextures, and the
code was needlessly duplicated between the GL and GLES backends. This moves
the cogl_rectangle* and cogl_polygon* code into common/cogl-primitives.c
makes which makes lot of sense since the two copies keep needlessly
diverging introducing or fixing bugs in one but not the other. For instance
I came accross one such bug regarding the enabling of texture units when
unifying the code.
2009-03-23 16:32:07 +00:00
Robert Bragg
b30bb575a1 [cogl_rectangles] A minor doc fix, and missing newline between functions
The gtk-doc had a copy and paste error, saying the float array should be 8
elements per rectangle instead of 4. There was also no newline in the gles
code before the new function.
2009-03-23 12:41:42 +00:00
Johan Bilien
13e5bd9e8b Allow using array of vertices even without textures
It's often nice to be able to draw a batch of vertices, even if these
have no texture coordinates. This add a cogl_rectangles, similar to
cogl_rectangles_with_texture_coords, only without.
2009-03-23 12:41:41 +00:00
Robert Bragg
5a06f1d1d0 Removes a hack in gles/cogl.c that was already fixed in gl/cogl.c
It removes the need to cast a CoglMatrix to a float * for transforming
a vertex manually instead of using cogl_matrix_transform_point.
2009-03-23 12:41:41 +00:00
Emmanuele Bassi
d6937b797e [doc] Update the should_pick_paint() documentation
The should_pick_paint() method of ClutterActor is not clearly
documented.
2009-03-21 20:40:22 +00:00
Neil Roberts
0a48a52ba1 [glx-texture-pixmap] Don't enable the texture target when binding the texture
There's no need to enable the texture target unless it is going to be
used for rendering. Enabling it directly with glEnable calls confuses
Cogl's state caching.

This is a replacement for the patch in bug 1483 which was reverted.
2009-03-19 17:54:17 +00:00
Neil Roberts
c4dcbb6bdb Revert "Use COGL to establish GL state for ClutterGLXTexturePixmap"
This reverts commit f9d996a460.

The change from calling glBindTexture to using the material API with
cogl_material_flush_gl_state does not always work because it doesn't
necessarily leave the active texture unit as GL_TEXTURE0. For example,
if the previously rendered texture was multi-layered then the last
thing cogl_material_flush_gl_state will do is select GL_TEXTURE1 just
to disable it.
2009-03-19 17:48:15 +00:00
Øyvind Kolås
e94e5ad65b [actor] use an epsilon whens sanity checking sizes
Clutter was complaining about netural width smaller than minimum widths
(differences around 0.0005) by using an epsilon value of 1e-4 for these
floating point comparisons, these warnings have now been silenced.
2009-03-19 14:46:23 +00:00
Emmanuele Bassi
7d8da0e830 [docs] Remove unused arguments
The documentation for some X11TexturePixmap method does not reflect
the actual API.
2009-03-18 17:07:50 +00:00
Emmanuele Bassi
6114c6c1db [docs] Pick up backend-specific API
The various backend API outside from clutter-x11.h and clutter-win32.h
is documented but not picked up by gtk-doc.
2009-03-18 17:06:56 +00:00
Emmanuele Bassi
ccca24ab76 Remove usage of the grave accent as quotation mark
See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.
2009-03-17 14:13:31 +00:00
Robert Bragg
39e2b43b22 [cogl] Apply the fix from 2c1c836417 (Flush matrix before clip planes) to GLES
glClipPlane() is affected by modelview matrix so we need to flush before
calling it.
2009-03-17 11:37:29 +00:00
Robert Bragg
b5a35a0f0b [test-cogl-vertex-buffer] Use clutter_color_from_hls instead of hsl_to_rgb
There is no need for a custom hsl to rgb converter since Clutter implements
this logic; originally it wasn't quite as optimal, but that has now been
fixed.
2009-03-17 11:37:29 +00:00
Robert Bragg
bb93a98762 [clutter-color] Use a different hls->rgb algorithm + use floating point
Using test-cogl-vertex-buffer as a test case which is CPU bound due to
hls -> rgb conversions this alternative algorithm looked to be ~10%
faster when tested on an X61s Lenovo.
2009-03-17 11:37:29 +00:00
Emmanuele Bassi
567a96c96a [docs] More information on animation queueing
Queuing an animation on an actor cannot be done from within the
::completed signal handler, because we guarantee that the Animation
instance is valid and attached to the actor it animates for the
whole duration of the signal emission chain.

In order to queue animations you have to install an idle handler
on the main loop, and call clutter_actor_animate() inside it.

The documentation should be more clear about this caveat in the
memory management of ClutterAnimations created by the animate()
family of functions.
2009-03-16 18:20:58 +00:00
Emmanuele Bassi
9694107f90 Post-release bump to 0.9.3 2009-03-16 17:09:57 +00:00
Emmanuele Bassi
35191f09ef [release] Release 0.9.2 2009-03-16 16:58:13 +00:00
Emmanuele Bassi
f061e27416 Update release notes 2009-03-16 16:56:51 +00:00
Emmanuele Bassi
e7c5b15e60 [docs] Ignore the TimeoutInterval internal API
The TimeoutInterval API is internal, and thus should not be part
of the API reference.
2009-03-16 16:56:51 +00:00
Emmanuele Bassi
e8785fef07 [docs] Fix naming of the interval parameter
The interval parameter is now expressed in frames per second and not
in milliseconds.
2009-03-16 16:56:51 +00:00
Emmanuele Bassi
d5ee6fc264 Fix release date of 0.9.0 2009-03-16 16:34:17 +00:00
Robert Bragg
ca3bfe2cea [cogl] Don't endlessly print the same warning regarding layer fallbacks
There are various constraints for when we can support multi-texturing and
when they can't be met we try and print a clear warning explaining why the
operation isn't supported, but we shouldn't endlessly repeat the warning for
every primitive of every frame. This patch fixes that.
2009-03-16 16:19:51 +00:00
Robert Bragg
c5bd63648d [tests] Adds an interactive cogl vertex buffer unit test
The test is a sanity check that dynamic updating of vertex data via the cogl
vertex buffer api works and has reasonable performance. (though it can't be
considered a well designed benchmark since it wastes casual amounts of CPU
time simply choosing pretty colors.)

The code also aims to demonstrate one way of creating, updating and efficiently
drawing a quad mesh structure via the vertex buffer api which could be applied
to lots of different use cases.
2009-03-16 16:19:51 +00:00
Robert Bragg
71d65b629b [cogl-vertex-buffer] fix cogl_vertex_buffer_draw_elements prototype
This function was renamed a while ago in the .c file from
cogl_vertex_buffer_draw_range_elements  but the corresponding .h and
doc/reference/cogl changes weren't made.
2009-03-16 16:19:39 +00:00
Robert Bragg
14e6323554 [cogl-vertex-buffer] Allow querying back the number of vertices a buffer represents
This may be convenient e.g. at draw time if you are simply drawing all vertices
2009-03-16 16:17:02 +00:00
Robert Bragg
075ae9c4a7 [cogl-vertex-buffer] Add a flush of attribute changes in the *_draw() functions
For convenience it is now valid to avoid a seperate call to
cogl_vertex_buffer_submit() and assume that the _draw() calls will do this
for you (though of course if you do this you still need to ensure the
attribute pointers remain valid until your draw call.)
2009-03-16 16:14:17 +00:00
Neil Roberts
a93a93d007 Count timeline frames using the FPS instead of an integer interval
Bug 1495 - Timelines run 4% short

Previously the timelines were timed by calculating the interval
between each frame stored as an integer number of milliseconds so some
precision is lost. For example, requesting 60 frames per second gets
converted to 16 ms per frame which is actually 62.5 frames per
second. This makes the timeline shorter by 4%.

This patch merges the common code for timing from the timeout pools
and frame sources into an internal clutter-timeout-interval file. This
stores the interval directly as the FPS and counts the number of
frames that have been reached instead of the elapsed time.
2009-03-16 15:40:18 +00:00