Commit Graph

3147 Commits

Author SHA1 Message Date
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