Commit Graph

3310 Commits

Author SHA1 Message Date
Neil Roberts
181b46933a cogl-gles2: Prefix internal GLES 2 wrapper symbols with _
Some internal symbols used for the GLES 2 wrapper were accidentally
being exported. This prepends an underscore to them so they won't
appear in the shared library.
2010-06-11 16:06:31 +01:00
Emmanuele Bassi
e00ed20805 click-action: Use clutter_actor_contains()
Instead of an internal copy.
2010-06-11 15:23:46 +01:00
Dan Winship
f3f3b56742 actor: add clutter_actor_contains()
It is often useful to determine if one actor is an ancestor of
another. Add a method to do that.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-06-11 15:19:45 +01:00
Emmanuele Bassi
d816acd834 shader-effect: Allow creating vertex shaders
By default, ShaderEffect creates a fragment shader; in order to be able
to deprecate ClutterShader we need a way for ShaderEffect sub-classes to
create a vertex shader if needed - By using a write-only, constructor
only property.

ClutterShader has, internally, a ClutterShaderType enumeration that can
be used exactly for this. We just need to expose it and create a GObject
property for ClutterShaderEffect.
2010-06-11 14:47:48 +01:00
Neil Roberts
0f41948c82 cogl-clip-stack: Always use the scissor when clipping
Whenever a path or a rectangle is added to the clip stack it now also
stores a screen space bounding box in the entry. Then when the clip
stack is flushed the bounding box is first used to set up the
scissor. That way when we eventually come to use the stencil buffer
the clear will be affected by the scissor so we don't have to clear
the entire buffer.
2010-06-10 21:52:55 +01:00
Neil Roberts
e74387f36f cogl-path: Export _cogl_path_get_bounds
_cogl_path_get_bounds is no longer static and is exported in
cogl-path-private.h so that it can be used in the clip stack code. The
old version of the function returned x/y and width/height. However
this was mostly used to call cogl_rectangle which takes x1/y1
x2/y2. The function has been changed to just directly return the
second form because it is more useful. Anywhere that was previously
using the function now just directly looks at path->path_nodes_min and
path->path_nodes_max instead.
2010-06-10 21:52:54 +01:00
Neil Roberts
0bc16c90ad cogl-clip-state: Export transform_point internally to Cogl
The transform_point function takes a modelview matrix, projection
matrix and a viewport and performs all three transformations on a
point to give a Cogl window coordinate. This is useful in a number of
places in Cogl so this patch moves it to cogl.c and adds it to
cogl-internal.h
2010-06-10 21:52:49 +01:00
Sunil Sadasivan
67812d6649 cogl_texture_get_data() copies using wrong width size.
For sliced 2D textures, _cogl_texture_2d_sliced_get_data() uses the
bitmap width, instead of the rowstride, when memcpy()ing into the
dest buffer.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2010-06-10 20:58:22 +01:00
Damien Lespiau
e562ac20df cogl-color: Provide setters for all the channels
We only had getters for the red, green, blue and alpha channels of a
color. This meant that, if you wanted to change, say, the alpha
component of a color, one would need to query the red, green and blue
channels and use set_from_4ub() or set_from_4f().

Instead of this, just provide some setters for CoglColor, using the same
naming scheme than the existing getters.
2010-06-10 20:02:01 +01:00
Damien Lespiau
55be1a23c3 cogl-color: Add cogl_color_unpremultiply()
For some operations on pre-multiplied colors (say, replace the alpha
value), you need to unpremultiply the color.

This patch provides the counterpart to cogl_color_premultiply().
2010-06-10 20:01:48 +01:00
Emmanuele Bassi
396914176f cogl: Initialize the framebuffer bits on state flush
The place where we actually change the framebuffer is
_cogl_framebuffer_flush_state(), so if we changed to a new frame buffer
we need to initialize the color bits there.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094
2010-06-10 19:55:18 +01:00
Emmanuele Bassi
15881e0f24 cogl-framebuffer: Use the FBO extension for color sizes
OpenGL 3.0 deprecated querying of the GL_{RED,GREEN,BLUE}_BITS
constants, and the FBO extension provides a mechanism to query for the
color buffer sizes which *should* work even with the default
framebuffer. Unfortunately, this doesn't seem to hold for Mesa - so we
just use this for the offscreen CoglFramebuffer type, and we fall back
to glGetIntegerv() for the onscreen one.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094
2010-06-10 19:53:39 +01:00
Emmanuele Bassi
3daafd4711 cogl: Hide cogl_framebuffer_get_*_bits()
These accessors should be private, for the time being.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094
2010-06-10 19:06:37 +01:00
Emmanuele Bassi
44f300b3a2 effect: Add PageTurnEffect
A simple deformation effect that simulates a page curl.

Ported from MxDeformPageTurn inside the Mx toolkit, written by
Chris Lord.
2010-06-10 18:40:29 +01:00
Emmanuele Bassi
c2081a076c effect: Add DeformEffect
DeformEffect is an abstract class that should be used to write effects
that change the geometry of an actor before submitting it to the GPU.

Just like the ShaderEffect class, DeformEffect renders the actor to
which it has been applied into an FBO; then it creates a mesh and stores
it inside a VBO. Sub-classes can control vertex attributes like
position, texel coordinates and the color.
2010-06-10 18:40:29 +01:00
Emmanuele Bassi
fa381cc361 offscreen-effect: Traslate the modelview with the offsets
Instead of using the stage offsets when painting we can simply traslate
the current modelview. This allows sub-classes to fully override the
paint_target() virtual function without chaining up.
2010-06-10 18:40:24 +01:00
Emmanuele Bassi
8d22fea31c docs: Fix Effect subclassing section
It still mentions the long since removed "prepare" function.
2010-06-10 17:34:48 +01:00
Neil Roberts
dc09fca264 cogl-material: Fix the function which sets the enable blend flag
This function had two problems. Firstly it would clear the enable
blend flag before calling pre_change_notify so that if blending was
previously enabled the journal would end up being flushed while the
flag was still cleared. Secondly it would call the pre change notify
whenever blending is needed regardless of whether it was already
needed previously.

This was causing problems in test-depth.
2010-06-09 17:26:15 +01:00
Robert Bragg
b1f7d2fea8 material: Avoid redundant glBindTexture calls
This adds a _cogl_bind_gl_texture_transient function that should be used
instead of glBindTexture so we can have a consistent cache of the
textures bound to each texture unit so we can avoid some redundant
binding.
2010-06-09 17:26:15 +01:00
Robert Bragg
ce6e80315e material: Adds backend abstraction for fragment processing
As part of an effort to improve the architecture of CoglMaterial
internally this overhauls how we flush layer state to OpenGL by adding a
formal backend abstraction for fragment processing and further
formalizing the CoglTextureUnit abstraction.

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

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

This adds three new COGL_DEBUG options:
* "disable-texturing" as expected should disable all texturing
* "disable-arbfp" always make the arbfp backend fallback
* "disable-glsl" always make the glsl backend fallback
* "show-source" show code generated by the arbfp/glsl backends
2010-06-09 17:15:59 +01:00
Neil Roberts
8cee3c8670 cogl-atlas-texture: Flush the journal before starting blit not after
_cogl_atlas_texture_blit_begin binds a texture to use as the
destination and it expects it to stay bound until
_cogl_atlas_texture_end_blit is called. However there was a call to
_cogl_journal_flush directly after setting up the blit state which
could cause the wrong texture to be bound. This just moves the flush
to before the call to _cogl_atlas_texture_blit_begin.

This was breaking test-cogl-sub-texture.
2010-06-09 15:22:05 +01:00
Robert Bragg
413e631f48 atlas: fix some journal flushing issues
1) Always flush when migrating textures out of an atlas because although
it's true that the original texture data will remain valid in the
original texture we can't assume that journal entries have resolved the
GL texture that will be used. This is only true if a layer0_override has
been used.

2) Don't flush at the point of creating a new atlas simply flush
immediately before reorganizing an atlas. This means we are now assuming
that we will never see recursion due to atlas textures being modified
during a journal flush. This means it's the responsibility of the
primitives code to _ensure_mipmaps for example not the responsibility of
_cogl_material_flush_gl_state.
2010-06-09 15:19:31 +01:00
Robert Bragg
d407bb520f primitives: make sure to update texture storage before drawing
We want to make sure that the material state flushing code will never
result in changes to the texture storage for that material. So for
example mipmaps need to be ensured by the primitives code.

Changes to the texture storage will invalidate the texture coordinates
in the journal and we want to avoid a recursion of journal flushing.
2010-06-09 15:19:31 +01:00
Robert Bragg
2f8d4fc180 matrix: add cogl_matrix_equal API
This adds a way to compare two CoglMatrix structures to see if they
represent the same transformations. memcmp can't be used because a
CoglMatrix contains private flags and padding.
2010-06-09 15:19:31 +01:00
Damien Lespiau
9815d75ebd cogl-material: Use fragment programs instead of texture env combiners
THIS IS A WORK IN PROGRESS

Mesa is building a big shader when using ARB_texture_env_combine. The
idea is to bypass that computation, do it ourselves and cache the
compiled program in a CoglMaterial.

For now that feature can be enabled by setting the COGL_PIPELINE
environment variable to "arbfp". COGL_SHOW_FP_SOURCE can be set to a non
empty string to dump the fragment program source too.

TODO:
  * fog (really easy, using OPTION)
  * support tex env combiner operands, DOT3, ADD_SIGNED, INTERPOLATE
    combine modes (need refactoring the generation of temporary
    variables) (not too hard)
  * alpha testing for GLES 2.0?
2010-06-09 15:19:30 +01:00
Damien Lespiau
df44c2e9e4 cogl: Introduce private feature flags and check for ARB_fp
The Cogl context has now a feature_flags_private enum that will allow us
to query and use OpenGL features without exposing them in the public
API.

The ARB_fragment_program extension is the first user of those flags.
Looking for this extension only happens in the gl driver as the gles
drivers will not expose them.

One can use _cogl_features_available_private() to check for the
availability of such private features.

While at it, reindent cogl-internal.h as described in CODING_STYLE.
2010-06-09 15:19:30 +01:00
Emmanuele Bassi
91a359c44e Always have a valid font map
Every time we request a CoglPangoFontMap, either internally or
externally, we should have one available.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2010-06-09 11:55:19 +01:00
Johan Bilien
5929468599 Create the pango context in clutter_set_font_flags
if it wasn't already. Allows honoring CLUTTER_FONT_MIPMAPPING.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-06-09 11:14:58 +01:00
Robert Bragg
30296a3307 backend-glx: Avoid vblank waits/glFinish calls when throttling blits
If we have the GLX_SGI_video_sync extension then it's possible to always
keep track for the video sync counter each time we call glXSwapBuffers
or do a sub stage blit. This then allows us to avoid waiting before
issuing a blit if we can see that the counter has already progressed.

Also since we expect that glXCopySubBuffer is synchronized to the vblank
we don't need to use glFinish () in conjunction with the vblank wait
since the vblank wait's only purpose is to add a delay.
2010-06-09 02:11:17 +01:00
Robert Bragg
1b31ac465d backend-glx: only check for GLX_SGI_video_sync for direct contexts
The GLX_SGI_video_sync spec explicitly says that it's only supported for
direct contexts so we don't setup up the function pointers if
glXIsDirect () returns GL_FALSE.
2010-06-09 02:10:08 +01:00
Robert Bragg
f37de23dec backend-glx: Make sure to throttle sub region blits
Neither glXCopySubBuffer or glBlitFramebuffer are integrated with the
swap interval of a framebuffer so that means when we do partial stage
updates (as Mutter does in response to window damage) then the blits
aren't throttled which means applications that throw lots of damage
events at the compositor can effectively cause Clutter to run flat out
taking up all the system resources issuing more blits than can even be
seen.

This patch now makes sure we use the GLX_SGI_video_sync or a
DRM_VBLANK_RELATIVE ioctl to throttle blits to the vblank frequency as
we do when using glXSwapBuffers.
2010-06-09 02:10:08 +01:00
Adel Gadllah
630a2c5edc backend-glx: Provide copy_sub_buffer fallback
Currently glXCopySubBufferMESA is used for sub stage redraws, but in case
a driver does not support GLX_MESA_copy_sub_buffer we fall back to redrawing
the complete stage which isn't really optimal.

So instead to directly fallback to complete redraws try using GL_EXT_framebuffer_blit
to do the BACK to FRONT buffer copies.

http://bugzilla.openedhand.com/show_bug.cgi?id=2128
2010-06-09 02:10:08 +01:00
Neil Roberts
ac3e0150ed cogl-gles2-wrapper: Fix some cases using the wrong texture unit
At two places in cogl_wrap_prepare_for_draw it was trying to loop over
the texture units to flush some state. However it was retrieving the
texture unit pointer using w->active_texture_unit instead of the loop
index so it would end up with the wrong state.

Also in glEnableClientState it was using the active unit instead of
the client active unit.
2010-06-08 17:26:26 +01:00
Emmanuele Bassi
4c22f122e1 script: Support layout manager properties
Layout properties work similarly to child properties, with the added
headache that they require the 3-tuple:

  ( layout manager, container, actor )

to be valid in order to be inspected, parsed and applied. This means
using the newly added back-pointer from the container to the layout
manager and then rejigging a bit how the ScriptParser handles the
unresolved properties.

Similarly to the child properties, which use the "child::" prefix, the
layout manager properties use the "layout::" prefix and are defined with
the child of a container holding a layout manager.
2010-06-07 22:45:34 +01:00
Emmanuele Bassi
ab76584965 layout-manager: Implement set_container()
Store a back pointer of the layout manager inside the container using
the GObject instance data. This introduces a change in the implementation
of ClutterLayoutManager, though it's still binary compatible.
2010-06-07 22:40:34 +01:00
Emmanuele Bassi
8583986e16 blur-effect: Fix loop unrolling
The box blur shader was not sampling all the points for producing the
desired effect.
2010-06-07 15:45:24 +01:00
Damien Lespiau
eb3017df7e doc: Some fixes for the Cogl documentation
• 3 general fixes (typos, copy/paste),
 • ignore cogl-object-private.h,
 • cogl_fixed_atani() was in reality cogl_fixed_atan(), fixed in commit
   43564f05.
 • Fix the cogl-vector section: sections must have a </SECTION> tag at
   the end. Also the cogl-vector section was added in the middle of the
   cogl-buffer one. Let's shiffle it out and add that </SECTION> tag.
2010-06-07 14:32:32 +01:00
Damien Lespiau
9a6a2a96dd animator,state: Mark variadic functions that ends with NULL
GCC can catch errors when it knows that a variadic function must be
ended with NULL. Let's use the glib macro encapsulating the GCC
attribute to clutter_animator_set() and clutter_state_set().
2010-06-07 14:22:26 +01:00
Colin Walters
f0ded315e4 g_source_set_name on custom sources (if available)
Call g_source_set_name, if the versio of GLib is new enough.
This aids debugging, using e.g. SystemTap.  See
https://bugzilla.gnome.org/show_bug.cgi?id=620511
for more information

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-06-07 12:05:24 +01:00
Damien Lespiau
cef4c8de76 build: Don't distribute clutter-version.h and cogl-defines.h
As with a351ff2af earlier, distributing headers generated at configure
time conflicts with out of tree builds as the distributed headers will
be included first instead of including the generated ones.
2010-06-04 17:43:57 +01:00
Robert Bragg
f6078eca83 cogl-object-private.h: white space cleanup
simply replaces tabs with spaces
2010-06-04 14:44:15 +01:00
Robert Bragg
2ce0cf3861 CoglObject: Adds a COGL_OBJECT macro for casting
This adds a convenience COGL_OBJECT macro for casting CoglObject
subclasses to (CoglObject *) pointers.
2010-06-04 14:44:15 +01:00
Robert Bragg
e7c800dacc CoglObject: Adds cogl_object_{get,set}_user_data
This provides a mechanism for associating private data with any
CoglObject. We expect Clutter will use this to associate weak materials
with normal materials.
2010-06-04 14:44:15 +01:00
Robert Bragg
d131602a6d cogl-path: Adds missing cogl_is_path prototype
This adds a missing cogl_is_path prototype to the public cogl-path.h
header.
2010-06-04 14:44:15 +01:00
Robert Bragg
eca2634050 cogl-path: Renames cogl_path_get/set cogl_get/set_path
These aren't path methods so aren't consistent with the
cogl_object_method naming style we are aiming for.
2010-06-04 14:44:15 +01:00
Damien Lespiau
a351ff2afc build: Do not distribute clutter-json.h
clutter-jon.h is generated at configure time, we should not distribute it.

This caused a build issue when compiling from a tarballs and out of tree
builds as we ended up with two clutter-json.h one in $(top_srcdir)/json
and the other in $(top_builddir)/json and picked up the wrong one
($(top_srcdir)/json is included first in the include search path).
2010-06-03 15:00:07 +01:00
Emmanuele Bassi
23084b9768 docs: Effects fixes for the API reference 2010-06-03 14:34:41 +01:00
Emmanuele Bassi
aef2f805a6 effects: Fix stacking of offscreen-based effects
Stacking multiple effects sub-classing ClutterOffscreenEffect requires
a small fix in the code that computes the screen coordinates of the
actor to position the FBO correctly with regards to the stage.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
8ef4d9fe21 actor: Add "effects" to the animatable metas
Since ClutterEffect is an ActorMeta it should be possible to animate the
properties of named effects using the @effects syntax, just like it
happens for actions and constraints.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
0e9a1dee6d shader-effect: Simplify setting the shader source
Sub-classes of ShaderEffect currently have to get the handle for the
Cogl shader and call cogl_shader_source(); this makes it awkward to
implement a ShaderEffect, and it exposes handles and Cogl API that we
might want to change in the future.

We should provide a ClutterShaderEffect method that allows to (safely)
set the shader source at the right time for sub-classes to use.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
a3e8e0025a effect: Rework the OffscreenEffect painting
The OffscreenEffect should set up the off screen draw buffer so that it
has the same projection and modelview as if it where on screen; we
achieve that by setting up the viewport to be the same size of the stage
but with an initial offset given by the left-most vertex of the actor.

When we paint the texture attached to the FBO we then set up the
modelview matrix of the on screen draw buffer so that it's the same as
the stage one: this way, the texture will be painted in screen
coordinates and it will occupy the same area as the actor would have
had.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
b4f8ba0f73 effect: Add ColorizeEffect
A copy of DesaturateEffect that converts to grayscale and applies a
user-defined tint to the render target.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
73a773d37a effect: Add DesaturateEffect
A simple shader-based effect that desaturates an actor and its contents
based on a controllable factor.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
5a5b21446c effect: Add BlurEffect
A simple, GLSL shader-based blur effect.

The blur shader is taken straight from the test-shader.c interactive
test case. It's a fairly clunky, inefficient and visually incorrect
implementation of a box blur, but it's all we have right now until I
figure out a way to do multi-pass shading with the current API.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
c260da79e3 effect: Add ShaderEffect
The ShaderEffect class is an abstract base type for shader-based
effects. GLSL-based effects should be implemented by sub-classing
ShaderEffect and overriding ActorMeta::set_actor() to set the source
code of the shader, and Effect::pre_paint() to update the uniform
values, if any.

The ShaderEffect has a generic API for sub-classes to set the values
of the uniforms defined by their shaders, and it uses the shader
types we defined for ClutterShader, to avoid re-inventing the wheel
every time.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
c3ab32ae68 effect: Add OffscreenEffect
The OffscreenEffect class is meant to be used to implement Effect
sub-classes that create an offscreen framebuffer and redirect the
actor's paint sequence there. The OffscreenEffect is useful for
effects using fragment shaders.

Any shader-based effect being applied to an actor through an offscreen
buffer should be used before painting the resulting target material and
not for every actor. This means that doing:

       pre_paint: cogl_program_use(program)
                  set up offscreen buffer
           paint: [ actors ] → offscreen buffer → target material
      post_paint: paint target material
                  cogl_program_use(null)

Is not correct. Unfortunately, we cannot really do:

      post_paint: cogl_program_use(program)
                  paint target material
                  cogl_program_use(null)

Because the OffscreenEffect::post_paint() implementation also pops the
offscreen buffer and re-instates the previous framebuffer:

      post_paint: cogl_program_use(program)
                  change frame buffer ← ouch!
                  paint target material
                  cogl_program_use(null)

One way to fix it is to allow using the shader right before painting
the target material - which means adding a new virtual inside the
OffscreenEffect class vtable in additions to the ones defined by the
parent Effect class.

The newly-added paint_target() virtual allows the correct sequence of
actions by adding an entry point for sub-classes to wrap the "paint
target material" operation with custom code, in order to implement the
case above correctly as:

      post_paint: change frame buffer
                  cogl_program_use(program)
                  paint target material
                  cogl_program_use(null)

The added upside is that sub-classes of OffscreenEffect involving
shaders really just need to override the prepare() and paint_target()
virtuals, since the pre_paint() and post_paint() do all that's needed.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
a86f1b45bb Add the ClutterEffect abstract class
ClutterEffect is an abstract class that should be used to apply effects
on generic actors.

The ClutterEffect class just defines what an effect should implement; it
could be defined as an interface, but we might want to add some default
behavior dependent on the internal state at a later point.

The effect API applies to any actor, so we need to provide a way to
assign an effect to an actor, and let ClutterActor call the Effect
methods during the paint sequence.

Once an effect is attached to an actor we will perform the paint in this
order:

  • Effect::pre_paint()
  • Actor::paint signal emission
  • Effect::post_paint()

Since an effect might collide with the Shader class, we either allow a
shader or an effect for the time being.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
5ffbcbe9ee actor: Reset the modelview matrix
When getting the relative modelview matrix we need to reset it to the
stage's initial state or, at least, initialize it to the identity
matrix, instead of assuming we have an empty stack.
2010-06-03 14:10:55 +01:00
Damien Lespiau
6eba218807 build: Distribute cogl-object.h
cogl-object.h is a new public header. Include it in the right list of
source files to have it distributed.
2010-06-03 11:41:03 +01:00
Emmanuele Bassi
91220c4b46 docs: Miscellaneous fixes to silence gtk-doc 2010-06-01 14:15:03 +01:00
Robert Bragg
311db34d08 clip_stack: Remove use of CoglHandle in the CoglClipStack API
This replaces the use of CoglHandle with strongly type CoglClipStack *
pointers instead. The only function not converted for now is
cogl_is_clip_stack which will be done in a later commit.
2010-06-01 12:20:59 +01:00
Robert Bragg
29da1d0d3e bitmap: Remove use of CoglHandle in the CoglBitmap API
This replaces the use of CoglHandle with strongly type CoglBitmap *
pointers instead. The only function not converted for now is
cogl_is_bitmap which will be done in a later commit.
2010-06-01 12:20:59 +01:00
Robert Bragg
f3f268b0cd path: Remove use of CoglHandle in the CoglPath API
This replaces the use of CoglHandle with strongly type CoglPath *
pointers instead. The only function not converted for now is
cogl_is_path which will be done in a later commit.
2010-06-01 12:20:58 +01:00
Robert Bragg
250d82cd3f cogl: avoid ‘_cogl_xyz_handle_new’ defined but not used warnings
This patch makes it so that only the backwards compatibility
COGL_HANDLE_DEFINE macro defines a _cogl_xyz_handle_new function. The
new COGL_OBJECT_DEFINE macro only defines a _cogl_xyz_object_new
function.
2010-06-01 12:20:58 +01:00
Damien Lespiau
43564f05a6 analysis: Fix some CoglFixed API
2 functions where not correctly defined/documented, use the actual
symbol name instead.
2010-06-01 12:08:18 +01:00
Damien Lespiau
653a8a7874 analysis: Use static functions when possible
It's best to ensure the functions only used in one compilation unit are
marked as static so GCC can inline them if it feels like it.
2010-06-01 12:08:18 +01:00
Damien Lespiau
3161e92818 analysis: Make all function declarations be protoypes
It's valid C to declare a function omitting it prototype, but it seems
to be a good practise to always declare a function with its
corresponding prototype.
2010-06-01 12:08:18 +01:00
Damien Lespiau
ec59af290c analysis: None used in pointer context
While this is totally fine (None is 0L and, in the pointer context, will
be converted in the right internal NULL representation, which could be a
value with some bits to 1), I believe it's clearer to use NULL instead
of None when we talk about pointers.
2010-06-01 12:08:18 +01:00
Damien Lespiau
52a78a7220 analysis: FALSE/0 used in pointer context
While this is totally fine (0 in the pointer context will be converted
in the right internal NULL representation, which could be a value with
some bits to 1), I believe it's clearer to use NULL in the pointer
context.

It seems that, in most case, it's more an overlook than a deliberate
choice to use FALSE/0 as NULL, eg. copying a _COGL_GET_CONTEXT (ctx, 0)
or a g_return_val_if_fail (cond, 0) from a function returning a
gboolean.
2010-06-01 12:08:18 +01:00
Robert Bragg
e2fc489f08 buffer: Remove use of CoglHandle in the CoglBuffer API
This replaces the use of CoglHandle with strongly type CoglBuffer *
pointers instead. The only function not converted for now is
cogl_is_buffer which will be done in a later commit.
2010-05-28 18:42:33 +01:00
Robert Bragg
a8c8cbee51 Start eradicating the CoglHandle typedef
CoglHandle is a common source of complaints and confusion because people
expect a "handle" to be some form of integer type with some indirection
to lookup the corresponding objects as opposed to a direct pointer.

This patch starts by renaming CoglHandle to CoglObject * and creating
corresponding cogl_object_ APIs to replace the cogl_handle ones.

The next step though is to remove all use of CoglHandle in the Cogl APIs
and replace with strongly typed pointer types such as CoglMaterial * or
CoglTexture * etc also all occurrences of COGL_INVALID_HANDLE can just
use NULL instead.

After this we will consider switching to GTypeInstance internally so we
can have inheritance for our types and hopefully improve how we handle
bindings.

Note all these changes will be done in a way that maintains the API and
ABI.
2010-05-28 18:39:22 +01:00
Neil Roberts
a4fc5074fa cogl-texture-2d: Regenerate the mipmaps when the texture is modified
When the texture is modified by cogl_texture_set_region, it wasn't
setting mipmaps_dirty so it would never update the mipmaps.
2010-05-28 18:13:53 +01:00
Robert Bragg
d0c743787d texture: don't use a static bool to gate warning
in create_pick_material we were using a static boolean to gate when we
show a warning, but that would mean if the problem recurs between
different textures then the warning will only be shown once. We now have
a private bitfield flag instead, just so we don't spew millions of
warnings if the problem is recurring.
2010-05-28 17:24:42 +01:00
Robert Bragg
589c8d9579 [texture] Support picking textures according to their alpha channel
This adds a boolean "pick-with-alpha" property to ClutterTexture and when
true, it will use the textures alpha channel to define the actors shape when
picking.

Users should be aware that it's a bit more expensive to pick textures like
this (so probably best not to blindly enable it on *all* your textures)
since it implies rasterizing the texture during picking whereas we would
otherwise just send a solid filled quad to the GPU.  It will also interrupt
the internal batching of geometry for pick renders which can otherwise often
be done in a single draw call.
2010-05-28 16:07:17 +01:00
Robert Bragg
8ded6663fb [material] fix _set_alpha_test_function: missing a glEnable(GL_ALPHA_TEST)
Since the default alpha test function of GL_ALWAYS is equivalent to
GL_ALPHA_TEST being disabled we don't need to worry about Enabling/Disabling
it when flushing material state, instead it's enough to leave it always
enabled.  We will assume that any driver worth its salt wont incur any
additional cost for glEnable (GL_ALPHA_TEST) + GL_ALWAYS vs
glDisable (GL_ALPHA_TEST).

This patch simply calls glEnable (GL_ALPHA_TEST) in cogl_create_context
2010-05-28 15:35:23 +01:00
Robert Bragg
3f64f57830 [texture] remove redundant if (paint_opacity == 0) bailout
clutter_texture_paint shouldn't need to optimize the case where
paint_opacity == 0 and bailout, since we've been doing this optimization for
all actors in clutter_actor_paint for a while now.
2010-05-28 15:35:23 +01:00
Neil Roberts
aa53dccfce cogl-vertex-buffer: Don't disable any texture coord arrays
The enabled state of the texture coord arrays is cached in the cogl
context so there is no need to disable them when we've finished
rendering a vbo.
2010-05-27 14:54:14 +01:00
Neil Roberts
401892af11 cogl: Record new enabled arrays in _cogl_disable_other_texcoord_arrays
When _cogl_disable_other_texcoord_arrays is called it disables the
neccessary texcoord arrays and then removes the bits for the disabled
arrays in ctx->texcoord_arrays_enabled. However none of the places
that call the function then set any bits in ctx->texcoord_arrays_enabled
so the arrays would never get marked and they would never get disabled
again.

This patch just changes it so that _cogl_disable_other_texcoord_arrays
also sets the corresponding bits in ctx->texcoord_arrays_enabled.
2010-05-27 14:51:44 +01:00
Emmanuele Bassi
b77c0c91d7 drag-action: Re-use press_button in emit_drag_end()
Since emit_drag_end() can be called from a MOTION event capture we
cannot call clutter_event_get_button(). We should, instead, use the
press_button value because if we're emitting ::drag-end it means we
also emitted ::drag-begin and the value is valid.
2010-05-27 12:30:22 +01:00
Emmanuele Bassi
346ebce573 actor: Add accessors pair for :clip-to-allocation
We should have an accessors pair for the :clip-to-allocation property,
to avoid going through the generic GObject accessors.
2010-05-26 16:09:47 +01:00
Emmanuele Bassi
5677cf671c actor: Fix a type check thinko in add_action_with_name() 2010-05-26 14:16:48 +01:00
Emmanuele Bassi
09659ea18d docs: Description fixes for Action and Constraint 2010-05-26 14:09:24 +01:00
Emmanuele Bassi
9510cbbad2 state: Minor fixes and documentation additions
Clean up the code a bit, and move common code paths into separate
function. Also, document clutter_state_set() with examples.
2010-05-26 13:43:42 +01:00
Emmanuele Bassi
7a299e9b47 introspection: Add --pkg atk
We need to tell the introspection scanner all the dependencies we
require, including the pkg-config name to use when compiling the
GIR file into a typelib object.
2010-05-26 13:40:18 +01:00
Emmanuele Bassi
e2bbf7f362 click-action: Handle the event
In case we did handle the event, we should return TRUE from the ::event
signal handler.
2010-05-25 13:27:29 +01:00
Emmanuele Bassi
cfb05bfb09 docs: Fix DragAction documentation
The ::drag-motion signal does not have a ModifierType argument; also,
there's no need to connect to the ::drag-motion signal any more.
2010-05-25 13:11:51 +01:00
Emmanuele Bassi
5a531bd1c9 Fix typo in get_accessible() 2010-05-25 13:03:24 +01:00
Emmanuele Bassi
7bf93e3e84 actor: Put get_accessible() at the end of the class structure
New virtual functions cannot go wherever they want, if we need to
preserve the ABI.

Also, the coding style should match the rest of ClutterActor and
Clutter's own coding style.
2010-05-25 12:54:59 +01:00
Emmanuele Bassi
7c627e1e03 actor-meta: Disconnect on actor destroy
When destroying an Actor the various ActorMeta instance should already
be disposed - unless something is holding a reference to them, in which
case we should use the ::destroy signal to unset the ActorMeta:actor
back pointer.
2010-05-25 11:13:03 +01:00
Emmanuele Bassi
f6fce05ee9 action: Add ClickAction
ClickAction adds "clickable" semantics to an actor. It provides all
the business logic to emit a high-level "clicked" signal from the
various low-level signals inside ClutterActor.
2010-05-25 11:13:03 +01:00
Emmanuele Bassi
728e2d8071 drag: Add a default drag-motion behaviour
The DragAction should, by default, drag the actor to which it has been
applied, instead of delegating what to do to the developer. If custom
code need to override it, g_signal_stop_emission_by_name() can be called
to stop the default handler to ever running.
2010-05-25 11:01:46 +01:00
Øyvind Kolås
49a4c62319 state: fix clutter_state_change (state, "state-name", FALSE)
Properties were not being updated correctly.
2010-05-24 16:29:04 +01:00
Neil Roberts
380e7b8b5d cogl: Use a CoglBitmask to store the list of used texcoord arrays
Instead of directly using a guint32 to store a bitmask for each used
texcoord array, it now stores them in a CoglBitmask. This removes the
limitation of 32 layers (although there are still other places in Cogl
that imply this restriction). To disable texcoord arrays code should
call _cogl_disable_other_texcoord_arrays which takes a bitmask of
texcoord arrays that should not be disabled. There are two extra
bitmasks stored in the CoglContext which are used temporarily for this
function to avoid allocating a new bitmask each time.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:57 +01:00
Neil Roberts
218efd0b62 cogl: Add an internal CoglBitmask type
This implements a growable array of bits called CoglBitmask. The
CoglBitmask is intended to be cheap if less than 32 bits are used. If
more bits are required it will allocate a GArray. The type is meant to
be allocated on the stack but because it can require additional
resources it also has a destroy function.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:56 +01:00
Neil Roberts
889dcee384 cogl-material: Fix the count of the number of layers
Previously the counter for the number of layers was only updated
whenever the texture handle for a layer changes. However there are
many other ways for a new layer to be created for example by setting a
layer combine constant. Also by default the texture on a layer is
COGL_INVALID_HANDLE so if the application tries to create an explicit
layer with no texture by calling cogl_material_set_layer with
COGL_INVALID_HANDLE then it also wouldn't update the count.

This patch fixes that by incrementing the count in
cogl_material_get_layer instead. This function is called by all
functions that may end up creating a layer so it seems like the most
appropriate place.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:56 +01:00
Neil Roberts
ae0354e9ba cogl-vertex-buffer: Don't disable layers with no texture coords
It should be quite acceptable to use a texture without defining any
texture coords. For example a shader may be in use that is doing
texture lookups without referencing the texture coordinates. Also it
should be possible to replace the vertex colors using a texture layer
without a texture but with a constant layer color.

enable_state_for_drawing_buffer no longer sets any disabled layers in
the overrides. Instead of counting the number of units with texture
coordinates it now keeps them in a mask. This means there can now be
gaps in the list of enabled texture coordinate arrays. To cope with
this, the Cogl context now also stores a mask to track the enabled
arrays. Instead of code manually iterating each enabled array to
disable them, there is now an internal function called
_cogl_disable_texcoord_arrays which disables a given mask.

I think this could also fix potential bugs when a vertex buffer has
gaps in the texture coordinate attributes that it provides. For
example if the vertex buffer only had texture coordinates for layer 2
then the disabling code would not disable the coordinates for layers 0
and 1 even though they are not used. This could cause a crash if the
previous data for those arrays is no longer valid.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:56 +01:00
Alejandro Piñeiro
a59bd4cfbb Implement AtkImplementor on ClutterActor
Implements AtkImplementor interface on ClutterActor, and his method
atk_implementor_ref_accessible.

More information:
http://library.gnome.org/devel/atk/stable/AtkObject.html#AtkImplementor
2010-05-24 15:54:54 +01:00
Alejandro Piñeiro
6a313ec2e2 Implemented clutter_actor_get_accessible
Added the implementation for clutter_actor_get_accessible, virtual
ClutterActor function, used to obtain the accessible object of
any ClutterActor.

As it is defined virtual, it would be possible to redefine it, so
any custom clutter actor could implement their accessibility object,
withouth relying totally on a accessibility implementation module.

See gtkiconview as example.

http://bugzilla.openedhand.com/show_bug.cgi?id=2070
2010-05-24 15:52:37 +01:00
Emmanuele Bassi
173e497ff4 state: Use Interval.compute() instead of compute_value()
Use the newly-added compute() variant to avoid creating a GValue only
for getting it copied by g_object_set_property().
2010-05-24 15:14:09 +01:00
Emmanuele Bassi
af84d97fca interval: Add a pointer variant to compute_value()
ClutterInterval.compute_value() computes the new value given a progress
and copies it to a given GValue. Since most of the time we want to pass
that very same value to another function that copies it again, we should
have a compute_value() variant that stores that computed value inside
ClutterInterval and returns a pointer to it. This way we initialize the
result GValue just once and we never copy it, as long as the Interval
instance is valid.
2010-05-24 15:06:14 +01:00
Emmanuele Bassi
489c16c6a6 docs: Align parameter names between header and source code 2010-05-24 14:20:23 +01:00
Emmanuele Bassi
382bd394b9 Merge branch 'wip/state-machine'
* wip/state-machine:
  Do not use wildcards in test-state
  script: Implement State deserialization
  state: added a "target-state" property
  state: documented data structures
  Add State interactive tests to the ignore file
  state: Documentation and introspection annotation fixes
  state: Minor coding style fixes
  state: Clean up the header's documentation
  state: Constify StateKey accessors
  Do not include clutter.h from a Clutter header file
  state-machine: made clutter_state_change take a boolean animate argument
  state-machine: use clutter_timeline_get_progress
  state-machine: add completed signal
  state machine: added state machine

Conflicts:
	.gitignore
2010-05-24 10:42:03 +01:00
Emmanuele Bassi
254e8d0fe5 Merge branch 'wip/framebuffer-bits'
* wip/framebuffer-bits:
  Implement accessors for the color bits in a framebuffer
2010-05-21 14:38:37 +01:00
Emmanuele Bassi
6ca425679e script: Implement State deserialization
It should be possible to describe ClutterState transitions using
ClutterScript in a similar way as ClutterAnimator.
2010-05-21 14:13:14 +01:00
Emmanuele Bassi
5e3dc55666 Merge branch 'wip/constraints'
* wip/constraints: (24 commits)
  Add the Cogl API reference to the fixxref extra directories
  Document the internal MetaGroup class
  Remove the construct-only flag from ActorMeta:name
  doc: Remove gtk-doc annotations from the json-glib copy
  doc: Fix parameter documentation
  Add named modifiers for Action and Constraint
  Remove a redundant animation
  Set the stage resizable in test-constraints
  Use a 9 grid for the constraints test
  Miscellaneous documentation fixes
  docs: Document animating action and constraint properties
  docs: Document BindConstraint and AlignConstraint
  constraint: Rename BindConstraint:bind-axis
  constraints: Add AlignConstraint
  tests: Add a constraints interactive test
  constraint: Add BindConstraint
  actor: Implement Animatable
  animation: Use the new Animatable API for custom properties
  animatable: Add custom properties to Animatable
  constraint: Add ClutterConstraint base class
  ...

Conflicts:
	configure.ac
2010-05-21 10:55:09 +01:00
Øyvind Kolås
d156550633 state: added a "target-state" property
When set the ClutterState transitions to the new state.
2010-05-21 10:37:42 +01:00
Øyvind Kolås
9c4467707f state: documented data structures 2010-05-21 10:34:13 +01:00
Emmanuele Bassi
ae3dc9bd5e state: Documentation and introspection annotation fixes 2010-05-20 18:59:22 +01:00
Emmanuele Bassi
c2abb827a3 state: Minor coding style fixes 2010-05-20 18:34:34 +01:00
Emmanuele Bassi
9fafc93c5d state: Clean up the header's documentation 2010-05-20 17:46:52 +01:00
Emmanuele Bassi
3f36b4a841 state: Constify StateKey accessors
Since the accessors do not modify the StateKey we should constify the
argument.
2010-05-20 17:34:36 +01:00
Emmanuele Bassi
5c74f990d6 Do not include clutter.h from a Clutter header file
Clutter header files should just include the needed headers.
2010-05-20 17:34:02 +01:00
Robert Bragg
bb2d088cb1 math: Adds an experimental cogl_vector3_* API
This adds a math utility API for handling 3 component, single precision
float vectors with the following; mostly self explanatory functions:

cogl_vector3_init
cogl_vector3_init_zero
cogl_vector3_equal
cogl_vector3_equal_with_epsilon
cogl_vector3_copy
cogl_vector3_free
cogl_vector3_invert
cogl_vector3_add
cogl_vector3_subtract
cogl_vector3_multiply_scalar
cogl_vector3_divide_scalar
cogl_vector3_normalize
cogl_vector3_magnitude
cogl_vector3_cross_product
cogl_vector3_dot_product
cogl_vector3_distance

Since the API is experimental you will need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h if you want to use
the API.
2010-05-20 17:18:24 +01:00
Øyvind Kolås
1dc8c0ff05 state-machine: made clutter_state_change take a boolean animate argument
Most of the time this will be TRUE, pass FALSE to change to the target
state immediately.
2010-05-20 16:24:29 +01:00
Øyvind Kolås
54bd541270 state-machine: use clutter_timeline_get_progress 2010-05-20 16:24:29 +01:00
Øyvind Kolås
8761b279a7 state-machine: add completed signal
Added a completed signal to the animator
2010-05-20 16:24:29 +01:00
Øyvind Kolås
fcdc3a8989 state machine: added state machine 2010-05-20 16:24:29 +01:00
Neil Roberts
5b2311aed7 cogl-texture-2d: Optimise _cogl_texture_2d_is_pot
This takes the simple algorithm from here:

http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2

This avoids a loop and is much faster.
2010-05-20 12:40:59 +01:00
Emmanuele Bassi
cc4729d42f Document the internal MetaGroup class
Just because it's an internal class, ClutterMetaGroup should not be left
undocumented.
2010-05-20 12:03:10 +01:00
Emmanuele Bassi
1b0be8e3b9 Remove the construct-only flag from ActorMeta:name
The ClutterActorMeta:name property should be read-write, and be
writeable at any time.
2010-05-20 12:02:13 +01:00
Emmanuele Bassi
c75a6b1a1d doc: Remove gtk-doc annotations from the json-glib copy
There's no need to use gtk-doc annotations: the API is internal to
Clutter.
2010-05-20 11:45:54 +01:00
Emmanuele Bassi
80a8568e0e doc: Fix parameter documentation 2010-05-20 11:45:25 +01:00
Emmanuele Bassi
7ce2693944 Add named modifiers for Action and Constraint
The ClutterActor API should have modifier methods for adding, removing
and retrieving Actions and Constraints using the ClutterActorMeta:name
property - mostly, for convenience.
2010-05-20 11:19:51 +01:00
Emmanuele Bassi
6457f66976 Miscellaneous documentation fixes 2010-05-19 16:10:05 +01:00
Robert Bragg
ee7ebe096e Stubs out _cogl_xlib_handle_event
This stubs out an xlib event handling mechanism for Cogl. The intention
is for Clutter to use this to forward all x11 events to Cogl. As we move
winsys functionality down into Cogl, Cogl will become responsible for
handling a number of X events: ConfigureNotify events for onscreen
framebuffers, swap events and Damage events for cogl_x11_texture_pixmap.
2010-05-19 15:28:04 +01:00
Emmanuele Bassi
52acc71161 docs: Document animating action and constraint properties
Add a refsect for the syntax to be used when animating action and
constraint properties with ClutterAnimation.
2010-05-19 15:09:47 +01:00
Robert Bragg
f2f2e9b7e6 build: expose automake conditionals for cogl winsys
Expose the ./configured window system/backend options to the Cogl
automake files via some new SUPPORT_XYZ conditionals.
2010-05-19 15:08:14 +01:00
Emmanuele Bassi
9f7e4b2b64 docs: Document BindConstraint and AlignConstraint
Add the missing gtk-doc annotations for BindConstraint and
AlignConstraint, plus the licensing blurb.
2010-05-19 14:46:02 +01:00
Emmanuele Bassi
e9b93d5676 constraint: Rename BindConstraint:bind-axis
We're not binding an axis: we're really binding a coordinate of an actor
to the coordinate of another one.
2010-05-19 14:34:18 +01:00
Emmanuele Bassi
f857457b9d constraints: Add AlignConstraint
AlignConstraint is a simple constraint that keeps an actor's position
aligned to the width or height of another actor, multiplied by an
alignment factor.
2010-05-19 13:02:43 +01:00
Emmanuele Bassi
769e964424 constraint: Add BindConstraint
The BindConstraint object is a constraint that binds the current
position of an actor on a given axis to the actor that has the
constraint applied.
2010-05-19 12:28:35 +01:00
Emmanuele Bassi
29257af30c actor: Implement Animatable
By implementing the newly added support for custom animatable
properties, we can allow addressing action and constraint properties
from ClutterAnimation and clutter_actor_animate().
2010-05-19 12:28:35 +01:00
Emmanuele Bassi
d9a05ac94b animation: Use the new Animatable API for custom properties
The Animation class should use the Animatable API for custom properties
to override finding a property definition, getting the initial state and
setting the final state of an object.
2010-05-19 12:28:35 +01:00
Emmanuele Bassi
3a1162cbcf animatable: Add custom properties to Animatable
Like ClutterScriptable, it would be good to have the Animatable
interface allow defining custom properties that can be animated.
2010-05-19 12:28:34 +01:00
Emmanuele Bassi
b842f0ad8e constraint: Add ClutterConstraint base class
The Constraint base, abstract class should be used to implement Actor
modifiers that affect the way an actor is sized or positioned inside a
fixed layout manager.
2010-05-19 12:28:30 +01:00
Brian Tarricone
b0cc98fdce eglx: implement cogl_get_proc_address()
http://bugzilla.openedhand.com/show_bug.cgi?id=2124
2010-05-18 17:30:31 +01:00
Neil Roberts
36903dfdcc eglx: Rename EGLNative{Window,Display}Type back to Native{Window,Display}Type
Commit e2a990d renamed these types to new names from EGL 1.3. However
it still works to use the old names under EGL 1.3 so let's just use
those to keep compatibility.
2010-05-18 17:25:25 +01:00
Neil Roberts
4b239e1fe8 clutter-backend-egl: Chain up in dispose before destroying the context
clutter_backend_egl_dispose now chains up before disposing its own
resources so that ClutterBackendX11 will destroy all of the stages
before we destroy the egl context. Otherwise the actors may try to
make GL calls during destruction which causes a crash.
2010-05-18 17:08:12 +01:00
Neil Roberts
6c3d1cfab9 clutter-stage-egl.c: Don't call eglWait*()
According to the docs, eglSwapBuffers performs an implicit glFlush
before swapping so there should be no need to wait.
2010-05-18 16:51:46 +01:00
Brian Tarricone
c4ae1a55fa fix case when EGL driver doesn't support EGL_NATIVE_VISUAL_ID
Some EGL drivers, such as the PowerVR simulator (and some proprietary drivers)
return zero when the EGLConfig is queried for the EGL_NATIVE_VISUAL_ID
attribute via eglGetConfigAttrib().

This patch detects and attempts to work around that situation by picking a
visual with the same color depth.

http://bugzilla.openedhand.com/show_bug.cgi?id=2123
2010-05-18 16:11:51 +01:00
Neil Roberts
26b061c3a8 clutter-backend-egl: Create a dummy X window and EGL surface
After the EGL context is created it now also creates an invisible 1x1
window and a corresponding surface so that the context can be
immediately made current. This is similar to changes for the GLX
backend introduced in d2c091e62.

http://bugzilla.openedhand.com/show_bug.cgi?id=2056
2010-05-18 15:05:36 +01:00
Brian Tarricone
e2a990dfd5 update backend to use lazy context/stage creation
http://bugzilla.openedhand.com/show_bug.cgi?id=2056
2010-05-18 15:05:33 +01:00
Øyvind Kolås
354d003860 animator: fix issue of dropped frames towards end of animations 2010-05-17 18:33:23 +01:00
Emmanuele Bassi
c007b7489b action: Warn if set_name() is called multiple times 2010-05-17 16:42:11 +01:00
Emmanuele Bassi
4fd74e71e6 action: Add DragAction, an action implementing drag capabilities
DragAction is an Action sub-class that provides dragging capabilities to
any actor. DragAction has:

  • drag-begin, drag-motion and drag-end signals, relaying the event
    information like coordinates, button and modifiers to user code;

  • drag-threshold property, for delaying the drag start by a given
    amount of pixels;

  • drag-handle property, to allow using other actors as the drag
    handle.

  • drag-axis property, to allow constraining the dragging to a specific
    axis.

An interactive test demonstrating the various features is also provided.
2010-05-17 16:42:11 +01:00
Emmanuele Bassi
0e0db0d624 action: Add ClutterAction
ClutterAction is an abstract class that should be used as the ancestor
for objects that change how an actor behaves when dealing with events
coming from user input.
2010-05-17 16:42:10 +01:00
Emmanuele Bassi
c075d26fb2 actor: Add ActorMeta, a base class for actor modifiers
ClutterActorMeta is a base, abstract class that can be used to derive
classes that are attached to a ClutterActor instance in order to modify
the way an actor is painted, sized/positioned or responds to events.

A typed container for ActorMeta instances is also provided to the
sub-classes can be attached to an Actor.
2010-05-17 16:42:10 +01:00
Neil Roberts
7caa10160d cogl-material: Set the blend equation even if blend funcs are the same
Previously it would only try to set the blend equation if the RGB and
alpha blending functions were different. However it's completely valid
to use a non-standard blending function when the functions are the
same. This patch moves the blending equation to outside the if
statement.
2010-05-17 16:31:28 +01:00
Neil Roberts
dd9e7853ec cogl-material: Set blend constant even if alpha and rgb factors are the same
Previously it would only set the blend constant if glBlendFuncSeparate
was used but it is perfectly acceptable to use the blend constant when
the same factor is used for each. It now sets the blend constant
whenever one of the factors would use the constant.
2010-05-17 16:31:28 +01:00
Neil Roberts
502446ed8d cogl-blend-string: Don't split combined blend statements into two
When a single statement is used to specify the factors for both the
RGB and alpha parts it previously split up the statement into
two. This works but it ends up unnecessarily using glBlendFuncSeparate
when glBlendFunc would suffice.

For example, the blend statement

 RGBA = ADD(SRC_COLOR*(SRC_COLOR), DST_COLOR*(1-SRC_COLOR))

would get split into the two statements

 RGBA = ADD(SRC_COLOR*(SRC_COLOR[RGB]), DST_COLOR*(1-SRC_COLOR[RGB]))
 A    = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))

That translates to:

 glBlendFuncSeparate (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
                      GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

This patch makes it so that arg_to_gl_blend_factor can handle the
combined RGBA mask instead. That way the single statement gets
translated to the equivalent call:

 glBlendFunc (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
2010-05-17 16:31:28 +01:00
Chris Lord
47d5493016 text: Fix typos that were causing false-positive cache hits
If a cached layout didn't actually match the layout we're looking for,
it would be returned anyway. Remove this return so that it can correctly
continue looking and get a cache miss if appropriate.

http://bugzilla.openedhand.com/show_bug.cgi?id=2109
2010-05-13 16:03:28 +01:00
Neil Roberts
acea83d7ae cogl-path: Use true copy-on-write semantics
Previously a path copy was implemented such that only the array of
path nodes was shared with the source and the rest of the data is
copied. This was so that the copy could avoid a deep copy if the
source path is appended to because the copy keeps track of its own
length. This optimisation is probably not worthwhile because it makes
the copies less cheap. Instead the CoglPath struct now just contains a
single pointer to a new CoglPathData struct which is separately
ref-counted. When the path is modified it will be copied if the ref
count on the data is not 1.
2010-05-11 16:10:39 +01:00
Owen W. Taylor
4ef041371c text: correct caching logic
This patch combines a number of fixes and improvements to the
layout caching logic in ClutterText.

 * Fix: The width must always be set on the PangoLayout when painting.
   This is necessary because the layout aligns in the width, and
   even when we think we are left-aligned, the auto-dir feature
   of PangoLayout may result in right-alignment.

 * Fix: We should only ever try to reuse a cached layout based
   on its logical width if layout.width was -1 when computing
   that logical width. If the layout was already ellipsized,
   then comparing the logical width to the new width we are
   trying to wrap to doesn't make sense. (If "abc" ellipsizes
   to a 15-pixel wide "..." for a width of 1 pixel, that doesn't
   mean that we should use "..." for a width of 15 pixels. Maybe
   "abc" itself is 15 pixels wide.)

 * Improvement: rather than looking up cached layouts based on the
   input allocation_width/allocation_height, look them up based
   on the actual width/height/ellipsize that we pass to create
   a layout. This is simpler and improves the chance we'll get
   a cache hit when appropriate even if there are small floating
   point differences.

Note because of the first fix this is less aggressive than dd40732
in caching layouts; get_preferred_width() and painting can't share
a layout since get_preferred_width() needs to pass a width of -1
to Pango and painting needs to pass the real width.

The patch has been updated from the clutter-1.2 branch to current
master; using the profiling instrumentation it is possible to verify
with test-text-field that the hit/miss counters go from:

   Name                                   Total Per Frame
   ----                                   ----- ---------
   Text layout cache hit counter          13    6
   Text layout cache miss counter         11    5

before applying the patch, to:

   Name                                   Total Per Frame
   ----                                   ----- ---------
   Text layout cache miss counter         4     2
   Text layout cache hit counter          3     1

after applying the patch.

https://bugzilla.gnome.org/show_bug.cgi?id=618104

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-05-11 12:22:30 +01:00
Neil Roberts
16680c74f3 Revert "clutter-cairo-texture: Use the new cogl_pixel_buffer API"
This reverts commit 716ec82db8.

The Cogl pixel buffer API currently has problems if an atlas texture
is created or the format needs to be converted. The atlas problem
doesn't currently show because the atlas rejects BGR textures anyway
but we may want to change this soon. The problem with format
conversion would happen under GLES because that does not support BGR
textures at all so Cogl has to do the conversion. However it doesn't
currently show either because GLES has no support for buffer objects
anyway.

It's also questionable whether the patch would give any performance
benefit because Cairo needs read/write access which implies the buffer
can't be put in write-optimised memory.

Conflicts:

	clutter/clutter-cairo-texture.c

http://bugzilla.openedhand.com/show_bug.cgi?id=1982
2010-05-10 16:17:32 +01:00
Owen W. Taylor
af37a1029f cogl-framebuffer: Flush journal when creating fbo
Since framebuffer state is not flushed prior to replaying the journal,
the trick of marking the framebuffer dirty prior to calling
glBindFramebuffer() doesn't work... the outstanding journal entries
will get replayed to the newly created framebuffer.

Fix this by flushing the journal as well.

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

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2010-05-10 14:38:10 +01:00
Emmanuele Bassi
4c850d39c5 Fix annotation typos 2010-05-09 00:14:24 +01:00
Neil Roberts
493041c505 clutter-cairo-texture: Fix destroying the old texture
In clutter_cairo_texture_create_region it tries to destroy the old
texture before mapping the PBO by setting the texture on the first
layer of the material to COGL_INVALID_HANDLE. However it was using the
material API incorrectly so it ended up showing a warning and doing
nothing.
2010-05-07 18:28:46 +01:00
Neil Roberts
0021b4aee0 cogl-clip-stack: Set *stencil_used_p when the stack is empty
If the clip stack is empty then _cogl_clip_stack_flush exits
immediately. This was missing out the assignment of *stencil_used_p at
the bottom of the function. If a path is then used after the clip is
cleared then it would think it needs to merge with the clip so the
stencil would not be cleared correctly.
2010-05-06 14:15:04 +01:00
Neil Roberts
f4ee7dc0e1 clutter-color: Don't directly read the contents of GValue structs
The code for implementing ClutterColor as GParamSpec and the
color↔string transformation functions were assuming that ClutterColor
owns the data in the GValue struct and directly reading
data[0].v_pointer to get a pointer to the color. However ClutterColor
is actually a boxed type and the format of the data array is meant to
be internal to GObject so it is not safe to poke around in it
directly. This patch changes it to use g_value_get_boxed to get the
pointer.

Also, boxed types allow a NULL value to be stored and not all of the
code was coping with this. This patch also attempts to fix that.

http://bugzilla.openedhand.com/show_bug.cgi?id=2068
2010-05-05 18:49:09 +01:00
Neil Roberts
fa1638c0ab clutter-color: Remove the value table
ClutterColor has long had a GTypeValueTable struct around and the
functions defined to be implemented as a fundamental type. However the
struct was never actually used anywhere and ClutterColor is actually
defined as a boxed type. This patch removes the table because it is
very confusing to have code lying around that is not used.

http://bugzilla.openedhand.com/show_bug.cgi?id=2068
2010-05-05 18:49:09 +01:00
Øyvind Kolås
452cb1abbf animator: fix looping when doing cubic interpolation
When using interpolation and the last key is not at 1.0 a bouncing
artifact could be observed after the keys.
2010-05-05 18:24:53 +01:00
Øyvind Kolås
e4089efb4c animator: only keys that are removed due to actors disappearing are inert 2010-05-05 18:24:53 +01:00
Øyvind Kolås
0f8ca38e59 animator: refactoring
renamed KeyAnimator to PropertyIter
2010-05-05 18:24:53 +01:00
Øyvind Kolås
8afb091f56 animator: retain ease-in/interpolation when changing first key
Duplicate the existing ease-in/interpolation mode for the property when
removing, replacing the first key for a property or adding a new first
key for a property.
2010-05-05 18:24:53 +01:00
Øyvind Kolås
d45395d78b animator: fix crash when setting keys on running animator
When inserting or modifying keys of a running animator the internal
iterators per property could go out of sync. Reinitializing the
iterators if the timeline is running avoids this.
2010-05-05 18:24:53 +01:00
Emmanuele Bassi
9ebd5fd935 Implement accessors for the color bits in a framebuffer
Instead of using cogl_get_bitmasks() to query the GL machinery for the
size of the color bits, we should store the values inside the
CoglFramebuffer object and query them the first time we set the framebuffer
as the current one.

Currently, cogl_get_bitmasks() is re-implemented in terms of
cogl_framebuffer_get_*_bits(). As soon as we are able to expose the
CoglOnscreen framebuffer object in the public API we'll be able to
deprecate cogl_get_bitmasks() altogether.

http://bugzilla.openedhand.com/show_bug.cgi?id=2094
2010-05-05 12:25:16 +01:00
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