Emmanuele Bassi [Tue, 27 Apr 2010 09:12:25 +0000 (10:12 +0100)]
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.
Emmanuele Bassi [Mon, 26 Apr 2010 11:58:17 +0000 (12:58 +0100)]
Clean up the Texture private data structure
Neil Roberts [Sun, 25 Apr 2010 15:20:39 +0000 (16:20 +0100)]
mingw-cross-compile.sh: Write the build environment to a script
The script now writes out a separate script that can be used to set up
the build environment to $ROOT_DIR/share/env.sh. This can be sourced
in a shell to set up the build environment or it can be given a
command to directly execute in the environment. This makes it easier
to build Clutter from your own source rather than checking it out from
git directly.
Neil Roberts [Sun, 25 Apr 2010 15:09:16 +0000 (16:09 +0100)]
mingw-cross-compile.sh: Update the package versions
This updates to the latest binaries from Tor Lillqvist. zlib and iconv
are now taken from the Tor deps instead of the gnuwin32 project. SDL
is no longer downloaded because the SDL backend has been removed from
Clutter. The GL headers are downloaded from the Mesa cgit rather than
downloading the whole Mesa package. glext.h is taken directly from
khronos.org.
Neil Roberts [Thu, 22 Apr 2010 17:14:40 +0000 (18:14 +0100)]
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.
Neil Roberts [Thu, 22 Apr 2010 17:03:57 +0000 (18:03 +0100)]
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.
Emmanuele Bassi [Thu, 22 Apr 2010 16:54:05 +0000 (17:54 +0100)]
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.
Emmanuele Bassi [Thu, 22 Apr 2010 16:52:13 +0000 (17:52 +0100)]
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
8146d8d08deafd6cf86238a4a8c2fa6149e5c691.
Emmanuele Bassi [Thu, 22 Apr 2010 16:51:56 +0000 (17:51 +0100)]
Add uprof to the jhbuild moduleset
Emmanuele Bassi [Thu, 22 Apr 2010 15:49:57 +0000 (16:49 +0100)]
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.
Emmanuele Bassi [Wed, 21 Apr 2010 10:30:54 +0000 (11:30 +0100)]
docs: Fix gtk-doc warnings
Neil Roberts [Wed, 21 Apr 2010 21:36:43 +0000 (22:36 +0100)]
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.
Neil Roberts [Wed, 21 Apr 2010 17:58:18 +0000 (18:58 +0100)]
test-cogl-path: Test sub paths and intersections
This changes the original tests so that it splits the original path
into two sub paths. When adding a new block to the copied path it also
adds another sub path. This further stresses the path copying
mechanism and exposes a bug.
It also tests intersections by drawing a self-intersecting path and a
path with two sub-paths that overlap. Where the path overlaps it
should be inverted.
Neil Roberts [Tue, 20 Apr 2010 13:58:57 +0000 (14:58 +0100)]
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
Neil Roberts [Wed, 21 Apr 2010 10:49:57 +0000 (11:49 +0100)]
cogl-path: Document how a shape is filled
This adds some documentation to cogl_path_fill() describing the fill
rule Cogl uses.
Neil Roberts [Mon, 19 Apr 2010 17:54:40 +0000 (18:54 +0100)]
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
Neil Roberts [Fri, 26 Mar 2010 23:09:11 +0000 (23:09 +0000)]
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
Neil Roberts [Fri, 26 Mar 2010 22:40:53 +0000 (22:40 +0000)]
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
Neil Roberts [Fri, 26 Mar 2010 22:34:56 +0000 (22:34 +0000)]
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
Emmanuele Bassi [Mon, 19 Apr 2010 16:55:37 +0000 (17:55 +0100)]
Require GLib >= 2.18
We use g_signal_override_class_handler(), which was added in GLib 2.18,
so we should bump up our requirements.
Neil Roberts [Thu, 15 Apr 2010 12:57:45 +0000 (13:57 +0100)]
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
Robert Bragg [Fri, 16 Apr 2010 13:38:52 +0000 (14:38 +0100)]
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.
Neil Roberts [Wed, 3 Feb 2010 20:58:32 +0000 (20:58 +0000)]
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>
Emmanuele Bassi [Fri, 16 Apr 2010 10:11:50 +0000 (11:11 +0100)]
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.
Rob Bradford [Tue, 13 Apr 2010 23:12:02 +0000 (00:12 +0100)]
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>
Neil Roberts [Thu, 15 Apr 2010 09:58:28 +0000 (10:58 +0100)]
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.
Neil Roberts [Thu, 15 Apr 2010 09:27:43 +0000 (10:27 +0100)]
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.
Neil Roberts [Wed, 14 Apr 2010 18:41:08 +0000 (19:41 +0100)]
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.
Neil Roberts [Wed, 14 Apr 2010 17:47:25 +0000 (18:47 +0100)]
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.
Neil Roberts [Wed, 14 Apr 2010 14:42:57 +0000 (15:42 +0100)]
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.
Neil Roberts [Wed, 14 Apr 2010 12:17:26 +0000 (13:17 +0100)]
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.
Emmanuele Bassi [Wed, 14 Apr 2010 22:34:38 +0000 (23:34 +0100)]
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.
Emmanuele Bassi [Tue, 13 Apr 2010 23:52:23 +0000 (00:52 +0100)]
Add test-cogl-wrap-mode to the ignore list
Neil Roberts [Tue, 13 Apr 2010 16:26:03 +0000 (17:26 +0100)]
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.
Neil Roberts [Thu, 1 Apr 2010 17:35:32 +0000 (18:35 +0100)]
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.
Neil Roberts [Wed, 31 Mar 2010 17:54:34 +0000 (18:54 +0100)]
tests: Add a conformance test for the wrap modes of a cogl material
This renders a texture using different combinations of wrap modes for
the s and t coordinates and then verifies that the expected wrapping
is acheived. The texture is drawn using rectangles, polygons and
vbos. There is also code to test a rectangle using an atlased texture
(which should test the manual repeating) however the validation for
this is currently disabled because it doesn't work.
http://bugzilla.openedhand.com/show_bug.cgi?id=2063
Neil Roberts [Thu, 1 Apr 2010 10:31:33 +0000 (11:31 +0100)]
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
Neil Roberts [Thu, 25 Mar 2010 17:29:22 +0000 (17:29 +0000)]
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
Neil Roberts [Thu, 1 Apr 2010 19:06:30 +0000 (20:06 +0100)]
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
Neil Roberts [Mon, 12 Apr 2010 14:16:58 +0000 (15:16 +0100)]
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.
Neil Roberts [Mon, 12 Apr 2010 11:06:03 +0000 (12:06 +0100)]
Fix indentation in CoglMatrix
The members of CoglMatrix were indented by 4 characters instead of 2.
Damien Lespiau [Sat, 10 Apr 2010 16:02:42 +0000 (17:02 +0100)]
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
Emmanuele Bassi [Fri, 9 Apr 2010 17:24:09 +0000 (18:24 +0100)]
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.
Emmanuele Bassi [Fri, 9 Apr 2010 17:22:50 +0000 (18:22 +0100)]
tests: Fix test-script.json
A trailing comma is breaking the validity of test-script.json
Fridrich Strba [Fri, 9 Apr 2010 14:43:42 +0000 (15:43 +0100)]
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.
Neil Roberts [Fri, 9 Apr 2010 13:10:11 +0000 (14:10 +0100)]
Add tests/conform/test-cogl-path to .gitignore
Neil Roberts [Thu, 8 Apr 2010 16:18:40 +0000 (17:18 +0100)]
Add a test case for cogl_path
This tests various paths drawing rectangles and verifies that the
expected pixels are filled in. Some of the paths are drawn by copying
an existing path and modifying it which should test the copy-on-write
code.
Neil Roberts [Thu, 8 Apr 2010 16:43:27 +0000 (17:43 +0100)]
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.
Robert Bragg [Thu, 8 Apr 2010 13:37:01 +0000 (14:37 +0100)]
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.
Robert Bragg [Thu, 1 Apr 2010 12:15:12 +0000 (13:15 +0100)]
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.
Robert Bragg [Wed, 3 Mar 2010 16:37:59 +0000 (16:37 +0000)]
test-cogl-offscreen: Setup a clutter style modelview/projection
This updates test-cogl-offscreen to give an example of setting up a
CoglFramebuffer with a Clutter style 2D coordinate system with (0,0) top
left and (framebuffer_width, framebuffer_height) bottom right.
Robert Bragg [Fri, 19 Mar 2010 09:55:30 +0000 (09:55 +0000)]
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.
Robert Bragg [Fri, 19 Mar 2010 09:30:59 +0000 (09:30 +0000)]
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.
Robert Bragg [Fri, 19 Mar 2010 09:16:08 +0000 (09:16 +0000)]
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.
Neil Roberts [Wed, 31 Mar 2010 18:03:02 +0000 (19:03 +0100)]
test-cogl-tex-polygon: Actually use the material it creates
test-cogl-tex-polygon creates a separate material so that it can set
the texture filters. However in the paint functions that use
cogl_polygon it was calling cogl_set_source_texture which replaces the
material and ends up always using GL_LINEAR. This patch makes the
paint functions assume the correct source is set up instead of trying
to select a new source.
Emmanuele Bassi [Wed, 31 Mar 2010 14:14:09 +0000 (15:14 +0100)]
Add jhbuild moduleset
Clutter should provide a moduleset for JHBuild, to allow building the
whole Clutter stack within a separate prefix.
Owen W. Taylor [Fri, 26 Mar 2010 00:41:46 +0000 (00:41 +0000)]
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>
Owen W. Taylor [Fri, 26 Mar 2010 00:35:36 +0000 (00:35 +0000)]
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>
Emmanuele Bassi [Thu, 25 Mar 2010 09:45:59 +0000 (09:45 +0000)]
docs: Add 1.4 index to the API references
Now that master has branched for the 1.3 development cycle.
José Dapena Paz [Wed, 17 Mar 2010 15:16:09 +0000 (16:16 +0100)]
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>
Emmanuele Bassi [Thu, 25 Mar 2010 09:33:26 +0000 (09:33 +0000)]
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
Neil Roberts [Wed, 24 Mar 2010 15:32:28 +0000 (15:32 +0000)]
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.
Adel Gadllah [Sun, 21 Mar 2010 12:12:58 +0000 (13:12 +0100)]
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>
Owen W. Taylor [Fri, 19 Mar 2010 18:18:17 +0000 (18:18 +0000)]
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>
Emmanuele Bassi [Fri, 19 Mar 2010 16:24:34 +0000 (16:24 +0000)]
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.
Emmanuele Bassi [Fri, 19 Mar 2010 11:39:23 +0000 (11:39 +0000)]
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.
Owen W. Taylor [Wed, 17 Mar 2010 00:38:53 +0000 (20:38 -0400)]
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>
Emmanuele Bassi [Fri, 19 Mar 2010 11:13:04 +0000 (11:13 +0000)]
json: Update JsonParser
Add another fix from upstream, to clean up the code.
Emmanuele Bassi [Fri, 19 Mar 2010 10:40:12 +0000 (10:40 +0000)]
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.
Owen W. Taylor [Thu, 18 Mar 2010 17:55:01 +0000 (13:55 -0400)]
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>
Owen W. Taylor [Wed, 17 Mar 2010 19:39:55 +0000 (15:39 -0400)]
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>
Emmanuele Bassi [Thu, 18 Mar 2010 20:36:02 +0000 (20:36 +0000)]
build: Mark --with-json=internal as experimental
The system JSON-GLib installation should be the preferred way of parsing
JSON in Clutter. The internal copy is limited by re-synchronization from
upstream, and by the fact that upstream contains a fork of GScanner that
allows parsing escaped UTF-8. We should warn users compiling Clutter
with the internal copy, just like we warn about the internal image
backend.
Emmanuele Bassi [Thu, 18 Mar 2010 20:29:59 +0000 (20:29 +0000)]
docs: Update the README
Add a "requirements" section and detail all the build requirements for
Clutter, depending on the platform.
Emmanuele Bassi [Thu, 18 Mar 2010 20:27:18 +0000 (20:27 +0000)]
build: Require xcomposite
The X11TexturePixmap actor uses XComposite API directly, without guards.
It has been doing so for a while, against the fact that we do check for
the XComposite extension - but we don't depend on it. As soon as you try
building Clutter on X11 without the XComposite extension available all
hell breaks loose.
The obvious fix is to make Clutter depend on XComposite - basically
ratifying what's the current state of things.
Emmanuele Bassi [Thu, 18 Mar 2010 20:20:09 +0000 (20:20 +0000)]
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.
Emmanuele Bassi [Thu, 18 Mar 2010 17:44:14 +0000 (17:44 +0000)]
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.
Emmanuele Bassi [Thu, 18 Mar 2010 14:15:33 +0000 (14:15 +0000)]
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.
Emmanuele Bassi [Wed, 17 Mar 2010 17:41:52 +0000 (17:41 +0000)]
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().
Emmanuele Bassi [Wed, 17 Mar 2010 17:28:20 +0000 (17:28 +0000)]
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.
Emmanuele Bassi [Wed, 17 Mar 2010 17:14:08 +0000 (17:14 +0000)]
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>
Emmanuele Bassi [Tue, 16 Mar 2010 18:57:28 +0000 (18:57 +0000)]
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.
Emmanuele Bassi [Tue, 16 Mar 2010 18:53:24 +0000 (18:53 +0000)]
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
c274118a8f7ed18e5bc703e614a9ea0a7cdb553c.
Emmanuele Bassi [Tue, 16 Mar 2010 10:44:40 +0000 (10:44 +0000)]
Branch master for 1.3
Emmanuele Bassi [Mon, 15 Mar 2010 16:40:50 +0000 (16:40 +0000)]
Post-release version bump to 1.2.3
Emmanuele Bassi [Mon, 15 Mar 2010 16:25:46 +0000 (16:25 +0000)]
Release 1.2.2
Emmanuele Bassi [Mon, 15 Mar 2010 16:04:34 +0000 (16:04 +0000)]
Update NEWS file
Colin Walters [Fri, 12 Mar 2010 22:39:27 +0000 (17:39 -0500)]
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>
Bastian Winkler [Tue, 2 Mar 2010 08:26:57 +0000 (09:26 +0100)]
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>
Neil Roberts [Wed, 10 Mar 2010 00:37:52 +0000 (16:37 -0800)]
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
Owen W. Taylor [Mon, 1 Mar 2010 21:49:04 +0000 (16:49 -0500)]
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>
Emmanuele Bassi [Wed, 10 Mar 2010 00:25:26 +0000 (00:25 +0000)]
test-paint-wrapper: Request ARGB visuals on GLX
If we are on GLX we have to request ARGB visuals, otherwise Clutter will
not do it by itself.
José Dapena Paz [Mon, 8 Mar 2010 14:37:36 +0000 (15:37 +0100)]
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>
Emmanuele Bassi [Sun, 7 Mar 2010 23:46:59 +0000 (23:46 +0000)]
actor: Remove some double indirection
Use an intermediate variable to avoid a double indirection when accessing
the instance private data structure.
Emmanuele Bassi [Sun, 7 Mar 2010 20:54:33 +0000 (20:54 +0000)]
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
Emmanuele Bassi [Fri, 5 Mar 2010 11:39:32 +0000 (11:39 +0000)]
Add test-cogl-texture-rectangle to the ignore file
Emmanuele Bassi [Fri, 5 Mar 2010 08:48:52 +0000 (08:48 +0000)]
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.
Emmanuele Bassi [Wed, 3 Mar 2010 18:17:15 +0000 (18:17 +0000)]
docs: Update the HACKING.backends file
The create_context() and ensure_context() sections should be more clear
on the role of the functions, and their eventual caveats, like being
called multiple times.
Neil Roberts [Tue, 2 Mar 2010 15:18:00 +0000 (15:18 +0000)]
Add a conformance test for rectangle textures
The test creates a GL_TEXTURE_RECTANGLE_ARB texture using
cogl_texture_new_from_foreign and confirms that rendering it works
correctly. If the rectangle texture extension isn't available then
this test always succeeds.
http://bugzilla.openedhand.com/show_bug.cgi?id=2015
Owen W. Taylor [Mon, 1 Mar 2010 19:04:20 +0000 (14:04 -0500)]
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
Neil Roberts [Wed, 3 Mar 2010 18:08:33 +0000 (18:08 +0000)]
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