profile/ivi/clutter.git
14 years agobackend: Undeprecated clutter_backend_get_resolution()
Emmanuele Bassi [Mon, 21 Jun 2010 17:01:57 +0000 (18:01 +0100)]
backend: Undeprecated clutter_backend_get_resolution()

Since the Settings:font-dpi property is exposed as 1024 * real_dpi in
order to make the setting as neutral as possible (and allow XSETTINGS
to use it natively) we need a simple API returning the DPI using a
floating point value.

14 years agoDeprecate the Backend settings
Emmanuele Bassi [Mon, 21 Jun 2010 16:58:26 +0000 (17:58 +0100)]
Deprecate the Backend settings

The Settings instance is the preferred way of accessing the settings.

14 years agoRemove default settings from backends
Emmanuele Bassi [Mon, 21 Jun 2010 16:57:57 +0000 (17:57 +0100)]
Remove default settings from backends

The defaults are set in the Settings instance.

14 years agodocs: Add Settings to the API reference
Emmanuele Bassi [Mon, 21 Jun 2010 16:57:11 +0000 (17:57 +0100)]
docs: Add Settings to the API reference

And document properties.

14 years agosettings: freeze notification on XSETTINGS notify
Emmanuele Bassi [Mon, 21 Jun 2010 15:10:49 +0000 (16:10 +0100)]
settings: freeze notification on XSETTINGS notify

14 years agox11: Add the XSETTINGS machinery
Emmanuele Bassi [Mon, 21 Jun 2010 14:43:31 +0000 (15:43 +0100)]
x11: Add the XSETTINGS machinery

Use the XSETTINGS machinery to get notification from foreign
environments about settings that might interest Clutter itself - namely:
the default font name, the font DPI, and the Xft font options that can
be mapped on cairo_font_options_t.

14 years agosettings: Migrate Backend settings to a new object
Emmanuele Bassi [Mon, 21 Jun 2010 14:42:20 +0000 (15:42 +0100)]
settings: Migrate Backend settings to a new object

Instead of storing settings inside the Backend instance we should use a
separate public object.

14 years agoconfigure.ac only explicitly add -lGL if no pkgconfig file
Robert Bragg [Fri, 18 Jun 2010 12:59:00 +0000 (13:59 +0100)]
configure.ac only explicitly add -lGL if no pkgconfig file

When configuring the glx flavour we were always explicitly adding -lGL
to the linker flags even when a pkg-config file was found which should
take care of that option for us.

14 years agoconfigure.ac: Use pkg-config for gles1/2 if available
Robert Bragg [Fri, 18 Jun 2010 12:35:09 +0000 (13:35 +0100)]
configure.ac: Use pkg-config for gles1/2 if available

When building for gles1/2 we now always try and look for a libglesv1_cm
or libglesv2 .pc file with details about where to find the library and
headers.

14 years agoegl: Consolidates eglx and eglnative into one "egl" winsys
Robert Bragg [Fri, 18 Jun 2010 03:38:43 +0000 (04:38 +0100)]
egl: Consolidates eglx and eglnative into one "egl" winsys

This remove quite a lot of redundant code by consolidating the eglx and
eglnative window system backends.

14 years agotslib: Add USE_TSLIB conditional for clutter-event-tslib.c
Robert Bragg [Thu, 17 Jun 2010 23:29:12 +0000 (00:29 +0100)]
tslib: Add USE_TSLIB conditional for clutter-event-tslib.c

This adds an automake USE_TSLIB condition to decide when we should
compile clutter-event-tslib.c. This is in preparation for consolidating
the eglx and eglnative backends.

14 years agoegl: rename clutter-event-egl.c -> clutter-event-tslib.c
Robert Bragg [Thu, 17 Jun 2010 23:25:57 +0000 (00:25 +0100)]
egl: rename clutter-event-egl.c -> clutter-event-tslib.c

clutter-event-egl had nothing to do with EGL, it's code for opening
tslib devices and creating a GSource for touch screen events. It just
happens that this only ever gets used with the eglnative backend.

14 years agoclutter event egl: fixes lots of compiler warnings
Robert Bragg [Thu, 17 Jun 2010 23:18:02 +0000 (00:18 +0100)]
clutter event egl: fixes lots of compiler warnings

The way the #ifdef HAVE_TSLIB guards were spread around it meant there
were lots of warnings about unused variables when building without
tslib.

14 years agoegl: support creating OpenGL contexts
Robert Bragg [Thu, 17 Jun 2010 22:12:34 +0000 (23:12 +0100)]
egl: support creating OpenGL contexts

Right before we create the EGL context, we check if we were built with
OpenGL or OpenGLES support and it was OpenGL then we call eglBindAPI
(EGL_OPENGL_API); This also explicitly requests a EGL_RENDERABLE_TYPE
supporting the EGL_OPENGL_BIT.

This will let us add a new ./configure flavour that combines OpenGL and
EGL instead of OpenGL and GLX.

14 years agoegl: Unify the eglx and eglnative backends
Robert Bragg [Thu, 17 Jun 2010 21:26:12 +0000 (22:26 +0100)]
egl: Unify the eglx and eglnative backends

Without actually consolidating the two backends this patch brings their
code within a cats whisker of each other in preparation for
consolidation.

14 years agobuild: Adds a new opengl-egl-xlib build flavour
Robert Bragg [Thu, 17 Jun 2010 22:23:12 +0000 (23:23 +0100)]
build: Adds a new opengl-egl-xlib build flavour

With this patch if you ./configure clutter using
--with-flavour=opengl-egl-xlib then it will use EGL + OpenGL instead of
the default GLX and OpenGL.

These days upstream driver work is more focused on improving EGL than it
is GLX so likewise we want to make sure Clutter has good support for
EGL.

14 years agobuild: distinguish CLUTTER_WINSYS and CLUTTER_SONAME_INFIX
Robert Bragg [Fri, 18 Jun 2010 00:25:46 +0000 (01:25 +0100)]
build: distinguish CLUTTER_WINSYS and CLUTTER_SONAME_INFIX

This adds a separate variable name "CLUTTER_SONAME_INFIX" to define the
infix for the clutter library that gets linked. Currently the WINSYS
corresponds to the directory we enter when building to compile the
window system and input support, but it is desirable to be able to
define multiple flavours that use the same WINSYS but should result in
different library names.

For example we are planning to combine the eglx and eglnative window
systems into one "egl" winsys but we will need to preserve the current
library names for the eglx and eglnative flavours.

14 years agoconfigure.ac: avoid some duplication
Robert Bragg [Fri, 18 Jun 2010 00:56:23 +0000 (01:56 +0100)]
configure.ac: avoid some duplication

When we check the flavour we now just set boolean variables for the
following things:

SUPPORT_X11=1
SUPPORT_XLIB=1
SUPPORT_GLX=1
SUPPORT_EGL=1
SUPPORT_EGL_POWERVR_X11=1
SUPPORT_EGL_POWERVR_NULL=1

This lets us avoid some duplication and also some error prone tests for
lists of flavours used, for example, to determine when we need to check
for x libraries.

14 years agoconfigure.ac: distinguish CLUTTER_FLAVOUR and CLUTTER_WINSYS
Robert Bragg [Fri, 18 Jun 2010 00:13:33 +0000 (01:13 +0100)]
configure.ac: distinguish CLUTTER_FLAVOUR and CLUTTER_WINSYS

It's desirable to have a separation between the "flavour" and the
"winsys". The flavour is a concept internal to the configure script and
is a convenient name to represent the users choice of window system,
opengl driver and input backend. The CLUTTER_WINSYS currently defines
the subdirectory under clutter/ that should be compiled to handle the
window system and input.

With a separation we could add a flavour with no correspondence to which
clutter/subdirectory needs to be built.

14 years agoconfigure.ac: move the special handling of the fruity flavour
Robert Bragg [Fri, 18 Jun 2010 00:07:59 +0000 (01:07 +0100)]
configure.ac: move the special handling of the fruity flavour

After checking the flavour option the user gives we were checking for
the fruity flavour to override the glesversion. Now that the glsl
checking has been moved this can instead just wait until the AS_CASE
that handles all the flavour configuration.

14 years agoconfigure.ac: move gles checks after the flavour checks
Robert Bragg [Fri, 18 Jun 2010 00:02:38 +0000 (01:02 +0100)]
configure.ac: move gles checks after the flavour checks

The flavour AS_CASE should define whether a flavour uses the gl or gles
COGL_DRIVER and so we shouldn't need to have an expanding list of
tests to gate when we check for a gles driver because if we move the
checks for gles after the flavour checks we can just look at
$COGL_DRIVER.

14 years agoconfigure.ac: don't have so many XYX_{LIBS,CFLAGS} vars
Robert Bragg [Fri, 18 Jun 2010 00:02:38 +0000 (01:02 +0100)]
configure.ac: don't have so many XYX_{LIBS,CFLAGS} vars

This removes EGL_{LIBS,CFLAGS}, GLX_{LIBS,CFLAGS}, OSX_{LIBS,CFLAGS},
WIN32_{LIBS,CFLAGS}, and GLES_{LIBS,CFLAGS} and instead we just append
to FLAVOUR_{LIBS,CFLAGS}.

This makes more of the file relocatable because there were previously
dependencies on the order that some variables were setup in.

14 years agoclutter-stage: Use g_array_free instead of g_array_unref
Neil Roberts [Fri, 18 Jun 2010 14:19:59 +0000 (15:19 +0100)]
clutter-stage: Use g_array_free instead of g_array_unref

g_array_unref was only added in GLib 2.22 so we should really update
the requirements in the configure script if we want to use that
function. However the array doesn't appear to have any extra reference
taken on it anywhere so it should be safe to use g_array_free instead.

14 years agocogl-context: Use the function pointer for glActiveUnit
Neil Roberts [Fri, 18 Jun 2010 14:25:51 +0000 (15:25 +0100)]
cogl-context: Use the function pointer for glActiveUnit

Under WGL, any functions that were defined after GL 1.1 are not
directly exported in the DLL so we need to reference them via the
function pointers. A new call to glActiveUnit was missed in
cogl-context.c

14 years agocogl-material: Don't use the symbol 'near'
Neil Roberts [Fri, 18 Jun 2010 14:33:03 +0000 (15:33 +0100)]
cogl-material: Don't use the symbol 'near'

The window headers contain the line

 #define near

so it's not possible to use the symbol 'near' in code that's portable
to Windows. This replaces it with 'near_val'.

I think the define is meant to improve compatibility with code written
for Windows 3.1 where near would be a keyword to make it a smaller
pointer size.

14 years agoactor: Parse actions, constraints and effects members
Emmanuele Bassi [Thu, 17 Jun 2010 16:35:00 +0000 (17:35 +0100)]
actor: Parse actions, constraints and effects members

ClutterActor should allow attaching actions, constraints and effects
just like it allows behaviours, e.g.:

  {
    ...
    "constraints" : [
      {
        "type" : "ClutterAlignConstraint",
        "source" : "stage",
        "align-axis" : "x-axis",
        "factor" : 0.5
      },
      {
        "type" : "ClutterAlignConstraint",
        "source" : "stage",
        "align-axis" : "y-axis",
        "factor" : 0.5
      }
    ],
    ...
  }

or:

  {
    ...
    "actions" : [
      {
        "type" : "ClutterDragAction",
        "signals" : [
          { "name" : "drag-end", "handler" : "on_drag_end" }
        ]
      }
    ],
    ...
  }

In order to do so, we use the Scriptable interface implementation and
add three new custom properties accepting an array; then we parse each
member of the array as a new object.

14 years agoconstraints: Allow Align and Bind sources to be NULL
Emmanuele Bassi [Thu, 17 Jun 2010 16:33:10 +0000 (17:33 +0100)]
constraints: Allow Align and Bind sources to be NULL

Since constructing AlignConstraint and BindConstraint instances could be
deferred (think ClutterScript) we need to make their :source properties
setters accept NULL. This does not break the constraints because they
need to handle that condition in case they actor to which they are
applied is destroyed and somebody is holding a reference on them anyway.

14 years agoscript-parser: Expose extracting the id from a node
Emmanuele Bassi [Thu, 17 Jun 2010 15:41:44 +0000 (16:41 +0100)]
script-parser: Expose extracting the id from a node

The get_id_from_node() internal function should be exposed inside
Clutter (as a private function) because it can be useful to other
custom parsing code. The code is pretty trivial, but it would be
pointless to re-implement it.

14 years agoactor: Disable the layout cycle warning with debug disabled
Emmanuele Bassi [Thu, 17 Jun 2010 11:32:24 +0000 (12:32 +0100)]
actor: Disable the layout cycle warning with debug disabled

If Clutter has been configured with --enable-debug set to 'no' then we
hide most of the warnings.

14 years agobind-constraint: Add accessor methods
Emmanuele Bassi [Thu, 17 Jun 2010 11:02:28 +0000 (12:02 +0100)]
bind-constraint: Add accessor methods

ClutterBindConstraint should have accessor methods for its properties,
to allow direct manipulation instead of going through GObject's API.

14 years agostate: add a duration property
Øyvind Kolås [Wed, 16 Jun 2010 16:33:48 +0000 (17:33 +0100)]
state: add a duration property

Adding a duration property to ClutterState allows the json parsing
to parse the default transition duration with the generic code paths.

14 years agostate: avoid walking off empty list
Øyvind Kolås [Wed, 16 Jun 2010 16:44:06 +0000 (17:44 +0100)]
state: avoid walking off empty list

When removing the last key in a list, the last part of the for statement
could cause dereferencing (NULL)->next and thus segfaulting.

14 years agoanimator: avoid walking off empty list
Øyvind Kolås [Wed, 16 Jun 2010 16:43:44 +0000 (17:43 +0100)]
animator: avoid walking off empty list

When removing the last key in a list, the last part of the for statement
could cause dereferencing (NULL)->next and thus segfaulting.

14 years agoshader-effect: Add a size check
Emmanuele Bassi [Wed, 16 Jun 2010 16:17:27 +0000 (17:17 +0100)]
shader-effect: Add a size check

Similar to the one in commit 2a354d9650bb8215dd75a90b947fb82734c35b78
that went into clutter_value_set_shader_*. We end up in the same
situation, but it's better to fail from within ClutterShaderEffect.

14 years agoshader-types: Check the size of the values
Richard Hughes [Wed, 16 Jun 2010 15:19:48 +0000 (16:19 +0100)]
shader-types: Check the size of the values

Emit a critical error if the user tries to send more data than
the static shader GValues can hold.

This fixes the random memory corruption you get when specifying
size > 4.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
14 years agocairo-texture: Disable :sync-size
Emmanuele Bassi [Wed, 16 Jun 2010 12:58:41 +0000 (13:58 +0100)]
cairo-texture: Disable :sync-size

The :sync-size property of ClutterTexture should be set to FALSE by
default by ClutterCairoTexture. The preferred size of the
ClutterCairoTexture is already the size of the internal Cairo surface,
and we override the preferred width/height getters to that effect.

The :sync-size property is also responsible of changing the size of
the Texture actor when changing the texture handle - but since we
encourage that to happen during the CairoTexture allocation, we get a
queue_relayout() invocation (and a warning) when we change the size
of the Cairo image surface.

Since GObject doesn't make it easy to override the default value of the
:sync-size property in sub-classes, we should simply call the setter
function during the ClutterCairoTexture instance initialization.

We should also change one of the interactive tests using a CairoTexture
to rebuild the contents of the actor in response to an allocation.

14 years agocairo-texture: Clean up style
Emmanuele Bassi [Wed, 16 Jun 2010 11:53:02 +0000 (12:53 +0100)]
cairo-texture: Clean up style

14 years agoalign-constraint: Publish the properties accessors
Emmanuele Bassi [Wed, 16 Jun 2010 11:47:56 +0000 (12:47 +0100)]
align-constraint: Publish the properties accessors

The accessor methods for the AlignConstraint properties should be
public.

14 years agobuild: Fix a compiler warning when using make dist
Richard Hughes [Tue, 15 Jun 2010 21:36:19 +0000 (22:36 +0100)]
build: Fix a compiler warning when using make dist

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
14 years agostage-glx: Never promote clipped redraws to full redraws.
Robert Bragg [Wed, 9 Jun 2010 01:42:01 +0000 (02:42 +0100)]
stage-glx: Never promote clipped redraws to full redraws.

When clipped redraws were first supported in Clutter a heuristic was
added to promote tall clipped redraws into full redraws due to a concern
that using glXCopySubBuffer for tall rectangles would block the GPU for
too long waiting for the vtrace to be in a suitable position so that
tearing isn't seen. We've so far been unable to measure any impact from
this blocking even with full height windows so we are removing the
arbitrary threshold of 300px that was originally "plucked out of thin
air".

http://bugzilla.o-hand.com/show_bug.cgi?id=2136

14 years agoSplit out the ignored test files
Emmanuele Bassi [Tue, 15 Jun 2010 15:51:55 +0000 (16:51 +0100)]
Split out the ignored test files

14 years agoAdd cogl-depth-test to the Git ignore file
Emmanuele Bassi [Tue, 15 Jun 2010 15:46:59 +0000 (16:46 +0100)]
Add cogl-depth-test to the Git ignore file

14 years agoSet the initial value of a variable
Emmanuele Bassi [Tue, 15 Jun 2010 15:42:30 +0000 (16:42 +0100)]
Set the initial value of a variable

Fixes a compiler warning.

14 years agomaterial: Adds arbfp compile counter
Robert Bragg [Mon, 14 Jun 2010 22:14:15 +0000 (23:14 +0100)]
material: Adds arbfp compile counter

This adds a uprof counter to track how many ARBfp programs get compiled
by an application.

14 years agomaterial: Support sparse ARBfp program generation
Robert Bragg [Thu, 10 Jun 2010 18:03:57 +0000 (19:03 +0100)]
material: Support sparse ARBfp program generation

We don't need to generate a new ARBfp program for every material created
if we can find an ancestor whos state will result in the same program
being generated.

The more code we can have adopt the coding pattern of deriving their
materials from other similar materials using cogl_material_copy() the
more likely this metric will be good enough on its own to minimize the
set of arbfp programs necessary to support a given application.

14 years agomaterial: free any layer cache in material_set_parent
Robert Bragg [Mon, 14 Jun 2010 21:20:27 +0000 (22:20 +0100)]
material: free any layer cache in material_set_parent

Previously in _cogl_material_pre_change_notify we manually freed the
layer caches of a material if we caused a reparent, but it makes more
sense to have _cogl_material_set_parent do this directly instead.

14 years agoAdds an internal weak material mechanism
Robert Bragg [Thu, 27 May 2010 19:04:49 +0000 (20:04 +0100)]
Adds an internal weak material mechanism

This adds a _cogl_material_weak_copy() function that can be used to
create materials that don't count as strong dependants on their parents.
This means the parent can be modified without worrying about how it will
affect weak materials. The material age of the parent can potentially be
queried to determine if a weak material might need to be re-created.

14 years agomaterial: Adds a simple material age getter
Robert Bragg [Thu, 27 May 2010 14:19:15 +0000 (15:19 +0100)]
material: Adds a simple material age getter

When we add support for weak materials it's expected that Clutter will
want to attach them as private data to other materials and it needs a
mechanism to determine when a weak material should be re-created because
its parent has changed somehow.

This adds the concept of a material age (internal only currently) which
increments whenever a material is modified. Clutter can then save the
age of the material which its weak materials are derived from and later
determine when the weak material may be invalid.

14 years agoprimitives: we were memsetting the wrong wrap mode overrides pointer
Robert Bragg [Thu, 27 May 2010 14:18:15 +0000 (15:18 +0100)]
primitives: we were memsetting the wrong wrap mode overrides pointer

In _cogl_texture_quad_multiple_primitives we weren't memsetting the
CoglMaterialWrapModeOverrides structure we were memsetting
&state.wrap_mode_overrides where state.wrap_mode_overrides is just a
pointer that might potentially later point to the
CoglMaterialWrapModeOverrides structure.

14 years agomaterial: generalize how we compare simple material properties
Robert Bragg [Wed, 26 May 2010 13:13:37 +0000 (14:13 +0100)]
material: generalize how we compare simple material properties

In _cogl_material_equal we were repeating the same code pattern to
compare several of the state groups so this just adds
simple_property_equal function that's now used instead.

14 years agomaterial: Make CoglMaterial responsible for depth state
Robert Bragg [Wed, 26 May 2010 10:33:32 +0000 (11:33 +0100)]
material: Make CoglMaterial responsible for depth state

This redirects the legacy depth testing APIs through CoglMaterial and
adds a new experimental cogl_material_ API for handling the depth
testing state.

This adds the following new functions:
cogl_material_set_depth_test_enabled
cogl_material_get_depth_test_enabled
cogl_material_set_depth_writing_enabled
cogl_material_get_depth_writing_enabled
cogl_material_set_depth_test_function
cogl_material_get_depth_test_function
cogl_material_set_depth_range
cogl_material_get_depth_range

As with other experimental Cogl API you need to define
COGL_ENABLE_EXPERIMENTAL_API to access them and their stability isn't
yet guaranteed.

14 years agocogl docs: Improve documentation for cogl_ortho
Robert Bragg [Wed, 26 May 2010 02:07:17 +0000 (03:07 +0100)]
cogl docs: Improve documentation for cogl_ortho

cogl_ortho is one of those APIs whos style was, for better or worse,
copied from OpenGL and for some inexplicable reason the near and far
arguments are inconsistent with the left, right, top, bottom arguments
because they don't take z coordinates they take a "distance" which
should be negative for a plane behind the viewer.

This updates the documentation to explain this.

14 years agoprimitives: no longer assume _get_layers list remains valid
Robert Bragg [Wed, 19 May 2010 00:02:16 +0000 (01:02 +0100)]
primitives: no longer assume _get_layers list remains valid

The internal CoglMaterialLayer pointers associated with a material may
change whenever layer properties are modified so it's no longer ok to
assume that a list of layers returned by cogl_material_get_layers
remains valid if the layers have been changed.

14 years agomaterial: Adds simple breadcrumb debugging mechanism
Robert Bragg [Tue, 18 May 2010 23:36:31 +0000 (00:36 +0100)]
material: Adds simple breadcrumb debugging mechanism

Since it can sometimes be awkward to figure out where a particular
material came from when debugging, this adds a breadcrumb mechanism that
lets you associate a const string with a material that may give a clue
about its origin.

14 years agomaterial: remove override options from _cogl_material_equal
Robert Bragg [Tue, 18 May 2010 22:38:33 +0000 (23:38 +0100)]
material: remove override options from _cogl_material_equal

As a follow on to using cogl_material_copy instead of flush options this
patch now removes the ability to pass flush options to
_cogl_material_equal which is the final reference to the
CoglMaterialFlushOptions mechanism.

14 years agocogl: remove _cogl_material_flush_gl_state flush options
Robert Bragg [Tue, 18 May 2010 21:42:49 +0000 (22:42 +0100)]
cogl: remove _cogl_material_flush_gl_state flush options

Since cogl_material_copy should now be cheap to use we can simplify
how we handle fallbacks and wrap mode overrides etc by simply copying
the original material and making our override changes on the new
material. This avoids the need for a sideband state structure that has
been growing in size and makes flushing material state more complex.

Note the plan is to eventually use weak materials for these override
materials and attach these as private data to the original materials so
we aren't making so many one-shot materials.

14 years agoCoglMaterial: Implements sparse materials design
Robert Bragg [Thu, 8 Apr 2010 11:21:04 +0000 (12:21 +0100)]
CoglMaterial: Implements sparse materials design

This is a complete overhaul of the data structures used to manage
CoglMaterial state.

We have these requirements that were aiming to meet:
(Note: the references to "renderlists" correspond to the effort to
support scenegraph level shuffling of Clutter actor primitives so we can
minimize GPU state changes)

Sparse State:
We wanted a design that allows sparse descriptions of state so it scales
well as we make CoglMaterial responsible for more and more state. It
needs to scale well in terms of memory usage and the cost of operations
we need to apply to materials such as comparing, copying and flushing
their state. I.e. we would rather have these things scale by the number
of real changes a material represents not by how much overall state
CoglMaterial becomes responsible for.

Cheap Copies:
As we add support for renderlists in Clutter we will need to be able to
get an immutable handle for a given material's current state so that we
can retain a record of a primitive with its associated material without
worrying that changes to the original material will invalidate that
record.

No more flush override options:
We want to get rid of the flush overrides mechanism we currently use to
deal with texture fallbacks, wrap mode changes and to handle the use of
highlevel CoglTextures that need to be resolved into lowlevel textures
before flushing the material state.

The flush options structure has been expanding in size and the structure
is logged with every journal entry so it is not an approach that scales
well at all. It also makes flushing material state that much more
complex.

Weak Materials:
Again for renderlists we need a way to create materials derived from
other materials but without the strict requirement that modifications to
the original material wont affect the derived ("weak") material. The
only requirement is that its possible to later check if the original
material has been changed.

A summary of the new design:

A CoglMaterial now basically represents a diff against its parent.
Each material has a single parent and a mask of state that it changes.

Each group of state (such as the blending state) has an "authority"
which is found by walking up from a given material through its ancestors
checking the difference mask until a match for that group is found.

There is only one root node to the graph of all materials, which is the
default material first created when Cogl is being initialized.

All the groups of state are divided into two types, such that
infrequently changed state belongs in a separate "BigState" structure
that is only allocated and attached to a material when necessary.

CoglMaterialLayers are another sparse structure. Like CoglMaterials they
represent a diff against their parent and all the layers are part of
another graph with the "default_layer_0" layer being the root node that
Cogl creates during initialization.

Copying a material is now basically just a case of slice allocating a
CoglMaterial, setting the parent to be the source being copied and
zeroing the mask of changes.

Flush overrides should now be handled by simply relying on the cheapness
of copying a material and making changes to it. (This will be done in a
follow on commit)

Weak material support will be added in a follow on commit.

14 years agomaterial: fix #ifdef guard around use of _TEXTURE_RECTANGLE
Robert Bragg [Tue, 15 Jun 2010 13:26:37 +0000 (14:26 +0100)]
material: fix #ifdef guard around use of _TEXTURE_RECTANGLE

We were incorrectly guarding the use of GL_TEXTURE_RECTANGLE_ARB with
ifdef ARB_texture_rectangle instead of ifdef GL_ARB_texture_rectangle
which broke test-cogl-texture-rectangle.

14 years agoblend-strings: removes the AUTO_COMPOSITE function enum
Robert Bragg [Thu, 10 Jun 2010 13:39:20 +0000 (14:39 +0100)]
blend-strings: removes the AUTO_COMPOSITE function enum

This was mistakenly added some time ago because at some point when we
were discussing how to handle premultiplied alpha in Clutter/Cogl we
were considering having a magic "just do the right thing" option which
was later abandoned.

14 years agocogl-color: add cogl_color_init_from_xyz funcs
Robert Bragg [Thu, 10 Jun 2010 13:17:42 +0000 (14:17 +0100)]
cogl-color: add cogl_color_init_from_xyz funcs

This is to try and improve API consistency. Simple cogl structures that
don't derive from CoglObject and which can be allocated on the stack,
such as CoglColor and CoglMatrix should all have  "_init" or
"_init_from" functions to initialize all the structure members. (As
opposed to a cogl_xyz_new() function for CoglObjects). CoglColor
previously used the naming scheme "_set_from" for these initializers but
"_set" is typically reserved for setting individual properties of a
structure/object.

This adds three _init functions:
cogl_color_init_from_4ub
cogl_color_init_from_4f
cogl_color_init_from_4fv

The _set_from functions are now deprecated but only with a gtk-doc
annotation for now. This is because the cogl_color_set_from API is quite
widely used already and so were giving a grace period before enabling a
GCC deprecated warning just because otherwise the MX maintainers will
complain to me that I've made their build logs look messy.

14 years agocogl-color: add private _cogl_color_get_rgba_4ubv API
Robert Bragg [Thu, 10 Jun 2010 13:07:40 +0000 (14:07 +0100)]
cogl-color: add private _cogl_color_get_rgba_4ubv API

The journal logs colors as 4bytes into a vertex array and since we are
planning to make CoglMaterial track its color using a CoglColor instead
of a byte array this convenience will be useful for re-implementing
_cogl_material_get_colorubv.

14 years agobuild: Do not include built sources in the distribution
Johan Bilien [Mon, 14 Jun 2010 19:34:24 +0000 (19:34 +0000)]
build: Do not include built sources in the distribution

allows to run make distcheck without first running make

http://bugzilla.openedhand.com/show_bug.cgi?id=2171

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
14 years agostate: consistently use clutter_state_get_state where possible
Øyvind Kolås [Mon, 14 Jun 2010 15:57:44 +0000 (16:57 +0100)]
state: consistently use clutter_state_get_state where possible

The previous commit reimplemented logic for creating states, this - and
other parts of the code should be using clutter_state_get_state.

14 years agostate: make null source state encounterd in json treated as wildcard
Øyvind Kolås [Mon, 14 Jun 2010 14:45:07 +0000 (15:45 +0100)]
state: make null source state encounterd in json treated as wildcard

To be properly useful the state machine needs to be able to specify the
default transitions to a target state with no specified source state.

14 years agotest-state: move press/release callbacks to stage avoiding grab
Øyvind Kolås [Tue, 25 May 2010 10:54:15 +0000 (11:54 +0100)]
test-state: move press/release callbacks to stage avoiding grab

14 years agodocs: Clarify the scope of Text:single-line-mode
Emmanuele Bassi [Mon, 14 Jun 2010 13:05:49 +0000 (14:05 +0100)]
docs: Clarify the scope of Text:single-line-mode

Only editable text actors can be in single-line mode.

14 years agoDon't add GL libs for EGL X11 backend
Kristian Høgsberg [Mon, 14 Jun 2010 11:59:42 +0000 (12:59 +0100)]
Don't add GL libs for EGL X11 backend

Configure uses the GL .pc file to add GL includes and libs for the eglx
backend.

http://bugzilla.openedhand.com/show_bug.cgi?id=2104

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
14 years agoclutter-text: Round the layout width to nearest integer not down
Neil Roberts [Mon, 14 Jun 2010 10:59:33 +0000 (11:59 +0100)]
clutter-text: Round the layout width to nearest integer not down

When converting the floating point allocation width to an integer
multiple of PANGO_SCALE to give to the PangoLayout it can sometimes
end up slightly short of the allocated size due to rounding
errors. This can cause some of the lines to be wrapped differently
when a non-integer-aligned position is used (such as when animating
text). It works better to round the number to the nearest integer by
adding 0.5 instead of letting the default float cast truncate it
downwards.

http://bugzilla.openedhand.com/show_bug.cgi?id=2170

14 years agodrag-action: Remove the press event button
Emmanuele Bassi [Sat, 12 Jun 2010 16:45:54 +0000 (17:45 +0100)]
drag-action: Remove the press event button

Both ::drag-begin and ::drag-end have a "button" argument - even though
we assume internally, and externally, that dragging can only be the
result of a primary button operation.

14 years agoMerge branch 'wip/deform-effect'
Emmanuele Bassi [Fri, 11 Jun 2010 17:12:54 +0000 (18:12 +0100)]
Merge branch 'wip/deform-effect'

* wip/deform-effect:
  docs: Add DeformEffect and PageTurnEffect to the API reference
  effect: Add PageTurnEffect
  effect: Add DeformEffect
  offscreen-effect: Traslate the modelview with the offsets
  docs: Fix Effect subclassing section

14 years agoHide the marshallers
Emmanuele Bassi [Fri, 11 Jun 2010 14:49:46 +0000 (15:49 +0100)]
Hide the marshallers

The marshallers we use for the signals are declared in a private header,
and it stands to reason that they should also be hidden in the shared
object by using the common '_' prefix. We are also using some direct
g_cclosure_marshal_* symbol from GLib, instead of consistently use the
clutter_marshal_* symbol.

14 years agocogl/winsys/cogl-eglx: Use the right egl header on 1.1
Neil Roberts [Fri, 11 Jun 2010 13:47:30 +0000 (14:47 +0100)]
cogl/winsys/cogl-eglx: Use the right egl header on 1.1

Commit b0cc98fdceb introduced a #include for the egl header in
cogl-eglx.c The header name is different under GLES 1.1 so it broke
compilation.

14 years agocogl-program: Add cogl_program_uniform_1i to GLES
Neil Roberts [Fri, 11 Jun 2010 13:37:56 +0000 (14:37 +0100)]
cogl-program: Add cogl_program_uniform_1i to GLES

The GLES 1.1 backend was missing a stub for cogl_program_uniform_1i.

14 years agocogl-gles2: Prefix internal GLES 2 wrapper symbols with _
Neil Roberts [Fri, 11 Jun 2010 13:36:38 +0000 (14:36 +0100)]
cogl-gles2: Prefix internal GLES 2 wrapper symbols with _

Some internal symbols used for the GLES 2 wrapper were accidentally
being exported. This prepends an underscore to them so they won't
appear in the shared library.

14 years agoclick-action: Use clutter_actor_contains()
Emmanuele Bassi [Fri, 11 Jun 2010 14:23:46 +0000 (15:23 +0100)]
click-action: Use clutter_actor_contains()

Instead of an internal copy.

14 years agoactor: add clutter_actor_contains()
Dan Winship [Thu, 10 Jun 2010 12:24:55 +0000 (08:24 -0400)]
actor: add clutter_actor_contains()

It is often useful to determine if one actor is an ancestor of
another. Add a method to do that.

http://bugzilla.openedhand.com/show_bug.cgi?id=2162

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
14 years agoshader-effect: Allow creating vertex shaders
Emmanuele Bassi [Fri, 11 Jun 2010 13:47:48 +0000 (14:47 +0100)]
shader-effect: Allow creating vertex shaders

By default, ShaderEffect creates a fragment shader; in order to be able
to deprecate ClutterShader we need a way for ShaderEffect sub-classes to
create a vertex shader if needed - By using a write-only, constructor
only property.

ClutterShader has, internally, a ClutterShaderType enumeration that can
be used exactly for this. We just need to expose it and create a GObject
property for ClutterShaderEffect.

14 years agocogl-clip-stack: Always use the scissor when clipping
Neil Roberts [Thu, 22 Apr 2010 13:33:47 +0000 (14:33 +0100)]
cogl-clip-stack: Always use the scissor when clipping

Whenever a path or a rectangle is added to the clip stack it now also
stores a screen space bounding box in the entry. Then when the clip
stack is flushed the bounding box is first used to set up the
scissor. That way when we eventually come to use the stencil buffer
the clear will be affected by the scissor so we don't have to clear
the entire buffer.

14 years agocogl-path: Export _cogl_path_get_bounds
Neil Roberts [Thu, 22 Apr 2010 13:13:52 +0000 (14:13 +0100)]
cogl-path: Export _cogl_path_get_bounds

_cogl_path_get_bounds is no longer static and is exported in
cogl-path-private.h so that it can be used in the clip stack code. The
old version of the function returned x/y and width/height. However
this was mostly used to call cogl_rectangle which takes x1/y1
x2/y2. The function has been changed to just directly return the
second form because it is more useful. Anywhere that was previously
using the function now just directly looks at path->path_nodes_min and
path->path_nodes_max instead.

14 years agocogl-clip-state: Export transform_point internally to Cogl
Neil Roberts [Thu, 22 Apr 2010 12:48:49 +0000 (13:48 +0100)]
cogl-clip-state: Export transform_point internally to Cogl

The transform_point function takes a modelview matrix, projection
matrix and a viewport and performs all three transformations on a
point to give a Cogl window coordinate. This is useful in a number of
places in Cogl so this patch moves it to cogl.c and adds it to
cogl-internal.h

14 years agocogl_texture_get_data() copies using wrong width size.
Sunil Sadasivan [Thu, 13 May 2010 07:59:06 +0000 (00:59 -0700)]
cogl_texture_get_data() copies using wrong width size.

For sliced 2D textures, _cogl_texture_2d_sliced_get_data() uses the
bitmap width, instead of the rowstride, when memcpy()ing into the
dest buffer.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
14 years agocogl-color: Provide setters for all the channels
Damien Lespiau [Sun, 6 Jun 2010 22:03:26 +0000 (23:03 +0100)]
cogl-color: Provide setters for all the channels

We only had getters for the red, green, blue and alpha channels of a
color. This meant that, if you wanted to change, say, the alpha
component of a color, one would need to query the red, green and blue
channels and use set_from_4ub() or set_from_4f().

Instead of this, just provide some setters for CoglColor, using the same
naming scheme than the existing getters.

14 years agocogl-color: Add cogl_color_unpremultiply()
Damien Lespiau [Sun, 6 Jun 2010 21:57:02 +0000 (22:57 +0100)]
cogl-color: Add cogl_color_unpremultiply()

For some operations on pre-multiplied colors (say, replace the alpha
value), you need to unpremultiply the color.

This patch provides the counterpart to cogl_color_premultiply().

14 years agocogl: Initialize the framebuffer bits on state flush
Emmanuele Bassi [Wed, 26 May 2010 15:32:23 +0000 (16:32 +0100)]
cogl: Initialize the framebuffer bits on state flush

The place where we actually change the framebuffer is
_cogl_framebuffer_flush_state(), so if we changed to a new frame buffer
we need to initialize the color bits there.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094

14 years agocogl-framebuffer: Use the FBO extension for color sizes
Emmanuele Bassi [Wed, 26 May 2010 16:14:53 +0000 (17:14 +0100)]
cogl-framebuffer: Use the FBO extension for color sizes

OpenGL 3.0 deprecated querying of the GL_{RED,GREEN,BLUE}_BITS
constants, and the FBO extension provides a mechanism to query for the
color buffer sizes which *should* work even with the default
framebuffer. Unfortunately, this doesn't seem to hold for Mesa - so we
just use this for the offscreen CoglFramebuffer type, and we fall back
to glGetIntegerv() for the onscreen one.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094

14 years agocogl: Hide cogl_framebuffer_get_*_bits()
Emmanuele Bassi [Wed, 26 May 2010 15:31:18 +0000 (16:31 +0100)]
cogl: Hide cogl_framebuffer_get_*_bits()

These accessors should be private, for the time being.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094

14 years agodocs: Add DeformEffect and PageTurnEffect to the API reference
Emmanuele Bassi [Thu, 10 Jun 2010 17:51:22 +0000 (18:51 +0100)]
docs: Add DeformEffect and PageTurnEffect to the API reference

14 years agoeffect: Add PageTurnEffect
Emmanuele Bassi [Thu, 10 Jun 2010 15:56:16 +0000 (16:56 +0100)]
effect: Add PageTurnEffect

A simple deformation effect that simulates a page curl.

Ported from MxDeformPageTurn inside the Mx toolkit, written by
Chris Lord.

14 years agoeffect: Add DeformEffect
Emmanuele Bassi [Wed, 9 Jun 2010 16:52:06 +0000 (17:52 +0100)]
effect: Add DeformEffect

DeformEffect is an abstract class that should be used to write effects
that change the geometry of an actor before submitting it to the GPU.

Just like the ShaderEffect class, DeformEffect renders the actor to
which it has been applied into an FBO; then it creates a mesh and stores
it inside a VBO. Sub-classes can control vertex attributes like
position, texel coordinates and the color.

14 years agooffscreen-effect: Traslate the modelview with the offsets
Emmanuele Bassi [Thu, 10 Jun 2010 16:35:56 +0000 (17:35 +0100)]
offscreen-effect: Traslate the modelview with the offsets

Instead of using the stage offsets when painting we can simply traslate
the current modelview. This allows sub-classes to fully override the
paint_target() virtual function without chaining up.

14 years agodocs: Fix Effect subclassing section
Emmanuele Bassi [Thu, 10 Jun 2010 16:34:48 +0000 (17:34 +0100)]
docs: Fix Effect subclassing section

It still mentions the long since removed "prepare" function.

14 years agocogl-material: Fix the function which sets the enable blend flag
Neil Roberts [Wed, 9 Jun 2010 12:53:34 +0000 (13:53 +0100)]
cogl-material: Fix the function which sets the enable blend flag

This function had two problems. Firstly it would clear the enable
blend flag before calling pre_change_notify so that if blending was
previously enabled the journal would end up being flushed while the
flag was still cleared. Secondly it would call the pre change notify
whenever blending is needed regardless of whether it was already
needed previously.

This was causing problems in test-depth.

14 years agomaterial: Avoid redundant glBindTexture calls
Robert Bragg [Mon, 26 Apr 2010 09:01:43 +0000 (10:01 +0100)]
material: Avoid redundant glBindTexture calls

This adds a _cogl_bind_gl_texture_transient function that should be used
instead of glBindTexture so we can have a consistent cache of the
textures bound to each texture unit so we can avoid some redundant
binding.

14 years agomaterial: Adds backend abstraction for fragment processing
Robert Bragg [Mon, 26 Apr 2010 09:01:43 +0000 (10:01 +0100)]
material: Adds backend abstraction for fragment processing

As part of an effort to improve the architecture of CoglMaterial
internally this overhauls how we flush layer state to OpenGL by adding a
formal backend abstraction for fragment processing and further
formalizing the CoglTextureUnit abstraction.

There are three backends: "glsl", "arbfp" and "fixed". The fixed backend
uses the OpenGL fixed function APIs to setup the fragment processing,
the arbfp backend uses code generation to handle fragment processing
using an ARBfp program, and the GLSL backend is currently only there as
a formality to handle user programs associated with a material. (i.e.
the glsl backend doesn't yet support code generation)

The GLSL backend has highest precedence, then arbfp and finally the
fixed. If a backend can't support some particular CoglMaterial feature
then it will fallback to the next backend.

This adds three new COGL_DEBUG options:
* "disable-texturing" as expected should disable all texturing
* "disable-arbfp" always make the arbfp backend fallback
* "disable-glsl" always make the glsl backend fallback
* "show-source" show code generated by the arbfp/glsl backends

14 years agocogl-atlas-texture: Flush the journal before starting blit not after
Neil Roberts [Wed, 9 Jun 2010 13:42:18 +0000 (14:42 +0100)]
cogl-atlas-texture: Flush the journal before starting blit not after

_cogl_atlas_texture_blit_begin binds a texture to use as the
destination and it expects it to stay bound until
_cogl_atlas_texture_end_blit is called. However there was a call to
_cogl_journal_flush directly after setting up the blit state which
could cause the wrong texture to be bound. This just moves the flush
to before the call to _cogl_atlas_texture_blit_begin.

This was breaking test-cogl-sub-texture.

14 years agoatlas: fix some journal flushing issues
Robert Bragg [Fri, 4 Jun 2010 15:42:30 +0000 (16:42 +0100)]
atlas: fix some journal flushing issues

1) Always flush when migrating textures out of an atlas because although
it's true that the original texture data will remain valid in the
original texture we can't assume that journal entries have resolved the
GL texture that will be used. This is only true if a layer0_override has
been used.

2) Don't flush at the point of creating a new atlas simply flush
immediately before reorganizing an atlas. This means we are now assuming
that we will never see recursion due to atlas textures being modified
during a journal flush. This means it's the responsibility of the
primitives code to _ensure_mipmaps for example not the responsibility of
_cogl_material_flush_gl_state.

14 years agoprimitives: make sure to update texture storage before drawing
Robert Bragg [Fri, 4 Jun 2010 16:06:32 +0000 (17:06 +0100)]
primitives: make sure to update texture storage before drawing

We want to make sure that the material state flushing code will never
result in changes to the texture storage for that material. So for
example mipmaps need to be ensured by the primitives code.

Changes to the texture storage will invalidate the texture coordinates
in the journal and we want to avoid a recursion of journal flushing.

14 years agotest-cogl-tex-foreign: save and restore GL state correctly
Robert Bragg [Mon, 26 Apr 2010 15:30:25 +0000 (16:30 +0100)]
test-cogl-tex-foreign: save and restore GL state correctly

This test breaks out into raw OpenGL to create a foreign texture so it
needs to be careful not to trample on any state that may be cached by
Cogl internally.

14 years agotest-cogl-texture-rectangle: save restore GL state correctly
Robert Bragg [Mon, 26 Apr 2010 15:27:59 +0000 (16:27 +0100)]
test-cogl-texture-rectangle: save restore GL state correctly

This test breaks out into raw OpenGL to create a RECTANGLE texture so it
needs to be careful not to trample on any state that may be cached by
Cogl internally.

14 years agomatrix: add cogl_matrix_equal API
Robert Bragg [Mon, 26 Apr 2010 08:55:50 +0000 (09:55 +0100)]
matrix: add cogl_matrix_equal API

This adds a way to compare two CoglMatrix structures to see if they
represent the same transformations. memcmp can't be used because a
CoglMatrix contains private flags and padding.