There are three potential variants to add a child inside a Box
with a BinLayout:
- clutter_box_pack(), a variadic argument function which
allows passing arbitrary LayoutMeta properties and values;
- clutter_bin_layout_add(), which uses the backpointer to
the container from the LayoutManager and sets the layout
properties directly without GValue (de)marshalling
- clutter_container_add_actor() and
clutter_bin_layout_set_alignment(), similar to the
clutter_bin_layout_add() function above, but split in two
The test-box interactive test should exercise all three variants.
The ClutterBox::add method is a simple wrapper around the Container
add_actor() method and the LayoutManager layout properties API. It
allows adding an actor to a Box and setting the layout properties in
one call.
If the LayoutManager used by the Box does not support layout properties
then the add() method short-circuits out.
Along with the varargs version of the method there's also a vector-based
variant, for language bindings to use.
Each actor managed by a BinLayout policy should reside inside its
own "layer", with horizontal and vertical alignment. The :x-align
and :y-align properties of the BinLayout are the default alignment
policies, which are copied to each new "layer" when it is created.
The set_alignment() and get_alignment() methods of BinLayout can
be changed to operate on a specific "layer".
The whole machinery uses the new ChildMeta support inside the
LayoutManager base abstract class.
Current parsing of units has a number of shortcomings:
* a number followed by trailing space (without any unit specified) was
not recognized,
* "5 emeralds" was parsed as 5em,
* the way we parse the digits after the separator makes us lose
precision for no good reason (5.0 is parsed as 5.00010014...f which
makes g_assert_cmpfloat() fail)
Let's define a stricter grammar we can recognize and try to do so. The
description is in EBNF form, removing the optional <> which is a pain
when having to write DocBook, and using '' for the terminal symbols.
Last step, add more ClutterUnits unit test to get a better coverage of
the grammar we want to parse.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Parse #rgb and #rrggbb in addition to forms with the alpha channel
specified. This allows conversion of colour strings from documents such as
CSS where the alpha channel is not specified when using '#' notation.
This patch also adds the relevant conformance test.
The user-initiated resize is conflicting with the allocated size. This
happens because we change the size of the stage's X Window behind the
back of the size allocation machinery.
Instead, we should change the size of the actor whenever we receive a
ConfigureNotify event to reflect the new size of the actor.
I just wasted a silly amount time trying to bisect an apparently broken
cogl-test-multitexture until I realized it was just silently failing to load
any textures.
This unit verifies that an Actor class will invoke the get_preferred_*
virtual functions unless the caching is in effect; it also verifies
that the cached values are correctly evicted.
The size requisition and allocation mechanisms should be thoroughly
tested to avoid unwanted regressions.
For starters, we can test the explicit size setting and the side
effects of calling clutter_actor_set_size().
The test-script.json UI definition still used old types, like
ClutterLabel and ClutterCloneTexture. It should move to the classes
that have replaced them.
We need to test that the depth sorting of ClutterGroup works correctly
in case we wish to change the data structure that stores the children,
and do so without changing the default behaviour.
in tests/interactive/Makefile.am add wrapper.sh to EXTRA_DIST otherwise
interactive unit tests wont be runnable when building from distributed
tarballs.
We should follow the convention for boxed types initializers of:
<type_name>_from_<another_type> (boxed, value)
For ClutterUnits as well; so:
clutter_units_pixels -> clutter_units_from_pixels
clutter_units_em -> clutter_units_from_em
...
We should still keep the short-hand version as a macro, though.
The ClutterColor conformance test should have a unit for verifying
the RGB<->HLS conversion code, especially the ability to roundtrip
between the two colorspaces.
AM_LDFLAGS is ignored by the LDFLAGS target, and it's also not the right
place to put the libraries used by the linker.
Thanks to Vincent Untz for spotting this.
The perspective test was used essentially to determine whether the
perspective set up in COGL worked correctly. The perspective code
has been changed a lot since Clutter 0.3: we rely on client-side
matrices and we use floating point; so, all the conditions the test
was supposed to verify do not exist anymore.
Fixes and adds a unit test for creating and drawing using materials with
COGL_INVALID_HANDLE texture layers.
This may be valid if for example the user has set a texture combine string
that only references a constant color.
_cogl_material_flush_layers_gl_state will bind the fallback texture for any
COGL_INVALID_HANDLE layer, later though we could explicitly check when the
current blend mode does't actually reference a texture source in which case
binding the fallback texture is redundant.
This tests drawing using cogl_rectangle, cogl_polygon and
cogl_vertex_buffer_draw.
To allow for flushing of batched geometry within Cogl we can't support users
directly calling glReadPixels. glReadPixels is also awkward, not least
because it returns upside down image data.
All the unit tests have been swithed over and clutter_stage_read_pixels now
sits on top of this too.
test-cogl-tex-getset was assuming it was dealing with
COGL_PIXEL_FORMAT_RGBA_8888 but since merging the premultiplcation branch
the pixel format is actually COGL_PIXEL_FORMAT_RGBA_8888_PRE
Texture data is now in premultiplied format and the shader should
output a premultiplied color if the default blend mode is being
used. Shaders that directly manipulate the rgb values now
unpremultiply and premultiply again afterwards.
Now that we can safely check for an uninitialized Clutter we
don't have side effects in calling one of the functions like
clutter_x11_enable_xinput(), which require to be called before
any other Clutter function.
The input device API is split halfway thorugh the backends in a very
weird way. The data structures are private, as they should, but most
of the information should be available in the main API since it's
generic enough.
The device type enumeration, for instance, should be common across
every backend; the accessors for device type and id should live in the
core API. The internal API should always use ClutterInputDevice and
not the private X11 implementation when dealing with public structures
like ClutterEvent.
By adding accessors for the device type and id, and by moving the
device type enumeration into the core API we can cut down the amount
of symbols private and/or visible only to the X11 backends; this way
when other backends start implementing multi-pointer support we can
share the same API across the code.
The test-easing interactive demo for the high-level animation API
is a bit "flat". Instead of using a Rectangle actor we should
probably be using something more "interesting" -- like a CairoTexture
with a gradient.
In order to chain up animations using clutter_actor_animate() and
friends you have to use an idle handler that guarantees that the
main loop spins at least once after the animation pointer has been
detached from the actor.
This has several drawbacks, first and foremost the fact that the
slice of the main loop for the idle handler might be starved by
other operations, like redrawing. This inevitably leads to tricks
with priorities and the like, contributing to the overall complexity.
Instead, we should guarantee that the animation instance created by
clutter_actor_animate() is valid for the ::completed signal until
it reaches its default handler; after that, the animation is detached
from the actor and destroyed. This means that it's possible to
create a new animation after the first is complete by simply using
g_signal_connect_after().
This unfortunately makes it impossible to keep a reference to the
animation pointer attached to the actor by using g_object_ref(); a
way to "fix" this would be to have a clutter_animation_attach()
and a clutter_animation_detach() pair of methods that allow attaching
any animation to an actor. This might overcomplicate what it is
the simple animation API, though, so it's currently not implemented
and left for future versions.
The test-easing interactive demo has been modified to show how
the animation queuing works by adding a command line switch that
recenters the animated actor once the first animation has ended.
In order to be ready for the next major version of GLib we need to
disable single header inclusion by using the G_DISABLE_SINGLE_INCLUDES
define in the build process.
The test has been broken since the change to use floats instead of
fixed point because it was passing degrees to sin and cos but they
expect radians.
It was further broken since the timeline changes because it was
directly using the parameter of the new-frame signal as a frame number
but it now represents the elapsed time.
We need to fix the VBO premultiplication; we also do not need to
forcibly queue a redraw in an idle handler: the timeline and the
master clock will do that for us.
The test-actors test (and its clones, test-actor-clone and
test-paint-wrapper) was written a long time ago for a different API
and has been tweaked to bits. We should probably have something a
little bit more complicated, but at least we should not use semantics
and coding patterns from Clutter 0.2, otherwise we won't be testing
anything except that Clutter 0.2 worked.
Merge branch 'premultiplication'
[cogl-texture docs] Improves the documentation of the internal_format args
[test-premult] Adds a unit test for texture upload premultiplication semantics
[fog] Document that fogging only works with opaque or unmultipled colors
[test-blend-strings] Explicitly request RGBA_888 tex format for test textures
[premultiplication] Be more conservative with what data gets premultiplied
[bitmap] Fixes _cogl_bitmap_fallback_unpremult
[cogl-bitmap] Fix minor copy and paste error in _cogl_bitmap_fallback_premult
Avoid unnecesary unpremultiplication when saving to local data
Don't unpremultiply Cairo data
Default to a blend function that expects premultiplied colors
Implement premultiplication for CoglBitmap
Use correct texture format for pixmap textures and FBO's
Add cogl_color_premultiply()