By implementing the newly added support for custom animatable
properties, we can allow addressing action and constraint properties
from ClutterAnimation and clutter_actor_animate().
The Animation class should use the Animatable API for custom properties
to override finding a property definition, getting the initial state and
setting the final state of an object.
The Constraint base, abstract class should be used to implement Actor
modifiers that affect the way an actor is sized or positioned inside a
fixed layout manager.
DragAction is an Action sub-class that provides dragging capabilities to
any actor. DragAction has:
• drag-begin, drag-motion and drag-end signals, relaying the event
information like coordinates, button and modifiers to user code;
• drag-threshold property, for delaying the drag start by a given
amount of pixels;
• drag-handle property, to allow using other actors as the drag
handle.
• drag-axis property, to allow constraining the dragging to a specific
axis.
An interactive test demonstrating the various features is also provided.
ClutterAction is an abstract class that should be used as the ancestor
for objects that change how an actor behaves when dealing with events
coming from user input.
ClutterActorMeta is a base, abstract class that can be used to derive
classes that are attached to a ClutterActor instance in order to modify
the way an actor is painted, sized/positioned or responds to events.
A typed container for ActorMeta instances is also provided to the
sub-classes can be attached to an Actor.
Previously it would only try to set the blend equation if the RGB and
alpha blending functions were different. However it's completely valid
to use a non-standard blending function when the functions are the
same. This patch moves the blending equation to outside the if
statement.
Previously it would only set the blend constant if glBlendFuncSeparate
was used but it is perfectly acceptable to use the blend constant when
the same factor is used for each. It now sets the blend constant
whenever one of the factors would use the constant.
When a single statement is used to specify the factors for both the
RGB and alpha parts it previously split up the statement into
two. This works but it ends up unnecessarily using glBlendFuncSeparate
when glBlendFunc would suffice.
For example, the blend statement
RGBA = ADD(SRC_COLOR*(SRC_COLOR), DST_COLOR*(1-SRC_COLOR))
would get split into the two statements
RGBA = ADD(SRC_COLOR*(SRC_COLOR[RGB]), DST_COLOR*(1-SRC_COLOR[RGB]))
A = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))
That translates to:
glBlendFuncSeparate (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
This patch makes it so that arg_to_gl_blend_factor can handle the
combined RGBA mask instead. That way the single statement gets
translated to the equivalent call:
glBlendFunc (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
If a cached layout didn't actually match the layout we're looking for,
it would be returned anyway. Remove this return so that it can correctly
continue looking and get a cache miss if appropriate.
http://bugzilla.openedhand.com/show_bug.cgi?id=2109
Previously a path copy was implemented such that only the array of
path nodes was shared with the source and the rest of the data is
copied. This was so that the copy could avoid a deep copy if the
source path is appended to because the copy keeps track of its own
length. This optimisation is probably not worthwhile because it makes
the copies less cheap. Instead the CoglPath struct now just contains a
single pointer to a new CoglPathData struct which is separately
ref-counted. When the path is modified it will be copied if the ref
count on the data is not 1.
This patch combines a number of fixes and improvements to the
layout caching logic in ClutterText.
* Fix: The width must always be set on the PangoLayout when painting.
This is necessary because the layout aligns in the width, and
even when we think we are left-aligned, the auto-dir feature
of PangoLayout may result in right-alignment.
* Fix: We should only ever try to reuse a cached layout based
on its logical width if layout.width was -1 when computing
that logical width. If the layout was already ellipsized,
then comparing the logical width to the new width we are
trying to wrap to doesn't make sense. (If "abc" ellipsizes
to a 15-pixel wide "..." for a width of 1 pixel, that doesn't
mean that we should use "..." for a width of 15 pixels. Maybe
"abc" itself is 15 pixels wide.)
* Improvement: rather than looking up cached layouts based on the
input allocation_width/allocation_height, look them up based
on the actual width/height/ellipsize that we pass to create
a layout. This is simpler and improves the chance we'll get
a cache hit when appropriate even if there are small floating
point differences.
Note because of the first fix this is less aggressive than dd40732
in caching layouts; get_preferred_width() and painting can't share
a layout since get_preferred_width() needs to pass a width of -1
to Pango and painting needs to pass the real width.
The patch has been updated from the clutter-1.2 branch to current
master; using the profiling instrumentation it is possible to verify
with test-text-field that the hit/miss counters go from:
Name Total Per Frame
---- ----- ---------
Text layout cache hit counter 13 6
Text layout cache miss counter 11 5
before applying the patch, to:
Name Total Per Frame
---- ----- ---------
Text layout cache miss counter 4 2
Text layout cache hit counter 3 1
after applying the patch.
https://bugzilla.gnome.org/show_bug.cgi?id=618104http://bugzilla.openedhand.com/show_bug.cgi?id=2109
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This reverts commit 716ec82db8.
The Cogl pixel buffer API currently has problems if an atlas texture
is created or the format needs to be converted. The atlas problem
doesn't currently show because the atlas rejects BGR textures anyway
but we may want to change this soon. The problem with format
conversion would happen under GLES because that does not support BGR
textures at all so Cogl has to do the conversion. However it doesn't
currently show either because GLES has no support for buffer objects
anyway.
It's also questionable whether the patch would give any performance
benefit because Cairo needs read/write access which implies the buffer
can't be put in write-optimised memory.
Conflicts:
clutter/clutter-cairo-texture.c
http://bugzilla.openedhand.com/show_bug.cgi?id=1982
Since framebuffer state is not flushed prior to replaying the journal,
the trick of marking the framebuffer dirty prior to calling
glBindFramebuffer() doesn't work... the outstanding journal entries
will get replayed to the newly created framebuffer.
Fix this by flushing the journal as well.
http://bugzilla.openedhand.com/show_bug.cgi?id=2110
Signed-off-by: Robert Bragg <robert@linux.intel.com>
In clutter_cairo_texture_create_region it tries to destroy the old
texture before mapping the PBO by setting the texture on the first
layer of the material to COGL_INVALID_HANDLE. However it was using the
material API incorrectly so it ended up showing a warning and doing
nothing.
If the clip stack is empty then _cogl_clip_stack_flush exits
immediately. This was missing out the assignment of *stencil_used_p at
the bottom of the function. If a path is then used after the clip is
cleared then it would think it needs to merge with the clip so the
stencil would not be cleared correctly.
The code for implementing ClutterColor as GParamSpec and the
color↔string transformation functions were assuming that ClutterColor
owns the data in the GValue struct and directly reading
data[0].v_pointer to get a pointer to the color. However ClutterColor
is actually a boxed type and the format of the data array is meant to
be internal to GObject so it is not safe to poke around in it
directly. This patch changes it to use g_value_get_boxed to get the
pointer.
Also, boxed types allow a NULL value to be stored and not all of the
code was coping with this. This patch also attempts to fix that.
http://bugzilla.openedhand.com/show_bug.cgi?id=2068
ClutterColor has long had a GTypeValueTable struct around and the
functions defined to be implemented as a fundamental type. However the
struct was never actually used anywhere and ClutterColor is actually
defined as a boxed type. This patch removes the table because it is
very confusing to have code lying around that is not used.
http://bugzilla.openedhand.com/show_bug.cgi?id=2068
Duplicate the existing ease-in/interpolation mode for the property when
removing, replacing the first key for a property or adding a new first
key for a property.
When inserting or modifying keys of a running animator the internal
iterators per property could go out of sync. Reinitializing the
iterators if the timeline is running avoids this.
In 91cde78a7 I accidentally changed the function names that get looked
up for the framebuffer extension under GLES so that they didn't have
any suffix. The spec for extension specifies that they should have the
OES suffix.
A server that supports GLX_BufferSwapComplete will always send
these events, so we should just silently ignore them if we've
chosen not to take advantage of the INTEL_swap_event GLX
extension.
http://bugzilla.openedhand.com/show_bug.cgi?id=2102
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
clutter_container_create_child_meta() uses CLUTTER_IS_ACTOR on the
container parameter instead of the actor parameter.
http://bugzilla.openedhand.com/show_bug.cgi?id=2087
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Debugging code is not meant to be run in the nominal code path. Use
G_UNLIKELY to be reduce the number of bubbles in the instruction
pipeline.
Took the opportunity to re-indent the macros.
Whether events come from the main loop source or from
clutter_x11_handle_event(), we need to feed them to the backend
virtual handle_event function. This fixes problems with clients
using clutter_x11_handle_event() hanging because
GLXBufferSwapComplete events aren't received.
http://bugzilla.openedhand.com/show_bug.cgi?id=2101
When uploading texture data the cogl-texture-2d-sliced backend was
using _cogl_texture_prepare_for_upload to create a bitmap suitable for
upload but then it was using the original bitmap instead of the new
bitmap for the data. This was causing any format conversions performed
by cogl_texture_prepare_for_upload to be ignored.
http://bugzilla.openedhand.com/show_bug.cgi?id=2059
In commit abe91784c4 I changed cogl-texture so that it would use the
OpenGL mechanism to specify a different internal texture format from
the image format so that it can do the conversion instead of
Cogl. However under GLES the internal format and the image format must
always be the same and it only supports a limited set of formats. This
patch changes _cogl_texture_prepare_for_upload so that it does the
conversion using the cogl bitmap code when compiling for GLES.
http://bugzilla.openedhand.com/show_bug.cgi?id=2059
There was a check at the bottom of the loop which sets up the state
for each of the layers so that it would break from the loop when the
maximum number of layers is reached. However after doing this it would
not increment 'i'. 'i' is later used to disable the remaining layers
so it would end up disabling the last layer it just set up.
This patch moves the check to be part of the loop condition so that
the check is performed after incrementing 'i'.
http://bugzilla.openedhand.com/show_bug.cgi?id=2064
The warning displayed when too many layers are used had an off-by-one
error so that it would display even if exactly the maximum number is
used. There was also a missing space at the end of the line in the
message which looked wrong when displayed on the terminal.
http://bugzilla.openedhand.com/show_bug.cgi?id=2064
The ClutterCrossingEvent data structure contains the coordinates
of the crossing; they are regularly filed out by Clutter and by
the backend event processing code. And yet clutter_event_get_coords()
returns (0, 0) because it thinks that CLUTTER_ENTER and CLUTTER_LEAVE
events do not have coordinates.
Whenever we are warning inside ClutterActor we prefer the actor's name
to its type, if the name is set. The current code is made less readable
by the use of the ternary operator:
priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (self)
This looks like a job for a simple convenience function.
cogl_path_arc_rel was never in any public headers so it isn't part of
the public API. It also has a slightly inconsistent name because the
rest of the relative path functions are called cogl_path_rel_*. This
patch makes it static for now to make it more obvious that it isn't
public. The name has changed to _cogl_path_rel_arc.
Timers and counters might not exist, so make every section of the
profile report depend on the object that it is querying.
This fixes the profile report generation that was broken by commit
8146d8d08d.
For internal use we should have a get_stage_internal() variant that
avoids type checks and calls to public functions. The implementation
is trivial enough, and it will avoid (scene graph depth + 1) type
checks and (scene graph depth) function calls.
If a path is copied and then appended to, the copy needs to have the
last sub path truncated so that it fits in the total path size in case
the original path was modified. However the path size check was broken
so if the copied path had more than one sub path it would fail.
Previously the clip stack code was trying to detect when the
orientation of the on-screen rectangle had changed by checking if the
order of the y-coordinates on the left edge was different from the
order the x-coordinates on the top edge. This doesn't work for some
rotations which was causing the clip planes to clip the wrong side of
the line. This patch makes it detect the orientation by calculating
the signed area which is a standard computer graphics algorithm.
http://bugzilla.openedhand.com/show_bug.cgi?id=2079
When drawing a path with only a single sub path, Cogl uses the
'even-odd' fill rule which means that if a part of the path intersects
with another part then the intersection would be inverted. However
when combining sub paths it treats them as separate paths and then
unions them together. This doesn't match the semantics of the even-odd
rule in SVG and Cairo. This patch makes it so that a new sub path is
just drawn as another triangle fan so that it will continue to invert
the stencil buffer. This is also much simpler and more efficient as
well as being more correct.
http://bugzilla.openedhand.com/show_bug.cgi?id=2088