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.
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>
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.)
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.
The Animation API should follow this pattern:
- functions with an Interval as part of the arguments should have
"interval" inside their name, e.g.:
clutter_animation_bind_interval
clutter_animation_update_interval
- functions dealing with property names should have "property"
inside their name, e.g.:
clutter_animation_has_property
clutter_animation_unbind_property
- unless -
- functions dealing with a property and its value should not
have any modifier, e.g.:
clutter_animation_bind
The change from update_property() to update_interval() frees up
clutter_animation_update(), to be added at a later date.
Bug 1454 - move queue_redraw virtualization to ClutterActor
The ClutterActor::queue-redraw signal allows parent containers to
track whether their children need a redraw.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
A common use of setting clip is to keep an actor inside its allocation;
right now to do this you have to set up a callback on notify::allocation.
There's no overhead added by sticking another bit in ClutterActor
clip-to-allocation that will clip painting to the allocation if set.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1419 - Add clutter_animation_bind, rename clutter_animation_bind_interval
This is a different approach from the clutter_actor_animatev
vector variant. The single call should be even easier on
automatic bindings, since calls can be chained like:
new Clutter.Animation({object: myactor}).bind("x", 42).bind("y", 43);
Note clutter_animation_bind_property which took a ClutterInterval
is renamed to clutter_animation_bind_interval for clarity, and to
discourage use since there are friendlier APIs about.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>