Next: , Previous: GL Features, Up: Top


21 Fixed Point Support

Fixed Point API

21.1 Overview

Clutter has a fixed point API targeted at platforms without a floating point unit, such as embedded devices. On such platforms this API should be preferred to the floating point one as it does not trigger the slow path of software emulation, relying on integer math for fixed-to-floating and floating-to-fixed conversion.

It is no recommened for use on platforms with a floating point unit (eg desktop systems) nor for use in bindings.

Basic rules of Fixed Point arithmethic:

Two fixed point numbers can be directly added, subtracted and have their modulus taken.

To add other numerical type to a fixed point number it has to be first converted to fixed point.

A fixed point number can be directly multiplied or divided by an integer.

Two fixed point numbers can only be multiplied and divided by the provided <clutter-fixed-mul> and <clutter-fixed-div> macros.

21.2 Usage