Commit Graph

3094 Commits

Author SHA1 Message Date
Neil Roberts
0ff02d18d2 gles: Fix the functions names for the GL_OES_framebuffer_object ext
In 91cde78a7 I accidentally changed the function names that get looked
up for the framebuffer extension under GLES so that they didn't have
any suffix. The spec for extension specifies that they should have the
OES suffix.
2010-05-05 12:24:11 +01:00
Owen W. Taylor
d8e1bd989c Ignore unexpected GLX_BufferSwapComplete
A server that supports GLX_BufferSwapComplete will always send
these events, so we should just silently ignore them if we've
chosen not to take advantage of the INTEL_swap_event GLX
extension.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-05-05 12:00:40 +01:00
Emmanuele Bassi
33642757f5 animation: Use 'guint' for set_duration() parameter
The :duration property and the get_duration() method use unsigned int,
but the setter using a signed integer for no apparent reason.

http://bugzilla.openedhand.com/show_bug.cgi?id=2089
2010-05-05 11:32:39 +01:00
Jussi Kukkonen
0835e27380 container: use CLUTTER_IS_ACTOR on correct parameter
clutter_container_create_child_meta() uses CLUTTER_IS_ACTOR on the
container parameter instead of the actor parameter.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-05-05 11:31:14 +01:00
Damien Lespiau
71f942d03a debug: Use G_UNLIKELY in the tests
Debugging code is not meant to be run in the nominal code path. Use
G_UNLIKELY to be reduce the number of bubbles in the instruction
pipeline.

Took the opportunity to re-indent the macros.
2010-05-04 17:01:14 +01:00
Owen W. Taylor
f9072b8663 Call backend handle_event from clutter_x11_handle_event()
Whether events come from the main loop source or from
clutter_x11_handle_event(), we need to feed them to the backend
virtual handle_event function. This fixes problems with clients
using clutter_x11_handle_event() hanging because
GLXBufferSwapComplete events aren't received.

http://bugzilla.openedhand.com/show_bug.cgi?id=2101
2010-05-04 11:04:03 +01:00
Robert Bragg
d6dbd62021 debug: wrap glClear calls with the GE macro
This adds a GE macro wrapper around our calls to glClear so we can
print a warning for any errors reported by the driver.
2010-04-30 12:10:16 +01:00
Neil Roberts
e477768bd8 cogl-texture-2d-sliced: Use the converted bitmap when uploading
When uploading texture data the cogl-texture-2d-sliced backend was
using _cogl_texture_prepare_for_upload to create a bitmap suitable for
upload but then it was using the original bitmap instead of the new
bitmap for the data. This was causing any format conversions performed
by cogl_texture_prepare_for_upload to be ignored.

http://bugzilla.openedhand.com/show_bug.cgi?id=2059
2010-04-29 13:15:36 +01:00
Neil Roberts
405d529f44 cogl-texture: Don't attempt to use GL to convert formats under GLES
In commit abe91784c4 I changed cogl-texture so that it would use the
OpenGL mechanism to specify a different internal texture format from
the image format so that it can do the conversion instead of
Cogl. However under GLES the internal format and the image format must
always be the same and it only supports a limited set of formats. This
patch changes _cogl_texture_prepare_for_upload so that it does the
conversion using the cogl bitmap code when compiling for GLES.

http://bugzilla.openedhand.com/show_bug.cgi?id=2059
2010-04-29 13:15:35 +01:00
Neil Roberts
8530b7946a cogl-material: Fix the check to prevent using too many layers
There was a check at the bottom of the loop which sets up the state
for each of the layers so that it would break from the loop when the
maximum number of layers is reached. However after doing this it would
not increment 'i'. 'i' is later used to disable the remaining layers
so it would end up disabling the last layer it just set up.

This patch moves the check to be part of the loop condition so that
the check is performed after incrementing 'i'.

http://bugzilla.openedhand.com/show_bug.cgi?id=2064
2010-04-29 12:15:17 +01:00
Neil Roberts
3c2bb33cbd cogl-material: Fix the warning for when too many layers are used
The warning displayed when too many layers are used had an off-by-one
error so that it would display even if exactly the maximum number is
used. There was also a missing space at the end of the line in the
message which looked wrong when displayed on the terminal.

http://bugzilla.openedhand.com/show_bug.cgi?id=2064
2010-04-29 12:15:11 +01:00
Emmanuele Bassi
ce261025f6 Fix clutter_event_get_coords() for crossing events
The ClutterCrossingEvent data structure contains the coordinates
of the crossing; they are regularly filed out by Clutter and by
the backend event processing code. And yet clutter_event_get_coords()
returns (0, 0) because it thinks that CLUTTER_ENTER and CLUTTER_LEAVE
events do not have coordinates.
2010-04-28 16:19:37 +01:00
Emmanuele Bassi
b7098563c2 actor: Make consistent use of the name in error reporting
Whenever we are warning inside ClutterActor we prefer the actor's name
to its type, if the name is set. The current code is made less readable
by the use of the ternary operator:

  priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (self)

This looks like a job for a simple convenience function.
2010-04-27 10:12:25 +01:00
Emmanuele Bassi
9024cd9f7c Clean up the Texture private data structure 2010-04-26 16:27:15 +01:00
Neil Roberts
a881c8b07e cogl-path: Make cogl_path_arc_rel static
cogl_path_arc_rel was never in any public headers so it isn't part of
the public API. It also has a slightly inconsistent name because the
rest of the relative path functions are called cogl_path_rel_*. This
patch makes it static for now to make it more obvious that it isn't
public. The name has changed to _cogl_path_rel_arc.
2010-04-22 18:17:59 +01:00
Neil Roberts
e16f05326e cogl-path: Add documentation for the angles of cogl_path_arc
This adds documentation for how Cogl interprets the angles given to
cogl_path_arc.
2010-04-22 18:17:59 +01:00
Emmanuele Bassi
73e4d49053 profile: Add profiling points for Text
Add a static timer for the text layout code, and two counters for the
layout cache hit and miss conditions.
2010-04-22 17:54:05 +01:00
Emmanuele Bassi
5608a54708 profile: Fix the report generation
Timers and counters might not exist, so make every section of the
profile report depend on the object that it is querying.

This fixes the profile report generation that was broken by commit
8146d8d08d.
2010-04-22 17:52:13 +01:00
Emmanuele Bassi
05cf570570 actor: Add an internal variant of get_stage()
For internal use we should have a get_stage_internal() variant that
avoids type checks and calls to public functions. The implementation
is trivial enough, and it will avoid (scene graph depth + 1) type
checks and (scene graph depth) function calls.
2010-04-22 16:49:57 +01:00
Emmanuele Bassi
1355c19f66 docs: Fix gtk-doc warnings 2010-04-22 16:39:18 +01:00
Neil Roberts
3196658b8c cogl-path: Fix the truncation when adding to a copied path
If a path is copied and then appended to, the copy needs to have the
last sub path truncated so that it fits in the total path size in case
the original path was modified. However the path size check was broken
so if the copied path had more than one sub path it would fail.
2010-04-21 22:36:43 +01:00
Neil Roberts
abc64a2c67 cogl-clip-stack: Use orientation of the polygon to set clip planes
Previously the clip stack code was trying to detect when the
orientation of the on-screen rectangle had changed by checking if the
order of the y-coordinates on the left edge was different from the
order the x-coordinates on the top edge. This doesn't work for some
rotations which was causing the clip planes to clip the wrong side of
the line. This patch makes it detect the orientation by calculating
the signed area which is a standard computer graphics algorithm.

http://bugzilla.openedhand.com/show_bug.cgi?id=2079
2010-04-21 13:24:59 +01:00
Neil Roberts
7f2b2e1364 cogl-path: Document how a shape is filled
This adds some documentation to cogl_path_fill() describing the fill
rule Cogl uses.
2010-04-21 13:20:23 +01:00
Neil Roberts
44c86fcead cogl-path: Don't try to union sub paths
When drawing a path with only a single sub path, Cogl uses the
'even-odd' fill rule which means that if a part of the path intersects
with another part then the intersection would be inverted. However
when combining sub paths it treats them as separate paths and then
unions them together. This doesn't match the semantics of the even-odd
rule in SVG and Cairo. This patch makes it so that a new sub path is
just drawn as another triangle fan so that it will continue to invert
the stencil buffer. This is also much simpler and more efficient as
well as being more correct.

http://bugzilla.openedhand.com/show_bug.cgi?id=2088
2010-04-21 11:39:28 +01:00
Neil Roberts
78dc59b348 picking: Read the colour value using COGL_PIXEL_FORMAT_RGBA_8888_PRE
In commit c0a553163b I changed the format used to read the picking
pixel to COGL_PIXEL_FORMAT_RGB_888 because it was convenient to avoid
the premult conversion. However this broke picking on GLES on some
platforms because for that glReadPixels is only guaranteed to support
GL_RGBA with GL_UNSIGNED_BYTE. Since the last commit cogl_read_pixels
will always use that format but it will end up with a conversion back
to RGB_888. This patch avoids that conversion and avoids the premult
conversion by reading in RGBA_8888_PRE.

http://bugzilla.openedhand.com/show_bug.cgi?id=2057
2010-04-21 11:34:04 +01:00
Neil Roberts
0cb09cd40d cogl_read_pixels: Always use GL_RGBA/GL_UNSIGNED_BYTE under GLES
Under GLES glReadPixels is documented to only support GL_RGBA with
GL_UNSIGNED_BYTE and an implementation specfic format which can be
fetched with glGet, GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES and
GL_IMPLEMENTATION_COLOR_READ_TYPE_OES. This patch makes it always read
using GL_RGBA and GL_UNSIGNED_BYTE and then convert the results if
neccessary.

This has some room for improvement because it doesn't attempt to use
the implementation specific format. Also the conversion is somewhat
wasteful because there are currently no cogl_bitmap_* functions to
convert without allocating a new buffer so it ends up doing an
intermediate copy.

http://bugzilla.openedhand.com/show_bug.cgi?id=2057
2010-04-21 10:56:21 +01:00
Neil Roberts
9750b90f37 cogl-bitmap: Fix converting formats with and without alpha channels
_cogl_bitmap_convert_format_and_premult was failing when converting
from RGBA to RGB and vice versa. _cogl_bitmap_fallback_convert
converts without altering the premult status so when choosing a new
format it would copy over the premult bit. However, it did this
regardless of whether the new format had an alpha channel so when
converting from RGBA_8888_PRE to RGB_888 it would end up inventing a
new meaningless format which would be RGB_888_PRE. This patch makes it
avoid copying the premult flag if the destination has no alpha. It
doesn't matter if it copies when the source format has no alpha
because it will always be unset.

_cogl_bitmap_convert_format_and_premult was also breaking when
converting from RGBA_8888_PRE to RGB_888 because it would think
RGB_888 is unpremultiplied and try to convert but then
_cogl_bitmap_fallback_premult wouldn't know how to do the conversion.

http://bugzilla.openedhand.com/show_bug.cgi?id=2057
2010-04-21 10:56:21 +01:00
Neil Roberts
a28440eafb clutter-texture: Remove confusing comments about realization
In 125bded81 some comments were introduced to ClutterTexture
complaining that it can have a Cogl texture before being
realized. Clutter always assumes that the single GL context is current
so there is no need to wait until the actor is realized before setting
a texture. This patch replaces the comments with clarification that
this should not be a problem.

The patch also changes the documentation about the realized state in
various places to clarify that it is acceptable to create any Cogl
resources before the actor is realized.

http://bugzilla.openedhand.com/show_bug.cgi?id=2075
2010-04-19 15:34:43 +01:00
Robert Bragg
62ac3b312e glx: handle spurious GLX_BufferSwapComplete events gracefully
Instead of simply aborting we now print out a warning, when a spurious
GLX_BufferSwapComplete event is handled since it seems that people are
coming across the problem (perhaps due to a buggy driver) and making
apps crash in this situation is a bit extreme.
2010-04-19 11:24:42 +01:00
Neil Roberts
716ec82db8 clutter-cairo-texture: Use the new cogl_pixel_buffer API
ClutterCairoTexture now stores the surface image data in a Cogl pixel
buffer object. When clutter_cairo_texture_create is called the buffer
is mapped and a new Cairo surface is created to render directly to the
PBO. When the surface is destroyed the buffer is unmapped and a Cogl
texture is recreated from the buffer. This should enable slightly
faster uploads when using Cairo because it avoids having to copy the
surface data to the texture.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-04-16 13:19:57 +01:00
Emmanuele Bassi
1a1e7d3573 text: Increase the size of the Layout cache
Currently, each ClutterText caches 3 Pango layouts:

  » one for the preferred, unbounded width
  » one for the preferred height for a given width
  » one for the allocated size

Some layout managers do a double pass that could flush the whole cache
before it has a chance of actually storing relevant data, resulting in
a continuous series of misses.

We can try to counteract this by doubling the size of the cache, from
three slots to six. More than six would be pointless, as well as too
memory consuming; but we might get down to a number between 3 and 6 at
any later point.
2010-04-16 12:57:49 +01:00
Rob Bradford
dd407326fe text: Check generated size of layouts in cache
By comparing the requested size against the computed sized for existing
Pango layouts we can avoid creating layouts where the requested size
matches that of a previously computed one.

In particular this optimisation means that when working with a fixed
positioning based layout (with no constraints on the size of the
ClutterText) the same PangoLayout can be used to calculate the preferred
width, height and also the layout used for the actual painting.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-04-16 12:50:35 +01:00
Neil Roberts
708bbc72e1 cogl: Implement retained clip stacks
This adds three new internal API functions which can be used to retain
the clip stack state and restore it later:

 _cogl_get_clip_stack
 _cogl_set_clip_stack
 _cogl_clip_stack_copy

The functions are currently internal and not yet used but we may want
to make them public in future to replace the cogl_clip_stack_save()
and cogl_clip_stack_restore() APIs.

The get function just returns the handle to the clip stack at the top
of the stack of stacks and the set function just replaces it.

The copy function makes a cheap copy of an existing stack by taking a
reference to the top stack entry. This ends up working like a deep
copy because there is no way to modify entries of a stack but it
doesn't actually copy the data.
2010-04-15 14:51:01 +01:00
Neil Roberts
3a58bc440b cogl-clip-stack: Convert to be a CoglHandle
CoglClipStacks can now be reference counted via a CoglHandle. The
ClipClipState now stores handles in the list rather than CoglClipStack
pointers.
2010-04-15 14:51:01 +01:00
Neil Roberts
aba7fb63cb Separate out CoglClipStackState from cogl-clip-stack.c
CoglClipStackState has now been renamed to CoglClipState and is moved
to a separate file. CoglClipStack now just maintains a stack and
doesn't worry about the rest of the state. CoglClipStack sill contains
the code to flush the stack to GL.
2010-04-15 14:51:00 +01:00
Neil Roberts
732223074b cogl-slip-stack: Store clip window rect entries in Cogl coordinates
When glScissor is called it needs to pass coordinates in GL's
coordinate space where the origin is the bottom left. Previously this
conversion was done before storing the window rect in the clip
stack. However this might make it more difficult if we want to be able
to grab a handle to a clip stack and use it in different circumstances
later. This patch moves the coordinate conversion to inside the clip
state flushing code.
2010-04-15 14:50:55 +01:00
Neil Roberts
e9aa5d807c cogl-clip-stack: Store window rect entries as ints not floats
The window rectangles are passed in as integers so there is no point
in converting them to floats when storing a stack entry for them.
2010-04-15 14:50:26 +01:00
Neil Roberts
a0e19c9469 cogl-clip-stack: Use reference counted stack entries
The stack is now stored as a list of reference counted entries.
Instead of using a GList, each entry now contains a link with a
reference to its parent. The idea is that this would allow copying
stacks with a shared ancestry.

Previously the code flushed the state by finding the bottom of the
stack and then applying each entry by walking back up to the top. This
is slightly harder to do now because the list is no longer
doubly-linked. However I don't think it matters which order the
entries are applied so I've just changed it to apply them in reverse
order.

There was also a restriction that if ever the stencil buffer is used
then we could no longer use clip planes for any subsequent entries. I
don't think this makes sense because it should always work as long as
it doesn't attempt to use the clip planes more than once. I've
therefore removed the restriction.
2010-04-15 14:47:01 +01:00
Emmanuele Bassi
15ef549207 docs: Clean up ClutterActor's long description
The Actor's long description is a bit cluttered; it contains a section
on the actor's box semantics, on the transformation order and on the
event handling.

We should use <refsect2> tags to divide the Actor's description into
logically separated sections.

We should also add a section about the custom Scriptable properties that
ClutterActor defines, and the special handling of unit-based properties.
2010-04-14 23:34:38 +01:00
Neil Roberts
1445e9d32d cogl-atlas-texture: Fix a memory leak
The CoglAtlasTexture struct was not being freed in
_cogl_atlas_texture_free so there would be a small leak whenever a
texture was destroyed.

Thanks to Robert Bragg for spotting this.
2010-04-13 17:26:03 +01:00
Neil Roberts
30f43c6cda cogl-material: Use CLAMP_TO_EDGE for WRAP_AUTOMATIC unless overriden
CoglMaterial now sets GL_CLAMP_TO_EDGE if WRAP_MODE_AUTOMATIC is used
unless it is overridden when the material is flushed. The primitives
are still expected to expose repeat semantics so no user visible
changes are made. The idea is that drawing non-repeated textures is
the most common case so if we make clamp_to_ege the default then we
will reduce the number of times we have to override the
material. Avoiding overrides will become important if the overriding
mechanism is replaced with one where the primitive is expected to copy
the material and change that instead.
2010-04-12 15:44:23 +01:00
Neil Roberts
75f1dc90b0 cogl-material: Add support for setting the wrap mode for a layer
Previously, Cogl's texture coordinate system was effectively always
GL_REPEAT so that if an application specifies coordinates outside the
range 0→1 it would get repeated copies of the texture. It would
however change the mode to GL_CLAMP_TO_EDGE if all of the coordinates
are in the range 0→1 so that in the common case that the whole texture
is being drawn with linear filtering it will not blend in edge pixels
from the opposite sides.

This patch adds the option for applications to change the wrap mode
per layer. There are now three wrap modes: 'repeat', 'clamp-to-edge'
and 'automatic'. The automatic map mode is the default and it
implements the previous behaviour. The wrap mode can be changed for
the s and t coordinates independently. I've tried to make the
internals support setting the r coordinate but as we don't support 3D
textures yet I haven't exposed any public API for it.

The texture backends still have a set_wrap_mode virtual but this value
is intended to be transitory and it will be changed whenever the
material is flushed (although the backends are expected to cache it so
that it won't use too many GL calls). In my understanding this value
was always meant to be transitory and all primitives were meant to set
the value before drawing. However there were comments suggesting that
this is not the expected behaviour. In particular the vertex buffer
drawing code never set a wrap mode so it would end up with whatever
the texture was previously used for. These issues are now fixed
because the material will always set the wrap modes.

There is code to manually implement clamp-to-edge for textures that
can't be hardware repeated. However this doesn't fully work because it
relies on being able to draw the stretched parts using quads with the
same values for tx1 and tx2. The texture iteration code doesn't
support this so it breaks. This is a separate bug and it isn't
trivially solved.

When flushing a material there are now extra options to set wrap mode
overrides. The overrides are an array of values for each layer that
specifies an override for the s, t or r coordinates. The primitives
use this to implement the automatic wrap mode. cogl_polygon also uses
it to set GL_CLAMP_TO_BORDER mode for its trick to render sliced
textures. Although this code has been added it looks like the sliced
trick has been broken for a while and I haven't attempted to fix it
here.

I've added a constant to represent the maximum number of layers that a
material supports so that I can size the overrides array. I've set it
to 32 because as far as I can tell we have that limit imposed anyway
because the other flush options use a guint32 to store a flag about
each layer. The overrides array ends up adding 32 bytes to each flush
options struct which may be a concern.

http://bugzilla.openedhand.com/show_bug.cgi?id=2063
2010-04-12 15:44:23 +01:00
Neil Roberts
463ebc8220 Split the wrap mode of _cogl_texture_set_wrap_mode into three
GL supports setting different wrap modes for the s, t and r
coordinates so we should design the backend interface to support that
also. The r coordinate is not currently used by any of the backends
but we might as well have it to make life easier if we ever add
support for 3D textures.

http://bugzilla.openedhand.com/show_bug.cgi?id=2063
2010-04-12 15:44:23 +01:00
Neil Roberts
774f5e0bdf cogl: Make private members really hard to accidentally use
CoglColor and CoglMatrix have public declarations with private members
so that we are free to change the implementation but the structures
could still be allocated on the stack in applications. However it's
quite easy not to realise the members are private and then access them
directly. This patch wraps the members in a macro which redefines the
symbol name when including the header outside of the clutter source.

http://bugzilla.openedhand.com/show_bug.cgi?id=2065
2010-04-12 15:38:58 +01:00
Neil Roberts
3fea5051db CoglMatrix: Don't make the matrix fields private
The xx, yx, zx etc fields are meant to be read-only but they were
marked as private with the gtk-doc annotation. This patch moves the
private marker so that the 16 float member fields are public but the
type, inverted matrix, flags and padding are not.
2010-04-12 15:38:58 +01:00
Neil Roberts
94465cfe39 Fix indentation in CoglMatrix
The members of CoglMatrix were indented by 4 characters instead of 2.
2010-04-12 15:38:58 +01:00
Damien Lespiau
e0f41fa166 actor: Flag the color argument of the ::pick signal as being constant
When emitting signals, one can mark arguments as being "static", ie an
indication this argument will not change during the signal emission.
This allows the signal marshalling code to create static GValues, in
this case not to copy the Color.

http://bugzilla.openedhand.com/show_bug.cgi?id=2073
2010-04-12 12:48:46 +01:00
Emmanuele Bassi
93a5b78e5a actor: Do not use G_UNLIKELY in paint()
We decide whether the paint() should be a real paint or a paint in pick
mode depending on the global pick_mode value. Using G_UNLIKELY() on an
operation that most likely is going to be executed once every frame is
going to blow a lot of cache lines and frak with the CPU branch
prediction. Not good.
2010-04-09 18:28:37 +01:00
Fridrich Strba
c99a24d341 win32: Use GCLP_* instead of GCL_* when calling GetClassLongPtr
(commit message by Neil)

GetClassLongPtr expects a different constant when retrieving handles
or pointers. This fixes problems using Win64.
2010-04-09 15:43:42 +01:00
Neil Roberts
9ee6dd240b cogl: Support retained paths
This adds three new API calls:

  CoglHandle cogl_path_get()
  void cogl_path_set(CoglHandle path)
  CoglHandle cogl_path_copy(CoglHandle path)

All of the fields relating to the path have been moved from the Cogl
context to a new CoglPath handle type. The cogl context now just
contains a CoglPath handle. All of the existing path commands
manipulate the data in the current path handle. cogl_path_new now just
creates a new path handle and unrefs the old one.

The path handle can be stored for later with cogl_path_get. The path
can then be copied with cogl_path_copy. Internally it implements
copy-on-write semantics with an extra optimisation that it will only
copy the data if the new path is modified, but not if the original
path is modified. It can do this because the only way to modify a path
is by appending to it so the copied path is able to store its own path
length and only render the nodes up to that length. For this to work
the copied path also needs to keep its own copies of the path extents
because the parent path may change these by adding nodes.

The clip stack now uses the cogl_path_copy mechanism to store paths in
the stack instead of directly copying the data. This should save some
memory and processing time.
2010-04-08 19:53:38 +01:00
Robert Bragg
45885850d2 cogl: renames cogl_multiply_matrix to cogl_transform
Although cogl_multiply_matrix was consistent with OpenGL, after further
consideration it was agreed that cogl_transform is a better name. Given
that it's in the global cogl_ namespace cogl_transform seems more self
documenting.
2010-04-08 14:37:01 +01:00
Robert Bragg
412a468d5e docs: This improves the documentation for cogl_push_framebuffer
This adds an example of how to setup a Clutter style 2D coordinate space
and clarifies what state is owned by a framebuffer. (projection,
modelview, viewport and clip stack)

When we expose more cogl_framebuffer API this example will hopefully be
migrated into a more extensive introduction to using framebuffers.
2010-04-06 09:26:10 +01:00
Robert Bragg
6f6ab86929 cogl: move cogl_set_source* funcs into cogl.c
Previously cogl_set_source and cogl_set_source_texture were in
cogl-material.c and the cogl_set_source_color* funcs were in
cogl-color.c. Originally this was because cogl.c was duplicated between
the GL and GLES backends and we didn't want to add to the amount of
duplicated code, but these files have since been consolidated into one
cogl.c.
2010-04-06 09:26:05 +01:00
Robert Bragg
a678e9f627 cogl: adds convenience cogl_multiply_matrix function
Quite often it's desirable to be able to multiply the current modelview
matrix by an arbitrary matrix. Currently though you have to first
explicitly call cogl_get_modelview_matrix to get the current modelview
into a temporary variable, then you need to multiply it with your matrix
using cogl_matrix_multiply and finally use cogl_set_modelview_matrix to
make the result be the new modelview. This new convenience function lets
more efficiently skip the first get and last set steps.
2010-04-01 13:24:56 +01:00
Robert Bragg
1dd70aff73 cogl: rename cogl_enable to _cogl_enable
Every now and then someone sees the cogl_enable API and gets confused,
thinking its public API so this renames the symbol to be clear that it's
is an internal only API.
2010-04-01 12:34:42 +01:00
Owen W. Taylor
6fcc8c5bce x11: Use has_allocation() in TfP actor
ClutterX11TexturePixmap calls get_allocation_box() when queueing a
clipped redraw. If the allocation is not valid, and if we queue a
lot of redraws in response to a series of damage events, the net
result is that we spend all our time in a re-layout. We can
short-circuit this by checking if the actor has a valid allocation, and
if not, just queue a redraw - the actor will be allocated by the time it
is going to be painted.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-26 00:46:43 +00:00
Owen W. Taylor
8df4a0b8fd actor: Add has_allocation() method
Add clutter_actor_has_allocation(), a method meant to be used when
deciding whether to call clutter_actor_get_allocation_box() or any
of its wrappers.

The get_allocation_box() method will, in case the allocation is invalid,
perform a costly re-allocation cycle to ensure that the returned box
is valid. The has_allocation() method is meant to be used if we have an
actor calling get_allocation_box() from outside the place where the
allocation is always guaranteed to be valid.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-26 00:46:31 +00:00
José Dapena Paz
7b63da69cf Add "homogeneous" mode to ClutterBoxLayout.
Added new "homogeneous" mode to ClutterBoxLayout, that makes layout children
get all the same size.

This is heavily inspired in the "homogeneous" attribute available in GtkBox,
but simplified as we don't have padding nor borders in box layout, only
spacing.

Also added to test-box-layout a key to set/unset homogeneous mode.

* Coding style fixes.
* Added proper test for homogeneous mode in box layout.
* Fix in homogeneous mode.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-25 09:41:54 +00:00
Emmanuele Bassi
5395a7a998 Use begin/end macros in cogl-primitives.h
Protect the people using a C++ compiler from the dark abyss of C code.

http://bugzilla.openedhand.com/show_bug.cgi?id=2049
2010-03-25 09:33:26 +00:00
Neil Roberts
6a8e108757 clutter-actor: Rename y1 to y_1 to avoid a compiler warning
Somebody somewhere decided it would be ok to define 'y1' as a global
function in math.h thus condemning us to repeatedly making commits to
fix these obnoxious compiler warnings about aliasing.
2010-03-24 15:32:28 +00:00
Adel Gadllah
5de85051c3 Make sure GLX_SGI_swap_control is set up correctly
glXSwapIntervalSGI only affects buffer swaps to the
current GLX drawable.

That means that calling it once in clutter_backend_glx_get_features
isn't sufficent, so set it up in clutter_backend_glx_ensure_context to
make sure it affects buffer swaps for the current drawable.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-22 11:23:55 +00:00
Owen W. Taylor
2fc8ecdb92 glx: Clean up the clip area conditions
Move the size check after the NULL check, add the clip height into the
check logic and fix up the comment.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-19 18:23:03 +00:00
Emmanuele Bassi
f935270aa0 script: Do not allocate memory when not needed
When printing out the property value during a ClutterScript debug run we
generate the value's content using g_strdup_value_contents() - though we
do it unconditionally. The contents might not be printed (they most
likely won't, actually) and will be freed afterwards. This is
unnecessary: we can allocate the contents string after checking if we're
going to print out the debug note, thus avoiding the whole
allocation/free cycle unless strictly needed.
2010-03-19 16:24:34 +00:00
Emmanuele Bassi
a39cef41b8 glx: Do not access stage_clip without checking it
The stage_clip parameter for add_redraw_clip() can be NULL, so we need
to check before accessing its members.
2010-03-19 11:41:12 +00:00
Owen W. Taylor
913c187f4e Switch texture units before calling _cogl_texture_set_filters()
When setting up the state for a layer, we need to switch texture
units before we do anything that might bind the texture, or
we'll bind the wrong texture to the previous unit.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-19 11:23:48 +00:00
Emmanuele Bassi
66e0f18753 json: Update JsonParser
Add another fix from upstream, to clean up the code.
2010-03-19 11:13:04 +00:00
Emmanuele Bassi
295bc517f8 json: Update the internal copy of JsonGenerator
The JsonGenerator we have inside Clutter as a fallback for a missing
system copy of JSON-GLib is way out of date.
2010-03-19 10:40:12 +00:00
Owen W. Taylor
d21b7522f8 Fix errors in keeping track of the stage bounding rectangle
* Add new clutter_geometry_union(), because writing union intersection
  is harder than it looks. Fixes two problems with the inline code in
  clutter_stage_glx_add_redraw_clip().

  1) The ->x and ->y of were reassigned to before using them to
     compute the new width and height.
  2) since ClutterGeometry has unsigned width, x + width is unsigned,
     and comparison goes wrong if either rectangle has a negative
     x + width. (We fixed width for GdkRectangle to be signed for GTK+-2.0,
     this is a potent source of bugs.)

* Use in clutter_stage_glx_add_redraw_clip()

* Account for the case where the incoming rectangle is empty, and don't
  end up with the stage being entirely redrawn.

* Account for the case where the stage already has a degenerate
  width and don't end up with redrawing only the new rectangle and not
  the rest of the stage.

The better fix here for the second two problems is to stop using a 0
width to mean the entire stage, but this should work for now.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-19 10:29:53 +00:00
Owen W. Taylor
bfd2b19290 Set pixel store parameters before calling glGetTexImage
We need to set up the rowstride and alignment properly in
CoglTexture2D before reading texture data.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-19 10:21:34 +00:00
Emmanuele Bassi
a8595aec13 script: Add more comments and annotations
Detail why we are adding a fake id, and under which circumstances that
happens. Also be more verbose with the debug annotations.
2010-03-18 20:20:09 +00:00
Emmanuele Bassi
203847d03c script: Skip empty nodes
If we get an empty node then we should skip it; this is really a
workaround for something that is broken in JSON-GLib or in our use
of JSON-GLib.
2010-03-18 17:44:14 +00:00
Emmanuele Bassi
d2bb57c3b2 Emit a critical warning if features are not initialized
If you forgot to call clutter_init() then you currently end up with a
warning saying that the stage cannot be initialized because the backend
does not support multiple stages. Clearly not useful.

We can catch some of the missing initialization in the features API,
since we will likely end up asking for a feature at some point.
2010-03-18 14:15:33 +00:00
Emmanuele Bassi
54504b7ac4 glx: Remove unnecessary call to create_stage()
If we are in the stage realization sequence we already have a GLX
context set in the backend; there is no need to call create_backend().
2010-03-17 17:41:52 +00:00
Emmanuele Bassi
bf7e6ae587 Add error reporting for create_context() failures
We kind of assume that stuff will break well before during the
ClutterBackend::create_context() implementation if we fail to create a
GL context. We do, however, have error reporting in place inside the
Backend API to catch those cases. Unfortunately, since we switched to
lazy initialization of the Stage, there can be a case of GL context
creation failure that still leads to a successful initialization - and a
segmentation fault later on. This is clearly Not Good™.

Let's try to catch a failure in all the places calling create_context()
and report back to the user the error in a meaningful way, before
crashing and burning.
2010-03-17 17:40:34 +00:00
Emmanuele Bassi
d735ac4807 model: Let get_n_columns() return a sane value
If you call get_n_columns() during the instance initialization phase but
before set_name()/set_types() have been called, you'll get a (guint) -1.
This is less than ideal.

If columns haven't been initialized we should just return 0, which was
the intent of the API since the beginning.

Based on a patch by: Bastian Winkler <buz@netbuz.org>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-17 17:14:08 +00:00
Emmanuele Bassi
0a6497a3b6 model: Add a comment on the n_columns field type
To avoid another bug report like:

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

with a patch that gets applied without a proper review, resulting in a
bug like:

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

I should probably add a comment on why on earth we're using an integer
as the n_columns member of the ClutterModelPrivate structure, and why it
is important that it is initialized as -1.
2010-03-16 18:57:28 +00:00
Emmanuele Bassi
de4abfac95 Revert "model: Use guint for the n_columns field"
The int storage, and the initial value of -1, is used as a guard when
subclassing ClutterListModel to allow the sub-class to call
clutter_model_set_names() and clutter_model_set_types().

This reverts commit c274118a8f.
2010-03-16 18:53:24 +00:00
Colin Walters
60d8369a1a Return and warn if a handle's refcount is <= 0
This makes it more likely consumers notice invalid unreferences.
GObject has the same assertion.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-15 16:22:20 +00:00
Bastian Winkler
c274118a8f model: Use guint for the n_columns field
clutter_model_get_n_columns is supposed to return a guint, so the
n_columns field needs to be a guint with the initial value set to 0.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-15 16:22:20 +00:00
Neil Roberts
c2faaa4f39 cogl-texture-2d: Determine format before checking texture support
When entering cogl_texture_2d_new_from_bitmap the internal format can
be COGL_PIXEL_FORMAT_ANY. This was causing _cogl_texture_2d_can_create
to use an invalid GL format type. Mesa apparently ignores this but it
was causing errors when Cogl is compiled with debugging under NVidia.

http://bugzilla.openedhand.com/show_bug.cgi?id=2026
2010-03-15 16:09:52 +00:00
Owen W. Taylor
a25885edf2 Fix checks for out-of-bounds coordinates and repeats
Add a return result from CoglTexture.transform_quad_coords_to_gl(),
so that we can properly determine the nature of repeats in
the face of GL_TEXTURE_RECTANGLE_ARB, where the returned
coordinates are not normalized.

The comment "We also work out whether any of the texture
coordinates are outside the range [0.0,1.0]. We need to do
this after calling transform_coords_to_gl in case the texture
backend is munging the coordinates (such as in the sub texture
backend)." is disregarded and removed, since it's actually
the virtual coordinates that determine whether we repeat,
not the GL coordinates.

Warnings about disregarded layers are used in all cases where
applicable, including for subtextures.

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

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2010-03-15 16:09:41 +00:00
José Dapena Paz
6bd1846d6c Fix argb initialisation.
Fix clutter initialisation if argb visuals are enabled, setting a border
color on creating the dummy window. This should avoid BadMatch happening
when the depth of the root window visual is not the same of the depth
of the argb visual.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-10 00:13:37 +00:00
Emmanuele Bassi
3d2d932835 actor: Remove some double indirection
Use an intermediate variable to avoid a double indirection when accessing
the instance private data structure.
2010-03-07 23:46:59 +00:00
Emmanuele Bassi
9ad1197cb2 json: Improve strictness of the JSON parser
Backport of the upstream JSON-GLib commit that improved the strictness
of JsonParser.

The original upstream commit is:

  29881f03468db08bfb404cfcd5b61b4cdc419a87
2010-03-07 20:54:33 +00:00
Emmanuele Bassi
ac074bc0f0 eglnative: Connect StageWindow.show and .hide
The show() and hide() methods of the StageWindow interface are
implemented but not assigned when initializing the interface
vtable.
2010-03-05 08:48:52 +00:00
Owen W. Taylor
f13a42793a CoglTexture2DSliced: Handle TEXTURE_RECTANGLE_ARB
In _cogl_texture_2d_sliced_foreach_sub_texture_in_region(), don't
assert that the target is GL_TEXTURE_2D; instead conditionalize
normalization on the target.

http://bugzilla.openedhand.com/show_bug.cgi?id=2015
2010-03-04 12:57:53 +00:00
Neil Roberts
40b43fd64a eglnative: Don't create a context if there already is one
If the EGL context is already created then we shouldn't try to create
another one. This was causing problems where one context would be
created from calling _clutter_feature_init and the other was created
from _clutter_backend_get_features. Cogl would set up its state using
the first context and then assume the state was still valid when the
second context became used so blending was not working correctly.

http://bugzilla.openedhand.com/show_bug.cgi?id=2020
2010-03-04 10:28:15 +00:00
Emmanuele Bassi
169ce1508b x11-texture-pixmap: Move signal handler override
The signal handling override for the ::queue-damage-redraw should be
done in the class initialization function, not in the instance one.
2010-03-03 17:46:53 +00:00
Emmanuele Bassi
1b57800208 Update stb_image.c
Upstream "released" 1.18.
2010-03-03 17:02:51 +00:00
Øyvind Kolås
b19332a0be animator: compare floating point values with an epsilon
Direct comparisons with doubles are error prone.
2010-03-03 15:53:07 +00:00
Øyvind Kolås
4168b216a3 animator: fix a crash in clutter_animator_compute_value
Fix a crasher when there is only one key in the animator.
2010-03-03 15:51:30 +00:00
Emmanuele Bassi
824cd9a7ff eglnative: Compilation fixes
We should include <errno.h>, if we plan to use errno.

Why, yes: I am that stupid.
2010-03-03 15:31:01 +00:00
Emmanuele Bassi
52f8cd30ce docs: Fix gtk-doc annotation for ClutterStageManageClass
Remove the semi-colon and use a colon for declaring the type.
2010-03-03 10:49:34 +00:00
Emmanuele Bassi
a2f444ccbe box: Fix allow-none annotation
The syntax for allowing NULL is "allow-none", not "allow none".
2010-03-03 10:47:42 +00:00
Neil Roberts
048fcea988 clutter-actor: Initialize with the identity matrix in get_transform
The documentation and name of the get_transformation_matrix function
implies that 'matrix' is purely an out parameter. However it wasn't
initializing the matrix before calling the 'apply_transform' virtual
so it was basically just a wrapper for the virtual. The virtual
assumes the matrix parameter is in/out and applies the actor's
transformation on top of any existing transformations. This causes
unexpected semantics that are inconsistent with the documentation.
2010-03-02 18:43:22 +00:00
Robert Bragg
38a2414498 glx tfp: make clutter_glx_texture_pixmap_update_area cheap
This changes clutter_glx_texture_pixmap_update_area so it defers the
call to glXBindTexImageEXT until our pre "paint" signal handler which
makes clutter_glx_texture_pixmap_update_area cheap to call.

The hope is that mutter can switch to reporting raw damage updates to
ClutterGLXTexturePixmap and we can use these to queue clipped redraws.
2010-03-02 17:19:11 +00:00
Robert Bragg
c0d5af5de5 Adds initial clipped redraw support to Clutter
A new (internal only currently) API, _clutter_actor_queue_clipped_redraw
can be used to queue a redraw along with a clip rectangle in actor
coordinates. This clip rectangle propagates up to the stage and clutter
backend which may optionally use the information to optimize stage
redraws. The GLX backend in particular may scissor the next redraw to
the clip rectangle and use GLX_MESA_copy_sub_buffer to present the stage
subregion.

The intention is that any actors that can naturally determine the bounds
of updates should queue clipped redraws to reduce the cost of updating
small regions of the screen.

Notes:
» If GLX_MESA_copy_sub_buffer isn't available then the GLX backend
  ignores any clip rectangles.

» queuing multiple clipped redraws will result in the bounding box of
  each clip rectangle being used.

» If a clipped redraw has a height > 300 pixels then it's promoted into
  a full stage redraw, so that the GPU doesn't end up blocking too long
  waiting for the vsync to reach the optimal position to avoid tearing.

  » Note: no empirical data was used to come up with this threshold so
    we may need to tune this.

» Currently only ClutterX11TexturePixmap makes use of this new API. This
  is done via a new "queue-damage-redraw" signal that is emitted when
  the pixmap is updated. The default handler queues a clipped redraw
  with the assumption that the pixmap is being painted as a rectangle
  covering the actors transformed allocation. If you subclass
  ClutterX11TexturePixmap and change how it's painted you now also
  need to override the signal handler and queue your own redraw.

  Technically this is a semantic break, but it's assumed that no one
  is currently doing this.

This still leaves a few unsolved issues with regards to optimizing sub
stage redraws that need to be addressed in further work so this can only
be considered a stepping stone a this point:

» Because we have no reliable way to determine if the painting of any
  given actor is being modified any optimizations implemented using
  _clutter_actor_queue_redraw_with_clip must be overridable by a
  subclass, and technically must be opt-in for existing classes to avoid
  a change in semantics. E.g. consider that a user connects to the paint
  signal for ClutterTexture and paints a circle instead of a rectangle.
  In this case any original logic to queue clipped redraws would be
  incorrect.

» Currently only the implementation of an actor has enough information
  with which to queue clipped redraws. E.g. It is not possible for
  generic code in clutter-actor.c to queue a clipped redraw when hiding
  an actor because actors have no way to report a "paint box". (remember
  actors can draw outside their allocation and actors with depth may
  also be projected outside of their allocation)

  » The current plan is to add a actor_class->get_paint_cuboid()
    virtual so actors can report a bounding cube for everything they
    would draw in their current state and use that to queue clipped
    redraws against the stage by projecting the paint cube into stage
    coordinates.

» Our heuristics for promoting clipped redraws into full redraws to
  avoid blocking the GPU while we wait for the vsync need improving:

  » vsync issues aren't relevant for redirected/composited applications
    so they should use different heuristics. In this case we instead
    need to trade off the cost of blitting when using glXCopySubBuffer
    vs promoting to a full redraw and flipping instead.
2010-03-02 17:19:11 +00:00
Øyvind Kolås
09d8460a5c animator: s/clutter_animator_run/clutter_animator_start/
This is consistent with choice of words in clutter_timeline_start and
makes the API less surprising.
2010-03-02 17:03:03 +00:00
Robert Bragg
9d1ea81dc5 cogl debug: Adds missing guards around debug cogl_args[]
commit 511e5ceb51 accidentally removed the #ifdef COGL_ENABLE_DEBUG
guards around the "cogl-debug" and "cogl-no-debug" cogl_args[] which
this patch restores.
2010-03-02 16:15:39 +00:00
Emmanuele Bassi
aba6c5acc7 flow-layout: Provide a preferred size
The FlowLayout fails to provide a preferred size in case no sizing is
specified on one axis. It should, instead, have the preferred size of
the sum of its children, depending on the orientation property.

http://bugzilla.openedhand.com/show_bug.cgi?id=2013
2010-03-02 15:11:27 +00:00
Øyvind Kolås
9a55ddc7c3 animator: restore accidentally removed break
In 505e5966 a break statement was removed by accident, causing the
animator to enter infinite loops if no initial key is present.
2010-03-02 12:38:51 +00:00
Emmanuele Bassi
3a84af0106 Merge branch 'eglnative-update'
* eglnative-update:
  eglnative: Add CLUTTER_FB_DEVICE
  eglnative: Update implementation
2010-03-02 12:25:45 +00:00
Emmanuele Bassi
a2573ad2ad eglnative: Add CLUTTER_FB_DEVICE
Some EGL drivers for embedded devices require a specific framebuffer
device to be opened and passed to eglCreateWindowSurface(). Since it's
optional, we can provide an environment variabled called
CLUTTER_FB_DEVICE that can be used to specify the path of the device
to be opened.

http://bugzilla.openedhand.com/show_bug.cgi?id=1997
2010-03-02 11:50:31 +00:00
Emmanuele Bassi
b4e9f40394 eglnative: Update implementation
Update the EGL native framebuffer backend to be 1.2-ready:

  » create the EGL context and the surface inside the create_context()
    implementation so that a context is always available

  » simplify the StageWindow implementation

  » clean up old code

http://bugzilla.openedhand.com/show_bug.cgi?id=1997
2010-03-02 11:50:31 +00:00
Owen W. Taylor
0baeabc2aa Fall back in _cogl_texture_2d_new_from_bitmap()
Just like _cogl_texture_2d_new_with_size(),
_cogl_texture_2d_new_from_bitmap() needs to check if an unsliced
texture can be created at the given size, or if hardware
limitations prevent this.

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

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2010-03-02 11:48:15 +00:00
Emmanuele Bassi
74a27bbb1c docs: Documentation fixes
Let's see if we can get a 100% coverage for Clutter too.
2010-03-02 11:12:32 +00:00
Neil Roberts
c0a553163b cogl: Support any format in cogl_read_pixels
cogl_read_pixels() no longer asserts that the format passed in is
RGBA_8888 but instead accepts any format. The appropriate GL enums for
the format are passed to glReadPixels so OpenGL should be perform a
conversion if neccessary.

It currently assumes glReadPixels will always give us premultiplied
data. This will usually be correct because the result of the default
blending operations for Cogl ends up with premultiplied data in the
framebuffer. However it is possible for the framebuffer to be in
whatever format depending on what CoglMaterial is used to render to
it. Eventually we may want to add a way for an application to inform
Cogl that the framebuffer is not premultiplied in case it is being
used for some special purpose.

If the requested format is not premultiplied then Cogl will convert
it. The tests have been changed to read the data as premultiplied so
that they won't be affected by the conversion. Picking in Clutter has
been changed to use COGL_PIXEL_FORMAT_RGB_888 because it doesn't need
the alpha component. clutter_stage_read_pixels is left unchanged
because the application can't specify a format for that so it seems to
make most sense to store unpremultiplied values.

http://bugzilla.openedhand.com/show_bug.cgi?id=1959
2010-03-02 11:01:35 +00:00
Øyvind Kolås
505e5966e4 Do not overwrite the initial key, making ease-in work as expected.
Fixes bug #2008, where a property with ease-in would jump instead of
start at the properties initial value.
2010-03-01 18:39:24 +00:00
Bastian Winkler
7d0ad7ac1b animator: Remove redundant declaration in header file
clutter_animator_property_set_interpolation was declared twice in
clutter-animator.h

http://bugzilla.openedhand.com/show_bug.cgi?id=2012
2010-03-01 17:49:58 +00:00
Emmanuele Bassi
1d9ddad9a3 docs: Fix syntax error in Model's documentation
A missing opening quote sign is breaking gtk-doc for ClutterModel.
2010-03-01 17:45:00 +00:00
Emmanuele Bassi
1777a69f2f Merge branch 'stage-min-size-rework'
* stage-min-size-rework:
  docs: Update minimum size accessors
  actor: Use the TOPLEVEL flag instead of a type check
  [stage] Use min-width/height props for min size
2010-03-01 15:37:12 +00:00
Robert Bragg
8146d8d08d profile: avoid segfault generating reports with no stats
The clutter-profile.c print_report() code would crash if no stats had
been gathered because uprof would return NULL for the "Redrawing" timer
which we then dereferenced.

This changes the code to start by checking for the "Mainloop",
"Redrawing" and "Do Pick" timers and if none are present it returns
immediately without generating any report.
2010-03-01 15:25:45 +00:00
Robert Bragg
b9a91594f4 build: Fixes out of tree builds
When building the gobject introspection data the build wasn't able to
find clutter/clutter-json.h so this adds $(top_builddir) to INCLUDES.
2010-03-01 15:25:45 +00:00
Emmanuele Bassi
79acb088e7 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Emmanuele Bassi
23867875a1 build: Remove unused checks on platform functions
There is no need for us to check for low-level functions and header
files, especially since we haven't been checking the results until
now. This makes cross-compiling slightly more bearable.
2010-03-01 11:12:16 +00:00
Emmanuele Bassi
ce6a24eb2b actor: Call unparent() in destroy
If the actor is an internal child of another actor then we should call
unparent() when destroying it, like clutter_actor_reparent() does;
otherwise we'll leak the actor, since the parent holds a reference to
it.

http://bugzilla.openedhand.com/show_bug.cgi?id=2009
2010-02-28 10:59:29 +00:00
Emmanuele Bassi
7ffb62eab9 docs: Update minimum size accessors
Expand the documentation for set_minimum_size() and get_minimum_size(),
and add introspection annotations for get_minimum_size().
2010-02-27 18:56:34 +00:00
Emmanuele Bassi
52ba9a1800 actor: Use the TOPLEVEL flag instead of a type check
We can use the internal private CLUTTER_ACTOR_IS_TOPLEVEL flag, which is
set only on Stages.
2010-02-27 18:24:17 +00:00
Chris Lord
cd62dfbd14 [stage] Use min-width/height props for min size
Instead of shadowing these properties with different properties with the
same names on stage, actually use them. Behaviour should be identical,
except the minimum stage size can now be enforced by setting the
min-width/height properties as well as using the set_minimum_size
function.
2010-02-26 18:36:38 +00:00
Emmanuele Bassi
e0f04efa41 device: When changing the stage, unset the pointer actor
If we do not unset the Stage we will have stale data, and the Crossing
event when re-entering a Stage will not be emitted, as the actor under
the pointer might be the same as before.
2010-02-26 11:19:26 +00:00
Neil Roberts
5d83468295 cogl-vertex-buffer: Add support for unsigned int indices
This adds a COGL_INDICES_TYPE_UNSIGNED_INT enum value so that unsigned
ints can be used with cogl_vertex_buffer_indices_new.  Unsigned ints
are not supported in core on GLES so a feature flag has also been
added to advertise this. GLES only sets the feature if the
GL_OES_element_index_uint extension is available. It is an error to
call indices_new() with unsigned ints unless the feature is
advertised.

http://bugzilla.openedhand.com/show_bug.cgi?id=1998
2010-02-26 10:56:35 +00:00
Emmanuele Bassi
67d9d92814 docs: Document the "columns" syntax for ClutterModel
Like we do for other classes implementing custom properties, we should
document the syntax of the "columns" scriptable property of ClutterModel.
2010-02-25 23:23:53 +00:00
Bastian Winkler
96c31bbf0e model: Implement ClutterScriptable interface
Allow a ClutterModel to be constructed through the ClutterScript API.
Currently this allows a model to be generated like like this:

{
  "id" : "test-model",
  "type" : "ClutterListModel",
  "columns" : [
    [ "text-column", "gchararray" ],
    [ "int-column", "gint" ],
    [ "actor-column", "ClutterRectangle" ]
  ]
}

where 'columns' is an array containing arrays of column-name,
column-type pairs.

http://bugzilla.openedhand.com/show_bug.cgi?id=2007
2010-02-25 23:09:11 +00:00
Emmanuele Bassi
63279f827e docs: gtk-doc fixes for Animator
Fix the syntax for:

  → enumeration values
  → return values
  → @since tags

Also, fix the introspection annotations.
2010-02-25 22:50:38 +00:00
Emmanuele Bassi
9db135c4ef glx: Clean up sync-to-vblank mechanism discovery
The code has gotten really complicated to follow.

As soon as we have a sync-to-vblank mechanism we should just bail out.

Also, __GL_SYNC_TO_VBLANK (which is used by nVidia) should be assumed
equivalent to a CLUTTER_VBLANK_GLX_SWAP.
2010-02-25 18:56:39 +00:00
Emmanuele Bassi
655cb966c0 docs: Add visual cue for Animator's key frames
We should explain what a "key frame" is for ClutterAnimator, possibly
with some sort of visual cue.

This allows me to demonstrate my poor skills at using Inkscape, as well
as my overall bad taste for graphics design.
2010-02-25 17:09:55 +00:00
Emmanuele Bassi
d3d05261e6 script-parser: Remove top-level types list
The top-level types list was comically out of date, and it was only
determining whether the type we were constructing was initially unowned
or a full object. We can safely replace it with a simple type check.
2010-02-25 14:22:08 +00:00
Emmanuele Bassi
c0be19eff6 script-parser: Be more strict with "children" members
The "children" member for Container definitions should only reference
actors, and warn about any other type.
2010-02-25 14:20:05 +00:00
Emmanuele Bassi
c291d5a660 animator: Add a :timeline property
It would be useful to be able to share the Timeline across different
animator instances, or with different animation constructs. Also this
allows sharing definitions of Timelines in ClutterScript.
2010-02-25 14:08:57 +00:00
Emmanuele Bassi
6415825339 animator: Remove NULL check in remove_key()
The arguments for remove_key() can be NULL, but there is an extraneous
assertion that fails if they are. The pre-conditions should match the
documentation, in this case.
2010-02-25 14:02:29 +00:00
Emmanuele Bassi
4bc4c604e9 box: Let pack_at() create the ChildMeta, if any
A sub-class of ClutterBox might add ChildMeta support, and since
pack_at() does not go through clutter_container_add_actor(), we
need to manually call the create_child_meta() ourselves.
2010-02-25 12:55:12 +00:00
Emmanuele Bassi
543e2d3f06 container: Expose create and destroy ChildMeta methods
It is conceivable that Container implementations might add children
outside of the Container::add() implementation - e.g. for packing at
a specific index. Since the addition (and removal) might happen outside
the common path we need to expose all the API that is implicitly called
by ClutterContainer when adding and removing a child - namely the
ChildMeta creation and destruction.
2010-02-25 12:55:12 +00:00
Neil Roberts
14999bec5e gles2: Remove the special wrapper for glBindTexture
Previously the GLES2 backend needed a special wrapper for
glBindTexture because it needed to know the internal GL format of the
texture in order to correctly implement the GL_MODULATE texture env
mode. When GL_MODULATE is used then the RGB values are taken from the
previous texture layer rather than being fetched from the
texture. However since the material API was added Cogl no longer uses
the GL_MODULATE texture env mode but instead always uses GL_COMBINE.

Compiling the GLES2 backend broke since the more-texture-backends
branch merge because the cogl_get_internal_gl_format function was
removed and there was one place in GLES2 specific code that was using
this to bind the texture.
2010-02-25 12:50:52 +00:00
Neil Roberts
eba07020c5 cogl-gles2-wrapper: Add support for the layer combine operations
The texture layer combine functions are now hard coded to GL_COMBINE
instead of GL_MODULATE. The combine function can be customized with
all the parameters of GL_COMBINE. A shader is generated to implement
the given parameters.

Currently it will try to generate code for the constant color but it
will use a uniform which does not exist.
2010-02-25 12:50:52 +00:00
Neil Roberts
02b952394a gles2: Implement a wrapper for glGetIntegerv(GL_MAX_TEXTURE_UNITS)
The GLES2 backend for Cogl is failing to compile because
GL_MAX_TEXTURE_UNITS is not defined. Let's define it and provide a
wrapper which uses GL_MAX_TEXTURE_IMAGE_UNITS or
COGL_GLES2_MAX_TEXTURE_UNITS, whichever is the smallest.
2010-02-25 12:50:52 +00:00
Øyvind Kolås
3bc0672fef animator: handle no initial key
Fixing the crasher reported in bug #1995.
2010-02-25 12:35:19 +00:00
Øyvind Kolås
d2db512788 animator: added clutter_animator_compute_value
Allow querying the computed values of properties managed by a
ClutterAnimator.
2010-02-25 12:35:06 +00:00
Øyvind Kolås
e8d32fd153 animator: removed bogus arg in keys interpolation accessor
A bogus ClutterInterpolation argument had been carried from
clutter_animator_set_interpolation to clutter_animator_get_interpolation
in copy and paste.
2010-02-25 12:35:05 +00:00
Emmanuele Bassi
be8f53f229 animation: Fix a typo
This will teach me to check before compiling a version-dependent branch
that I'm actually using my jhbuild environment and not the system
libraries.
2010-02-25 12:01:03 +00:00
Emmanuele Bassi
26e22b2ede Conditionally use G_VALUE_COLLECT_INIT() macro
GLib 2.24 (but starting from the 2.23.2 unstable release) added a new
macro for collecting GValues from a va_list.

The newly added G_VALUE_COLLECT_INIT() macro should be used in place
of initializing the GValue and calling G_VALUE_COLLECT(), and improves
the collection performances by avoiding multiple checks, free and
initialization calls.
2010-02-25 10:22:36 +00:00
Bastian Winkler
59fd7e4a81 animator: Append parsed animator keys to previously parsed ones
Reuse the GSList of the previously parsed property when building a
ClutterAnimator from script, otherwise only the last used property will
be used

http://bugzilla.openedhand.com/show_bug.cgi?id=2003
2010-02-24 16:33:19 +00:00
Emmanuele Bassi
ec0c7fcd9b build: Use the right headers when enumerating them
The installed _HEADERS should be the public ones and the enumeration
types; repeating clutter-x11-texture-pixmap.h breaks with automake 1.11
and doesn't strictly make any sense.

http://bugzilla.openedhand.com/show_bug.cgi?id=2002
2010-02-24 14:23:58 +00:00
Emmanuele Bassi
d1ca0e1b8f fixed layout: Store a back pointer to the Container
When set_container() is called with a NULL container we cannot use the
passed pointer to unset the CLUTTER_ACTOR_NO_LAYOUT flag. We should
store a back pointer to the container as object data (there's no need
to add a Private data structure in this case) and unset the flag on the
back pointer instead.
2010-02-24 12:25:53 +00:00
Emmanuele Bassi
aa8c812705 box: Do not short-circuit size negotiation for empty Boxes
The LayoutManager used might decide to have a default allocation or a
default preferred size when empty.
2010-02-24 12:10:23 +00:00
Robert Bragg
523bab0868 layout: allow wider use of the CLUTTER_ACTOR_NO_LAYOUT flag
Previously only ClutterGroup was able to set the CLUTTER_ACTOR_NO_LAYOUT
flag which allows clutter-actor.c to avoid a relayout when showing or
hiding fixed layout containers. Instead of it being the responsibility
of the container to set this flag this patch makes the layout manager
itself decide in the ::set_container method. This way both ClutterBox
and ClutterGroup can take advantage of the optimization.
2010-02-24 12:07:23 +00:00
Emmanuele Bassi
f21e649c80 docs: Detail replacement for cogl_check_extension()
The cogl_check_extension() function has been deprecated, but it's easily
replaceable with a simple strstr() call.
2010-02-24 11:28:44 +00:00
Emmanuele Bassi
d54af2363d build: Use template for ClutterX11 enumerationt types
Clutter and Cogl use the template Makefile.am.enums for building the
enumeration GTypes from public headers, but ClutterX11 is not.
2010-02-24 10:20:10 +00:00
Neil Roberts
eb35c446b1 clutter-box: Layer new actors on top of all others at the same depth
g_list_insert_sorted inserts the new actor before all others that
compare equal so for the normal case when all actors have depth==0
this has the surprising behaviour of layering the actors in reverse
order. To fix this it now manually inserts the actor in the right
place by searching until it finds an actor at a higher depth and
inserting before that.

http://bugzilla.openedhand.com/show_bug.cgi?id=1988
2010-02-24 10:03:43 +00:00
Neil Roberts
da0315e4d6 box: Revert "Tweak the depth sorting function"
This reverts commit 939e56e2b1.

Changing the depth sort function to have inconsistent behaviour for
nodes that compare equal breaks the stability of g_list_sort. It ends
up so that every time clutter_container_sort_depth_order is called the
order of all actors with the same depth is reversed.

http://bugzilla.openedhand.com/show_bug.cgi?id=1988
2010-02-24 10:03:41 +00:00
Robert Bragg
1c65f2ee1e cogl debug: Adds glViewport call tracing
To aid in the debugging of Clutter stage resize issues this adds a
COGL_DEBUG=opengl option that will trace "some select OpenGL calls"
(currently just glViewport calls)
2010-02-23 22:09:07 +00:00