profile/ivi/clutter.git
13 years agocogl: Revert "build: Remove unused variable"
Damien Lespiau [Tue, 30 Nov 2010 16:36:56 +0000 (16:36 +0000)]
cogl: Revert "build: Remove unused variable"

Having ctx here produces a warning on GLES. However it's needed for Big
GL as we have at the top of the file:

 #ifdef HAVE_COGL_GL
 #define glClientActiveTexture ctx->drv.pf_glClientActiveTexture
 #endif

This reverts commit 27a3a2056a245aca64b8e3a7d82b7976c13e897a.

13 years agoegl: Fix compilation with EGLX
Damien Lespiau [Tue, 30 Nov 2010 16:22:49 +0000 (16:22 +0000)]
egl: Fix compilation with EGLX

That what happens when you test things only with 2 configure options
instead of 3. The 2 tested compile, the third one breaks. Another good
catch for the eglx bot!

13 years agocogl: Fix unused variable warning with GLES2
Damien Lespiau [Tue, 30 Nov 2010 16:03:26 +0000 (16:03 +0000)]
cogl: Fix unused variable warning with GLES2

This shader variable is only used with big GL.

13 years agoegl: Don't try to use stage_x11 with non-X winsys
Damien Lespiau [Tue, 30 Nov 2010 15:06:12 +0000 (10:06 -0500)]
egl: Don't try to use stage_x11 with non-X winsys

The access to stage_x11 has to be protected by COGL_HAS_X11_SUPPORT.

13 years agoevdev: Add a comment to revisit the GSource management with glib 2.28
Damien Lespiau [Tue, 30 Nov 2010 14:50:13 +0000 (14:50 +0000)]
evdev: Add a comment to revisit the GSource management with glib 2.28

With glib 2.28, we'll be able to have one GSource per device manager
with child sources for earch device. Make a note to update the code
in a few months.

13 years agobuild: Remove unused variable
Damien Lespiau [Fri, 19 Nov 2010 19:51:39 +0000 (14:51 -0500)]
build: Remove unused variable

and be 100% warning free again.

13 years agoevdev: Enable the compilation of the evdev backend for eglnative
Damien Lespiau [Fri, 19 Nov 2010 19:31:51 +0000 (14:31 -0500)]
evdev: Enable the compilation of the evdev backend for eglnative

Not tested (but checked that it compiles).

There's no reason to only enable the check for the cex100. Hopefully
should work.

We make sure not to enable both the evdev and the tslib backend at the
same time as the DeviceManager is a singleton and we can't have both
subclasses at the same time for now.

13 years agoevdev: Don't oveflow when translating buttons to masks
Damien Lespiau [Fri, 19 Nov 2010 19:19:52 +0000 (14:19 -0500)]
evdev: Don't oveflow when translating buttons to masks

An array is used to translate the button to its mask. Clutter defines
the masks for button 1 to 5 but we report BTN_LEFT..BTN_TASK ie
0x110..0x117. We need to pad the array for the translation not to access
random data for buttons between 0x115 and 0x117.

13 years agoinput-device: Warn if the device has no associated stage
Damien Lespiau [Fri, 12 Nov 2010 00:11:27 +0000 (19:11 -0500)]
input-device: Warn if the device has no associated stage

Discarding the event without any warning when the device has no
associated stage makes it hard to find the bug for people implementing
new event backends. We should really warn for that abnormal condition in
_clutter_input_device_update().

13 years agoevdev: Add mouse support
Damien Lespiau [Fri, 12 Nov 2010 00:07:35 +0000 (19:07 -0500)]
evdev: Add mouse support

We know support EV_REL events comming from evdev devices. This addition
is pretty straigthforward, it adds a x,y per GSource listening to a
evdev device, updates from EL_REL (relative) events and craft new
ClutterMotionEvents. As for buttons, BTN_LEFT..BTN_TASK are translated
to ClutterButtonEvents with 1..8 as button number.

13 years agoevdev: Only create a xkbcommon mapping for keyboard devices
Damien Lespiau [Tue, 9 Nov 2010 18:14:37 +0000 (13:14 -0500)]
evdev: Only create a xkbcommon mapping for keyboard devices

13 years agoevdev: Close the device gracefully in case of a read() error
Damien Lespiau [Tue, 9 Nov 2010 18:02:53 +0000 (13:02 -0500)]
evdev: Close the device gracefully in case of a read() error

Even with udev, the read fails before udev has a chance to signal the
change. Hence (and to handle errors gracefully anyway), let's remove the
device from the device manager in case of a read() error.

13 years agoevdev: Merge clutter-event-evdev.[ch] into the device manager
Damien Lespiau [Tue, 9 Nov 2010 17:50:23 +0000 (12:50 -0500)]
evdev: Merge clutter-event-evdev.[ch] into the device manager

The device manager now fully owns the GSources corresponding to the
devices it manages. This will allow not only to remove the source when
udev signals a device removal but also handle read() errors gracefully
by removing the faulty device from the manager.

13 years agoevdev: Support hotplug (addition/removal) of evdev devices
Damien Lespiau [Tue, 9 Nov 2010 16:56:26 +0000 (11:56 -0500)]
evdev: Support hotplug (addition/removal) of evdev devices

Just connect to the GUdevClient "uevent" signal and deals with
"add"/"remove" commands. This drives the installation/removal of
GSource to listen to the device.

13 years agoevdev: Make sure we only add evdev devices
Damien Lespiau [Mon, 8 Nov 2010 16:38:16 +0000 (11:38 -0500)]
evdev: Make sure we only add evdev devices

Let's use the sysfs path of the device to make sure we only load evdev
device, not legacy mousedev ones for instance. We rely on the sysfs
API/ABI guarantees and look for devices finishing by /input%d/event%d.

13 years agoevdev: First stab at an evdev backend
Damien Lespiau [Thu, 4 Nov 2010 14:38:32 +0000 (10:38 -0400)]
evdev: First stab at an evdev backend

This backend is a event backend that can be enabled for EGL (for now).
It uses udev (gudev) to query input devices on a linux system, listens to
keyboard events from input devices and xkbcommon to translate raw key
codes into key keysyms.

This commit only supports key events, more to follow.

13 years agoevdev: Fix the unicode_value for new ClutterEvents
Damien Lespiau [Thu, 4 Nov 2010 14:09:28 +0000 (10:09 -0400)]
evdev: Fix the unicode_value for new ClutterEvents

Looking at what the X11 backend does: the unicode value is being
translated to the unicode codepoint of the symbol if possible. Let's do
the same then.

Before that, key events for say KEY_Right (0xff53) had the unicode_value
set to the keysym, which meant "This key event is actually printable and
is Unicode codepoint is 0xff53", which lead to interesting results.

13 years agoevdev: Factor out the xkbcommon code from the wayland client backend
Damien Lespiau [Thu, 4 Nov 2010 10:59:22 +0000 (06:59 -0400)]
evdev: Factor out the xkbcommon code from the wayland client backend

The wayland client code has support for translating raw linux input
device key codes coming from the wayland compositor into key symbols
thanks to libxkbcommon.

A backend directly listening to linux input devices (called evdev, just
like the Xorg one) could use exactly the same code for the translation,
so abstract it a bit in a separate file.

13 years agomoduleset: Add gstreamer and gst-plugins-good
Emmanuele Bassi [Tue, 30 Nov 2010 10:35:17 +0000 (10:35 +0000)]
moduleset: Add gstreamer and gst-plugins-good

13 years agomoduleset: Disable stand-alone Cally
Emmanuele Bassi [Tue, 30 Nov 2010 10:34:59 +0000 (10:34 +0000)]
moduleset: Disable stand-alone Cally

13 years agomoduleset: Switch gtk2 to the 2.24 branch
Emmanuele Bassi [Tue, 30 Nov 2010 10:34:38 +0000 (10:34 +0000)]
moduleset: Switch gtk2 to the 2.24 branch

13 years agoPost-release version bump to 1.5.9
Emmanuele Bassi [Mon, 29 Nov 2010 14:21:21 +0000 (14:21 +0000)]
Post-release version bump to 1.5.9

13 years agoRelease Clutter 1.5.8 (snapshot)
Emmanuele Bassi [Mon, 29 Nov 2010 14:09:09 +0000 (14:09 +0000)]
Release Clutter 1.5.8 (snapshot)

13 years agocogl-shader.c: Don't add the common boilerplate twice
Neil Roberts [Mon, 29 Nov 2010 10:55:49 +0000 (10:55 +0000)]
cogl-shader.c: Don't add the common boilerplate twice

In 6246c2bd6 I moved the code to add the boilerplate to a shader to a
separate function and also made it so that the common boilerplate is
added as a separate string to glShaderSource. However I didn't notice
that the #define for the vertex and fragment shaders already includes
the common part so it was being added twice. Mesa seems to accept this
but it was causing problems on the IMG driver because COGL_VERSION was
defined twice.

13 years agocogl-pipeline-glsl: Use char* instead of GLchar*
Neil Roberts [Mon, 29 Nov 2010 10:51:40 +0000 (10:51 +0000)]
cogl-pipeline-glsl: Use char* instead of GLchar*

It appears that some GLES2 headers don't define GLchar and it works
just as well to use a regular char.

13 years agodocs: Close a tag
Emmanuele Bassi [Mon, 29 Nov 2010 12:23:14 +0000 (12:23 +0000)]
docs: Close a tag

13 years agoUpdate NEWS
Emmanuele Bassi [Mon, 29 Nov 2010 12:01:20 +0000 (12:01 +0000)]
Update NEWS

13 years agoMerge remote branch 'elliot/cookbook-animations-scaling'
Emmanuele Bassi [Mon, 29 Nov 2010 11:56:36 +0000 (11:56 +0000)]
Merge remote branch 'elliot/cookbook-animations-scaling'

* elliot/cookbook-animations-scaling:
  cookbook: Add recipe for animated scaling of an actor
  cookbook: Add example of scaling a texture
  cookbook: Added "animated scaling" recipe skeleton
  cookbook: Added animated scaling example

13 years agotext: Optimise get_preferred_height for single-line-mode
Chris Lord [Thu, 25 Nov 2010 15:11:42 +0000 (15:11 +0000)]
text: Optimise get_preferred_height for single-line-mode

Don't calculate an extra layout in clutter_text_get_preferred_height for
single-line strings, when it's unnecessary. There's no need to set the
width of a layout when in single-line mode, as wrapping will not happen.

13 years agoUpdate NEWS file
Emmanuele Bassi [Mon, 29 Nov 2010 11:19:16 +0000 (11:19 +0000)]
Update NEWS file

13 years agoshader-effect: Remove unused function
Emmanuele Bassi [Mon, 29 Nov 2010 10:59:16 +0000 (10:59 +0000)]
shader-effect: Remove unused function

The reset_uniforms() internal function is not used any more because the
CoglProgram cannot be reset post-creation - hence the uniforms cannot
change.

13 years agoClutterShaderEffect: Don't throw away the program for a new actor
Neil Roberts [Sat, 27 Nov 2010 16:26:20 +0000 (16:26 +0000)]
ClutterShaderEffect: Don't throw away the program for a new actor

Previously when the shader effect is used with a new actor it would
end up throwing away the old program. I don't think this is neccessary
and it means if you use an effect to temporarily bind to an actor then
it will recompile the shader whenever it is applied.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2454

13 years agoClutterOffscreenEffect: Don't throw away the material for a new actor
Neil Roberts [Sat, 27 Nov 2010 16:27:59 +0000 (16:27 +0000)]
ClutterOffscreenEffect: Don't throw away the material for a new actor

When a new actor is set for ClutterOffscreenEffect it would throw away
the old material. I don't think there is anything specifically tied to
the actor in the material so throwing away just loses Cogl's cached
state about the material. This ends up relinking the shader every time
a new actor is set in ClutterShaderEffect.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2454

13 years agoDon't bail out from creating the FBO if we don't have it yet.
Tomeu Vizoso [Sat, 27 Nov 2010 15:07:01 +0000 (16:07 +0100)]
Don't bail out from creating the FBO if we don't have it yet.

This happens when reattaching an effect to another actor.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2453

13 years agoSet the signal handler to 0 when disconnecting it.
Tomeu Vizoso [Sat, 27 Nov 2010 15:04:50 +0000 (16:04 +0100)]
Set the signal handler to 0 when disconnecting it.

Otherwise we'll try to disconnect it again later.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2452

13 years agoshader-effect: Zero out ShaderUniform
Emmanuele Bassi [Mon, 29 Nov 2010 08:55:13 +0000 (08:55 +0000)]
shader-effect: Zero out ShaderUniform

Do not use the compiler to zero the first field of the GValue member,
since it's apparently non-portable. As we're allocating memory anyway we
can let the slice allocator do the zero-ing for us.

Mentioned in: http://bugzilla.clutter-project.org/show_bug.cgi?id=2455

13 years agocogl_pipeline_equal: Fix the comparison for layer texture equality
Neil Roberts [Fri, 26 Nov 2010 15:23:15 +0000 (15:23 +0000)]
cogl_pipeline_equal: Fix the comparison for layer texture equality

Before commit 49898d43 CoglPipeline would compare whether a pipeline
layer's texture is equal by fetching the underlying GL handle. I
changed that so that it would only compare the CoglHandles because
that commit removes the GL handle texture overrides and sliced
textures instead log the underlying primitive texture. However I
forgot that the primitives don't always use
_cogl_texture_foreach_sub_texture_in_region when the quad fits within
the single texture so it won't use a texture override. This meant that
atlas textures and sub textures get logged with the atlas handle so
the comparison still needs to be done using the GL handles. It might
be nice to add a CoglTexture virtual to get the underlying primitive
texture instead to avoid having the pipeline poke around with GL
handles.

13 years agotests: Adds test-cogl-perf micro benchmark
Robert Bragg [Mon, 1 Nov 2010 13:53:16 +0000 (13:53 +0000)]
tests: Adds test-cogl-perf micro benchmark

This is mostly a stub, starting point for a one-stop Cogl
micro-benchmarking tool. The first test it adds is one that tries to
hammer the Cogl journal, but no doubt there are lots of other things we
should be regularly testing. Currently the aim is that the tool will be
able to also generate reports which we can collect to keep track of
performance changes over time.

13 years agoprimitives: avoid leaking polygon override materials
Robert Bragg [Thu, 25 Nov 2010 20:12:36 +0000 (20:12 +0000)]
primitives: avoid leaking polygon override materials

If we have to make override changes to the user's source material to
handle cogl_polygon then we need to make sure we unref the override
material at the end.

13 years agoFixed "the the" repetitions in some doc strings
Alexandre Quessy [Thu, 25 Nov 2010 18:13:51 +0000 (13:13 -0500)]
Fixed "the the" repetitions in some doc strings

http://bugzilla.clutter-project.org/show_bug.cgi?id=2450

13 years agopipeline: Simplify layer change notifications to backend
Robert Bragg [Thu, 25 Nov 2010 13:19:59 +0000 (13:19 +0000)]
pipeline: Simplify layer change notifications to backend

Previously we used the layers->backend_priv[] members to determine when
to notify backends about layer changes, but it entirely up to the
backends if they want to associate private state with layers, even
though they may still be interested in layer change notifications (they
may associate layer related state with the owner pipeline).

We now make the observation that in
_cogl_pipeline_backend_layer_change_notify we should be able to assume
there can only be one backend currently associated with the layer
because we wouldn't allow changes to a layer with multiple dependants.
This means we can determine the backend to notify by looking at the
owner pipeline instead.

13 years agoclutter-offscreen-effect: Don't recreate the material when FBO changes
Neil Roberts [Thu, 25 Nov 2010 10:56:50 +0000 (10:56 +0000)]
clutter-offscreen-effect: Don't recreate the material when FBO changes

Previously whenever the size of the FBO changes it would create a new
material and attach the texture to it. This is not good for Cogl
because it throws away any cached state for the material. In
test-rotate the size of the FBO changes constantly so it effectively
uses a new material every paint. For shader effects this also ends up
relinking the shader every paint because the linked programs are part
of the material state.

13 years agocogl-context: Get rid of the features_cached member
Neil Roberts [Wed, 24 Nov 2010 18:37:47 +0000 (18:37 +0000)]
cogl-context: Get rid of the features_cached member

The features_cached member of CoglContext is intended to mark when
we've calculated the features so that we know if they are ready in
cogl_get_features. However we always intialize the features while
creating the context so features_cached will never be FALSE so it's
not useful. We also had the odd behaviour that the COGL_DEBUG feature
overrides were only applied in the first call to
cogl_get_features. However there are other functions that use the
feature flags such as cogl_features_available that don't use this
function so in some cases the feature flags will be interpreted before
the overrides are applied. This patch makes it always initialize the
features and apply the overrides immediately while creating the
context. This fixes a problem with COGL_DEBUG=disable-arbfp where the
first material flushed is done before any call to cogl_get_features so
it may still use ARBfp.

13 years agoLower the priority of the GLSL pipeline backend
Neil Roberts [Wed, 24 Nov 2010 17:42:34 +0000 (17:42 +0000)]
Lower the priority of the GLSL pipeline backend

Now that the GLSL backend can generate code it can effectively handle
any pipeline unless there is an ARBfp program. However with current
open source GL drivers the ARBfp compiler is more stable so it makes
sense to prefer ARBfp when possible. The GLSL backend is also lower
than the fixed function backend on the assumption that any driver that
supports GLSL will also support ARBfp so it's quicker to try the fixed
function backend next.

13 years agoAdd a COGL_DEBUG option to disable the fixed function pipeline backend
Neil Roberts [Wed, 24 Nov 2010 17:29:00 +0000 (17:29 +0000)]
Add a COGL_DEBUG option to disable the fixed function pipeline backend

This adds COGL_DEBUG=disable-fixed to disable the fixed function
pipeline backend. This is needed to test the GLSL shader generation
because otherwise the fixed function backend would always override it.

13 years agoDon't use the fixed function backend if there is a user program
Neil Roberts [Wed, 24 Nov 2010 17:33:07 +0000 (17:33 +0000)]
Don't use the fixed function backend if there is a user program

The fixed function pipeline backend can't handle a user program so it
should bail out if one is given.

13 years agoAdd a warning message when no usable Cogl pipeline backend is found
Neil Roberts [Wed, 24 Nov 2010 17:37:55 +0000 (17:37 +0000)]
Add a warning message when no usable Cogl pipeline backend is found

If none of the pipeline backends can handle the state then it now
displays a warning so the developer has a chance to work out what's
going on.

13 years agocogl-pipeline-glsl: Don't use gl_PointCoord on OpenGL
Neil Roberts [Wed, 24 Nov 2010 15:30:56 +0000 (15:30 +0000)]
cogl-pipeline-glsl: Don't use gl_PointCoord on OpenGL

We don't want to use gl_PointCoord to implement point sprites on big
GL because in that case we already use glTexEnv(GL_COORD_REPLACE) to
replace the texture coords with the point sprite coords. Although GL
also supports the gl_PointCoord variable, it requires GLSL 1.2 which
would mean we would have to declare the GLSL version and check for
it. We continue to use gl_PointCoord for GLES2 because it has no
glTexEnv function.

13 years agoAdd a conformance test that uses a vertex shader with no frag shader
Neil Roberts [Sat, 17 Jul 2010 13:11:02 +0000 (14:11 +0100)]
Add a conformance test that uses a vertex shader with no frag shader

This creates a material which users a layer to override the color of
the rectangle. A simple vertex shader is then created which just
emulates the fixed function pipeline. No fragment shader is
added. This demonstrates a bug where the layer state is getting
ignored when a vertex shader is in use.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2221

13 years agoRemove the fragment shader generation from the GLES2 wrapper
Neil Roberts [Tue, 23 Nov 2010 14:47:17 +0000 (14:47 +0000)]
Remove the fragment shader generation from the GLES2 wrapper

The GLES2 wrapper no longer needs to generate any fragment shader
state because the GLSL pipeline backend will always give the wrapper a
custom fragment shader. This simplifies a lot of the state comparison
done by the wrapper. The fog generation is also removed even though
it's actually part of the vertex shader because only the fixed
function pipeline backend actually calls the fog functions so it would
be disabled when using any of the other backends anyway. We can fix
this when the two shader backends also start generating vertex
shaders.

13 years agoDisable the fixed function backend for GLES2
Neil Roberts [Tue, 23 Nov 2010 14:51:49 +0000 (14:51 +0000)]
Disable the fixed function backend for GLES2

GLES2 doesn't really support fixed function so if we disable it we can
remove the fixed function wrappers from the GLES2 Cogl backend.

13 years agocogl-pipeline-glsl: Generate the alpha test snippet under GLES2
Neil Roberts [Mon, 22 Nov 2010 18:33:49 +0000 (18:33 +0000)]
cogl-pipeline-glsl: Generate the alpha test snippet under GLES2

GLES2 has no glAlphaFunc function so we need to simulate the behaviour
in the fragment shader. The alpha test function is simulated with an
if-statement and a discard statement. The reference value is stored as
a uniform.

13 years agocogl-pipeline: Add getters for the alpha test state
Neil Roberts [Mon, 22 Nov 2010 18:32:43 +0000 (18:32 +0000)]
cogl-pipeline: Add getters for the alpha test state

This adds two public functions:

 cogl_pipeline_get_alpha_test_function
   and
 cogl_pipeline_get_alpha_test_reference.

13 years agocogl: Separate out state flags for the alpha test func and ref
Neil Roberts [Mon, 22 Nov 2010 18:29:50 +0000 (18:29 +0000)]
cogl: Separate out state flags for the alpha test func and ref

Previously the flag to mark the differences for the alpha test
function and reference value were conflated into one. However this is
awkward when generating shader code to simulate the alpha testing for
GLES 2 because in that case changing the function would need a
different program but changing the reference value just requires
updating a uniform. This patch makes the function and reference have
their own state flags.

13 years agoRemove the disabling of layer constants for GLES2
Neil Roberts [Mon, 22 Nov 2010 16:44:11 +0000 (16:44 +0000)]
Remove the disabling of layer constants for GLES2

The GLSL shader generation supports layer combine constants so there's
no need to disable it for GLES2. It looks like there was also code for
it in the GLES2 wrapper so I'm not sure why it was disabled in the
first place.

13 years agoGenerate GLSL in the CoglPipeline GLSL backend
Neil Roberts [Fri, 19 Nov 2010 10:44:27 +0000 (10:44 +0000)]
Generate GLSL in the CoglPipeline GLSL backend

The GLSL pipeline backend can now generate code to represent the
pipeline state in a similar way to the ARBfp backend. Most of the code
for this is taken from the GLES 2 wrapper.

13 years agoMove the cogl shader boilerplate setting code to a separate function
Neil Roberts [Mon, 22 Nov 2010 12:15:35 +0000 (12:15 +0000)]
Move the cogl shader boilerplate setting code to a separate function

_cogl_shader_compile_real had some code to create a set of strings to
combine the boilerplate code with a shader before calling
glShaderSource. This has now been moved to its own internal function
so that it could be used from the GLSL pipeline backend as well.

13 years agoMove need_texture_combine_separate to cogl-pipeline
Neil Roberts [Fri, 19 Nov 2010 15:42:26 +0000 (15:42 +0000)]
Move need_texture_combine_separate to cogl-pipeline

need_texture_combine_separate is moved to cogl-pipeline.c and renamed
to _cogl_pipeline_need_texture_combine_separate. The function is
needed by both the ARBfp and GLSL codegen backends so it makes sense to
share it.

13 years agoMove find_arbfp_authority to cogl-pipeline.c
Neil Roberts [Fri, 19 Nov 2010 10:43:52 +0000 (10:43 +0000)]
Move find_arbfp_authority to cogl-pipeline.c

The code for finding the arbfp authority for a pipeline should be the
same as finding the GLSL authority. So that the code can be shared the
function has been moved to cogl-pipeline.c and renamed to
_cogl_pipeline_find_codegen_authority.

13 years agocogl: Rename arbfp_source_buffer to fragment_source_buffer
Neil Roberts [Mon, 1 Nov 2010 17:25:26 +0000 (17:25 +0000)]
cogl: Rename arbfp_source_buffer to fragment_source_buffer

Only one of the material backends can be generating code at the same
time so it seems to make sense to share the same source buffer between
arbfp and glsl. The new name is fragment_source_buffer in case we
later want to create a new buffer for the vertex shader. That probably
couldn't share the same buffer because it will likely need to be
generated at the same time.

13 years agocogl: Include exported pacakges information in GIR
Evan Nemerson [Sat, 20 Nov 2010 07:27:46 +0000 (23:27 -0800)]
cogl: Include exported pacakges information in GIR

http://bugzilla.clutter-project.org/show_bug.cgi?id=2438

13 years agodocs: Update documentation to reflect automatic map/unmap/etc.
Chris Lord [Wed, 24 Nov 2010 16:34:21 +0000 (16:34 +0000)]
docs: Update documentation to reflect automatic map/unmap/etc.

Update the ClutterActor documentation to reflect the new automatic
map/unmap/realize/unrealize implementations.

13 years agoactor: Use the internal child list for map/unmap
Chris Lord [Tue, 26 Oct 2010 16:09:24 +0000 (17:09 +0100)]
actor: Use the internal child list for map/unmap

Use the internal child list for the default map/unmap vfuncs. This removes
the requirement for non-container composite actors to implement their own
map/unmap functions.

13 years agoactor: re-work unrealize to work with composite actors
Robert Bragg [Wed, 20 Oct 2010 17:26:01 +0000 (18:26 +0100)]
actor: re-work unrealize to work with composite actors

Unrealizing an actor is a recursive process that needs to traverse the
children of an actor to ensure they are also unrealized. This maintains
the invariant that if any given actor is marked as unrealized then you
know that all its children have also been unrealized.

The previous implementation would use the container interface's
foreach_with_internals vfunc to explicitly traverse the children of
container actors but this didn't consider composite actors that aren't
containers.

Since clutter-actor now maintains an explicit list of children we can
also handle composite actors that aren't containers using
_clutter_actor_traverse.

13 years agoactor: make _clutter_actor_traverse more flexible
Robert Bragg [Wed, 20 Oct 2010 14:40:30 +0000 (15:40 +0100)]
actor: make _clutter_actor_traverse more flexible

This makes it possible to choose the traversal order; either depth first
or breadth first and when visiting actors in a depth first order there
is now a callback called before children are traversed and one called
after. Some tasks such as unrealizing actors need to explicitly control
the traversal order to maintain the invariable that all children of an
actor are unrealized before we actually mark the parent as unrealized.

The callbacks are now passed the relative depth in the graph of the
actor being visited and instead of only being able to return a boolean
to bail out of further traversal it can now do one of: continue,
skip_children or break. To implement something like unrealize it's
desirable to skip children that you find have already been unrealized.

13 years agoClutterX11TexturePixmap: Optimize ConfigureEvent handling
Owen W. Taylor [Tue, 5 Oct 2010 17:05:45 +0000 (13:05 -0400)]
ClutterX11TexturePixmap: Optimize ConfigureEvent handling

ClutterX11TexturePixmap watches for configure events to tell when it
needs to name a new pixmap for the window. However, ConfigureEvents
occur on moves in addition to resizes, and doing round trips and
naming new pixmaps every time a window is moved is a real performance
killer.

Add clutter_x11_texture_pixmap_sync_window_internal() that takes the
size/position of the window as arguments rather than always calling
XGetWindowAttributes. This allows us to bypass all work other than
notifying the window-x/window-y properties when we get a ConfigurEvent
for a move.

The last received width/height is saved to allow us to also omit
XGetWindowAttributes on MapNotify events.

The public clutter_x11_texture_pixmap_sync_window() becomes a bit less
efficient since we no longer combine the roundtrips for
XGetWindowAttributes() and XCompositeNameWindowPixmap(), but it appears
to have no callers in current publicly available code.

Several FIXME's are added for areas where there are still weird things
going on in the code or improvements could be made.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2356

13 years agotest-cogl-texture-get-set-data: Test the alpha component
Neil Roberts [Wed, 17 Nov 2010 17:31:23 +0000 (17:31 +0000)]
test-cogl-texture-get-set-data: Test the alpha component

Previously the alpha component of the test texture data was always set
to 255 and the data was read back as RGB so that the alpha component
is ignored. Now the alpha component is set to a generated value and
the data is read back a second time as RGBA to verify that Cogl is not
doing any premult conversions when the internal texture and target
data is the same.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agoUse FBOs and use cogl_read_pixels() to efficiently read partial textures
Owen W. Taylor [Fri, 12 Nov 2010 16:02:13 +0000 (11:02 -0500)]
Use FBOs and use cogl_read_pixels() to efficiently read partial textures

* cogl_texture_get_data() is converted to use
   _cogl_texture_foreach_sub_texture_in_region() to iterate
  through the underlying textures.

 * When we need to read only a portion of the underlying
   texture, we set up a FBO and use _cogl_read_pixels()
   to read the portion we need. This is enormously more
   efficient for reading a small portion of a large atlas
   texture.

 * The CoglAtlasTexture, CoglSubTexture, and CoglTexture2dSliced
   implementation of get_texture() are removed.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agocogl-framebuffer: Try to track format of the framebuffer
Neil Roberts [Wed, 17 Nov 2010 17:57:17 +0000 (17:57 +0000)]
cogl-framebuffer: Try to track format of the framebuffer

Previously in cogl_read_pixels we assume the format of the framebuffer
is always premultiplied because that is the most likely format with
the default Cogl blend mode. However when the framebuffer is bound to
a texture we should be able to make a better guess at the format
because we know the texture keeps track of the premult status. This
patch adds an internal format member to CoglFramebuffer. For onscreen
framebuffers we still assume it is RGBA_8888_PRE but for offscreen to
textures we copy the texture format. cogl_read_pixels uses this to
determine whether the data returned by glReadPixels will be
premultiplied.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agocogl_read_pixels: Fix the format used in GLES2
Neil Roberts [Wed, 17 Nov 2010 17:45:27 +0000 (17:45 +0000)]
cogl_read_pixels: Fix the format used in GLES2

When converting the data in cogl_read_pixels it was using bmp_format
instead of the format passed in to the function. bmp_format is the
same as the passed in format except that it always has the premult bit
set. Therefore the conversion would not handle premultiply correctly.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agoAdd an internal _cogl_read_pixels_with_rowstride
Neil Roberts [Wed, 17 Nov 2010 15:38:20 +0000 (15:38 +0000)]
Add an internal _cogl_read_pixels_with_rowstride

This is the same as _cogl_read_pixels except that it takes a rowstride
parameter for the destination buffer. Under OpenGL setting the
rowstride this will end up calling GL_ROW_LENGTH so that the buffer
region can be directly written to. Under GLES GL_ROW_LENGTH is not
supported so it will use an intermediate buffer as it does if the
format is not GL_RGBA.

cogl_read_pixels now just calls the full version of the function with
the rowstride set to width*bpp.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agoAdd an internal _cogl_offscreen_new_to_texture_full function
Neil Roberts [Thu, 11 Nov 2010 15:28:44 +0000 (15:28 +0000)]
Add an internal _cogl_offscreen_new_to_texture_full function

This function is the same as cogl_offscreen_new_to_texture but it
takes a level parameter and a set of flags so that FBOs can be used to
render to higher mipmap levels and to disable the depth and stencil
buffers. cogl_offscreen_new_to_texture now just calls the new function
with the level set to zero. This function could be useful in a few
places in Cogl where we want to use FBOs as an implementation detail
such as when copying between textures.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agoTest slicing when getting data in both directions
Owen W. Taylor [Fri, 12 Nov 2010 15:58:59 +0000 (10:58 -0500)]
Test slicing when getting data in both directions

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414

13 years agostage: if backend _ignoring_redraw_clips queue full redraw
Robert Bragg [Tue, 23 Nov 2010 16:48:59 +0000 (16:48 +0000)]
stage: if backend _ignoring_redraw_clips queue full redraw

In clutter_stage_real_queue_redraw we were checking to see if the
backend will ignore any subsequent redraw_clip so we can avoid the cost
of projecting the paint-volume of an actor into stage coordinates, but
we weren't ensuring that a full redraw would be queued instead we just
bailed out immediately. This makes sure to call
_clutter_stage_window_add_redraw_clip (stage_window, NULL) in this case
to make sure the backend will do an un-clipped redraw.

13 years agostage-window: tweak has_redraw_clips semantics
Robert Bragg [Tue, 23 Nov 2010 16:05:44 +0000 (16:05 +0000)]
stage-window: tweak has_redraw_clips semantics

This tweaks the semantics of the has_redraw_clips vfunc so we can assume
that at the start of a new frame there is an implied, initial,
redraw_clip that clips everything (i.e. nothing would be redrawn) so in
that case we would expect the has_redraw_clips vfunc to return True at
the start of a new frame for backends that support clipping.

Previously there was an ambiguity when this function returned False
since it could either mean a full screen redraw had been queued or it
could mean that the clip state wasn't yet initialized for that frame.
This would result in _clutter_stage_has_full_redraw_queued() returning
True at the start of a new frame even before any actors have been
updated, which in turn meant we would incorrectly ignore queue_redraw
requests for actors, believing them to be redundant.

13 years agocookbook: Add recipe for animated scaling of an actor
Elliot Smith [Wed, 24 Nov 2010 12:44:35 +0000 (12:44 +0000)]
cookbook: Add recipe for animated scaling of an actor

Recipe explains how to animate scaling a single actor.

Also covers scaling vs. resizing, scale center, and
scaling within layouts and containers.

The first example shows how animations around each scale
gravity look, as well as tracking the transformed position
and size of the actor and displaying those.

The second example is a simple image viewer with zoom in/out
using scaling.

13 years agocookbook: Add example of scaling a texture
Elliot Smith [Wed, 24 Nov 2010 12:22:12 +0000 (12:22 +0000)]
cookbook: Add example of scaling a texture

Added a simple application for scaling a
texture while keeping the mouse pointer over
the same coordinates on its surface.

13 years agocookbook: Added "animated scaling" recipe skeleton
Elliot Smith [Fri, 19 Nov 2010 14:52:44 +0000 (14:52 +0000)]
cookbook: Added "animated scaling" recipe skeleton

13 years agocookbook: Added animated scaling example
Elliot Smith [Fri, 19 Nov 2010 14:29:39 +0000 (14:29 +0000)]
cookbook: Added animated scaling example

Added an example showing scaling of an actor on
each of the scaling gravity settings (NORTH_WEST, NORTH etc.),
with a mark indicating the center being used.

Displays the transformed size and position, updated
on each paint of the actor.

13 years agox11: Check for initialized context when enabling ARGB visuals
Emmanuele Bassi [Wed, 24 Nov 2010 12:02:38 +0000 (12:02 +0000)]
x11: Check for initialized context when enabling ARGB visuals

Instead of using the backend singleton. This allows lazy initialization
of Clutter.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2435

13 years agoFix API docs for ClutterShaderEffects
Tomeu Vizoso [Tue, 23 Nov 2010 16:06:52 +0000 (17:06 +0100)]
Fix API docs for ClutterShaderEffects

It can implement now both fragment and vertex shaders.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2442

13 years agostage: Report an unknown paint volume.
Robert Bragg [Tue, 23 Nov 2010 14:31:45 +0000 (14:31 +0000)]
stage: Report an unknown paint volume.

Previously we were leaving it up to the default implementation of
get_paint_volume in ClutterGroup to handle the stage by determining the
bounding box of all contained children. This isn't the true bounding box
of the stage though since the stage is responsible for clearing the
entire framebuffer at the start of the frame. This adds a
get_paint_volume implementation for ClutterStage which simply returns
False which means Clutter has to assume it covers everything.

13 years agox11: only queue clipped redraw for Expose
Robert Bragg [Tue, 23 Nov 2010 14:30:08 +0000 (14:30 +0000)]
x11: only queue clipped redraw for Expose

When we handle Expose events we try and queue a clipped redraw of the
stage, but for some reason we were also redundantly calling
clutter_actor_queue_redraw for the stage which would negate the request
to queue a clipped redraw.

13 years agocogl-texture-driver-gles: Fix image height for uploading 3D textures
Neil Roberts [Tue, 23 Nov 2010 14:07:16 +0000 (14:07 +0000)]
cogl-texture-driver-gles: Fix image height for uploading 3D textures

When uploading a 3D texture with an awkward rowstride, on GLES Cogl
will copy the images to an intermediate buffer to pass to GL. However
it was using the wrong height when copying the data so it would end up
overflowing the buffer and crashing.

13 years agopipeline: Use WrapModeInternal in the Layer struct
Emmanuele Bassi [Tue, 23 Nov 2010 13:05:47 +0000 (13:05 +0000)]
pipeline: Use WrapModeInternal in the Layer struct

Since we're using CoglPipelineWrapModeInternal in the internal API
anyway, and the compiler complains loudly when comparing two enumeration
types without casting, the PipelineLayer struct should store the
wrap modes using the internal enumeration.

13 years agoDon't update or use last_paint_box when painting inside a clone
Owen W. Taylor [Sat, 13 Nov 2010 16:29:49 +0000 (11:29 -0500)]
Don't update or use last_paint_box when painting inside a clone

The last_paint_box for an actor represents its "normal" position - we
shouldn't update it or use it to cull drawing if we are painting
a clone of the actor. Tracking whether we are painting a clone is
done by adding  _clutter_actor_push/pop_clone_paint() and a global
"clone paint level".

http://bugzilla.clutter-project.org/show_bug.cgi?id=2396

13 years agoclip-stack: combine modelview-projection in set_clip_planes
Robert Bragg [Mon, 22 Nov 2010 15:51:15 +0000 (15:51 +0000)]
clip-stack: combine modelview-projection in set_clip_planes

When using clip planes and we we have to project some vertices into
screen coordinates we used to transform those by the modelview and then
the projection matrix separately. Now we combine the modelview and
projection matrix and then use that to transform the vertices in one
step instead.

13 years agojournal: remove possability of fallback layers
Robert Bragg [Mon, 22 Nov 2010 12:44:36 +0000 (12:44 +0000)]
journal: remove possability of fallback layers

When logging quads in the journal it used to be possible to specify a
mask of fallback layers (layers where a default white texture should be
used in-place of the corresponding texture in the current source
pipeline). Since we now handle fallbacks for cogl_rectangle* primitives
when validating the pipeline up-front before logging in the journal we
no longer need the ability for the journal to apply fallbacks too.

13 years agouse cogl_matrix_transform_points in clutter
Robert Bragg [Fri, 12 Nov 2010 16:08:25 +0000 (16:08 +0000)]
use cogl_matrix_transform_points in clutter

When transforming a paint-volume or transforming allocation vertices we
are transforming more than one point at a time so we can batch those
together with cogl_matrix_transform_points instead of
cogl_matrix_transform_point. Also in both of these cases we don't need
to do a projective transform so using cogl_matrix_transform_points also
lets us reduce the per-vertex computation.

13 years agomatrix: Adds experimental cogl_matrix_{transform,project}_points
Robert Bragg [Fri, 12 Nov 2010 13:35:24 +0000 (13:35 +0000)]
matrix: Adds experimental cogl_matrix_{transform,project}_points

This add two new function that allows us to transform or project an
array of points instead of only transforming one point at a time. Recent
benchmarking has shown cogl_matrix_transform_point to be a bottleneck
sometimes, so this should allow us to reduce the overhead when
transforming lots of vertices at the same time, and also reduce the cost
of 3 component, non-projective transforms.

For now they are marked as experimental (you have to define
COGL_ENABLE_EXPERIMENTAL_API) because there is some concern that it
introduces some inconsistent naming. cogl_matrix_transform_point would
have to be renamed cogl_matrix_project_point to be consistent, but that
would be an API break.

13 years agoprimitives: validate with _cogl_pipeline_foreach_layer
Robert Bragg [Thu, 11 Nov 2010 16:28:45 +0000 (16:28 +0000)]
primitives: validate with _cogl_pipeline_foreach_layer

Switch _cogl_rectangles_with_multitexture_coords to using
_cogl_pipeline_foreach_layer to iterate the layers of a pipeline when
validating instead of iterating the pipelines internal list, which is
risky since any modifications to pipelines (even to an override pipeline
derived from the original), could potentially corrupt the list as it is
being iterated.

13 years agocogl: remove WrapModeOverrides from FlushOptions
Robert Bragg [Thu, 11 Nov 2010 15:08:38 +0000 (15:08 +0000)]
cogl: remove WrapModeOverrides from FlushOptions

This removes the possibility to specify wrap mode overrides within a
CoglPipelineFlushOptions struct since the right way to handle these
overrides is by copying the user's material and making the changes to
that copy before flushing. All primitives code has already switched away
from using these wrap mode overrides so this patch just removes unused
code and types. It also remove the wrap_mode_overrides argument for
_cogl_journal_log_quad.

13 years agox11: Ignore NULL settings
Emmanuele Bassi [Tue, 23 Nov 2010 10:26:15 +0000 (10:26 +0000)]
x11: Ignore NULL settings

Prevent a segfault when dealing with XSETTINGS_ACTION_DELETE.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2441

13 years agocolor: Do not shadow a variable
Emmanuele Bassi [Mon, 22 Nov 2010 17:01:17 +0000 (17:01 +0000)]
color: Do not shadow a variable

Avoid a warning.

13 years agoUpdate NEWS
Emmanuele Bassi [Mon, 22 Nov 2010 15:20:55 +0000 (15:20 +0000)]
Update NEWS

13 years agocolor: And finally, add hsla() support
Emmanuele Bassi [Mon, 22 Nov 2010 15:07:01 +0000 (15:07 +0000)]
color: And finally, add hsla() support

Missed it when reading the CSS spec.

13 years agocolor: Support the CSS hsl() notation
Emmanuele Bassi [Mon, 22 Nov 2010 15:02:47 +0000 (15:02 +0000)]
color: Support the CSS hsl() notation

Since we support the rgb() and rgba() notations we might as well also
support the hsl() one.

13 years agocolor: Support CSS color definitions
Emmanuele Bassi [Mon, 22 Nov 2010 14:22:56 +0000 (14:22 +0000)]
color: Support CSS color definitions

The CSS Color Module 3, available at:

  http://www.w3.org/TR/css3-color/

allows defining colors as:

  rgb ( r, g, b )
  rgba ( r, g, b, a)

along with the usual hexadecimal and named notations.

The r, g, and b channels can be:

  • integers between 0 and 255
  • percentages, between 0% and 100%

The alpha channel, if included using the rgba() modifier, can be a
floating point value between 0.0 and 1.0.

The ClutterColor parser should support this notation.

13 years agodocs: Update the release notes in the README
Emmanuele Bassi [Mon, 22 Nov 2010 10:16:45 +0000 (10:16 +0000)]
docs: Update the release notes in the README

Also updates the introductory blurb.

13 years agodocs: Include the Behaviour migration guide
Emmanuele Bassi [Sat, 20 Nov 2010 13:05:51 +0000 (13:05 +0000)]
docs: Include the Behaviour migration guide

I forgot to add the xinclude directive in the main document.