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.
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.
Continuation of the fix in commit 00a3c69868.
Instead of using a separate flag for the resize process, just
delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the
stage to the point when we receive a ConfigureNotify event from
X11.
This commit will break the stage embedding into other toolkits.
When calling clutter_backend_get_font_name(), if no default font
name has previously been set, we just set the default and return
a pointer to it - like we do for the font options.
The default backend stores some of the global defaults, like the
font options, text resolution, double click settings. It should also
store the default font name, to allow various text-based actors to
share the same settings.
When the font name changes, the ::font-changed signal is emitted,
to allow actors to pick up the change.
The ClutterBackend instance at the moment lacks the ability to
notify runtime changes of the font options and the resolution.
For this reason, this commit adds a ::resolution-changed and a
::font-changed signals to the Backend class.
The ::resolution-changed signal is emitted when set_resolution()
is called with a different DPI; ::font-changed is emitted when the
cairo_font_options_t* changes from the default.
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-actor.c:
(clutter_actor_set_min_width),
(clutter_actor_set_min_height),
(clutter_actor_set_natural_width),
(clutter_actor_set_natural_height): Ignore any override of the
minimum and natural size of the stage on backends that only
support static stages.
* clutter/clutter-stage.c (clutter_stage_allocate): Use the
preferred size of the ClutterStage implementation instead of
the display size.
* clutter/clutter-backend.[ch]: Remove get_display_size() and
clutter_backend_get_display_size().
* clutter/eglnative/clutter-backend-egl.c:
* clutter/fruity/clutter-backend-fruity.c:
* clutter/osx/clutter-backend-osx.c:
* clutter/sdl/clutter-backend-sdl.c:
* clutter/win32/clutter-backend-win32.c:
* clutter/x11/clutter-backend-x11.c: Remove get_display_size()
implementations.
* clutter/clutter-backend.c:
(clutter_backend_get_display_size): Provide a fallback for
backends not implementing get_display_size().
* clutter/clutter-stage.c:
(clutter_stage_allocate): Add debug messages.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_get_display_size),
(clutter_backend_sdl_class_init): Implement get_display_size()
on the SDL backend.
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_get_display_size): Add a function for getting the
display size out of the backend.
* clutter/clutter-stage.c:
(clutter_stage_allocate): When allocating on a backend with a
static stage, we simply ignore the passed box and override it with
the size of the display.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_get_display_size),
(clutter_backend_egl_class_init): Implement get_display_size() by
returning the size of the EGL surface.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_egl_get_display_size),
(clutter_backend_egl_class_init): Ditto as above.
* clutter/x11/clutter-backend-x11.c:
(clutter_backend_x11_get_display_size),
(clutter_backend_x11_class_init): Implement get_display_size() by
returning the DisplayWidth and DisplayHeight of the current
screen.
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
* clutter/clutter-backend.c:
(_clutter_backend_create_stage): Call _clutter_stage_set_window()
ourselves, thus removing yet another action that backends must
implement and might get wrong; also cuts a backend-agnostic piece
of code duplication.
* clutter/eglnative/clutter-backend-egl.c:
(clutter_backend_egl_create_stage): Update the EGL native backend.
* clutter/eglx/clutter-backend-egl.c:
(clutter_backend_egl_create_stage): Update the EGLX backend.
* clutter/fruity/clutter-backend-fruity.c:
(clutter_backend_egl_create_stage): Update the fruity backend
* clutter/glx/clutter-backend-glx.c:
(clutter_backend_glx_create_stage): Update the GLX backend.
* clutter/sdl/clutter-backend-sdl.c:
(clutter_backend_sdl_create_stage): Update the SDL backend.
* HACKING.backends: Update the ::create_stage() description.
* clutter/clutter-backend.c: Add more debug messages
* clutter/clutter-stage.h:
* clutter/clutter-stage.c:
(clutter_stage_is_default): Add a function to check if the
stage is the default one.
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-stage-glx.c:
* clutter/x11/clutter-stage-x11.c: Keep the stage wrapper
and implementation flags in sync, to ensure that the GL
context is always set.
Bug #864 - Allow instantiating and subclassing of ClutterStage
* clutter/Makefile.am: Add clutter-stage-window.[ch]
* clutter/clutter-stage-manager.c:
(_clutter_stage_manager_remove_stage): Do not warn if removing
a stage we don't manage, as we might be invoked multiple times
during a ClutterState dispose sequence.
* clutter/clutter-actor.c:
* clutter/clutter-backend.[ch]:
* clutter/clutter-main.c:
* clutter/clutter-private.h:
* clutter/clutter-stage.[ch]: Make ClutterStage a proxy actor,
with a private actor implementing the ClutterStageWindow
interface for handling the per-backend realization, painting
and unrealization, plus all the windowing system abstraction.
* clutter/x11/clutter-event-x11.c:
* clutter/x11/clutter-stage-x11.[ch]: Port the X11 backend
to the new backend and stage API and semantics.
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-stage-glx.c: Port the GLX backend to
the new backend and stage API and semantics.
* clutter/eglx/clutter-backend-egl.[ch]:
* clutter/eglx/clutter-stage-egl.[ch]: Port the EGLX backend
to the new backend and stage API and semantics (untested).
* tests/test-multistage.c (on_button_press): Rename
clutter_stage_create_new() to clutter_stage_new().
* clutter/clutter-backend.c:
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-stage-glx.c:
Allow NULL to be passed to _clutter_backend_ensure_context
which essentially clears GL context. This is hooked into stage
unrealisation. Isn't yet quite bulletproof.
Fixes issues with gtk-embed crasher (thanks to Neil).
* clutter/clutter-backend.[ch]: Add clutter_backend_set_resolution()
and clutter_backend_get_resolution(); backends should use the former
to set the resolution of the display when initialising, while actors
should use the latter when sizing themselves depending on the
resolution or the font size.
* clutter/glx/clutter-backend-glx.c: Set the resolution as 96 dpi
as a default and query the X server when opening the display.
* clutter/clutter-entry.c: Drop the hardcoded dpi value and use
clutter_backend_get_resolution() to compute the default size.
* clutter/clutter-backend.c:
* clutter/clutter-backend.h:
* clutter/glx/clutter-stage-glx.c:
* clutter/glx/clutter-backend-glx.c:
Fix up rendering pipeline removing clutter_backend_XXX_stage_paint
and adding clutter_backend_XXX_redraw instead. Duplicates less
code in backends, avoids clutter_actor_paint() getting called
before stage is set up (viewport wise) and unbreaks things like
picking.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* clutter/clutter-main.c:
* clutter/clutter-private.h:
* clutter/clutter-stage.c: (clutter_stage_get_actor_at_pos):
Redo picking functionality a different way (via color indexing)
as to provide more flexibility, possibly speed and more likely
work with GL/ES (doesn't currently however - not sure why).
* clutter/clutter-group.c:
Add groups own 'pick' method.
* clutter/cogl/cogl.h:
* clutter/cogl/gl/cogl.c:
* clutter/cogl/gles/cogl.c:
Move clipping funtionality into cogl.
* clutter/cogl/gles/cogl-defines.h:
Hack around missing BGR format in GL/ES.
* clutter/egl/clutter-backend-egl.c:
* clutter/egl/clutter-backend-egl.h:
* clutter/egl/clutter-stage-egl.c:
* clutter/sdl/clutter-backend-sdl.c:
* clutter/sdl/clutter-backend-sdl.h:
* clutter/sdl/clutter-event-sdl.c:
* clutter/sdl/clutter-stage-sdl.c:
Update backends to newer API.
Add basic mouse event translation to SDL.
* clutter/clutter-backend.c:
* clutter/clutter-backend.h:
* clutter/clutter-event.c:
* clutter/clutter-main.c:
* clutter/clutter-private.h:
* clutter/glx/clutter-backend-glx.c:
* clutter/glx/clutter-backend-glx.h:
* clutter/glx/clutter-event-glx.c:
Rejig backend event code as to simplify a little.
NOTE: This breaks non glx backends.
* tests/Makefile.am:
* tests/test-events.c:
Add a very simple event test.
* tests/test-textures.c: (main):
Add some more sizes to the test.
Add clutter_backend_get_n_screens(), which returns the number of screens
manager by the ClutterBackend, and change clutter_backend_get_screen_number()
to return the screen number of the currently used screen; this is semantically
equivalent to clutter_glx_get_default_screen(), but leaves the door open for
a "screen" abstraction in Clutter, handled by the backend. Update the GLX
and EGL backends to retrieve and set the screen_num and n_screens members of
ClutterBackend using Xlib calls.
Add functions to retrieve some of the properties of the screen used by
the backend, like its dimensions (also physical, in millimeters); the
number of screens. Also add setters and getters for the double click
time (in milliseconds) and distance.
* clutter/clutter-backend.c: Clear the event queue when
disposing the backend object; remove the initialisation
of the backend structure members...
* clutter/glx/clutter-backend-glx.c: ... and keep it here
in the backends where it belongs.
* clutter/clutter-private.h:
* clutter/clutter-backend.h: Move the backend functions
into the private header.
* clutter/glx/clutter-stage-glx.c:
* clutter/glx/clutter-event-glx.c:
* clutter/clutter-main.c:
* clutter/clutter-stage.c: Update the calls to the private
backend functions.
* clutter/clutter-backend.[ch]: Add an ::init_features
vfunc to ClutterBackend.
* clutter/clutter-private.h: Remove inclusion of backend-specific
headers; update the main context object; add the declarations for
the event queue functions.
* clutter/clutter-backend.[ch]: Add the abstract ClutterBackend
object, which holds backend-specific settings, the main stage,
and the event queue. Every backend must implement a subclass of
ClutterBackend and ClutterStage.
* clutter/clutter-feature.c: Protect the GLX specific calls
behing #ifdef HAVE_CLUTTER_GLX.
* clutter/clutter-actor.c:
* clutter/clutter-group.c:
* clutter/clutter-clone-texture.c: Include GL/gl.h
* clutter/clutter-event.[ch]: Update public API and implement the
event queue private API; hold a reference on the event objects;
move out the keysym-to-unicode table; add the new event types.
* clutter/clutter-color.h: Include clutter-fixed.h
* clutter/clutter-main.c: Update API; get the main stage
from the backend object; process the event received from the
queue; lock/unlock the main mutex if we have one; move the
initialisation process sooner in the init sequence, in order to
have the backend object when we check for options; call the
backed vfuncs in the pre/post parse hooks.
* clutter/clutter-stage.c: Make ClutterStage and abstract class,
implemented by the backends.
* clutter/clutter/glx/clutter-glx.h:
* clutter/clutter/glx/clutter-backend-glx.[ch]:
* clutter/clutter/glx/clutter-event-glx.c:
* clutter/clutter/glx/clutter-stage-glx.[ch]:
* clutter/clutter/glx/Makefile.am: Add the GLX backend.
* clutter/clutter/egl/clutter-backend-egl.[ch]:
* clutter/clutter/egl/clutter-event-egl.c:
* clutter/clutter/egl/clutter-stage-egl.[ch]:
* clutter/clutter/egl/Makefile.am: Add the stub for a EGL backend.
* examples/*.c: Update for the new API.