1
0
Fork 0
Commit graph

2633 commits

Author SHA1 Message Date
Emmanuele Bassi
b43e804c07 actor: Fix a pre-condition check in set_text_direction()
The check is failing because the condition should be:

  text_dir != CLUTTER_TEXT_DIRECTION_DEFAULT
2009-12-01 16:06:57 +00:00
Emmanuele Bassi
586750751a Merge branch 'text-direction'
* text-direction:
  docs: Add text-direction accessors
  Set the default language on the Pango context
  actor: Set text direction on parenting
  tests: Display the index inside text-box-layout
  box-layout: Honour :text-direction
  text: Dirty layout cache on text direction changes
  actor: Add :text-direction property
  Use the newly added ClutterTextDirection enumeration
  Add ClutterTextDirection enumeration
2009-12-01 14:55:19 +00:00
Emmanuele Bassi
15a04a1dd3 layout-manager: Create LayoutMeta on demand
The ClutterLayoutMeta instances should be created on demand, whenever
the layout manager needs them - if the layout manager supports layout
properties.

This removes the requirement to call add_child_meta() and
remove_child_meta() on add and remove respectively; it also simplifies
the implementation of LayoutManager sub-classes since we can add
fallback code in the base abstract class.

Eventually, this will also lead to an easier to implement ClutterScript
parser for layout properties.

With the new scheme, the ClutterLayoutMeta instance is created whenever
the layout manager tries to access it; if there isn't an instance
already attached to the container's child, one is created -- assuming
that the LayoutManager sub-class has overridden the
get_child_meta_type() virtual function and it's returning a valid GType.

We can also provide a default implementation for create_child_meta(),
by getting the GType and instantiating a ClutterLayoutMeta with all the
fields already set. If the layout manager requires more work then it can
obviously override the default implementation (and even chain up to it).

The ClutterBox actor has been updated, as well as the ClutterBoxLayout
layout manager, to take advantage of the changes of LayoutManager.
2009-11-30 19:11:00 +00:00
Neil Roberts
c3e640e6e3 Use the correct colour when clearing the stage for picking
The colour test for the stage in _clutter_do_pick checks for white to
determine whether the stage was picked but since 47db7af4d we were
setting the colur to black. This usually worked because the id of the
default stage ends up being 0 which equates to black. However if a
second stage is created then it will always end up picking the first
stage.
2009-11-30 19:09:05 +00:00
Neil Roberts
1bb034fbd7 cogl: Enable blending if a lighting colour is semi-transparent
We currently enable blending if the material colour has
transparency. This patch makes it also enable blending if any of the
lighting colours have transparency. Arguably this isn't neccessary
because we don't expose any API to enable lighting so there is no
bug. However it is currently possible to enable lighting with a direct
call to glEnable and this otherwise works so it is a shame not to have
it.

http://bugzilla.openedhand.com/show_bug.cgi?id=1907
2009-11-30 19:08:38 +00:00
Emmanuele Bassi
3cb974ee8b Set the default language on the Pango context
When creating the Pango context we should also set the language
to be the default Pango language.
2009-11-30 16:15:19 +00:00
Emmanuele Bassi
daeb3b2fec actor: Set text direction on parenting
When setting the parent on an actor we should set the text direction to
be the same as the parent's.
2009-11-30 16:14:09 +00:00
Robert Bragg
934eb5d251 primitives: Don't use dynamic arrays since VS2008 can't cope with them :-(
This changes _cogl_path_fill_nodes_scanlines to use g_alloca instead of
using a variable to declare an array length.
2009-11-27 15:24:09 +00:00
Robert Bragg
47db7af4d3 picking: avoid redundant picking geometry for the stage.
The stage's pick id can be written to the framebuffer when we call
cogl_clear so there's no need for the stage to also chain up in it's pick
function resulting in clutter-actor.c also emitting a rectangle for the
stage.
2009-11-27 00:43:57 +00:00
Robert Bragg
439f8c62b0 cogl: deprecate cogl_draw_buffer API and replace with a cogl_framebuffer API
cogl_push_draw_buffer, cogl_set_draw_buffer and cogl_pop_draw_buffer are now
deprecated and new code should use the new cogl_framebuffer_* API instead.

Code that previously did:
    cogl_push_draw_buffer ();
    cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, buffer);
    /* draw */
    cogl_pop_draw_buffer ();
should now be re-written as:
    cogl_push_framebuffer (buffer);
    /* draw */
    cogl_pop_framebuffer ();

As can be seen from the example above the rename has been used as an
opportunity to remove the redundant target argument from
cogl_set_draw_buffer; it now only takes one call to redirect to an offscreen
buffer, and finally the term framebuffer may be a bit more familiar to
anyone coming from an OpenGL background.
2009-11-26 19:33:14 +00:00
Robert Bragg
b598210e01 cogl_offscreen: deprecate cogl_offscreen_ref/unref.
New code should use cogl_handle_ref/unref
2009-11-26 19:33:13 +00:00
Neil Roberts
e12a691187 cogl: Use a vtable for the texture backends instead of a type and switch
Instead of storing an enum with the backend type for each texture and
then using a switch statement to decide which function to call, we
should store pointers to all of the functions in a struct and have
each texture point to that struct. This is potentially slightly faster
when there are more backends and it makes implementing new backends
easier because it's more obvious which functions have to be
implemented.
2009-11-25 13:47:28 +00:00
Robert Bragg
558b17ee1e offscreen: cogl_offscreen_new_to_texture now supports GL_TEXTURE_RECTANGLE_ARB
cogl_offscreen_new_to_texture previously bailed out if the given texture's
GL target was anything but GL_TEXTURE_2D, but it now also allows
foreign GL_TEXTURE_RECTANGLE_ARB textures.

Thanks to Owen for reporting this issue, ref:
https://bugzilla.gnome.org/show_bug.cgi?id=601032
2009-11-25 02:56:25 +00:00
Robert Bragg
d3a01e0c96 debug: remove the COGL_DEBUG=client-side-matrices option
Cogl only supports client side matrices so this debug option is no longer
useful.
2009-11-25 02:55:56 +00:00
Robert Bragg
b38c6b420f [cogl-material] Adds cogl_material_copy() API
cogl_material_copy can be used to create a new CoglHandle referencing a copy
of some given material.

From now on we will advise that developers always aim to use this function
instead of cogl_material_new() when creating a material that is in any way
derived from another.

By using cogl_material_copy, Cogl can maintain an ancestry for each material
and keep track of "similar" materials.  The plan is that Cogl will use this
information to minimize the cost of GPU state transitions.
2009-11-24 17:58:22 +00:00
Robert Bragg
70ca3bfe41 [cogl] remove unused gles/cogl-utils.[c,h]
The only function in gles/cogl-utils.c was cogl_util_next_p2() and it's
redundant since we also have a cogl/cogl-utils.[c,h]
2009-11-24 17:58:22 +00:00
Robert Bragg
4a63af0c63 docs: Don't document cogl_flush_gl_state as public API
This function was #if 0'd before we released Clutter 1.0 so there's no
implementation of it.  At some point we thought it might assist with
developers breaking out into raw OpenGL.  Breaking out to raw GL is a
difficult problem though so we decided instead we will wait for a specific
use case to arrise before trying to support it.
2009-11-24 17:58:22 +00:00
Emmanuele Bassi
328ce370e7 animation: Keep a weak reference on actors
Actors, unlike objects, can effectively go away whilst being
animated - usually because of an explicit destoy().

The Animation created by clutter_actor_animate() and friends
should keep a weak reference on the actor and eventually
get rid of the animation itself in case the actor goes away
whilst being animated.
2009-11-24 16:59:24 +00:00
Neil Roberts
1107fa8797 Minor fix to cogl material
_cogl_material_get_layer expects a CoglMaterial* pointer but it was
being called with a CoglHandle. This doesn't matter because the
CoglHandle is actually just the CoglMaterial* pointer anyway but it
breaks the ability to change the _cogl_material_pointer_from_handle
macro.
2009-11-23 18:36:59 +00:00
Emmanuele Bassi
8d64c4641d docs: Increase consistency in Cogl documentation 2009-11-19 14:19:59 +00:00
Emmanuele Bassi
550c14449e docs: Documentation fixes for CoglMatrix
Clean up the references, the docbook tags, and the style to fit in
with the rest of the API references for Cogl and Clutter.
2009-11-19 13:56:47 +00:00
Emmanuele Bassi
056cfcffc3 Whitespace fix for cogl-color.h 2009-11-19 13:56:47 +00:00
Emmanuele Bassi
851d628cf8 docs: Documentation fixes for CoglMaterial
Clean up the references, the docbook tags, and the style to fit in
with the rest of the API references for Cogl and Clutter.
2009-11-19 13:56:47 +00:00
Emmanuele Bassi
fe804f1d02 docs: Documentation fixes for CoglBitmap
• Use the same style for the Cogl API reference as the one used for
  the Clutter API reference.

• Fix the introspection annotations for cogl_bitmap_get_size_from_file()
2009-11-19 13:56:47 +00:00
Emmanuele Bassi
05a5a7e759 docs: Remove non-gtk-doc annotations
The imported Mesa matrix code has some documentation annotations
that make gtk-doc very angry. Since it's all private anyway we
can safely make gtk-doc ignore the offending stuff.
2009-11-19 13:55:46 +00:00
Neil Roberts
7a011af974 docs: Fix the 'Since' annotation for some functions
The 'Since' annotation needs to have a colon after it or gtk-doc won't
pick it up.
2009-11-19 11:51:21 +00:00
Neil Roberts
8ef57898ad cogl: Use APIENTRY for GL function pointer declarations
This matters for platforms such as Windows that use a different
calling covention from the default for GL functions.
2009-11-18 19:24:09 +00:00
Neil Roberts
be58e5261f build: Fix out-of-tree builds for cogl-defines.h
$(COGL_DRIVER)/cogl-defines.h is generated in the configure script so
it ends up in the build directory. Therefore the build rule for
cogl/cogl-defines.h should depend on the file in $(builddir) not
$(srcdir).
2009-11-18 19:24:09 +00:00
Emmanuele Bassi
19e485325f docs: Clean up deprecation notices
The deprecation notices in gtk-doc should also refer to the
release that added the deprecation, and if the deprecated
symbol has been replaced by something else then the new symbol
should be correctly referenced.
2009-11-18 18:04:13 +00:00
Emmanuele Bassi
5f28c8b654 build: Make cogl.h not conditional on driver defines
The main COGL header cogl.h is currently created at configure time
because it conditionally includes the driver-dependent defines. This
sometimes leads to a stale cogl.h with old definitions which can
break the build until you clean out the whole tree and start from
scratch.

We can generate a stable cogl-defines.h at build time from the
equivalent driver-dependent header and let cogl.h include that
file instead.
2009-11-18 17:49:21 +00:00
Emmanuele Bassi
60fae6a92e build: Add cogl-matrix-private.h to the dist 2009-11-18 14:43:46 +00:00
Emmanuele Bassi
425f3b4660 build: Add cogl-feature-functions.h to the dist 2009-11-18 14:43:46 +00:00
Neil Roberts
142305b1d5 cogl: Add the missing terminators for the arrays of feature functions
_cogl_feature_check expects the array of function names to be
terminated with a NULL pointer but I forgot to add this. This was
causing crashes depending on what happened to be in memory after the
array.
2009-11-18 13:23:10 +00:00
Christian Persch
70aeb1c642 Pass the interned string value to the binding callback
http://bugzilla.openedhand.com/show_bug.cgi?id=1891

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-11-17 21:32:17 +00:00
Neil Roberts
2832940603 cogl: Use the GL_EXT_blend_{func,equation}_separate extensions
We should use these extensions to check for glBlendFuncSeparate and
glBlendEquationSeparate as well as checking the GL version number.
2009-11-17 18:06:31 +00:00
Neil Roberts
6e0877507e cogl: Don't bother checking for NPOTs or VBOs on later GLs
For VBOs, we don't need to check for the extension if the GL version
is greater than 1.5. Non-power-of-two textures are given in 2.0.

We could also assume shader support in GL 2.0 except that the function
names are different from those in the extension so it wouldn't work
well with the current mechanism.
2009-11-17 17:22:22 +00:00
Neil Roberts
91cde78a70 cogl: Make it easier to add checks for GL extensions
Previously if you need to depend on a new GL feature you had to:

- Add typedefs for all of the functions in cogl-defines.h.in

- Add function pointers for each of the functions in
  cogl-context-driver.h

- Add an initializer for the function pointers in
  cogl-context-driver.c

- Add a check for the extension and all of the functions in
  cogl_features_init. If the extension is available under multiple
  names then you have to duplicate the checks.

This is quite tedious and error prone. This patch moves all of the
features and their functions into a list of macro invocations in
cogl-feature-functions.h. The macros can be redefined to implement all
of the above tasks from the same header.

The features are described in a struct with a pointer to a table of
functions. A new function takes the feature description from this
struct and checks for its availability. The feature can take a list of
extension names with a list of alternate namespaces (such as "EXT" or
"ARB"). It can also detect the feature from a particular version of
GL.

The typedefs are now gone and instead the function pointer in the Cogl
context just directly contains the type.

Some of the functions in the context were previously declared with the
'ARB' extension. This has been removed so that now all the functions
have no suffix. This makes more sense when the extension could
potentially be merged into GL core as well.
2009-11-17 15:11:26 +00:00
Neil Roberts
037192552e win32: Remove the check for GL 1.2
Since 568c29ba4 the GL version is now validated further up in
ClutterStage via Cogl so there is no need for the Win32 backend to do
it.
2009-11-13 17:23:13 +00:00
Neil Roberts
62a37d8e53 Use the GL_ARB_multitexture extension on GL 1.2
Cogl requires multi-texturing support. This is only available as an
extension in GL 1.2 so we should check for it before accepting the
driver.

http://bugzilla.openedhand.com/show_bug.cgi?id=1875
2009-11-13 15:56:01 +00:00
Neil Roberts
2e99b276a4 cogl-material: Fallback to BlendFunc if BlendFuncSeparate is unavailable
glBlendFuncSeparate is only available in OpenGL 1.4. If we
conditionally check for this then Clutter will work with OpenGL 1.2.

http://bugzilla.openedhand.com/show_bug.cgi?id=1875
2009-11-13 15:55:55 +00:00
Neil Roberts
568c29ba49 Validate that the GL version is >= 1.2
There is a new internal Cogl function called _cogl_check_driver_valid
which looks at the value of the GL_VERSION string to determine whether
the driver is supported. Clutter now calls this after the stage is
realized. If it fails then the stage is marked as unrealized and a
warning is shown.

_cogl_features_init now also checks the version number before getting
the function pointers for glBlendFuncSeparate and
glBlendEquationSeparate. It is not safe to just check for the presence
of the functions because some drivers may define the function without
fully implementing the spec.

The GLES version of _cogl_check_driver_valid just always returns TRUE
because there are no version requirements yet.

Eventually the function could also check for mandatory extensions if
there were any.

http://bugzilla.openedhand.com/show_bug.cgi?id=1875
2009-11-13 15:55:48 +00:00
Samuel Degrande
677ff9fb30 Can no more include clutter-stage.h inside clutter-win32.h
http://bugzilla.openedhand.com/show_bug.cgi?id=1847

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-11-13 15:50:01 +00:00
Samuel Degrande
26ce94eda0 Adapt win32 backend to the semantic change of StageWindow
http://bugzilla.openedhand.com/show_bug.cgi?id=1847

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-11-13 15:50:00 +00:00
Neil Roberts
568ad044eb Clear pending events for a stage when it is destroyed
We can not process events for a stage that has been destroyed so we
should make sure that the events for the stage are removed from the
global event queue during dispose.

http://bugzilla.openedhand.com/show_bug.cgi?id=1882
2009-11-13 15:27:38 +00:00
Emmanuele Bassi
49cd887aab docs: Document the AnimationMode definition
Both ClutterAlpha:mode and ClutterAnimation:mode can be defined using:

  • an integer id
  • the "nick" field of the AnimationMode GEnumValue
  • a custom, tweener-like string

All these methods should be documented.
2009-11-13 15:01:17 +00:00
Emmanuele Bassi
d54f4e944c Whitespace fixes 2009-11-13 15:01:17 +00:00
Emmanuele Bassi
9bae553564 animation: Override parsing :mode
Like in ClutterAlpha, ClutterAnimation:mode must be overridden when
parsing a Script definition, as we accept both a numeric id and the
string id for easing modes.
2009-11-13 15:01:17 +00:00
Neil Roberts
dab1da20ae [cogl-primitives] Don't clear the whole stencil buffer
When _cogl_add_path_to_stencil_buffer is used to draw a path we don't
need to clear the entire stencil buffer. Instead it can clear just the
bounding box of the path. This adds an extra parameter called
'need_clear' which is only set if the stencil buffer is being used for
clipping.

http://bugzilla.openedhand.com/show_bug.cgi?id=1829
2009-11-13 10:51:47 +00:00
Neil Roberts
bc8faf52f4 Remove _cogl_flush_matrix_stacks from cogl-internal.h
The definition for this function was removed in f7d64e5abvoid so it
should be removed from the header too.
2009-11-12 17:01:44 +00:00
Emmanuele Bassi
9fa562ad21 cogl: Declare cogl_is_bitmap()
The function is automatically defined by the CoglHandle type
definition macro, but it still requires to be declared in the
header file to be used.
2009-11-11 10:32:39 +00:00
Emmanuele Bassi
4bc3d02ebd box-layout: Honour :text-direction
During size request and allocation a ClutterBoxLayout should honour
the ClutterActor:text-direction property, and change the order of
the children.
2009-11-10 12:20:14 +00:00
Emmanuele Bassi
adab87b520 text: Dirty layout cache on text direction changes
When the text direction changes we should evict the cached layouts
to avoid stale entries in case the direction change produces a layout
with the same size.
2009-11-10 12:18:32 +00:00
Emmanuele Bassi
f94f7692a6 actor: Add :text-direction property
Every actor should have a property for retrieving (and setting) the
text direction.

The text direction is used to provide a consisten behaviour in both
left-to-right and right-to-left languages. For instance, ClutterText
should perform key navigation following text direction. Layout
managers should also take into account text direction to derive the
right packing order for their children.
2009-11-10 12:16:55 +00:00
Emmanuele Bassi
53a9d0c637 Use the newly added ClutterTextDirection enumeration
Instead of using PangoDirection directly we should use the
ClutterTextDirection enumeration.

We also need a pair of accessor functions for setting and
getting the default text direction.
2009-11-10 11:06:20 +00:00
Emmanuele Bassi
3958df4ff9 Add ClutterTextDirection enumeration
The ClutterTextDirection is composed of three values:

  DEFAULT: a flag for returning the default text direction
  LTR: left to right
  RTL: right to left
2009-11-10 11:06:20 +00:00
Neil Roberts
1ce25ffbb2 cogl: Add an initialiser for enable_flags in cogl_begin_gl
This fixes a warning about an uninitialised value. It could also
potentially fix some crashes for example if the enable_flags value
happened to include a bit for enabling a vertex array if no vertex
buffer pointer was set.
2009-11-09 11:50:16 +00:00
Emmanuele Bassi
09c04d4c67 text: Add a NULL preedit string check
This commit avoids a critical warning introduced by commit
bc51b8ca47
2009-11-09 11:07:27 +00:00
Raymond Liu
bc51b8ca47 Fix cursor position in preedit status
http://bugzilla.openedhand.com/show_bug.cgi?id=1871

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-11-09 10:50:18 +00:00
Emmanuele Bassi
7e17822cfd Clean up cogl.h template
The inclusion order is mostly random, and it should really be
in alphabetic order, just like clutter.h.

Also, cogl-vertex-buffer.h is included twice.
2009-11-06 15:06:39 +00:00
Tim Horton
fcd8237ac5 osx: CGBitmapContextCreate can't make 24bpp, alphaless offscreen pixmaps
While loading a JPEG from disk (with clutter_texture_new_from_file),
I got the following:

<Error>: CGBitmapContextCreate: unsupported parameter combination: 8
integer bits/component; 24 bits/pixel; 3-component colorspace;
kCGImageAlphaNone; 3072 bytes/row.
<Error>: CGContextDrawImage: invalid context

Looking around, I found that CGBitmapContextCreate can't make 24bpp
offscreen pixmaps without an alpha channel...

This fixes the bug, and seems to not break other things...

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-11-06 14:10:41 +00:00
Emmanuele Bassi
5c67e8e0c0 script: Coding style clean-ups 2009-11-06 14:07:46 +00:00
Emmanuele Bassi
179a66c922 script: Document private functions 2009-11-06 14:07:26 +00:00
Emmanuele Bassi
30bc36082e Do not pass flags to g_module_open(NULL)
The flags are ignored when opening the main module, so we
should pass 0 to avoid confusion when reading the source.
2009-11-06 14:06:18 +00:00
Joshua Lock
031d4d6203 osx: Fix a warning on Snow Leopard
Apple where nice and changed API between releases. This patch checks the
version of the compilation environment and tries to use the right parameter
type.

http://bugzilla.openedhand.com/show_bug.cgi?id=1866
2009-11-06 11:48:42 +00:00
Joshua Lock
4533e37744 osx: Implement the updated ClutterStageWindow interface
In the new Clutter world backend stage implementations should be lightweight
objects implementing the ClutterStageWindow interface and not ClutterActor
subclasses.

This patch performs various cut-n-pastes to acheive that for the OSX backend

http://bugzilla.openedhand.com/show_bug.cgi?id=1864
2009-11-06 11:47:49 +00:00
Emmanuele Bassi
cb60c038ac behaviour: Implement the implicit alpha parsing
ClutterBehaviour should implement the Scriptable interface
and parse ClutterAlpha when implicitly defined, instead of
having this ad hoc code inside ClutterScriptParser itself.

After all, only ClutterBehaviour supports Alpha defined
implicitly.
2009-11-06 11:39:30 +00:00
Emmanuele Bassi
7279afd28c script: Generic assignment of properties requiring objects
The ClutterScriptParser should do most of the heavy-lifting for
parsing a JSON object member defining another JSON object into
a GObject property defined using a GParamSpecObject.
2009-11-06 11:39:30 +00:00
Emmanuele Bassi
f9581ca5ce script: Apply properties when constructing implicit timelines
The object construction is done in two passes, now, so we must do both
passes when parsing implicit timelines from a fake ObjectInfo.
2009-11-06 11:39:30 +00:00
Robert Bragg
abae6013e1 Remove all internal use of deprecated cogl_clip_* API
cogl_clip_push, and cogl_clip_push_window_rect which are now deprecated were
used in various places internally so this just switches to using the
replacement functions.
2009-11-05 21:10:18 +00:00
Robert Bragg
c1d9e09d38 [clip-stack] stop using deprecated cogl_clip_push_window_rect API
try_pushing_rect_as_window_rect now uses the new
cogl_clip_push_window_rectangle API.
2009-11-05 21:10:17 +00:00
Robert Bragg
272e227109 [cogl-clip] deprecate parts and cleanup the API
cogl_clip_push() which accepts a rectangle in model space shouldn't have
been defined to take x,y,width,height arguments because this isn't consistant
with other Cogl API dealing with model space rectangles.  If you are using a
coordinate system with the origin at the center and the y+ extending up,
then x,y,width,height isn't as natural as (x0,y0)(x1,y1). This API has
now been replace with cogl_clip_push_rectangle()

(As a general note: the Cogl API should only use the x,y,width,height style
when the appropriate coordinate space is defined by Cogl to have a top left
origin.  E.g.  window coordinates, or potentially texture coordinates)

cogl_clip_push_window_rect() shouldn't have been defined to take float
arguments since we only clip with integral pixel precision. We also
shouldn't have abbreviated "rectangle". This API has been replaced with
cogl_clip_push_window_rectangle()

cogl_clip_ensure() wasn't documented at all in Clutter 1.0 and probably
no one even knew it existed. This API isn't useful, and so it's now
deprecated. If no one complains we may remove the API altogether for
Clutter 1.2.

cogl_clip_stack_save() and cogl_clip_stack_restore() were originally added
to allow us to save/restore the clip when switching to/from offscreen
rendering.  Now that offscreen draw buffers are defined to own their clip
state and the state will be automatically saved and restored this API is now
redundant and so deprecated.
2009-11-05 21:10:17 +00:00
Robert Bragg
6cd49fdd40 [clip-stack] Internally track model space clip rects as (x0,y0)(x1,y1) pairs
Don't track the rectangles as x0,y0,width,height. This is in preparation
for some API tidy up.
2009-11-05 21:10:17 +00:00
Robert Bragg
7752ed98f1 [clip-stack] move lots of supporting code from cogl.c to cogl-clip-stack.c
There was quite a bit of code in cogl.c that was only used to support
cogl-clip-stack.c, so this has now been moved to cogl-clip-stack.c
2009-11-05 21:10:16 +00:00
Robert Bragg
864e12df05 [debug] Adds a COGL_DEBUG=force-scanline-paths
For a long time now the GLES driver for Cogl has supported a fallback
scanline rasterizer for filling paths when no stencil buffer is available,
but now that we build the same cogl-primitives code for GL and GLES I
thought it may sometimes be useful for debugging to force Cogl to use the
scanline rasterizer instead of the current stencil buffer approach.
2009-11-05 21:10:16 +00:00
Emmanuele Bassi
c3368c0d15 layout: Add layout properties introspection
In order to know if a layout property exists and retrieve its
description in form of a GParamSpec, we need a wrapper API inside
ClutterLayoutManager. This allows introspecting a LayoutManager
sub-class and eventually serialize and deserialize it.
2009-11-05 12:26:57 +00:00
Emmanuele Bassi
b0c9de2730 box-layout: Add get_child_meta_type() override
Return the GType of ClutterBoxChild.
2009-11-05 12:26:30 +00:00
Emmanuele Bassi
eea00d2805 bin-layout: Add get_child_meta_type() override
Return the GType of ClutterBinLayer.
2009-11-05 12:26:10 +00:00
Emmanuele Bassi
e6dff59b27 layout: Add LayoutManager::get_child_meta_type()
In order to inspect a LayoutManager using LayoutMeta we need a
virtual function that returns the GType of the LayoutMeta used.
2009-11-05 12:09:44 +00:00
Emmanuele Bassi
95d78acb4c script: Allow parsing child properties
The ClutterScript parser needs to be extended to parse child properties
and apply them after an actor has been added to a container. In order to
distinguish child properties from regular GObject properties we can use
the "child::" prefix, e.g.:

  {
    "type" : "ClutterRectangle",
    "id" : "child-01",
    "child::has-focus" : true,
    ...
  }

Parsing child properties can be deferred to the ClutterScriptable
interface, just like regular properties.
2009-11-04 16:50:35 +00:00
Robert Bragg
c52d878032 [cogl-primitives] Get rid of driver specific cogl-primitives code
These files were practically identical, except the gles code had additional
support for filling paths without a stencil buffer.  All the driver code has
now been moved into cogl/cogl-primitives.c
2009-11-04 16:02:34 +00:00
Emmanuele Bassi
8ba13d6495 script: Clean up Color parsing rules
All the ClutterColor parsing rules should be coalesced inside
clutter_script_parse_color(): object, array and string notations
are the canonical ways of defining a ClutterColor inside a
ClutterScript definition. Having a single function in charge of
the parsing cleans up the code.
2009-11-04 15:21:03 +00:00
Emmanuele Bassi
3e815de32b script: Simplify boxed types parsing
We should use the typed accessors for complex JSON types, and
be more liberal in what we accept.
2009-11-04 15:20:12 +00:00
Emmanuele Bassi
4df59d330c script: Separate construction from properties application
Currently, ClutterScriptParser will construct the object (using the
construct-only and construct parameters), apply the properties from
the ClutterScript definition, and eventuall will add children and
behaviours.

The construction phase should be more compartimentalized: the objects
should be constructed first and eventual children and behaviours
added. Then, once an object is requested or when the parsing process
has terminated, all the properties should be applied.

This change allows us to set up the actors before setting their
non-construct properties.
2009-11-04 14:18:43 +00:00
Emmanuele Bassi
31e5dadb68 script: Move all parser code inside ClutterScriptParser
ClutterScript is currently a mix of parser-related code and
the ClutterScript object. All the parser-related code should
be moved inside a private class, ClutterScriptParser, inheriting
from JsonParser.
2009-11-04 13:32:26 +00:00
Emmanuele Bassi
6e571928a4 script: Take a copy of property nodes
Instead of counting on a JsonNode pointer to survive we should take
a copy. This allows keeping unresolved properties across different
ClutterScript passes.
2009-11-04 10:43:11 +00:00
Emmanuele Bassi
4ad57aa3e4 script: Use JsonObject direct accessors
Instead of getting the JsonNode for a member of which we mandate
the type we can use the typed accessors of JsonObject.
2009-11-04 10:43:11 +00:00
Robert Bragg
fec13f6202 [cogl-texture-2d-sliced] allow COGL_FORMAT_ANY with _new_with_size()
It's useful when initialzing offscreen draw buffers to be able to ask
Cogl to create a texture of a given size and with the default internal
pixel format.
2009-11-04 03:34:07 +00:00
Robert Bragg
ae57c30e93 [texture] fix rounding when calculating update_fbo viewport offset
When rendering to an fbo for supporting clutter_texture_new_from_actor we
render to an fbo with the same size as the source actor, but with a viewport
the same size as the stage.  We offset the viewport so when we render the
source actor in its normal transformed stage position it lands on the fbo.
Previously we were rounding the transformed position given as a float by
truncating the fraction (just using a C cast) but that resulted in an
incorrect pixel offset when rendering offscreen depending on the source
position.

We now simply + 0.5 before casting (or -0.5 for negative numbers)
2009-11-04 03:34:07 +00:00
Robert Bragg
309f852efb [texture] switch to a new design for handling offscreen rendering
For supporting clutter_texture_new_from_actor(): when updating a
ClutterTexture's fbo we previously set up an offset frustum in the
perspective matrix before rendering source actors to an offscreen draw
buffer so as to give a perspective as if it were being drawn at its
original stage location.

Now that Cogl supports offset viewports there is a simpler way...

When we come to render the source actor to our offscreen draw buffer we
now copy the projection matrix from the stage; we create a viewport
that's also the same size as the stage (though larger than the offscreen
draw buffer) and as before we apply the modelview transformations of
the source actors ancestry before painting it.

The only trick we need now is to offset the viewport according to the
transformed (to screen space) allocation of the source actor (something we
required previously too).  We negatively offset the stage sized viewport
such that the smaller offscreen draw buffer is positioned to sit underneath
the source actor in stage coordinates.
2009-11-04 03:34:07 +00:00
Robert Bragg
94a6028358 [texture] split out fbo update code from cluter_texture_paint
To help keep clutter_texture_paint maintainable this splits out a big
chunk of standalone code that's responsible for updating the fbo when
clutter_texture_new_from_actor has been used.
2009-11-04 03:34:06 +00:00
Robert Bragg
2762e6d9b9 [texture] push/pop draw buffer when painting actors to a texture
When updating the FBO for a source actor (to support
clutter_texture_new_from_actor()) we used to simply set an offscreen draw
buffer to be current, paint the source actor and then explicitly set the
window to be current again.  This precluded chaining texture_new_from_actor
though because updating another FBO associated with a source actor would end
up restoring the window as the current buffer instead of the previous
offscreen buffer.  Now that we use Cogl's draw buffer stack; chaining
clutter_texture_new_from_actor() should be possible.
2009-11-04 03:34:06 +00:00
Robert Bragg
c7d229585f [texture] Avoid redundant use of cogl_clip_stack_save when drawing offscreen
Since cogl draw buffers now own their clip state the stage's clip state will
automatically be saved and restored via the cogl_set_draw_buffer API.
2009-11-04 03:34:06 +00:00
Robert Bragg
90dbae5aa9 [cogl-draw-buffer] fix Cogl -> GL viewport coord conversion
Before we call glViewport we need to convert Cogl viewport coordinates
(where the origin is defined to be top left) to OpenGL coordinates
(where the origin is defined to be bottom left)

We weren't considering that offscreen rendering is always upside down
and in this case Cogl coordinates == OpenGL coordinates.
2009-11-04 03:34:05 +00:00
Robert Bragg
149e3e168a [cogl_clip_push_window_rect] fix Cogl -> GL coordinate conversion
Firstly this now uses the draw buffer height not the viewport height
when we need to perform a y = height - y conversion, since (as the
name suggests) we are dealing with window coordinates not viewport
coordinates.

Secondly this skips any conversion when the current draw buffer is an
offscreen draw buffer since offscreen rendering is always forced to be
upside down and in this case Cogl window coordinates == GL window
coordinates.
2009-11-04 03:34:05 +00:00
Robert Bragg
0369a1b84d [matrix] Adds cogl_matrix_get_inverse API
This new API takes advantage of the recently imported Mesa code to support
inverse matrix calculation.  The matrix code keeps track (via internal
flags) of the transformations a matrix represents so that it can select an
optimized inversion function.

Note: although other aspects of the Cogl matrix API have followed a similar
style to Cairo's matrix API we haven't added a cogl_matrix_invert API
because the inverse of a CoglMatrix is actually cached as part of the
CoglMatrix structure meaning a destructive API like cogl_matrix_invert
doesn't let users take advantage of this caching design.
2009-11-04 03:34:05 +00:00
Robert Bragg
8051596e96 [debug] Adds a COGL_DEBUG=matrices debug option
This adds a COGL_DEBUG=matrices debug option that can be used to trace all
matrix manipulation done using the Cogl API.  This can be handy when you
break something in such a way that a trace is still comparable with a
previous working version since you can simply diff a log of the broken
version vs the working version to home in on the bug.
2009-11-04 03:34:04 +00:00
Robert Bragg
eb438dd499 [cogl-matrix] Import Mesa's matrix manipulation code
This pulls in code from Mesa to improve our matrix manipulation support. It
includes support for calculating the inverse of matrices based on top of a
matrix categorizing system that allows optimizing certain matrix types.
(the main thing we were after) but also adds some optimisations for
rotations.

Changes compared to the original code from Mesa:

- Coding style is consistent with the rest of Cogl
- Instead of allocating matrix->m and matrix->inv using malloc, our public
  CoglMatrix typedef is large enough to directly contain the matrix, its
  inverse, a type and a set of flags.
- Instead of having a _math_matrix_analyse which updates the type, flags and
  inverse, we have _math_matrix_update_inverse which essentially does the
  same thing (internally making use of _math_matrix_update_type_and_flags())
  but with additional guards in place to bail out when the inverse matrix is
  still valid.
- When initializing a matrix with the identity matrix we don't immediately
  initialize the inverse matrix; rather we just set the dirty flag for the
  inverse (since it's likely the user won't request the inverse of the
  identity matrix)
2009-11-04 03:34:04 +00:00
Robert Bragg
d38d888f78 [cogl] avoid any state changes when cogl_set_backface_culling_enable is a nop
This is a simple optimization to bail out of cogl_set_backface_culling_enable
if it's not resulting in a change of state.
2009-11-04 03:34:04 +00:00
Robert Bragg
764cca75b4 [cogl] Use clockwise face winding for offscreen buffers with culling enabled
Because Cogl defines the origin for texture as top left and offscreen draw
buffers can be used to render to textures, we (internally) force all
offscreen rendering to be upside down. (because OpenGL defines the origin
to be bottom left)

By forcing the users scene to be rendered upside down though we also reverse
the winding order of all the drawn triangles which may interfere with the
users use of backface culling.  This patch ensures that we reverse the
winding order for a front face (if culling is in use) while rendering
offscreen so we don't conflict with the users back face culling.
2009-11-04 03:34:03 +00:00
Robert Bragg
b2ebb7db48 [main] Use cogl_read_pixels not glReadPixels in clutter-main.c
The debugging function read_pixels_to_file() and _clutter_do_pick were both
directly calling glReadPixels, but we don't wan't Clutter making direct
OpenGL calls and Cogl provides a suitable alternative.  It also means
read_pixels_to_file() doesn't need to manually flip the data read due to
differences in Clutter/Cogl coordinate systems.
2009-11-04 03:34:03 +00:00
Robert Bragg
40b8399d49 [cogl_read_pixels] don't force a 4 byte pack alignment
Technically this change shouldn't make a difference since we are
calling glReadPixels with GL_RGBA GL_UNSIGNED_BYTE which is a 4
byte format and it should always result in the same value according
to how OpenGL calculates the location of sequential rows.

i.e. k  = a/s * ceil(snl/a) where:
 a = alignment
 s = component size (1)
 n = number of components per pixel (4)
 l = number of pixels in a row
gives:
k = 4/1 * ceil(4l/4) and k = 1/1 * ceil(4l/1) which are equivalent

I'm changing it because I've seen i915 driver code that bails out of
hardware accelerated paths if the alignment isn't 1, and because
conceptually we have no alignment constraints here so even if the current
value has no effect, when we start reading back other formats it may upset
things.
2009-11-04 03:34:03 +00:00
Robert Bragg
a222ee22f9 [cogl_read_pixels] call cogl_flush() before changing glPixelStore state
We were previously calling cogl_flush() after setting up the glPixelStore
state for calling glReadPixels, but flushing the journal could itself
change the glPixelStore state.
2009-11-04 03:34:02 +00:00
Robert Bragg
ed431a3c65 [cogl_read_pixels] ensure we flush the current draw buffer state before reading
Make sure we call _cogl_draw_buffer_flush_state() before glReadPixels() to
be sure we have bound the correct framebuffer.
2009-11-04 03:34:02 +00:00
Robert Bragg
b47404c91d [cogl_read_pixels] fixes for calculating the y offset when rendering offscreen
Since offscreen rendering is forced to be upside down we don't need to do
any conversion of the users coordinates to go from Cogl window coordinates
to OpenGL window coordinates.
2009-11-04 03:34:02 +00:00
Robert Bragg
426197f51d [read-pixels] don't flip data when reading from offscreen draw buffers
Since we do all offscreen rendering upside down (so that we can have the
origin for texture coordinates be the top left of textures for the cases
where offscreen draw buffers are bound to textures) we don't need to flip
data read back from an offscreen framebuffer before we we return it to the
user.
2009-11-04 03:34:01 +00:00
Robert Bragg
21322848e0 [clip-stack] tidy up transform_point() code
I was originally expecting the code not to handle offset viewports or
viewports with a different size to the framebuffer, but it turns out the
code worked fine.  In the process though I think I made the code slightly
more readable.
2009-11-04 03:32:52 +00:00
Robert Bragg
8c3a132ecb [cogl] deprecate cogl_viewport() in favour of cogl_set_viewport()
cogl_viewport only accepted a viewport width and height, but there are times
when it's also desireable to have a viewport offset so that a scene can be
translated after projection but before hitting the framebuffer.
2009-11-04 03:23:21 +00:00
Robert Bragg
1e2d88e789 [cogl_read_pixels] use buffer not viewport height to calculate y offset
glReadPixel takes window coordinates not viewport coordinates so we
shouldn't have been assuming that the viewport height == window height.
2009-11-04 03:23:20 +00:00
Robert Bragg
e1630be35a [draw-buffer] Adds cogl_draw_buffer_get_{width,height} API
Simply adds missing API to query the width and height of any Cogl draw buffer.
2009-11-04 03:23:20 +00:00
Robert Bragg
12af275139 [cogl] Make sure Cogl always knows the current window geometry
Because Cogl defines the origin of viewport and window coordinates to be
top-left it always needs to know the size of the current window so that Cogl
window/viewport coordinates can be transformed into OpenGL coordinates.

This also fixes cogl_read_pixels to use the current draw buffer height
instead of the viewport height to determine the OpenGL y coordinate to use
for glReadPixels.
2009-11-04 03:23:20 +00:00
Robert Bragg
e3391b0173 [cogl] Make sure we draw upside down to offscreen draw buffers
First a few notes about Cogl coordinate systems:
- Cogl defines the window origin, viewport origin and texture coordinates
origin to be top left unlike OpenGL which defines them as bottom left.
- Cogl defines the modelview and projection identity matrices in exactly the
same way as OpenGL.
- I.e. we believe that for 2D centric constructs: windows/framebuffers,
viewports and textures developers are more used to dealing with a top left
origin, but when modeling objects in 3D; an origin at the center with y
going up is quite natural.

The way Cogl handles textures is by uploading data upside down in OpenGL
terms so that bottom left becomes top left.  (Note: This also has the
benefit that we don't need to flip the data we get from image decoding
libraries since they typically also consider top left to be the image
origin.)

The viewport and window coords are mostly handled with various y =
height - y tweaks before we pass y coordinates to OpenGL.

Generally speaking though the handling of coordinate spaces in Cogl is a bit
fragile.  I guess partly because none of it was design to be, it just
evolved from how Clutter defines its coordinates without much consideration
or testing.  I hope to improve this over a number of commits; starting here.

This commit deals with the fact that offscreen draw buffers may be bound to
textures but we don't "upload" the texture data upside down, and so if you
texture from an offscreen draw buffer you need to manually flip the texture
coordinates to get it the right way around.  We now force offscreen
rendering to be flipped upside down by tweaking the projection matrix right
before we submit it to OpenGL to scale y by -1.  The tweak is entirely
hidden from the user such that if you call cogl_get_projection you will not
see this scale.
2009-11-04 03:23:19 +00:00
Robert Bragg
8b4c496f2a [cogl] Ensure features are initialized first in cogl_create_context
Previously some context initializing was being done without valid feature
flags.
2009-11-04 03:23:19 +00:00
Robert Bragg
419db4dcfb [clip-stack] Handle flipped rectangles in try_pushing_rect_as_window_rect()
We were ignoring the possibility that the current modelview matrix may flip
the incoming rectangle in which case we didn't calculate a valid scissor
rectangle for clipping.

This fixes: http://bugzilla.o-hand.com/show_bug.cgi?id=1809
(Clipping doesn't work within an FBO)
2009-11-04 03:23:19 +00:00
Robert Bragg
f7d64e5abd [draw-buffers] First pass at overhauling Cogl's framebuffer management
Cogl's support for offscreen rendering was originally written just to support
the clutter_texture_new_from_actor API and due to lack of documentation and
several confusing - non orthogonal - side effects of using the API it wasn't
really possible to use directly.

This commit does a number of things:
- It removes {gl,gles}/cogl-fbo.{c,h} and adds shared cogl-draw-buffer.{c,h}
  files instead which should be easier to maintain.
- internally CoglFbo objects are now called CoglDrawBuffers. A
  CoglDrawBuffer is an abstract base class that is inherited from to
  implement CoglOnscreen and CoglOffscreen draw buffers.  CoglOffscreen draw
  buffers will initially be used to support the
  cogl_offscreen_new_to_texture API, and CoglOnscreen draw buffers will
  start to be used internally to represent windows as we aim to migrate some
  of Clutter's backend code to Cogl.
- It makes draw buffer objects the owners of the following state:
  - viewport
  - projection matrix stack
  - modelview matrix stack
  - clip state
(This means when you switch between draw buffers you will automatically be
 switching to their associated viewport, matrix and clip state)

Aside from hopefully making cogl_offscreen_new_to_texture be more useful
short term by having simpler and well defined semantics for
cogl_set_draw_buffer, as mentioned above this is the first step for a couple
of other things:
- Its a step toward moving ownership for windows down from Clutter backends
  into Cogl, by (internally at least) introducing the CoglOnscreen draw
  buffer.  Note: the plan is that cogl_set_draw_buffer will accept on or
  offscreen draw buffer handles, and the "target" argument will become
  redundant since we will instead query the type of the given draw buffer
  handle.
- Because we have a common type for on and offscreen framebuffers we can
  provide a unified API for framebuffer management. Things like:
  - blitting between buffers
  - managing ancillary buffers (e.g. attaching depth and stencil buffers)
  - size requisition
  - clearing
2009-11-03 17:23:03 +00:00
Robert Bragg
f8f8873714 [stage-x11] Ensure viewport is initialized before first stage paint
This ensures that glViewport is called before the first stage paint.
Previously _clutter_stage_maybe_setup_viewport (which is done before we
start painting) was bailing out without calling cogl_setup_viewport because
the CLUTTER_STAGE_IN_RESIZE flag may be set if the stage was resized before
the first paint.  (NB: The CLUTTER_STAGE_IN_RESIZE flag isn't removed until
we get an explicit event back from the X server since the window manager may
choose to deny/alter the resize.)

We now special case the first resize - where the viewport hasn't previously
been initialized and use the requested geometry to initialize the
glViewport without waiting for a reply from the server.
2009-11-02 16:55:02 +00:00
Robert Bragg
ad98e96d97 [cogl-fbo] Bring the gles code more in line with gl code
Over time the two cogl-fbo.c files have needlessly diverged as bug fixes or
cleanups went into one version but not the other.  This tries to bring them
back in line with each other.  It should actually be simple enough to move
cogl-fbo.c to be a common file, and simply not build it for GLES 1.1, so
maybe I'll follow up with such a patch soon.
2009-11-02 16:55:02 +00:00
Robert Bragg
613977f710 [cogl-fbo] Remove poorly documented workaround for unknown driver/hardware
The comment just said: "Some implementation require a clear before drawing
to an fbo.  Luckily it is affected by scissor test." and did a scissored
clear, which is clearly a driver bug workaround, but for what driver?  The
fact that it was copied into the gles backend (or vica versa is also
suspicious since it seems unlikely that the workaround is necessary for both
backends.)

We can easily restore the workaround with a better comment if this problem
really still exists on current drivers, but for now I'd rather minimize
hand-wavey workaround code that can't be tested.
2009-11-02 16:55:02 +00:00
Damien Lespiau
0599d12ec9 texture: Don't compare fbo_source with COGL_INVALID_HANDLE
fbo_source is a ClutterActor, it should be compared to NULL instead of
COGL_INVALID_HANDLE.
2009-11-02 14:40:43 +00:00
Emmanuele Bassi
f6e0e48ac6 build: Add missing gles/cogl-context-driver.h to dist
The gles/cogl-context-driver.h header file is missing from the
dist target, which means it's not in the tarballs.
2009-10-30 12:11:19 +00:00
Emmanuele Bassi
f551cbfb61 Add run-time version checks
Just like CLUTTER_CHECK_VERSION does version checking at compile
time, we need a way to verify the version of the library that we
are linking against. This is mostly needed for language bindings
and for run-time loadable modules -- when we'll get those.
2009-10-30 11:02:35 +00:00
Neil Roberts
f8e6727e74 [cogl_polygon] Enable COGL_ENABLE_BLEND when use_color is set
Otherwise you can't use the alpha channel of the vertex colors unless
the material has a texture with alpha or the material's color has
alpha less than 255.
2009-10-27 13:18:51 +00:00
Neil Roberts
0c32573ffa build: Add $(top_buiddir)/clutter/cogl to the include path in clutter/cogl/cogl
Some files try to include "cogl/cogl-defines-gl.h" so
$(top_builddir)/clutter/cogl needs to be in the include path for out of
tree builds to work.
2009-10-27 12:53:57 +00:00
Emmanuele Bassi
c387513a5f color: Fix HLS-to-RGB conversion
Apparently, on 64bit systems the floating point noise is enough
to screw up the float-to-int truncation.

The solution is to round up by 0.5 and then use floorf(). This
gives predictable and correct results on both 32bit and 64bit
systems.
2009-10-26 16:29:31 +00:00
Emmanuele Bassi
5a14db5089 layout: Do not create a LayoutMeta on remove
When calling remove_child_meta() we check if there is a LayoutMeta
already attached to the Actor, and if that LayoutMeta matches the
(manager, container, actor) tuple. If the LayoutMeta does not match,
though, we create a new LayoutMeta instance -- in order to remove it
right afterwards.

Instead of doing this, we can simply check for a matching LayoutMeta
and if present, remove it.

In case of an existing, non-matching LayoutMeta, we're left with a
dangling instance, but it does not matter: the removal happens in the
unparenting phase of a ClutterContainer, so either the Actor will be
destroyed and thus the LayoutMeta will be disposed along with it; or
it will be parented to another container, and thus the LayoutMeta
will be replaced.
2009-10-26 16:02:06 +00:00
Emmanuele Bassi
a5a0171cb0 box: Depth level changes should queue a relayout
ClutterBox is not ClutterGroup: a change in the level of an actor
through raise, lower or depth sorting must trigger a relayout.
2009-10-26 15:09:07 +00:00
Emmanuele Bassi
2cad7e24f0 box: Check before using the LayoutManager instance
A ClutterBox might not have a ClutterLayoutManager instance
associated -- for instance, during destruction. We should check
for one before calling methods on it.
2009-10-26 15:08:03 +00:00
Emmanuele Bassi
81c8cf3e6d texture: Error handling fix
When cogl_texture_new_from_data() fails in clutter_texture_set_from_data()
and no GError is provided, the clutter app will segfault when dereferencing
the GError ** and emitting LOAD_FINISHED signal.

Based on a patch by: Haakon Sporsheim <haakon.sporsheim@gmail.com>

http://bugzilla.openedhand.com/show_bug.cgi?id=1806
2009-10-26 11:51:30 +00:00
Emmanuele Bassi
f0b434918b docs: Add images for layout managers
It's easier to show the layout manager policy with a simple
screen shot coming from our interactive tests.
2009-10-23 17:32:18 +01:00
Emmanuele Bassi
924780ce35 cogl: Avoid C99-isms
Do not declare variables after statements.
2009-10-23 16:44:28 +01:00
Emmanuele Bassi
b56b26cc62 cogl: Remove cogl-current-matrix.c
The cogl-current-matrix.c file is unused since commit
5e5d94dfbe and it's not compiled
or distributed anymore.
2009-10-23 15:46:25 +01:00
Emmanuele Bassi
24594bcde4 build: Make COGL pass distcheck
Some changes to make COGL pass distcheck with Automake 1.11 and
anal-retentiveness turned up to 11.

The "major" change is the flattening of the winsys/ part of COGL,
which is built directly inside libclutter-cogl.la instead of an
intermediate libclutter-cogl-winsys.la object.

Ideally, the whole COGL should be flattened out using a
quasi-non-recursive Automake layout; unfortunately, the driver/
sub-section ships with identical targets and Automake cannot
distinguish GL and GLES objects.
2009-10-23 13:38:40 +01:00
Emmanuele Bassi
c882893e91 actor: Identify allocation cycles
If an actor calls directly or indirectly clutter_actor_queue_relayout()
on itself from within the allocate() implementation it will cause a
relayout cycle. This is usually a condition that should be checked by
ClutterActor and we should emit a warning if it is verified.
2009-10-23 13:38:40 +01:00
Emmanuele Bassi
ca15143d1f actor: Add checks for IN_DESTRUCTION flag
ClutterActor should check whether the current instance is being
destroyed and avoid performing operations like:

 • queueing redraws
 • queueing relayouts

It should also warn if the actor is being parented to an actor
currently being destroyed.
2009-10-23 13:38:40 +01:00
Emmanuele Bassi
7de47e74bd actor: Show actor name or type in the state checks warnings
When showing a warning in the state checks we perform to verify that
the invariants are maintained when showing, mapping and realizing, we
should also print out the name of the actor failing the checks. If the
actor has no name, the GType name should be used as a fallback.
2009-10-23 13:38:40 +01:00
Neil Roberts
f028744706 Fix some compilation errors in cogl-gles2-wrapper.c
The changes in 74f2122b6 introduced some syntax errors which were
preventing the GLES2 backend from compiling.
2009-10-22 18:04:59 +01:00
Emmanuele Bassi
8727c3127c clone: Set :source as CONSTRUCT
The :source property for ClutterClone is a constructor property, but
it most definitely is not a constructor-only one.
2009-10-22 15:51:06 +01:00
Neil Roberts
b82f874b46 Remove cogl/{gl,gles}/Makefile.am
These are no longer used anywhere.
2009-10-22 15:39:30 +01:00
Emmanuele Bassi
bd809f690a docs: Close the right tag to avoid XML errors 2009-10-21 17:44:44 +01:00
Emmanuele Bassi
7a52fddcd6 alpha: Manually parse the :mode property in ClutterScript
The :mode property for a ClutterAlpha can either be an integer, for
an easing mode logical id, or a string for the easing mode "nickname".
2009-10-21 16:14:40 +01:00
Emmanuele Bassi
01bc3fa2c8 script, docs: Update documentation for alphas
It is now possible to have Alpha instances defined explicitly for
behaviours, so we need to fix the documentation.
2009-10-21 15:43:01 +01:00
Emmanuele Bassi
f0ed71c77d alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:

  {
    "id" : "behaviour-1",
    "type" : "ClutterBehaviourDepth",
    "alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
    ...
  }

And:

  {
    "id" : "alpha-1",
    "type" : "ClutterAlpha",
    "timeline" : "timeline-1",
    "function" : "alpha_func"
  },
  {
    "id" : "behaviour-1",
    "type" : "ClutterBehaviourDepth",
    "alpha" : "alpha-1",
    ...
  }

The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 15:29:25 +01:00
Emmanuele Bassi
50aec3c540 script: Always allow setting object properties by id reference
The block that allows setting a GObject property holding an object
instance is conditionally depending on the USE_PIXBUF define. This
makes it impossible to reference an object inside ClutterScript on
platforms not using GdkPixbuf.
2009-10-21 15:17:50 +01:00
Emmanuele Bassi
ef8ae7d72f behaviour: Notify changes of the :alpha property
The set_alpha() setter of ClutterBehaviour is not emitting notifications
for the alpha property.
2009-10-21 15:16:43 +01:00
Owen W. Taylor
c137010524 Force a relayout when showing an actor
When an actor is hidden, the parent actor is not required to
size request or allocate it. (ClutterGroup does, but, for example,
NbtkBoxLayout doesn't.) This means that the
needs_width_request/needs_height_request/needs_allocate can be
stale when we go to show it again - they are set for the actor
but not the parent. Explicitly setting them to FALSE avoids
clutter_actor_relayout() improperly short-circuiting.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-21 12:21:25 +01:00
Emmanuele Bassi
571df43b6d text: Invalidate caches and sizes in set_text_internal()
The change in commit 3bbc96e17e moved the
:text property setter to use set_text_internal(); this function does not
invalidate the Layout cache and does not queue a relayout, thus breaking
the behaviour of ClutterText when setting the contents of the actor using
the property.

http://bugzilla.openedhand.com/show_bug.cgi?id=1851
2009-10-20 22:09:21 +01:00
Robert Bragg
91c38f877f [group] Fix copy & paste error from 857b0239e (Use FixedLayout inside Group)
clutter_group_get_preferred_height was calling
clutter_layout_manager_get_preferred_width which e.g.  broke
test-actor-clone.
2009-10-20 16:18:53 +01:00
Robert Bragg
74f2122b68 [gles2] remove lots of redundant matrix stack code
Since we no longer depend on the GL matrix API in Cogl we can remove a lot
of wrapper code from the GLES 2 backend.  This is particularly nice given
that there was no code shared between the cogl-matrix-stack API and gles2
wrappers so we had a lot of duplicated logic.
2009-10-20 12:32:51 +01:00
Robert Bragg
5e5d94dfbe [cogl] Removes the cogl-current-matrix abstraction
The indirection through this API isn't necessary since we no longer
arbitrate between the OpenGL matrix API and Cogl's client side API.  Also it
doesn't help to maintain an OpenGL style matrix mode API for internal use
since it's awkward to keep restoring the MODELVIEW mode and easy enough to
directly work with the matrix stacks of interest.

This replaces use of the _cogl_current_matrix API with direct use of the
_cogl_matrix_stack API.  All the unused cogl_current_matrix API is removed
and the matrix utility code left in cogl-current-matrix.c was moved to
cogl.c.
2009-10-20 12:32:50 +01:00
Robert Bragg
9f7bf9fb4d [matrix-stack] Adds ctx->flushed_matrix_mode to cache the gl matrix mode
This cache of the gl matrix mode lets us avoid repeat calls to glMatrixMode
in _cogl_matrix_stack_flush_to_gl when we have lots of sequential modelview
matrix modifications.
2009-10-20 12:32:50 +01:00
Robert Bragg
b1f9f0a97d matrix-stack: more optimization for load_identity case
This goes a bit further than the previous patch, and as a special case
we now simply represent identity matrices using a boolean, and only
lazily initialize them when they need to be modified.
2009-10-20 12:32:50 +01:00