A GValue containing a ClutterUnit should be transformable into a
GValue holding an integer, a floating point value or a fixed point
value.
This means adding more transformation functions when registering
the ClutterUnit GType.
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.
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.
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.
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.
ClutterUnits should not be used interchangeably as, or with
ClutterFixed values. ClutterUnits should also not be assumed
to be integers.
This commit fixes the last few improper usages of ClutterUnit
values, and adds a CLUTTER_UNITS_FORMAT macro for safely printing
ClutterUnit values with printf().
Bug 1209 - Move fixed point API in COGL
* clutter/cogl/cogl-fixed.h:
* clutter/cogl/cogl.h.in:
* clutter/cogl/common/Makefile.am:
* clutter/cogl/common/cogl-fixed.c: Add fixed point API, modelled
after the ClutterFixed. The CoglFixed API supercedes the ClutterFixed
one and avoids the dependency of COGL on Clutter's own API.
* clutter/cogl/common/cogl-clip-stack.c:
* clutter/cogl/common/cogl-primitives.c:
* clutter/cogl/common/cogl-primitives.h: Update internal usage of
ClutterFixed to CoglFixed.
* clutter/cogl/gl/Makefile.am:
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gl/cogl-texture.c:
* clutter/cogl/gl/cogl.c: Ditto, in the GL implementation of the
COGL API.
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-fbo.c:
* clutter/cogl/gles/cogl-gles2-wrapper.c:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gles/cogl.c: Ditto, in the GLES implementation of
the COGL API.
* clutter/pango/pangoclutter-glyph-cache.c:
* clutter/pango/pangoclutter-glyph-cache.h: Ditto, in the Pango
renderer glyphs cache.
* clutter/clutter-fixed.c:
* clutter/clutter-fixed.h: ClutterFixed and related API becomes
a simple transition API for bindings and public Clutter API.
* clutter/clutter-actor.c:
* clutter/clutter-alpha.c:
* clutter/clutter-backend.c:
* clutter/clutter-behaviour-depth.c:
* clutter/clutter-behaviour-ellipse.c:
* clutter/clutter-behaviour-path.c:
* clutter/clutter-behaviour-rotate.c:
* clutter/clutter-behaviour-scale.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-color.c:
* clutter/clutter-entry.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c:
* clutter/clutter-timeline.c:
* clutter/clutter-units.h: Move from the internal usage of
ClutterFixed to CoglFixed.
* doc/reference/clutter/clutter-sections.txt:
* doc/reference/cogl/cogl-docs.sgml:
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
* tests/test-cogl-tex-tile.c:
* tests/test-project.c: Fix tests after the API change
* README: Add release notes.
* clutter/clutter-fixed.h:
* clutter/clutter-units.h: Fix the upper and lower boundaries of
ClutterFixed and ClutterUnit types; G_MAXINT16 and G_MININT16
were not enough to describe those values.
* clutter/clutter-units.h:
* clutter/clutter-fixed.h: Add boundaries for fixed point
and units values.
* doc/reference/clutter-sections.txt: Update the documentation.
* clutter/Makefile.am: Add clutter-units.c
* clutter/clutter-units.[ch]: Add a ClutterUnit fundamental
type, and wrappers for storing it into GValues; also add a
GParamSpec subclass for defining parameters holding ClutterUnit
values. This allows creating GObject properties using units.
* doc/reference/clutter-sections.txt: Document the newly
added API.
* clutter/clutter-actor.c (parse_units),
(clutter_actor_parse_custom_node),
(clutter_scriptable_iface_init): Override the parsing code
for the x, y, width and height properties of ClutterActor,
to allow strings with modifiers when defining the position
and/or the dimensions of an actor. Bare integers are assumed
as pixels; floating point values in the [0, 1] interval are
assumed as percentages; strings can have these modifiers:
- px - pixels
- mm - millimeters
- pt - points (at the current resolution)
- % - percentage of the stage
* clutter/clutter-units.h: Fix the conversion macros
* tests/test-script.json: Test the new values.
* clutter/clutter-label.[ch]: Fix ClutterLabel size allocation when
no bounding box has been provided, and store the box set by the
user so that it can be reused when recomputing the layout. (#600)
(clutter_label_class_init),
(clutter_label_init): Set the :wrap property default to FALSE.
* clutter/clutter-units.h: Add ClutterUnit-to-PangoUnit conversion
macro.
* tests/test-rotate.c: Fix string.