Commit Graph

1993 Commits

Author SHA1 Message Date
Emmanuele Bassi
e7d533f176 Improve accuracy of clutter_sinx()
Improve clutter_sinx() by replacing the low precision CFX_SIN_STEP
with a multiply/divide pair. This reduces the maximum error from
1.8e-04 to 2.4e-05.

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

Based on a patch by Owen W. Taylor <otaylor@fishsoup.net>
2009-01-22 15:59:23 +00:00
Emmanuele Bassi
a1e493fadb Use the allocation to get the pick area
Since a pick is really a paint operation, we can safely get
the allocation box, instead of using get_width() and get_height().

This should help cutting down the function calls. If we were
feeling adventurous, we could even use the allocation directly
from the private data structure.

Based on a patch by Gwenole Beauchesne <gbeauchesne@splitted-desktop.org>
2009-01-22 15:55:43 +00:00
Emmanuele Bassi
e1ab6f972e [gles] Fix computation of camera distance
Port the fix in commit f409b58e to the GLES implementation of
COGL.
2009-01-22 14:52:34 +00:00
Owen W. Taylor
f409b58e89 Fix computation of camera distance
Compute the value of the camera distance as exactly half the xx
component of the projection matrix. The heuristically derived
value for 60 degrees was off by about 0.016%, causing noticeable
blurring, and other field of view angles which didn't have the
heuristic adjustment off by much more.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-22 14:17:16 +00:00
Emmanuele Bassi
a74369e309 Avoid needlessly queue redraws for invisible actors
If an actor is not set as visible, or if it is in a section of
the scenegraph that it's set as not visible (e.g. one of the
parents is not visible) then we should not queue a redraw for
it.

Patch based on code from Michael Boccara <michael@graphtech.co.il>
2009-01-22 13:58:50 +00:00
Jason Tackaberry
c998462c9f Bug 1409 - Use G_SIGNAL_RUN_LAST with ::queue-redraw signal
The intention behind ::queue-redraw is to be able to block the
default handler by attaching a callback and calling one of the
g_signal_stop_emission variants.

However this doesn't work, because ::queue-redraw has the
G_SIGNAL_RUN_FIRST flag instead of G_SIGNAL_RUN_LAST.
2009-01-22 13:38:32 +00:00
Emmanuele Bassi
01a5cb8430 Fix typo in the flags update
Epic en_GB keyboard FAIL.
2009-01-22 13:24:20 +00:00
Emmanuele Bassi
6ca40faaec [units] Fix Units in GValue and ClutterParamSpecUnit
The GValue and GParamSpec integration of ClutterUnit was still
using the old, fixed-point based logic.

Storing ClutterUnits in a GValue should use floating point values,
and ClutterParamSpecUnit should follow suit.
2009-01-22 12:11:25 +00:00
Emmanuele Bassi
1876785d12 Fix the format for a floating point value
The debug annotation was still expecting an integer after
we switched the angle to float.
2009-01-22 11:46:23 +00:00
Emmanuele Bassi
355555c1bf Store the units-per-em inside the Backend
Instead of recomputing the number of units needed to fit in
an em each time clutter_units_em() is called, we can store this
value into the default Backend along with the resolution and
font name. The value should also be updated each time the
resolution and font are changed, to keep it up to date.
2009-01-22 11:42:11 +00:00
Emmanuele Bassi
c5aca39c69 [docs] Specify the coordinate space of ButtonEvent
The coordinates of each ButtonEvent are relative to the stage that
received the event, so we should document this in the structure
annotation.

It should also be mentioned that the coordinates can be transformed
into actor-relative coordinates by using transform_stage_point().
2009-01-21 22:03:31 +00:00
Emmanuele Bassi
ee883f30d4 Add units-from-em conversion
An em is a unit of measurement in typography, equal to the point
size of the current font.

It should be possible to convert a value expressed in em to
ClutterUnits by using the current font and the current DPI as
stored by the default backend.
2009-01-21 17:35:47 +00:00
Emmanuele Bassi
93a0454c09 Remove the single-stage units converters
The stage-with/height-percentage converters had been broken by
the multiple-stages support of Clutter 0.8. They are also made
useless by the fact that Units are now floating point values.

The millimeters and typographic points converters also depended
on the default stage, but they can be reworked to use the default
DPI coming from the default Backend instead.
2009-01-21 17:10:36 +00:00
Emmanuele Bassi
0be613109e [docs] Remove sources of warnings in API references 2009-01-21 16:41:18 +00:00
Emmanuele Bassi
74d00185fd [docs] Add CoglTextureFlags to the API reference 2009-01-21 10:59:19 +00:00
Emmanuele Bassi
2cb3a41dff [docs] Build COGL API reference first
Since the Clutter API reference needs some types from COGL's,
we should be building COGL's API reference first.
2009-01-21 10:58:32 +00:00
Emmanuele Bassi
07689865fe [tests] Update the tests calling cogl_texture_new_*
The tests calling any of the cogl_texture_new_* family of functions
must be updated to the new constructor syntax.
2009-01-21 10:14:29 +00:00
Emmanuele Bassi
c9739e6aef Change the COGL texture constructor to use flags
Boolean arguments for functions are pretty evil and usually
lead to combinatorial explosion of parameters in case multiple
settings are added.

In the case of the COGL texture constructors we have a boolean
argument for enabling the auto-mipmapping; it is conceivable that
we might want to add more settings for a COGL texture without
breaking API or ABI compatibility, so the boolean argument should
become a bitmask.

The internals have not been changed: instead of checking for
a non-zero value, we check for a bitmask being set.
2009-01-21 10:14:29 +00:00
Emmanuele Bassi
8736db6aed [docs] Update ClutterMedia section
The ClutterMedia API has been changed, so we need to update
the API reference to reflect that.
2009-01-20 23:40:25 +00:00
Emmanuele Bassi
5a4f9c5050 Bug 1404 - ClutterMedia issues
ClutterMedia was a rough cut at a simple media API; it needs some
re-evaluation before 1.0 in order to keep it simple to use, and
simple to implement.

- ClutterMedia:position

  The position property accessors collide with the corresponding
  ClutterActor methods, which make it impossible to bind them in
  high-level languages:

    video_texture.set_position()
    video_texture.get_position()

  In order to resolve the collision, we have to go through the
  GObject properties API:

    video_texture.set('position', value)
    value = video_texture.get('position')

  A :position in seconds is also a GStreamer-ism, and should rather
  be converted to a :progress property, with a normalized value
  between 0 and 1. the current position in seconds would then simply
  be progress*duration. For non-seekable streams, 0.0 would always
  be returned. This makes it easier to use the progress inside
  animations, Timelines or ClutterPath instances.

- ClutterMedia:volume should be renamed to :audio-volume and normalized
  as well, instead of being a floating point value between 0 and 100.

- ClutterMedia:buffer-percent should just be :buffer-fill and normalized
  between 0.0 and 1.0
2009-01-20 23:40:25 +00:00
Robert Bragg
e338245827 Renames the mesh api to the "vertex buffer api".
This better reflects the fact that the api manages sets of vertex attributes,
and the attributes really have no implied form. It is only when you use the
attributes to draw that they become mesh like; when you specify how they should
be interpreted, e.g. as triangle lists or fans etc. This rename frees up the
term "mesh", which can later be applied to a concept slightly more fitting.
E.g. at some point it would be nice to have a higher level abstraction that
sits on top of cogl vertex buffers that adds the concept of faces. (Somthing
like Blender's mesh objects.) There have also been some discussions over
particle engines, and these can be defined in terms of emitter faces; so some
other kind of mesh abstraction might be usefull here.
2009-01-20 22:29:35 +00:00
Robert Bragg
4bc1e567fc Removes the fixed-to-float scripts and patches
Now that the conversion has been applied the scripts aren't needed any more
2009-01-20 18:52:15 +00:00
Robert Bragg
3014d4ff8a Merge branch 'cogl-float'
Okey; to summarise the changes...

We have converted Clutter and Cogl over to using floating point internally
instead of 16.16 fixed, but we have maintained the cogl-fixed API as a
utility to applications in case they want to implement their own optimizations.

The Clutter API has not changed (though ClutterFixed and ClutterUnit are now
internally floats) but all Cogl entry points have been changed to accept floats
now instead of CoglFixed.

To summarise the rationale...

There have been a number of issues with using fixed point though out Clutter
and Cogl including: lack of precision, lack of range, excessive format
conversion (GPUs tend to work nativly with IEEE floats) and maintainability.
One of the main arguments for fixed point - performance - hasn't shown
itself to be serious in practice so far since we seem to be more limited
by GPU performance and making improvements regarding how we submit data to
OpenGL[ES]/the GPU has had a more significant impact.

Ref: The recent multiple rectangle queuing changes + the
cogl-texture-agressive-batching branch which show significant performance
gains, and that recent tests on the ipodtouch (ARM + MBX) also showed no
loss of performance running with floats.

So finally; please forgive the inevitable fallout, this is a far reaching
change. There are still a few known issues with the fixed to float
conversion but enough works for all our conformance tests to pass, and the
remaining issues hopefully wont be too tricky to solve. For reference two
tags will be available either side of this change: "cogl-fixed-end" and
"cogl-float-start"
2009-01-20 18:47:50 +00:00
Robert Bragg
c29a3b4dee [Automatic fixed-to-float.sh change] Hand coded changes for clutter-{fixed,units}
To avoid clashing with all the scripted changes, clutter-fixed.h and
clutter-units.h were manually converted to internally use floats instead of
16.16 fixed numbers.

Note: again no API changes were made in Clutter.
2009-01-20 16:20:55 +00:00
Robert Bragg
a2cf7e4a19 [Automatic fixed-to-float.sh change] Applies a number fixed to float patches
To deal with all the corner cases that couldn't be scripted a number of patches
were written for the remaining 10% of the effort.

Note: again no API changes were made in Clutter, only in Cogl.
2009-01-20 16:20:54 +00:00
Robert Bragg
e82f656590 [Automatic fixed-to-float.sh change] Applies all scripted changes
This is the result of running a number of sed and perl scripts over the code to
do 90% of the work in converting from 16.16 fixed to single precision floating
point.

Note: A pristine cogl-fixed.c has been maintained as a standalone utility API
      so that applications may still take advantage of fixed point if they
      desire for certain optimisations where lower precision may be acceptable.

Note: no API changes were made in Clutter, only in Cogl.

Overview of changes:
- Within clutter/* all usage of the COGL_FIXED_ macros have been changed to use
the CLUTTER_FIXED_ macros.

- Within cogl/* all usage of the COGL_FIXED_ macros have been completly stripped
and expanded into code that works with single precision floats instead.

- Uses of cogl_fixed_* have been replaced with single precision math.h
alternatives.

- Uses of COGL_ANGLE_* and cogl_angle_* have been replaced so we use a float for
angles and math.h replacements.
2009-01-20 16:20:54 +00:00
Robert Bragg
abc2a359ea Improves the git commit messages used by fixed-to-float.sh
In preperation for commiting a final conversion into master
2009-01-20 16:18:31 +00:00
Owen W. Taylor
6d4cd416ec Change default tile-waste from 64 to 63
It's more sensible to use 2^n-1 for a max tile-waste value rather
than 2^n, so change the value default from 64 to 63. Example:
191 and 192 will both be sliced to 128+64 rather than having
191=>128+64, 192=>256.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-16 23:45:36 +00:00
Owen W. Taylor
b716d32000 Fix properties that have X11 types to be 'long'
While X11 Pixmap and Window types only have 32-bits of data, they
are actually 'unsigned long'. Change the "window" and "pixmap"
property of ClutterX11TexturePixmaps to be ulong.

This fixes 64-bit bugs where ClutterGLXTexturePixmap passed a
reference to Pixmap to g_object_get("pixmap", &pixmap, ...);

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-16 23:44:32 +00:00
Emmanuele Bassi
10f1f6587e [eglnative] Set the SYNC_MATRICES on stage realization
Since the stage in the EGL native backend only has one size, and it
is determined at realization, we can simply set the SYNC_MATRICES
private flag and let _clutter_stage_maybe_setup_viewport() set up
the GL viewport at the first redraw.
2009-01-16 22:13:44 +00:00
Neil Roberts
ae3615cfe3 [fixed-to-float.sh] Apply the automatic changes to the tests as well
Some of the tests are using the Cogl API so they should be updated to
float as well.

The patches have been updated to apply cleanly.
2009-01-16 18:32:03 +00:00
Neil Roberts
7a96ea9255 [fixed-to-float.sh] Group some of the sed expressions into one command
This has no effect other than to make the script run faster.
2009-01-16 17:59:54 +00:00
Neil Roberts
e02024151b [fixed-to-float-patches] Replace the cogl_color_*x functions with *f
cogl_set_source_color4x and cogl_color_set_from_4x actually take float
values now so they are renamed to *4f.
2009-01-16 14:59:59 +00:00
Emmanuele Bassi
7c93565902 [docs] Clarify what API registers a global alpha function
Both clutter_alpha_new_with_func() and clutter_alpha_set_func()
will not register a global alpha function, so we need to update
the documentation to explicitly say so.
2009-01-16 14:53:42 +00:00
Neil Roberts
7b93cc068d [fixed-to-float-patches] Merge the two patches to remove cogl fixed params
The two patches for removing cogl apis taking fixed params have been
merged into one patch.
2009-01-16 14:38:24 +00:00
Emmanuele Bassi
c096f41e70 [doc] Clarify the animation mode meaning
The animation mode parameters and properties are now slightly
anonymous unsigned longs, so we need to clarify in the documentation
that the user should either pass a ClutterAnimationMode value or
the result of registering an alpha function.
2009-01-16 14:37:42 +00:00
Emmanuele Bassi
d02819949d Remove AnimationMode from the Animation API
The animation mode symbolic id might come from the AnimationMode
enumeration or from the clutter_alpha_register_*() family of
functions. For this reason, we should use a gulong instead of
ClutterAnimationMode whenever we have an "animation mode" parameter
or property.
2009-01-16 14:37:42 +00:00
Emmanuele Bassi
74213e0ee3 [alpha] Allow registering alpha functions
In order to unify alpha functions and animation modes in ClutterAlpha
we should be able to register alpha functions and get a logical id
for them; the logical id will then be available to be used by
clutter_alpha_set_mode().

The registration requires API changes in ClutterAlpha constructors
and methods. It also provides the chance to shift ClutterAlpha
towards the use of animations modes only, and to alpha functions
as a convenience API for language bindings alone.
2009-01-16 14:37:35 +00:00
Neil Roberts
18378fe180 [fixed-to-float.sh] Use float names for the GLES2 wrappers
For example cogl_wrap_glFrustumx -> cogl_wrap_glFrustumf.

The wrappers get #defined to the float versions anyway but it helps
avoid some confusion.

The conversion is done using a regular expression in the upgrade
script. Some of the patches had to be updated to apply cleanly.
2009-01-16 13:07:02 +00:00
Neil Roberts
52d7b7be73 [fixed-to-float-patches] Move the changes to gles2-wrapper.h into the patch
It looks like the changes to cogl-gles2-wrapper.h were accidentally
committed to the actual file instead of the patch in commit
de27da0e. This commit moves the changes back into the patch so
cogl-gles2-wrapper.h is reverted back to master.
2009-01-16 10:50:53 +00:00
Neil Roberts
bef099ce40 [fixed-to-float-patches] Fix use of glClearColor and glColor under GLES 2
The wrapper for glClearColor was taking fixed arguments but was given
floating point values so it ended up always setting the clear color to
black. Now that GLES 1.1 is using the floating point version, there is
no need for the wrapper so both versions now just use glClearColor
directly.

A similar problem was happening for glColor but this does still need a
wrapper because it needs to set the vertex attribute.
2009-01-15 19:00:55 +00:00
Neil Roberts
4e94500a2a Merge branch 'master' into cogl-float
The patches have been updated to apply cleanly.

The patches for the g_warnings in clutter-actor.c have been removed
because master now uses CLUTTER_UNITS_FORMAT so they aren't
necessary. The clutter-units.h patch now sets CLUTTER_UNITS_FORMAT to
'f'.
2009-01-15 18:26:22 +00:00
Neil Roberts
9339334a43 Fix GLES backends after merging the async-textures branch
The changes from the GL version of cogl-texture.c have been mirrored
in the GLES version. This adds the cogl_texture_new_from_bitmap
function and fixes the build errors.
2009-01-15 18:09:54 +00:00
Neil Roberts
d89ed3ed25 [fixed-to-float.sh] Remove the mtx_transform patch from the script
The patch got deleted and merged into the clutter-actor.c patch in
commit 012b16 so it was just causing unnecessary errors.
2009-01-15 16:35:46 +00:00
Neil Roberts
ea1d9f5522 [fixed-to-float-patches] Fix some of the matrix getters and setters
The GL versions of get_modelview_matrix, get_projection_matrix and
get_viewport were using glGetDoublev and then converting them to
floats, but it might as well just call glGetFloatv directly.

The GL ES versions were using glGetFixedv but this was being replaced
with glGetFloatv by the #define in the GLES 2 wrappers.

The patch also replaces the glGetFixedv wrapper with
glGetFloatv. Previously this was calling
cogl_gles2_float_array_to_fixed which actually converted to
float. That function has been removed and memcpy is used instead.
2009-01-15 15:25:05 +00:00
Robert Bragg
642617b7a0 [test-text] queue redraws instead of calling clutter_actor_paint directly
Directly calling clutter_actor_paint skips out quite a bit code such as the
backend swap buffer call.

Since we are interested in the highest fps possible, and it now goes through
to the backend swap buffer call we now do a setenv (CLUTTER_VBLANK, none, 0)
before calling clutter_init.
2009-01-15 14:25:22 +00:00
Emmanuele Bassi
22183c7a8f Bug 1380 - Return booleans from CLUTTER_ACTOR_IS_* macros
If you try to use the CLUTTER_ACTOR_IS_* macros defined in ClutterActor
like this:

  typedef struct { unsigned int reactive : 1; } foo_t;

  foo_t f; f.reactive = CLUTTER_ACTOR_IS_REACTIVE (actor);

It will blow up because while the macros evaluate to 0 they can also
evaluate to non-zero values. Since most of the boolean flags in
Clutter and Clutter-based code are going to be stored like in the
example above, we should change the macros and let them evaluate
stricly either to 0 or to 1.
2009-01-14 18:18:20 +00:00
Emmanuele Bassi
41386a5f72 Remove the Effects API
The Effects API and all related symbols have been superceded by
the newly added Animation API and clutter_actor_animate().

This commit removes the Effects implementation, the documentation
and the interactive test/example code.
2009-01-14 16:56:21 +00:00
Emmanuele Bassi
5d346cca57 Emit ::load-finished for every texture load
The ::load-finished signal is emitted only when loading a texture
using clutter_texture_set_from_file(). Since this breaks user
expectations and consistency, we should also emit ::load-finished
when loading a texture from image data.
2009-01-14 15:38:04 +00:00
Robert Bragg
3e9e5a11da [test-depth] cast width to gint when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
2009-01-14 15:25:27 +00:00